clplug: Create Core Lightning Plugins

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Library to create plugins to extend the functionality of Core Lightning daemon.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.3.1.0, 0.3.2.0, 0.3.3.0, 0.4.0.0, 0.5.0.0, 1.0.0.0
Change log CHANGELOG.md
Dependencies aeson (<2.1), attoparsec (<0.15), base (>=4.7 && <5), bytestring (<0.12), conduit (<1.4), mtl (<2.3), network (<3.2), text (<1.3) [details]
License BSD-3-Clause
Copyright 2023
Author Taylor Singleton-Fookes
Maintainer taylorsingletonfookes@live.com
Category bitcoin, lightning, plugin
Home page https://github.com/AutonomousOrganization/clplug#readme
Bug tracker https://github.com/AutonomousOrganization/clplug/issues
Source repo head: git clone https://github.com/AutonomousOrganization/clplug
Uploaded by autonomousorganization at 2023-05-08T21:48:12Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for clplug-0.5.0.0

[back to package description]

Core Lightning Plug

Create Core Lightning plugins in haskell.

To get started import the Library by adding it to your projects stack.yaml:

extra-deps:
- clplug-0.4.0.0

Once the library is imported there are two main imports.

The steps to create a plugin are:

import Data.Aeson
import Data.Lightning
manifest = object [
       "dynamic" .= True
     , "subscriptions" .= ([] :: [Text] )
     , "options" .= ([]::[Option])
     , "rpcmethods" .= ([
         , RpcMethod "command" "[label]" "description" Nothing False
         ])
     , "hooks" .= ([Hook "invoice_payment" Nothing])
     , "featurebits" .= object [ ]
     , "notifications" .= ([]::[Notification])
     ]
import Control.Plugin 
import Control.Client
start = do 
    (rpcHandle, Init options config) <- ask
    Just response <- lightningCli (Command "getinfo" filter params)
    _ <- liftIO . forkIO $ < service > 
    return < state >
app :: (Maybe Id, Method, Params) -> PluginMonad a b
app (Just i, "method", params) = 
    if contition 
        then release i 
        else reject i      
main :: IO ()
main = plugin manifest start app

tipjar: bc1q5xx9mathvsl0unfwa3jlph379n46vu9cletshr