lnlink-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +461 -0
  2. package/dist/app.js +11165 -0
  3. package/dist/binaries.json +20 -0
  4. package/dist/build-info.json +41 -0
  5. package/dist/config.default.js +19 -0
  6. package/dist/index.js +19002 -0
  7. package/dist/index.js.map +7 -0
  8. package/dist/package.json +61 -0
  9. package/dist/prisma/migrations/20250918020814_/migration.sql +188 -0
  10. package/dist/prisma/migrations/20251114105314_auto_update/migration.sql +2 -0
  11. package/dist/prisma/migrations/migration_lock.toml +3 -0
  12. package/dist/prisma/schema.prisma +181 -0
  13. package/dist/proto/chainkit.proto +74 -0
  14. package/dist/proto/lightning.proto +5411 -0
  15. package/dist/proto/lit-status.proto +36 -0
  16. package/dist/proto/looprpc/client.proto +1435 -0
  17. package/dist/proto/price_oracle.proto +243 -0
  18. package/dist/proto/rfqrpc/rfq.proto +436 -0
  19. package/dist/proto/routerrpc/router.proto +1136 -0
  20. package/dist/proto/signrpc/signer.proto +709 -0
  21. package/dist/proto/stateservice.proto +73 -0
  22. package/dist/proto/swapserverrpc/common.proto +37 -0
  23. package/dist/proto/tapchannel.proto +306 -0
  24. package/dist/proto/tapcommon.proto +36 -0
  25. package/dist/proto/taprootassets.proto +1959 -0
  26. package/dist/proto/universe.proto +1063 -0
  27. package/dist/proto/walletkit.proto +1594 -0
  28. package/dist/proto/walletunlocker.proto +338 -0
  29. package/dist/public/css/initOwner.css +553 -0
  30. package/dist/public/favicon.ico +0 -0
  31. package/dist/public/init.html +70 -0
  32. package/dist/public/js/init.js +454 -0
  33. package/dist/setting.mainnet.json +22 -0
  34. package/dist/setting.regtest.json +22 -0
  35. package/dist/setting.testnet.json +22 -0
  36. package/package.json +91 -0
