clplug: Easily add functionality to your lightning node

[ bitcoin, bsd3, library, lightning, mit, plugin ] [ Propose Tags ]

For more information see the documentation about plugins from the core lightning project https://docs.corelightning.org/docs/plugins


[Skip to Readme]

Modules

[Last Documentation]

  • Plugin
    • Plugin.Client
    • Plugin.Connect
    • Plugin.Generic
    • Plugin.Hooks
    • Internal
      • Plugin.Internal.Conduit
    • Plugin.Manifest
    • Plugin.Notifications

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 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, 1.0.0.0
Change log CHANGELOG.md
Dependencies 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), mtl (>=2.3.1 && <2.4), network (>=3.1.4 && <3.2), stm (>=2.5.2 && <2.6), text (>=2.1.1 && <2.2) [details]
License MIT
Copyright 2024
Author autonomousorganization
Maintainer autonomousorganization
Category bitcoin, lightning, plugin
Uploaded by autonomousorganization at 2024-05-26T16:57:42Z
Distributions
Downloads 289 total (24 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2024-05-26 [all 2 reports]

Readme for clplug-1.0.0.0

[back to package description]

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.

tipjar: bc1q5xx9mathvsl0unfwa3jlph379n46vu9cletshr | lno1pgz8getnwstzzqehd9zs2y36z2504hv42g7ucg6cnzknhq9qde9x8j3xlmtgm5x30s