clplug-0.3.1.0: Create Core Lightning Plugins
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Plugin

Synopsis

Documentation

plugin :: Value -> InitMonad s -> PluginApp s -> IO () Source #

Create main executable that can be installed as core lightning plugin.

release :: Monad m => Id -> ConduitT i (Res Value) m () Source #

Helper function to allow node to continue default behaviour.

reject :: Monad m => Id -> ConduitT i (Res Value) m () Source #

Helper function to prevent node default behaviour.

respond :: Value -> Id -> PluginMonad a () Source #

Respond with arbitrary Value, custom rpc hooks will pass back through to terminal.

type PluginApp a = PluginReq -> PluginMonad a () Source #

Function called on every event subscribed to in the manifest.

type PluginMonad a b = ConduitT (Either (Res Value) PluginReq) (Res Value) (ReaderT PlugInfo (StateT a IO)) b Source #

Plugin stack contains ReaderT (ask - rpc handle & config), stateT (get/put - polymorphic state) and conduitT (yield - data exchange to core lightning.)

type InitMonad a = ReaderT PlugInfo IO a Source #

Function called on initialization, returned value is the initial state.

type PlugInfo = (Handle, Init) Source #

Handle connected to lightning-rpc file (use with Control.Client) & configuration object.