@@ -0,0 +1,73 @@
1
+ syntax = "proto3";
2
+
3
+ package lnrpc;
4
+
5
+ option go_package = "github.com/lightningnetwork/lnd/lnrpc";
6
+
7
+ /*
8
+ * Comments in this file will be directly parsed into the API
9
+ * Documentation as descriptions of the associated method, message, or field.
10
+ * These descriptions should go right above the definition of the object, and
11
+ * can be in either block or // comment format.
12
+ *
13
+ * An RPC method can be matched to an lncli command by placing a line in the
14
+ * beginning of the description in exactly the following format:
15
+ * lncli: `methodname`
16
+ *
17
+ * Failure to specify the exact name of the command will cause documentation
18
+ * generation to fail.
19
+ *
20
+ * More information on how exactly the gRPC documentation is generated from
21
+ * this proto file can be found here:
22
+ * https://github.com/lightninglabs/lightning-api
23
+ */
24
+
25
+ // State service is a always running service that exposes the current state of
26
+ // the wallet and RPC server.
27
+ service State {
28
+ // SubscribeState subscribes to the state of the wallet. The current wallet
29
+ // state will always be delivered immediately.
30
+ rpc SubscribeState (SubscribeStateRequest)
31
+ returns (stream SubscribeStateResponse);
32
+
33
+ // GetState returns the current wallet state without streaming further
34
+ // changes.
35
+ rpc GetState (GetStateRequest) returns (GetStateResponse);
36
+ }
37
+
38
+ enum WalletState {
39
+ // NON_EXISTING means that the wallet has not yet been initialized.
40
+ NON_EXISTING = 0;
41
+
42
+ // LOCKED means that the wallet is locked and requires a password to unlock.
43
+ LOCKED = 1;
44
+
45
+ // UNLOCKED means that the wallet was unlocked successfully, but RPC server
46
+ // isn't ready.
47
+ UNLOCKED = 2;
48
+
49
+ // RPC_ACTIVE means that the lnd server is active but not fully ready for
50
+ // calls.
51
+ RPC_ACTIVE = 3;
52
+
53
+ // SERVER_ACTIVE means that the lnd server is ready to accept calls.
54
+ SERVER_ACTIVE = 4;
55
+
56
+ // WAITING_TO_START means that node is waiting to become the leader in a
57
+ // cluster and is not started yet.
58
+ WAITING_TO_START = 255;
59
+ }
60
+
61
+ message SubscribeStateRequest {
62
+ }
63
+
64
+ message SubscribeStateResponse {
65
+ WalletState state = 1;
66
+ }
67
+
68
+ message GetStateRequest {
69
+ }
70
+
71
+ message GetStateResponse {
72
+ WalletState state = 1;
73
+ }
@@ -0,0 +1,37 @@
1
+ syntax = "proto3";
2
+
3
+ // We can't change this to swapserverrpc, it would be a breaking change because
4
+ // the package name is also contained in the HTTP URIs and old clients would
5
+ // call the wrong endpoints. Luckily with the go_package option we can have
6
+ // different golang and RPC package names to fix protobuf namespace conflicts.
7
+ package looprpc;
8
+
9
+ option go_package = "github.com/lightninglabs/loop/swapserverrpc";
10
+
11
+ message HopHint {
12
+ // The public key of the node at the start of the channel.
13
+ string node_id = 1;
14
+
15
+ // The unique identifier of the channel.
16
+ uint64 chan_id = 2;
17
+
18
+ // The base fee of the channel denominated in millisatoshis.
19
+ uint32 fee_base_msat = 3;
20
+
21
+ /*
22
+ The fee rate of the channel for sending one satoshi across it denominated in
23
+ millionths of a satoshi.
24
+ */
25
+ uint32 fee_proportional_millionths = 4;
26
+
27
+ // The time-lock delta of the channel.
28
+ uint32 cltv_expiry_delta = 5;
29
+ }
30
+
31
+ message RouteHint {
32
+ /*
33
+ A list of hop hints that when chained together can assist in reaching a
34
+ specific destination.
35
+ */
36
+ repeated HopHint hop_hints = 1;
37
+ }
@@ -0,0 +1,306 @@
1
+ syntax = "proto3";
2
+
3
+ package tapchannelrpc;
4
+
5
+ option go_package = "github.com/lightninglabs/taproot-assets/taprpc/tapchannelrpc";
6
+
7
+ import "rfqrpc/rfq.proto";
8
+ import "lightning.proto";
9
+ import "routerrpc/router.proto";
10
+ import "taprootassets.proto";
11
+
12
+ service TaprootAssetChannels {
13
+ /* litcli: `ln fundchannel`
14
+ FundChannel initiates the channel funding negotiation with a peer for the
15
+ creation of a channel that contains a specified amount of a given asset.
16
+ */
17
+ rpc FundChannel (FundChannelRequest) returns (FundChannelResponse);
18
+
19
+ /*
20
+ Deprecated.
21
+ EncodeCustomRecords allows RPC users to encode Taproot Asset channel related
22
+ data into the TLV format that is used in the custom records of the lnd
23
+ payment or other channel related RPCs. This RPC is completely stateless and
24
+ does not perform any checks on the data provided, other than pure format
25
+ validation.
26
+ */
27
+ rpc EncodeCustomRecords (EncodeCustomRecordsRequest)
28
+ returns (EncodeCustomRecordsResponse) {
29
+ option deprecated = true;
30
+ };
31
+
32
+ /* litcli: `ln sendpayment`
33
+ SendPayment is a wrapper around lnd's routerrpc.SendPaymentV2 RPC method
34
+ with asset specific parameters. It allows RPC users to send asset keysend
35
+ payments (direct payments) or payments to an invoice with a specified asset
36
+ amount.
37
+ */
38
+ rpc SendPayment (SendPaymentRequest) returns (stream SendPaymentResponse);
39
+
40
+ /* litcli: `ln addinvoice`
41
+ AddInvoice is a wrapper around lnd's lnrpc.AddInvoice method with asset
42
+ specific parameters. It allows RPC users to create invoices that correspond
43
+ to the specified asset amount. If a peer pubkey is specified, then only that
44
+ peer will be used for RFQ negotiations. If none is specified then RFQ quotes
45
+ for all peers with suitable asset channels will be created.
46
+ */
47
+ rpc AddInvoice (AddInvoiceRequest) returns (AddInvoiceResponse);
48
+
49
+ /* litcli: `ln decodeassetinvoice`
50
+ DecodeAssetPayReq is similar to lnd's lnrpc.DecodePayReq, but it accepts an
51
+ asset ID or group key and returns the invoice amount expressed in asset
52
+ units along side the normal information.
53
+ */
54
+ rpc DecodeAssetPayReq (AssetPayReq) returns (AssetPayReqResponse);
55
+ }
56
+
57
+ message FundChannelRequest {
58
+ // The asset amount to fund the channel with. The BTC amount is fixed and
59
+ // cannot be customized (for now).
60
+ uint64 asset_amount = 1;
61
+
62
+ // The asset ID to use for the channel funding.
63
+ bytes asset_id = 2;
64
+
65
+ // The public key of the peer to open the channel with. Must already be
66
+ // connected to this peer.
67
+ bytes peer_pubkey = 3;
68
+
69
+ // The channel funding fee rate in sat/vByte.
70
+ uint32 fee_rate_sat_per_vbyte = 4;
71
+
72
+ // The number of satoshis to give the remote side as part of the initial
73
+ // commitment state. This is equivalent to first opening a channel and then
74
+ // sending the remote party funds, but all done in one step. Therefore, this
75
+ // is equivalent to a donation to the remote party, unless they reimburse
76
+ // the funds in another way (outside the protocol).
77
+ int64 push_sat = 5;
78
+
79
+ // The group key to use for the channel. This can be used instead of the
80
+ // asset_id to allow assets from a fungible group to be used for the channel
81
+ // funding instead of just assets from a single minting tranche (asset_id).
82
+ bytes group_key = 6;
83
+ }
84
+
85
+ message FundChannelResponse {
86
+ // The channel funding transaction ID.
87
+ string txid = 1;
88
+
89
+ // The index of the channel funding output in the funding transaction.
90
+ int32 output_index = 2;
91
+ }
92
+
93
+ message RouterSendPaymentData {
94
+ // The string encoded asset ID to amount mapping. Instructs the router to
95
+ // use these assets in the given amounts for the payment. Can be empty for
96
+ // a payment of an invoice, if the RFQ ID is set instead.
97
+ map<string, uint64> asset_amounts = 1;
98
+
99
+ // The RFQ ID to use for the payment. Can be empty for a direct keysend
100
+ // payment that doesn't involve any conversion (and thus no RFQ).
101
+ bytes rfq_id = 2;
102
+ }
103
+
104
+ message EncodeCustomRecordsRequest {
105
+ oneof input {
106
+ // The custom records to encode for a payment request.
107
+ RouterSendPaymentData router_send_payment = 1;
108
+ }
109
+ }
110
+
111
+ message EncodeCustomRecordsResponse {
112
+ // The encoded custom records in TLV format.
113
+ map<uint64, bytes> custom_records = 1;
114
+ }
115
+
116
+ message SendPaymentRequest {
117
+ // The asset ID to use for the payment. This must be set for both invoice
118
+ // and keysend payments, unless RFQ negotiation was already done beforehand
119
+ // and payment_request.first_hop_custom_records already contains valid RFQ
120
+ // data. Mutually exclusive to group_key.
121
+ bytes asset_id = 1;
122
+
123
+ // The asset amount to send in a keysend payment. This amount is ignored for
124
+ // invoice payments as the asset amount is negotiated through RFQ with the
125
+ // peer, depending on the invoice amount. This can also be left unset if RFQ
126
+ // negotiation was already done beforehand and
127
+ // payment_request.first_hop_custom_records already contains valid RFQ data.
128
+ uint64 asset_amount = 2;
129
+
130
+ // The node identity public key of the peer to ask for a quote for sending
131
+ // out the assets and converting them to satoshis. If set, only a quote with
132
+ // this peer may be negotiated to carry out the payment.
133
+ bytes peer_pubkey = 3;
134
+
135
+ // The full lnd payment request to send. All fields behave the same way as
136
+ // they do for lnd's routerrpc.SendPaymentV2 RPC method (see the API docs
137
+ // at https://lightning.engineering/api-docs/api/lnd/router/send-payment-v2
138
+ // for more details).
139
+ // To send a keysend payment, the payment_request.dest_custom_records must
140
+ // contain a valid keysend record (key 5482373484 and a 32-byte preimage
141
+ // that corresponds to the payment hash).
142
+ routerrpc.SendPaymentRequest payment_request = 4;
143
+
144
+ // The rfq id to use for this payment. If the user sets this value then the
145
+ // payment will immediately be dispatched, skipping the rfq negotiation
146
+ // phase, and using the following rfq id instead.
147
+ bytes rfq_id = 5;
148
+
149
+ // If a small invoice should be paid that is below the amount that always
150
+ // needs to be sent out to carry a single asset unit, then by default the
151
+ // payment is rejected. If this flag is set, then the payment will be
152
+ // allowed to proceed, even if it is uneconomical, meaning that more sats
153
+ // are sent out to the network than the invoice amount plus routing fees
154
+ // require to be paid.
155
+ bool allow_overpay = 6;
156
+
157
+ // The group key which dictates which assets may be used for this payment.
158
+ // Mutually exclusive to asset_id.
159
+ bytes group_key = 7;
160
+
161
+ // An optional text field that can be used to provide additional metadata
162
+ // about the payment to the price oracle. This can include information
163
+ // about the wallet end user that initiated the transaction, or any
164
+ // authentication information that the price oracle can use to give out a
165
+ // more accurate (or discount) asset rate. Though not verified or enforced
166
+ // by tapd, the suggested format for this field is a JSON string.
167
+ // This field is optional and can be left empty if no metadata is available.
168
+ // The maximum length of this field is 32'768 bytes.
169
+ string price_oracle_metadata = 8;
170
+ }
171
+
172
+ message AcceptedSellQuotes {
173
+ // If swapping of assets is necessary to carry out the payment, a number of
174
+ // RFQ quotes may be negotiated for that purpose. The following field
175
+ // contains all the sell orders that were negotiated with our peers.
176
+ repeated rfqrpc.PeerAcceptedSellQuote accepted_sell_orders = 1;
177
+ }
178
+
179
+ message SendPaymentResponse {
180
+ oneof result {
181
+ // In case channel assets need to be swapped to another asset, an asset
182
+ // sell order is negotiated with the channel peer. The result will be
183
+ // the first message in the response stream. If no swap is needed, the
184
+ // payment results will be streamed directly.
185
+ // Deprecated. This will now only contain the first quote that was
186
+ // negotiated. Since the introduction of multi-rfq we now negotiate
187
+ // multiple quotes in the context of a payment. Use the new field named
188
+ // "accepted_sell_orders" to retrieve all of them.
189
+ rfqrpc.PeerAcceptedSellQuote accepted_sell_order = 1;
190
+
191
+ // If swapping of assets is necessary to carry out the payment, a number
192
+ // of RFQ quotes may be negotiated for that purpose. The following field
193
+ // contains all the sell orders that were negotiated with our peers.
194
+ AcceptedSellQuotes accepted_sell_orders = 3;
195
+
196
+ // The payment result of a single payment attempt. Multiple attempts
197
+ // may be returned per payment request until either the payment
198
+ // succeeds or the payment times out.
199
+ lnrpc.Payment payment_result = 2;
200
+ }
201
+ }
202
+
203
+ message HodlInvoice {
204
+ // The payment hash of the HODL invoice to be created.
205
+ bytes payment_hash = 1;
206
+ }
207
+
208
+ message AddInvoiceRequest {
209
+ // The asset ID to use for the invoice. Mutually exclusive to group_key.
210
+ bytes asset_id = 1;
211
+
212
+ // The asset amount to receive.
213
+ uint64 asset_amount = 2;
214
+
215
+ // The node identity public key of the peer to ask for a quote for receiving
216
+ // assets and converting them from satoshis. When specified only quotes with
217
+ // this peer will be negotiated.
218
+ bytes peer_pubkey = 3;
219
+
220
+ // The full lnd invoice request to send. All fields behave the same way as
221
+ // they do for lnd's lnrpc.AddInvoice RPC method (see the API docs at
222
+ // https://lightning.engineering/api-docs/api/lnd/lightning/add-invoice
223
+ // for more details).
224
+ //
225
+ // Only one of the asset_amount/value/value_msat may be set to dictate the
226
+ // value of the invoice. When using asset_amount, the value/value_msat
227
+ // fields will be overwritten by the satoshi (or milli-satoshi) equivalent
228
+ // of the asset amount, after negotiating a quote with a peer that supports
229
+ // the given asset ID.
230
+ //
231
+ // If the value/value_msat are used, we still receive assets, but they will
232
+ // exactly evaluate to the defined amount in sats/msats.
233
+ lnrpc.Invoice invoice_request = 4;
234
+
235
+ // If set, then this will make the invoice created a hodl invoice, which
236
+ // won't be settled automatically. Instead, users will need to use the
237
+ // invoicesrpc.SettleInvoice call to manually settle the invoice.
238
+ HodlInvoice hodl_invoice = 5;
239
+
240
+ // The group key which dictates which assets may be accepted for this
241
+ // invoice. If set, any asset that belongs to this group may be accepted to
242
+ // settle this invoice. Mutually exclusive to asset_id.
243
+ bytes group_key = 6;
244
+
245
+ // An optional text field that can be used to provide additional metadata
246
+ // about the invoice to the price oracle. This can include information
247
+ // about the wallet end user that initiated the transaction, or any
248
+ // authentication information that the price oracle can use to give out a
249
+ // more accurate (or discount) asset rate. Though not verified or enforced
250
+ // by tapd, the suggested format for this field is a JSON string.
251
+ // This field is optional and can be left empty if no metadata is available.
252
+ // The maximum length of this field is 32'768 bytes.
253
+ string price_oracle_metadata = 7;
254
+ }
255
+
256
+ message AddInvoiceResponse {
257
+ // The quote for the purchase of assets that was accepted by the peer.
258
+ rfqrpc.PeerAcceptedBuyQuote accepted_buy_quote = 1;
259
+
260
+ // The result of the invoice creation.
261
+ lnrpc.AddInvoiceResponse invoice_result = 2;
262
+ }
263
+
264
+ message AssetPayReq {
265
+ // The asset ID that will be used to resolve the invoice's satoshi amount.
266
+ // Mutually exclusive to group_key.
267
+ bytes asset_id = 1;
268
+
269
+ // The normal LN invoice that whose amount will be mapped to units of the
270
+ // asset ID.
271
+ string pay_req_string = 2;
272
+
273
+ // The group key that will be used to resolve the invoice's satoshi amount.
274
+ // Mutually exclusive to asset_id.
275
+ bytes group_key = 3;
276
+
277
+ // An optional text field that can be used to provide additional metadata
278
+ // about the invoice to the price oracle. This can include information
279
+ // about the wallet end user that initiated the transaction, or any
280
+ // authentication information that the price oracle can use to give out a
281
+ // more accurate (or discount) asset rate. Though not verified or enforced
282
+ // by tapd, the suggested format for this field is a JSON string.
283
+ // This field is optional and can be left empty if no metadata is available.
284
+ // The maximum length of this field is 32'768 bytes.
285
+ string price_oracle_metadata = 4;
286
+ }
287
+
288
+ message AssetPayReqResponse {
289
+ // The invoice amount, expressed in asset units.
290
+ uint64 asset_amount = 1;
291
+
292
+ // The decimal display corresponding to the asset_id.
293
+ taprpc.DecimalDisplay decimal_display = 2;
294
+
295
+ // The group the asset ID belong to, if applicable.
296
+ taprpc.AssetGroup asset_group = 3;
297
+
298
+ // Genesis information for the asset ID which includes the meta hash, and
299
+ // asset ID. This is only set if the payment request was decoded with an
300
+ // asset ID and not with a group key (since a group can contain assets from
301
+ // different minting events or genesis infos).
302
+ taprpc.GenesisInfo genesis_info = 4;
303
+
304
+ // The normal decoded payment request.
305
+ lnrpc.PayReq pay_req = 5;
306
+ }
@@ -0,0 +1,36 @@
1
+ syntax = "proto3";
2
+
3
+ package taprpc;
4
+
5
+ option go_package = "github.com/lightninglabs/taproot-assets/taprpc";
6
+
7
+ // Represents a Bitcoin transaction outpoint.
8
+ message OutPoint {
9
+ /*
10
+ Raw bytes representing the transaction id.
11
+ */
12
+ bytes txid = 1;
13
+
14
+ /*
15
+ The index of the output on the transaction.
16
+ */
17
+ uint32 output_index = 2;
18
+ }
19
+
20
+ // A transaction outpoint annotated with TAP-level asset metadata. It uniquely
21
+ // identifies an asset anchored at a specific outpoint.
22
+ message AssetOutPoint {
23
+ // The outpoint of the asset anchor, represented as a string in the
24
+ // format "<txid>:<vout>". The <txid> is the transaction ID of the UTXO,
25
+ // hex-encoded and byte-reversed (i.e., the internal little-endian
26
+ // 32-byte value is reversed to big-endian hex format) to match standard
27
+ // Bitcoin RPC and UI conventions.
28
+ string anchor_out_point = 1;
29
+
30
+ // The asset ID of the asset anchored at the outpoint.
31
+ bytes asset_id = 2;
32
+
33
+ // The script key of the asset. This is the taproot output key that the
34
+ // asset is locked to.
35
+ bytes script_key = 3;
36
+ }