Skip to content

Commit b29599c

Browse files
swaptrvincenzopalazzo
authored andcommitted
kraken: lib init
1 parent 71fc34e commit b29599c

File tree

2 files changed

+14
-34
lines changed

2 files changed

+14
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<img src="https://github.com/dart-lightning/icons/raw/main/main/res/mipmap-xxxhdpi/ic_launcher.png" />
55

66
<p>
7-
<strong> :dart: Plugin to analyze Core Lightning payments :dart: </strong>
7+
<strong> :dart: A Core Lightning invoice payment plugin :dart: </strong>
88
</p>
99

1010
<h4>

lib/src/kraken.dart

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,33 @@
11
import 'package:cln_plugin_api/cln_plugin.dart';
22

33
class KrakenPlugin extends Plugin {
4-
/// Here we extend the base Plugin class of our API. This is the
5-
/// backbone of our plugin. All interactions with and by the plugin
6-
/// are done here.
7-
Future<Map<String, Object>> rpcMethod(
4+
Future<Map<String, Object>> krakenDoctor(
85
Plugin plugin, Map<String, Object> request) {
96
log(level: "info", message: "RPC Method call.");
107
return Future.value({
118
"greeting": "Hello ${options["name"]!.value.toString()}!",
129
});
1310
}
1411

15-
Future<Map<String, Object>> notifyMethod(
12+
Future<Map<String, Object>> krakenPay(
1613
Plugin plugin, Map<String, Object> request) {
17-
log(level: 'debug', message: 'Notification received!');
18-
return Future.value({});
19-
}
20-
21-
Future<Map<String, Object>> hookMethod(
22-
Plugin plugin, Map<String, Object> request) {
23-
log(level: "info", message: "Hook message.");
24-
return Future(() => {"result": "continue"});
14+
log(level: "info", message: "RPC Method call.");
15+
return Future.value({
16+
"greeting": "Hello ${options["name"]!.value.toString()}!",
17+
});
2518
}
26-
27-
/// The important step is to register methods pertaining to our plugin for differed use cases.
28-
/// The following template demonstrates the standard way of defining a RPC Method, option, hook
29-
/// and a notification subscription.
3019
@override
3120
void configurePlugin() {
32-
/// The configurePlugin() override allows developing plugins by simply calling the functions
33-
/// required for handling the core plugin functionality. These methods allow callbacks that
34-
/// handle core logic behind the plugins.
3521
registerRPCMethod(
36-
name: "hello",
22+
name: "kraken_pay",
3723
usage: "",
3824
description:
3925
"This method will greet you and serves as an example of how to register a RPC method.",
40-
callback: rpcMethod);
41-
42-
registerOption(
43-
name: "name",
44-
type: "string",
45-
def: "World",
46-
description: "This is your name and it will be used to greet you.",
47-
deprecated: false);
48-
49-
registerHook(name: 'rpc_command', callback: hookMethod);
50-
51-
registerSubscriptions(event: 'connect', callback: notifyMethod);
26+
callback: krakenPay);
27+
registerRPCMethod(
28+
name: "kraken_doctor",
29+
usage: "",
30+
description: "This method will analyze invoice ",
31+
callback: krakenDoctor);
5232
}
5333
}

0 commit comments

Comments
 (0)