@@ -53,12 +53,9 @@ interface Node {
53
53
void event_handled();
54
54
PublicKey node_id();
55
55
sequence<SocketAddress>? listening_addresses();
56
- [Throws=NodeError]
57
- Address new_onchain_address();
58
- [Throws=NodeError]
59
- Txid send_to_onchain_address([ByRef]Address address, u64 amount_msat);
60
- [Throws=NodeError]
61
- Txid send_all_to_onchain_address([ByRef]Address address);
56
+ Bolt11Payment bolt11_payment();
57
+ SpontaneousPayment spontaneous_payment();
58
+ OnchainPayment onchain_payment();
62
59
[Throws=NodeError]
63
60
void connect(PublicKey node_id, SocketAddress address, boolean persist);
64
61
[Throws=NodeError]
@@ -71,36 +68,51 @@ interface Node {
71
68
void update_channel_config([ByRef]UserChannelId user_channel_id, PublicKey counterparty_node_id, ChannelConfig channel_config);
72
69
[Throws=NodeError]
73
70
void sync_wallets();
71
+ PaymentDetails? payment([ByRef]PaymentId payment_id);
74
72
[Throws=NodeError]
75
- PaymentHash send_payment([ByRef]Bolt11Invoice invoice);
73
+ void remove_payment([ByRef]PaymentId payment_id);
74
+ BalanceDetails list_balances();
75
+ sequence<PaymentDetails> list_payments();
76
+ sequence<PeerDetails> list_peers();
77
+ sequence<ChannelDetails> list_channels();
76
78
[Throws=NodeError]
77
- PaymentHash send_payment_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat);
79
+ string sign_message([ByRef]sequence<u8> msg);
80
+ boolean verify_signature([ByRef]sequence<u8> msg, [ByRef]string sig, [ByRef]PublicKey pkey);
81
+ };
82
+
83
+ interface Bolt11Payment {
78
84
[Throws=NodeError]
79
- PaymentHash send_spontaneous_payment(u64 amount_msat, PublicKey node_id );
85
+ PaymentId send([ByRef]Bolt11Invoice invoice );
80
86
[Throws=NodeError]
81
- void send_payment_probes ([ByRef]Bolt11Invoice invoice);
87
+ PaymentId send_using_amount ([ByRef]Bolt11Invoice invoice, u64 amount_msat );
82
88
[Throws=NodeError]
83
- void send_spontaneous_payment_probes(u64 amount_msat, PublicKey node_id );
89
+ void send_probes([ByRef]Bolt11Invoice invoice );
84
90
[Throws=NodeError]
85
- void send_payment_probes_using_amount ([ByRef]Bolt11Invoice invoice, u64 amount_msat);
91
+ void send_probes_using_amount ([ByRef]Bolt11Invoice invoice, u64 amount_msat);
86
92
[Throws=NodeError]
87
- Bolt11Invoice receive_payment (u64 amount_msat, [ByRef]string description, u32 expiry_secs);
93
+ Bolt11Invoice receive (u64 amount_msat, [ByRef]string description, u32 expiry_secs);
88
94
[Throws=NodeError]
89
- Bolt11Invoice receive_variable_amount_payment ([ByRef]string description, u32 expiry_secs);
95
+ Bolt11Invoice receive_variable_amount ([ByRef]string description, u32 expiry_secs);
90
96
[Throws=NodeError]
91
- Bolt11Invoice receive_payment_via_jit_channel (u64 amount_msat, [ByRef]string description, u32 expiry_secs, u64? max_lsp_fee_limit_msat);
97
+ Bolt11Invoice receive_via_jit_channel (u64 amount_msat, [ByRef]string description, u32 expiry_secs, u64? max_lsp_fee_limit_msat);
92
98
[Throws=NodeError]
93
- Bolt11Invoice receive_variable_amount_payment_via_jit_channel([ByRef]string description, u32 expiry_secs, u64? max_proportional_lsp_fee_limit_ppm_msat);
94
- PaymentDetails? payment([ByRef]PaymentHash payment_hash);
99
+ Bolt11Invoice receive_variable_amount_via_jit_channel([ByRef]string description, u32 expiry_secs, u64? max_proportional_lsp_fee_limit_ppm_msat);
100
+ };
101
+
102
+ interface SpontaneousPayment {
95
103
[Throws=NodeError]
96
- void remove_payment([ByRef]PaymentHash payment_hash);
97
- BalanceDetails list_balances();
98
- sequence<PaymentDetails> list_payments();
99
- sequence<PeerDetails> list_peers();
100
- sequence<ChannelDetails> list_channels();
104
+ PaymentId send(u64 amount_msat, PublicKey node_id);
101
105
[Throws=NodeError]
102
- string sign_message([ByRef]sequence<u8> msg);
103
- boolean verify_signature([ByRef]sequence<u8> msg, [ByRef]string sig, [ByRef]PublicKey pkey);
106
+ void send_probes(u64 amount_msat, PublicKey node_id);
107
+ };
108
+
109
+ interface OnchainPayment {
110
+ [Throws=NodeError]
111
+ Address new_address();
112
+ [Throws=NodeError]
113
+ Txid send_to_address([ByRef]Address address, u64 amount_msat);
114
+ [Throws=NodeError]
115
+ Txid send_all_to_address([ByRef]Address address);
104
116
};
105
117
106
118
[Error]
@@ -127,6 +139,7 @@ enum NodeError {
127
139
"InvalidSocketAddress",
128
140
"InvalidPublicKey",
129
141
"InvalidSecretKey",
142
+ "InvalidPaymentId",
130
143
"InvalidPaymentHash",
131
144
"InvalidPaymentPreimage",
132
145
"InvalidPaymentSecret",
@@ -173,9 +186,9 @@ enum BuildError {
173
186
174
187
[Enum]
175
188
interface Event {
176
- PaymentSuccessful(PaymentHash payment_hash, u64? fee_paid_msat);
177
- PaymentFailed(PaymentHash payment_hash, PaymentFailureReason? reason);
178
- PaymentReceived(PaymentHash payment_hash, u64 amount_msat);
189
+ PaymentSuccessful(PaymentId? payment_id, PaymentHash payment_hash, u64? fee_paid_msat);
190
+ PaymentFailed(PaymentId? payment_id, PaymentHash payment_hash, PaymentFailureReason? reason);
191
+ PaymentReceived(PaymentId? payment_id, PaymentHash payment_hash, u64 amount_msat);
179
192
ChannelPending(ChannelId channel_id, UserChannelId user_channel_id, ChannelId former_temporary_channel_id, PublicKey counterparty_node_id, OutPoint funding_txo);
180
193
ChannelReady(ChannelId channel_id, UserChannelId user_channel_id, PublicKey? counterparty_node_id);
181
194
ChannelClosed(ChannelId channel_id, UserChannelId user_channel_id, PublicKey? counterparty_node_id, ClosureReason? reason);
@@ -207,6 +220,14 @@ interface ClosureReason {
207
220
HTLCsTimedOut();
208
221
};
209
222
223
+ [Enum]
224
+ interface PaymentKind {
225
+ Onchain();
226
+ Bolt11(PaymentHash hash, PaymentPreimage? preimage, PaymentSecret? secret);
227
+ Bolt11Jit(PaymentHash hash, PaymentPreimage? preimage, PaymentSecret? secret, LSPFeeLimits lsp_fee_limits);
228
+ Spontaneous(PaymentHash hash, PaymentPreimage? preimage);
229
+ };
230
+
210
231
enum PaymentDirection {
211
232
"Inbound",
212
233
"Outbound",
@@ -224,13 +245,11 @@ dictionary LSPFeeLimits {
224
245
};
225
246
226
247
dictionary PaymentDetails {
227
- PaymentHash hash;
228
- PaymentPreimage? preimage;
229
- PaymentSecret? secret;
248
+ PaymentId id;
249
+ PaymentKind kind;
230
250
u64? amount_msat;
231
251
PaymentDirection direction;
232
252
PaymentStatus status;
233
- LSPFeeLimits? lsp_fee_limits;
234
253
};
235
254
236
255
[NonExhaustive]
@@ -352,6 +371,9 @@ typedef string Address;
352
371
[Custom]
353
372
typedef string Bolt11Invoice;
354
373
374
+ [Custom]
375
+ typedef string PaymentId;
376
+
355
377
[Custom]
356
378
typedef string PaymentHash;
357
379
0 commit comments