forked from lightningdevkit/ldk-node
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathldk_node.udl
More file actions
185 lines (163 loc) · 4.24 KB
/
ldk_node.udl
File metadata and controls
185 lines (163 loc) · 4.24 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
namespace ldk_node {
};
dictionary Config {
string storage_dir_path;
string esplora_server_url;
Network network;
SocketAddr? listening_address;
u32 default_cltv_expiry_delta;
};
interface Builder {
constructor();
[Name=from_config]
constructor(Config config);
Node build();
};
interface Node {
[Throws=NodeError]
void start();
[Throws=NodeError]
void stop();
Event next_event();
void event_handled();
PublicKey node_id();
SocketAddr? listening_address();
[Throws=NodeError]
Address new_funding_address();
[Throws=NodeError]
Txid send_to_onchain_address([ByRef]Address address, u64 amount_msat);
[Throws=NodeError]
Txid send_all_to_onchain_address([ByRef]Address address);
[Throws=NodeError]
u64 spendable_onchain_balance_sats();
[Throws=NodeError]
u64 total_onchain_balance_sats();
[Throws=NodeError]
void connect(PublicKey node_id, SocketAddr address, boolean permanently);
[Throws=NodeError]
void disconnect(PublicKey node_id);
[Throws=NodeError]
void connect_open_channel(PublicKey node_id, SocketAddr address, u64 channel_amount_sats, u64? push_to_counterparty_msat, boolean announce_channel);
[Throws=NodeError]
void close_channel([ByRef]ChannelId channel_id, PublicKey counterparty_node_id);
[Throws=NodeError]
void sync_wallets();
[Throws=NodeError]
PaymentHash send_payment([ByRef]Invoice invoice);
[Throws=NodeError]
PaymentHash send_payment_using_amount([ByRef]Invoice invoice, u64 amount_msat);
[Throws=NodeError]
PaymentHash send_spontaneous_payment(u64 amount_msat, PublicKey node_id);
[Throws=NodeError]
Invoice receive_payment(u64 amount_msat, [ByRef]string description, u32 expiry_secs);
[Throws=NodeError]
Invoice receive_variable_amount_payment([ByRef]string description, u32 expiry_secs);
PaymentDetails? payment([ByRef]PaymentHash payment_hash);
[Throws=NodeError]
boolean remove_payment([ByRef]PaymentHash payment_hash);
sequence<PeerDetails> list_peers();
sequence<ChannelDetails> list_channels();
};
[Error]
enum NodeError {
"AlreadyRunning",
"NotRunning",
"OnchainTxCreationFailed",
"ConnectionFailed",
"InvoiceCreationFailed",
"PaymentFailed",
"PeerInfoParseFailed",
"ChannelCreationFailed",
"ChannelClosingFailed",
"PersistenceFailed",
"WalletOperationFailed",
"WalletSigningFailed",
"TxSyncFailed",
"GossipUpdateFailed",
"InvalidAddress",
"InvalidPublicKey",
"InvalidPaymentHash",
"InvalidPaymentPreimage",
"InvalidPaymentSecret",
"InvalidAmount",
"InvalidInvoice",
"InvalidChannelId",
"InvalidNetwork",
"NonUniquePaymentHash",
"InsufficientFunds",
};
[Enum]
interface Event {
PaymentSuccessful( PaymentHash payment_hash );
PaymentFailed( PaymentHash payment_hash );
PaymentReceived( PaymentHash payment_hash, u64 amount_msat);
ChannelPending ( ChannelId channel_id, UserChannelId user_channel_id, ChannelId former_temporary_channel_id, PublicKey counterparty_node_id, OutPoint funding_txo );
ChannelReady ( ChannelId channel_id, UserChannelId user_channel_id );
ChannelClosed ( ChannelId channel_id, UserChannelId user_channel_id );
};
enum PaymentDirection {
"Inbound",
"Outbound",
};
enum PaymentStatus {
"Pending",
"Succeeded",
"Failed",
};
dictionary PaymentDetails {
PaymentHash hash;
PaymentPreimage? preimage;
PaymentSecret? secret;
u64? amount_msat;
PaymentDirection direction;
PaymentStatus status;
};
dictionary OutPoint {
Txid txid;
u32 vout;
};
dictionary ChannelDetails {
ChannelId channel_id;
PublicKey counterparty_node_id;
OutPoint? funding_txo;
u64 channel_value_satoshis;
u64? unspendable_punishment_reserve;
UserChannelId user_channel_id;
u64 balance_msat;
u64 outbound_capacity_msat;
u64 inbound_capacity_msat;
u32? confirmations_required;
u32? confirmations;
boolean is_outbound;
boolean is_channel_ready;
boolean is_usable;
boolean is_public;
u16? cltv_expiry_delta;
};
dictionary PeerDetails {
PublicKey node_id;
SocketAddr address;
boolean is_connected;
};
[Custom]
typedef string Txid;
[Custom]
typedef string SocketAddr;
[Custom]
typedef string PublicKey;
[Custom]
typedef string Address;
[Custom]
typedef string Invoice;
[Custom]
typedef string PaymentHash;
[Custom]
typedef string PaymentPreimage;
[Custom]
typedef string PaymentSecret;
[Custom]
typedef string ChannelId;
[Custom]
typedef string UserChannelId;
[Custom]
typedef string Network;