packages feed

clplug-1.0.0.0: README.md

## Core Lightning Plug

Create [Core Lightning](https://lightning.readthedocs.io/PLUGINS.html) plugins in haskell. 

Use `plugin` to create an executable that can be installed as a plugin! 

```
main = plugin manifest start app
```

A [manifest](https://lightning.readthedocs.io/PLUGINS.html#the-getmanifest-method) 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