@hackage clplug1.0.0.0
Easily add functionality to your lightning node
Installation
Dependencies (10)
- aeson >=2.2.1 && <2.3
- attoparsec >=0.14.4 && <0.15
- attoparsec-aeson >=2.2.0 && <2.3
- base >=4.19 && <5
- bytestring >=0.12.1 && <0.13
- conduit >=1.3.5 && <1.4 Show all…
Dependents (0)
Core Lightning Plug
Create Core Lightning plugins in haskell.
Use plugin to create an executable that can be installed as a plugin!
main = plugin manifest start app
A manifest defines the interface with core lightning. It is just a Value but Plugin.Manifest has helper types to easily define it.
manifest = object [
"dynamic" .= True
, "subscriptions" .= ([] :: [Text] )
, "options" .= ([]::[Option])
, "rpcmethods" .= ([
, RpcMethod "command" "[label]" "description" Nothing False
])
, "hooks" .= ([Hook "invoice_payment" Nothing])
, "featurebits" .= object [ ]
, "notifications" .= ([]::[Notification])
]
start runs on startup and defines the initial state.
start = do
_ <- lightningCli ("getinfo" :: Text)
_ <- liftIO . forkIO $ < service >
return < state >
app handler function allows you to monitor status (through notification), add rpc commands, or augment normal operation (through hooks).
app (Req (Just i) "method" params) =
if <condition>
then release i
else reject i
Remember any output to stdout will break the connection.