forked from lightningdevkit/ldk-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathldk_node.udl
More file actions
418 lines (355 loc) · 10.4 KB
/
ldk_node.udl
File metadata and controls
418 lines (355 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
namespace ldk_node {
Mnemonic generate_entropy_mnemonic(WordCount? word_count);
Config default_config();
};
typedef dictionary Config;
typedef dictionary EsploraSyncConfig;
typedef dictionary ElectrumSyncConfig;
typedef dictionary TorConfig;
typedef interface NodeEntropy;
typedef enum WordCount;
[Remote]
enum LogLevel {
"Gossip",
"Trace",
"Debug",
"Info",
"Warn",
"Error",
};
typedef dictionary LogRecord;
[Trait, WithForeign]
interface LogWriter {
void log(LogRecord record);
};
interface Builder {
constructor();
[Name=from_config]
constructor(Config config);
void set_chain_source_esplora(string server_url, EsploraSyncConfig? config);
void set_chain_source_electrum(string server_url, ElectrumSyncConfig? config);
void set_chain_source_bitcoind_rpc(string rpc_host, u16 rpc_port, string rpc_user, string rpc_password);
void set_chain_source_bitcoind_rest(string rest_host, u16 rest_port, string rpc_host, u16 rpc_port, string rpc_user, string rpc_password);
void set_gossip_source_p2p();
void set_gossip_source_rgs(string rgs_server_url);
void set_pathfinding_scores_source(string url);
void set_liquidity_source_lsps1(PublicKey node_id, SocketAddress address, string? token);
void set_liquidity_source_lsps2(PublicKey node_id, SocketAddress address, string? token);
void set_storage_dir_path(string storage_dir_path);
void set_filesystem_logger(string? log_file_path, LogLevel? max_log_level);
void set_log_facade_logger();
void set_custom_logger(LogWriter log_writer);
void set_network(Network network);
[Throws=BuildError]
void set_listening_addresses(sequence<SocketAddress> listening_addresses);
[Throws=BuildError]
void set_announcement_addresses(sequence<SocketAddress> announcement_addresses);
[Throws=BuildError]
void set_tor_config(TorConfig tor_config);
[Throws=BuildError]
void set_node_alias(string node_alias);
[Throws=BuildError]
void set_async_payments_role(AsyncPaymentsRole? role);
void set_wallet_recovery_mode();
[Throws=BuildError]
Node build(NodeEntropy node_entropy);
[Throws=BuildError]
Node build_with_fs_store(NodeEntropy node_entropy);
[Throws=BuildError]
Node build_with_vss_store(NodeEntropy node_entropy, string vss_url, string store_id, record<string, string> fixed_headers);
[Throws=BuildError]
Node build_with_vss_store_and_lnurl_auth(NodeEntropy node_entropy, string vss_url, string store_id, string lnurl_auth_server_url, record<string, string> fixed_headers);
[Throws=BuildError]
Node build_with_vss_store_and_fixed_headers(NodeEntropy node_entropy, string vss_url, string store_id, record<string, string> fixed_headers);
[Throws=BuildError]
Node build_with_vss_store_and_header_provider(NodeEntropy node_entropy, string vss_url, string store_id, VssHeaderProvider header_provider);
};
interface Node {
[Throws=NodeError]
void start();
[Throws=NodeError]
void stop();
NodeStatus status();
Config config();
Event? next_event();
Event wait_next_event();
[Async]
Event next_event_async();
[Throws=NodeError]
void event_handled();
PublicKey node_id();
sequence<SocketAddress>? listening_addresses();
sequence<SocketAddress>? announcement_addresses();
NodeAlias? node_alias();
Bolt11Payment bolt11_payment();
Bolt12Payment bolt12_payment();
SpontaneousPayment spontaneous_payment();
OnchainPayment onchain_payment();
UnifiedPayment unified_payment();
LSPS1Liquidity lsps1_liquidity();
[Throws=NodeError]
void lnurl_auth(string lnurl);
[Throws=NodeError]
void connect(PublicKey node_id, SocketAddress address, boolean persist);
[Throws=NodeError]
void disconnect(PublicKey node_id);
[Throws=NodeError]
UserChannelId open_channel(PublicKey node_id, SocketAddress address, u64 channel_amount_sats, u64? push_to_counterparty_msat, ChannelConfig? channel_config);
[Throws=NodeError]
UserChannelId open_announced_channel(PublicKey node_id, SocketAddress address, u64 channel_amount_sats, u64? push_to_counterparty_msat, ChannelConfig? channel_config);
[Throws=NodeError]
UserChannelId open_channel_with_all(PublicKey node_id, SocketAddress address, u64? push_to_counterparty_msat, ChannelConfig? channel_config);
[Throws=NodeError]
UserChannelId open_announced_channel_with_all(PublicKey node_id, SocketAddress address, u64? push_to_counterparty_msat, ChannelConfig? channel_config);
[Throws=NodeError]
UserChannelId open_0reserve_channel(PublicKey node_id, SocketAddress address, u64 channel_amount_sats, u64? push_to_counterparty_msat, ChannelConfig? channel_config);
[Throws=NodeError]
UserChannelId open_0reserve_channel_with_all(PublicKey node_id, SocketAddress address, u64? push_to_counterparty_msat, ChannelConfig? channel_config);
[Throws=NodeError]
void splice_in([ByRef]UserChannelId user_channel_id, PublicKey counterparty_node_id, u64 splice_amount_sats);
[Throws=NodeError]
void splice_in_with_all([ByRef]UserChannelId user_channel_id, PublicKey counterparty_node_id);
[Throws=NodeError]
void splice_out([ByRef]UserChannelId user_channel_id, PublicKey counterparty_node_id, [ByRef]Address address, u64 splice_amount_sats);
[Throws=NodeError]
void close_channel([ByRef]UserChannelId user_channel_id, PublicKey counterparty_node_id);
[Throws=NodeError]
void force_close_channel([ByRef]UserChannelId user_channel_id, PublicKey counterparty_node_id, string? reason);
[Throws=NodeError]
void update_channel_config([ByRef]UserChannelId user_channel_id, PublicKey counterparty_node_id, ChannelConfig channel_config);
[Throws=NodeError]
void sync_wallets();
PaymentDetails? payment([ByRef]PaymentId payment_id);
[Throws=NodeError]
void remove_payment([ByRef]PaymentId payment_id);
BalanceDetails list_balances();
sequence<PaymentDetails> list_payments();
sequence<PeerDetails> list_peers();
sequence<ChannelDetails> list_channels();
NetworkGraph network_graph();
string sign_message([ByRef]sequence<u8> msg);
boolean verify_signature([ByRef]sequence<u8> msg, [ByRef]string sig, [ByRef]PublicKey pkey);
[Throws=NodeError]
bytes export_pathfinding_scores();
};
typedef interface Bolt11Payment;
typedef interface Bolt12Payment;
typedef interface SpontaneousPayment;
typedef interface OnchainPayment;
[Remote]
interface FeeRate {
[Name=from_sat_per_kwu]
constructor(u64 sat_kwu);
[Name=from_sat_per_vb_unchecked]
constructor(u64 sat_vb);
u64 to_sat_per_kwu();
u64 to_sat_per_vb_floor();
u64 to_sat_per_vb_ceil();
};
typedef interface UnifiedPayment;
typedef interface LSPS1Liquidity;
[Error]
enum NodeError {
"AlreadyRunning",
"NotRunning",
"OnchainTxCreationFailed",
"ConnectionFailed",
"InvoiceCreationFailed",
"InvoiceRequestCreationFailed",
"OfferCreationFailed",
"RefundCreationFailed",
"PaymentSendingFailed",
"InvalidCustomTlvs",
"ProbeSendingFailed",
"ChannelCreationFailed",
"ChannelClosingFailed",
"ChannelSplicingFailed",
"ChannelConfigUpdateFailed",
"PersistenceFailed",
"FeerateEstimationUpdateFailed",
"FeerateEstimationUpdateTimeout",
"WalletOperationFailed",
"WalletOperationTimeout",
"OnchainTxSigningFailed",
"TxSyncFailed",
"TxSyncTimeout",
"GossipUpdateFailed",
"GossipUpdateTimeout",
"LiquidityRequestFailed",
"UriParameterParsingFailed",
"InvalidAddress",
"InvalidSocketAddress",
"InvalidPublicKey",
"InvalidSecretKey",
"InvalidOfferId",
"InvalidNodeId",
"InvalidPaymentId",
"InvalidPaymentHash",
"InvalidPaymentPreimage",
"InvalidPaymentSecret",
"InvalidAmount",
"InvalidInvoice",
"InvalidOffer",
"InvalidRefund",
"InvalidChannelId",
"InvalidNetwork",
"InvalidUri",
"InvalidQuantity",
"InvalidNodeAlias",
"InvalidDateTime",
"InvalidFeeRate",
"InvalidScriptPubKey",
"DuplicatePayment",
"UnsupportedCurrency",
"InsufficientFunds",
"LiquiditySourceUnavailable",
"LiquidityFeeTooHigh",
"InvalidBlindedPaths",
"AsyncPaymentServicesDisabled",
"HrnParsingFailed",
"LnurlAuthFailed",
"LnurlAuthTimeout",
"InvalidLnurl",
};
typedef dictionary NodeStatus;
[Remote]
dictionary BestBlock {
BlockHash block_hash;
u32 height;
};
typedef enum BuildError;
[Trait, WithForeign]
interface VssHeaderProvider {
[Async, Throws=VssHeaderProviderError]
record<string, string> get_headers(sequence<u8> request);
};
typedef enum VssHeaderProviderError;
[Remote]
enum PaymentFailureReason {
"RecipientRejected",
"UserAbandoned",
"RetriesExhausted",
"PaymentExpired",
"RouteNotFound",
"UnexpectedError",
"UnknownRequiredFeatures",
"InvoiceRequestExpired",
"InvoiceRequestRejected",
"BlindedPathCreationFailed",
};
typedef dictionary PaymentDetails;
[Remote]
dictionary RouteParametersConfig {
u64? max_total_routing_fee_msat;
u32 max_total_cltv_expiry_delta;
u8 max_path_count;
u8 max_channel_saturation_power_of_half;
};
[Remote]
dictionary LSPS1OrderStatus {
LSPS1OrderId order_id;
LSPS1OrderParams order_params;
LSPS1PaymentInfo payment_options;
LSPS1ChannelInfo? channel_state;
};
[Remote]
dictionary LSPS1OrderParams {
u64 lsp_balance_sat;
u64 client_balance_sat;
u16 required_channel_confirmations;
u16 funding_confirms_within_blocks;
u32 channel_expiry_blocks;
string? token;
boolean announce_channel;
};
typedef dictionary LSPS1PaymentInfo;
[Remote]
dictionary LSPS1ChannelInfo {
LSPSDateTime funded_at;
OutPoint funding_outpoint;
LSPSDateTime expires_at;
};
[Remote]
enum LSPS1PaymentState {
"ExpectPayment",
"Hold",
"Paid",
"Refunded",
};
[Remote, NonExhaustive]
enum Network {
"Bitcoin",
"Testnet",
"Signet",
"Regtest",
};
[Remote]
dictionary OutPoint {
Txid txid;
u32 vout;
};
typedef dictionary ChannelDetails;
typedef dictionary PeerDetails;
[Remote]
enum BalanceSource {
"HolderForceClosed",
"CounterpartyForceClosed",
"CoopClose",
"Htlc",
};
typedef dictionary BalanceDetails;
typedef dictionary ChannelConfig;
typedef interface NetworkGraph;
[Remote]
dictionary RoutingFees {
u32 base_msat;
u32 proportional_millionths;
};
[Remote]
enum Currency {
"Bitcoin",
"BitcoinTestnet",
"Regtest",
"Simnet",
"Signet",
};
typedef enum AsyncPaymentsRole;
[Custom]
typedef string Txid;
[Custom]
typedef string BlockHash;
[Custom]
typedef string SocketAddress;
[Custom]
typedef string PublicKey;
[Custom]
typedef string NodeId;
[Custom]
typedef string Address;
[Custom]
typedef string OfferId;
[Custom]
typedef string PaymentId;
[Custom]
typedef string PaymentHash;
[Custom]
typedef string PaymentPreimage;
[Custom]
typedef string PaymentSecret;
[Custom]
typedef string ChannelId;
[Custom]
typedef string UserChannelId;
[Custom]
typedef string Mnemonic;
[Custom]
typedef string UntrustedString;
[Custom]
typedef string NodeAlias;
[Custom]
typedef string LSPS1OrderId;
[Custom]
typedef string LSPSDateTime;
[Custom]
typedef string ScriptBuf;
typedef enum Event;