getManifest method

Future<Map<String, Object>> getManifest(
  1. Plugin plugin,
  2. Map<String, Object> request
)

get manifest method used to communicate the plugin configuration to core lightning.

Implementation

Future<Map<String, Object>> getManifest(
    Plugin plugin, Map<String, Object> request) {
  // TODO: add some unit test to check if the format it is correct!
  var response = HashMap<String, Object>();
  response["options"] =
      plugin.options.values.map((opt) => opt.toMap()).toList();
  response["rpcmethods"] = plugin.rpcMethods.values
      .where((rpc) => rpc.name != "init" && rpc.name != "getmanifest")
      .map((rpc) => rpc.toMap())
      .toList();
  response["hooks"] =
      plugin.hooks.values.map((hook) => hook.toMap()).toList();
  response["subscriptions"] = plugin.subscriptions.values
      .map((subscription) => subscription.method)
      .toList();
  response["notifications"] = [];
  response["dynamic"] = plugin.dynamic;

  return Future.value(response);
}