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.
- package/README.md +461 -0
- package/dist/app.js +11165 -0
- package/dist/binaries.json +20 -0
- package/dist/build-info.json +41 -0
- package/dist/config.default.js +19 -0
- package/dist/index.js +19002 -0
- package/dist/index.js.map +7 -0
- package/dist/package.json +61 -0
- package/dist/prisma/migrations/20250918020814_/migration.sql +188 -0
- package/dist/prisma/migrations/20251114105314_auto_update/migration.sql +2 -0
- package/dist/prisma/migrations/migration_lock.toml +3 -0
- package/dist/prisma/schema.prisma +181 -0
- package/dist/proto/chainkit.proto +74 -0
- package/dist/proto/lightning.proto +5411 -0
- package/dist/proto/lit-status.proto +36 -0
- package/dist/proto/looprpc/client.proto +1435 -0
- package/dist/proto/price_oracle.proto +243 -0
- package/dist/proto/rfqrpc/rfq.proto +436 -0
- package/dist/proto/routerrpc/router.proto +1136 -0
- package/dist/proto/signrpc/signer.proto +709 -0
- package/dist/proto/stateservice.proto +73 -0
- package/dist/proto/swapserverrpc/common.proto +37 -0
- package/dist/proto/tapchannel.proto +306 -0
- package/dist/proto/tapcommon.proto +36 -0
- package/dist/proto/taprootassets.proto +1959 -0
- package/dist/proto/universe.proto +1063 -0
- package/dist/proto/walletkit.proto +1594 -0
- package/dist/proto/walletunlocker.proto +338 -0
- package/dist/public/css/initOwner.css +553 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/init.html +70 -0
- package/dist/public/js/init.js +454 -0
- package/dist/setting.mainnet.json +22 -0
- package/dist/setting.regtest.json +22 -0
- package/dist/setting.testnet.json +22 -0
- package/package.json +91 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package priceoraclerpc;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/lightninglabs/taproot-assets/taprpc/priceoraclerpc";
|
|
6
|
+
|
|
7
|
+
service PriceOracle {
|
|
8
|
+
/*
|
|
9
|
+
QueryAssetRates retrieves the exchange rate between a tap asset and BTC for
|
|
10
|
+
a specified transaction type, subject asset, and payment asset. The asset
|
|
11
|
+
rate represents the number of tap asset units per BTC.
|
|
12
|
+
*/
|
|
13
|
+
rpc QueryAssetRates (QueryAssetRatesRequest)
|
|
14
|
+
returns (QueryAssetRatesResponse);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// TransactionType is an enum representing the type of transaction.
|
|
18
|
+
enum TransactionType {
|
|
19
|
+
// PURCHASE indicates a purchase transaction.
|
|
20
|
+
PURCHASE = 0;
|
|
21
|
+
|
|
22
|
+
// SALE indicates a sale transaction.
|
|
23
|
+
SALE = 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Intent is an enum informing the price oracle about the intent of the price
|
|
27
|
+
// rate query. This is used to provide context for the asset rates being
|
|
28
|
+
// requested, allowing the price oracle to tailor the response based on the
|
|
29
|
+
// specific use case, such as paying an invoice or receiving a payment and the
|
|
30
|
+
// different stages involved in those.
|
|
31
|
+
enum Intent {
|
|
32
|
+
// INTENT_UNSPECIFIED is used to indicate that the intent of the price rate
|
|
33
|
+
// query is not specified. This is the fallback default value and should not
|
|
34
|
+
// be used in production code. It is primarily used for backward
|
|
35
|
+
// compatibility with older versions of the protocol that did not include
|
|
36
|
+
// intent information.
|
|
37
|
+
INTENT_UNSPECIFIED = 0;
|
|
38
|
+
|
|
39
|
+
// INTENT_PAY_INVOICE_HINT is used to indicate that the user is requesting
|
|
40
|
+
// a price rate hint for paying an invoice. This is typically used by the
|
|
41
|
+
// payer of an invoice to provide a suggestion of the expected asset rate to
|
|
42
|
+
// the RFQ peer (edge node) that will determine the actual rate for the
|
|
43
|
+
// payment.
|
|
44
|
+
INTENT_PAY_INVOICE_HINT = 1;
|
|
45
|
+
|
|
46
|
+
// INTENT_PAY_INVOICE is used to indicate that a peer wants to pay an
|
|
47
|
+
// invoice with assets. This is typically used by the edge node that
|
|
48
|
+
// facilitates the swap from assets to BTC for the payer of an invoice. This
|
|
49
|
+
// intent is used to provide the actual asset rate for the payment, which
|
|
50
|
+
// may differ from the hint provided by the payer.
|
|
51
|
+
INTENT_PAY_INVOICE = 2;
|
|
52
|
+
|
|
53
|
+
// INTENT_PAY_INVOICE_QUALIFY is used to indicate that the payer of an
|
|
54
|
+
// invoice has received an asset rate from their RFQ peer (edge node) and is
|
|
55
|
+
// qualifying the rate for the payment. This is typically used by the payer
|
|
56
|
+
// of an invoice to ensure that the asset rate provided by their peer (edge
|
|
57
|
+
// node) is acceptable before proceeding with the payment.
|
|
58
|
+
INTENT_PAY_INVOICE_QUALIFY = 3;
|
|
59
|
+
|
|
60
|
+
// INTENT_RECV_PAYMENT_HINT is used to indicate that the user is requesting
|
|
61
|
+
// a price rate hint for receiving a payment through an invoice. This is
|
|
62
|
+
// typically used by the creator of an invoice to provide a suggestion of
|
|
63
|
+
// the expected asset rate to the RFQ peer (edge node) that will determine
|
|
64
|
+
// the actual rate used for creating an invoice.
|
|
65
|
+
INTENT_RECV_PAYMENT_HINT = 4;
|
|
66
|
+
|
|
67
|
+
// INTENT_RECV_PAYMENT is used to indicate that a peer wants to create an
|
|
68
|
+
// invoice to receive a payment with assets. This is typically used by the
|
|
69
|
+
// edge node that facilitates the swap from BTC to assets for the receiver
|
|
70
|
+
// of a payment. This intent is used to provide the actual asset rate for
|
|
71
|
+
// the invoice creation, which may differ from the hint provided by the
|
|
72
|
+
// receiver.
|
|
73
|
+
INTENT_RECV_PAYMENT = 5;
|
|
74
|
+
|
|
75
|
+
// INTENT_RECV_PAYMENT_QUALIFY is used to indicate that the creator of an
|
|
76
|
+
// invoice received an asset rate from their RFQ peer (edge node) and is
|
|
77
|
+
// qualifying the rate for the creation of the invoice. This is typically
|
|
78
|
+
// used by the creator of an invoice to ensure that the asset rate provided
|
|
79
|
+
// by their peer (edge node) is acceptable before proceeding with creating
|
|
80
|
+
// the invoice.
|
|
81
|
+
INTENT_RECV_PAYMENT_QUALIFY = 6;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// FixedPoint is a scaled integer representation of a fractional number.
|
|
85
|
+
//
|
|
86
|
+
// This type consists of two integer fields: a coefficient and a scale.
|
|
87
|
+
// Using this format enables precise and consistent representation of fractional
|
|
88
|
+
// numbers while avoiding floating-point data types, which are prone to
|
|
89
|
+
// precision errors.
|
|
90
|
+
//
|
|
91
|
+
// The relationship between the fractional representation and its fixed-point
|
|
92
|
+
// representation is expressed as:
|
|
93
|
+
// ```
|
|
94
|
+
// V = F_c / (10^F_s)
|
|
95
|
+
// ```
|
|
96
|
+
// where:
|
|
97
|
+
//
|
|
98
|
+
// * `V` is the fractional value.
|
|
99
|
+
//
|
|
100
|
+
// * `F_c` is the coefficient component of the fixed-point representation. It is
|
|
101
|
+
// the scaled-up fractional value represented as an integer.
|
|
102
|
+
//
|
|
103
|
+
// * `F_s` is the scale component. It is an integer specifying how
|
|
104
|
+
// many decimal places `F_c` should be divided by to obtain the fractional
|
|
105
|
+
// representation.
|
|
106
|
+
message FixedPoint {
|
|
107
|
+
// The coefficient is the fractional value scaled-up as an integer. This
|
|
108
|
+
// integer is represented as a string as it may be too large to fit in a
|
|
109
|
+
// uint64.
|
|
110
|
+
string coefficient = 1;
|
|
111
|
+
|
|
112
|
+
// The scale is the component that determines how many decimal places
|
|
113
|
+
// the coefficient should be divided by to obtain the fractional value.
|
|
114
|
+
uint32 scale = 2;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// AssetRates represents the exchange rates for subject and payment assets
|
|
118
|
+
// relative to BTC, expressed as fixed-point numbers. It includes the rates
|
|
119
|
+
// for both assets and an expiration timestamp indicating when the rates
|
|
120
|
+
// are no longer valid.
|
|
121
|
+
message AssetRates {
|
|
122
|
+
// subjectAssetRate is the number of subject asset units per BTC represented
|
|
123
|
+
// as a fixed-point number. This field is also commonly referred to as the
|
|
124
|
+
// subject asset to BTC (conversion) rate. When the subject asset is BTC,
|
|
125
|
+
// this field should be set to 100 billion, as one BTC is equivalent to 100
|
|
126
|
+
// billion msats.
|
|
127
|
+
FixedPoint subjectAssetRate = 1;
|
|
128
|
+
|
|
129
|
+
// paymentAssetRate is the number of payment asset units per BTC represented
|
|
130
|
+
// as a fixed-point number. This field is also commonly referred to as the
|
|
131
|
+
// payment asset to BTC (conversion) rate. When the payment asset is BTC,
|
|
132
|
+
// this field should be set to 100 billion, as one BTC is equivalent to 100
|
|
133
|
+
// billion msats.
|
|
134
|
+
FixedPoint paymentAssetRate = 2;
|
|
135
|
+
|
|
136
|
+
// expiry_timestamp is the Unix timestamp in seconds after which the asset
|
|
137
|
+
// rates are no longer valid.
|
|
138
|
+
uint64 expiry_timestamp = 3;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// AssetSpecifier is a union type for specifying an asset by either its asset ID
|
|
142
|
+
// or group key.
|
|
143
|
+
message AssetSpecifier {
|
|
144
|
+
oneof id {
|
|
145
|
+
// The 32-byte asset ID specified as raw bytes (gRPC only).
|
|
146
|
+
bytes asset_id = 1;
|
|
147
|
+
|
|
148
|
+
// The 32-byte asset ID encoded as a hex string (use this for REST).
|
|
149
|
+
string asset_id_str = 2;
|
|
150
|
+
|
|
151
|
+
// The 32-byte asset group key specified as raw bytes (gRPC only).
|
|
152
|
+
bytes group_key = 3;
|
|
153
|
+
|
|
154
|
+
// The 32-byte asset group key encoded as hex string (use this for
|
|
155
|
+
// REST).
|
|
156
|
+
string group_key_str = 4;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// QueryAssetRatesRequest specifies the parameters for querying asset exchange
|
|
161
|
+
// rates in a transaction. It includes the transaction type, details about the
|
|
162
|
+
// subject and payment assets, and an optional hint for expected asset rates.
|
|
163
|
+
message QueryAssetRatesRequest {
|
|
164
|
+
// transaction_type indicates whether the transaction is a purchase or a
|
|
165
|
+
// sale.
|
|
166
|
+
TransactionType transaction_type = 1;
|
|
167
|
+
|
|
168
|
+
// subject_asset is the asset to be priced for purchase or sale.
|
|
169
|
+
AssetSpecifier subject_asset = 2;
|
|
170
|
+
|
|
171
|
+
// subject_asset_max_amount is the maximum amount of the subject asset that
|
|
172
|
+
// could be involved in the transaction.
|
|
173
|
+
uint64 subject_asset_max_amount = 3;
|
|
174
|
+
|
|
175
|
+
// payment_asset is the asset used for purchasing or receiving from a sale.
|
|
176
|
+
//
|
|
177
|
+
// NOTE: An asset ID of all zeros indicates that the payment asset is BTC.
|
|
178
|
+
// In this case, the asset rate will be given as milli-satoshi per asset
|
|
179
|
+
// unit
|
|
180
|
+
AssetSpecifier payment_asset = 4;
|
|
181
|
+
|
|
182
|
+
// payment_asset_max_amount is the maximum amount of the payment asset that
|
|
183
|
+
// could be involved in the transaction. This field is optional. If set to
|
|
184
|
+
// zero, it is considered unset.
|
|
185
|
+
uint64 payment_asset_max_amount = 5;
|
|
186
|
+
|
|
187
|
+
// asset_rates_hint is an optional suggestion of asset rates for the
|
|
188
|
+
// transaction, intended to provide guidance on expected pricing.
|
|
189
|
+
AssetRates asset_rates_hint = 6;
|
|
190
|
+
|
|
191
|
+
// intent informs the price oracle about the stage of the payment flow that
|
|
192
|
+
// lead to the price rate query. This is used to provide context for the
|
|
193
|
+
// asset rates being requested, allowing the price oracle to tailor the
|
|
194
|
+
// response based on the specific use case, such as paying an invoice or
|
|
195
|
+
// receiving a payment and the different stages involved in those. This
|
|
196
|
+
// field will only be set by tapd v0.7.0 and later.
|
|
197
|
+
Intent intent = 7;
|
|
198
|
+
|
|
199
|
+
// counterparty_id is the 33-byte public key of the peer that is on the
|
|
200
|
+
// opposite side of the transaction. This field will only be set by tapd
|
|
201
|
+
// v0.7.0 and later and only if the user initiating the transaction (sending
|
|
202
|
+
// a payment or creating an invoice) opted in to sharing their peer ID with
|
|
203
|
+
// the price oracle.
|
|
204
|
+
bytes counterparty_id = 8;
|
|
205
|
+
|
|
206
|
+
// metadata is an optional text field that can be used to provide
|
|
207
|
+
// additional metadata about the transaction to the price oracle. This can
|
|
208
|
+
// include information about the wallet end user that initiated the
|
|
209
|
+
// transaction, or any authentication information that the price oracle
|
|
210
|
+
// can use to give out a more accurate (or discount) asset rate. Though not
|
|
211
|
+
// verified or enforced by tapd, the suggested format for this field is a
|
|
212
|
+
// JSON string. This field is optional and can be left empty if no metadata
|
|
213
|
+
// is available. The maximum length of this field is 32'768 bytes. This
|
|
214
|
+
// field will only be set by tapd v0.7.0 and later.
|
|
215
|
+
string metadata = 9;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// QueryAssetRatesOkResponse is the successful response to a
|
|
219
|
+
// QueryAssetRates call.
|
|
220
|
+
message QueryAssetRatesOkResponse {
|
|
221
|
+
// asset_rates is the asset exchange rates for the transaction.
|
|
222
|
+
AssetRates asset_rates = 1;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// QueryAssetRatesErrResponse is the error response to a QueryAssetRates call.
|
|
226
|
+
message QueryAssetRatesErrResponse {
|
|
227
|
+
// error is the error message.
|
|
228
|
+
string message = 1;
|
|
229
|
+
|
|
230
|
+
// code is the error code.
|
|
231
|
+
uint32 code = 2;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// QueryAssetRatesResponse is the response from a QueryAssetRates RPC call.
|
|
235
|
+
message QueryAssetRatesResponse {
|
|
236
|
+
oneof result {
|
|
237
|
+
// ok is the successful response to the query.
|
|
238
|
+
QueryAssetRatesOkResponse ok = 1;
|
|
239
|
+
|
|
240
|
+
// error is the error response to the query.
|
|
241
|
+
QueryAssetRatesErrResponse error = 2;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package rfqrpc;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/lightninglabs/taproot-assets/taprpc/rfqrpc";
|
|
6
|
+
|
|
7
|
+
service Rfq {
|
|
8
|
+
/* tapcli: `rfq buyorder`
|
|
9
|
+
AddAssetBuyOrder is used to add a buy order for a specific asset. If a buy
|
|
10
|
+
order already exists for the asset, it will be updated.
|
|
11
|
+
|
|
12
|
+
A buy order instructs the RFQ (Request For Quote) system to request a quote
|
|
13
|
+
from a peer for the acquisition of an asset.
|
|
14
|
+
|
|
15
|
+
The normal use of a buy order is as follows:
|
|
16
|
+
1. Alice, operating a wallet node, wants to receive a Tap asset as payment
|
|
17
|
+
by issuing a Lightning invoice.
|
|
18
|
+
2. Alice has an asset channel established with Bob's edge node.
|
|
19
|
+
3. Before issuing the invoice, Alice needs to agree on an exchange rate with
|
|
20
|
+
Bob, who will facilitate the asset transfer.
|
|
21
|
+
4. To obtain the best exchange rate, Alice creates a buy order specifying
|
|
22
|
+
the desired asset.
|
|
23
|
+
5. Alice's RFQ subsystem processes the buy order and sends buy requests to
|
|
24
|
+
relevant peers to find the best rate. In this example, Bob is the only
|
|
25
|
+
available peer.
|
|
26
|
+
6. Once Bob provides a satisfactory quote, Alice accepts it.
|
|
27
|
+
7. Alice issues the Lightning invoice, which Charlie will pay.
|
|
28
|
+
8. Instead of paying Alice directly, Charlie pays Bob.
|
|
29
|
+
9. Bob then forwards the agreed amount of the Tap asset to Alice over their
|
|
30
|
+
asset channel.
|
|
31
|
+
*/
|
|
32
|
+
rpc AddAssetBuyOrder (AddAssetBuyOrderRequest)
|
|
33
|
+
returns (AddAssetBuyOrderResponse);
|
|
34
|
+
|
|
35
|
+
/* tapcli: `rfq sellorder`
|
|
36
|
+
AddAssetSellOrder is used to add a sell order for a specific asset. If a
|
|
37
|
+
sell order already exists for the asset, it will be updated.
|
|
38
|
+
*/
|
|
39
|
+
rpc AddAssetSellOrder (AddAssetSellOrderRequest)
|
|
40
|
+
returns (AddAssetSellOrderResponse);
|
|
41
|
+
|
|
42
|
+
/* tapcli: `rfq selloffer`
|
|
43
|
+
AddAssetSellOffer is used to add a sell offer for a specific asset. If a
|
|
44
|
+
sell offer already exists for the asset, it will be updated.
|
|
45
|
+
*/
|
|
46
|
+
rpc AddAssetSellOffer (AddAssetSellOfferRequest)
|
|
47
|
+
returns (AddAssetSellOfferResponse);
|
|
48
|
+
|
|
49
|
+
/* tapcli: `rfq buyoffer`
|
|
50
|
+
AddAssetBuyOffer is used to add a buy offer for a specific asset. If a
|
|
51
|
+
buy offer already exists for the asset, it will be updated.
|
|
52
|
+
|
|
53
|
+
A buy offer is used by the node to selectively accept or reject incoming
|
|
54
|
+
asset sell quote requests before price is considered.
|
|
55
|
+
*/
|
|
56
|
+
rpc AddAssetBuyOffer (AddAssetBuyOfferRequest)
|
|
57
|
+
returns (AddAssetBuyOfferResponse);
|
|
58
|
+
|
|
59
|
+
/* tapcli: `rfq acceptedquotes`
|
|
60
|
+
QueryPeerAcceptedQuotes is used to query for quotes that were requested by
|
|
61
|
+
our node and have been accepted our peers.
|
|
62
|
+
*/
|
|
63
|
+
rpc QueryPeerAcceptedQuotes (QueryPeerAcceptedQuotesRequest)
|
|
64
|
+
returns (QueryPeerAcceptedQuotesResponse);
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
SubscribeRfqEventNtfns is used to subscribe to RFQ events.
|
|
68
|
+
*/
|
|
69
|
+
rpc SubscribeRfqEventNtfns (SubscribeRfqEventNtfnsRequest)
|
|
70
|
+
returns (stream RfqEvent);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
message AssetSpecifier {
|
|
74
|
+
oneof id {
|
|
75
|
+
// The 32-byte asset ID specified as raw bytes (gRPC only).
|
|
76
|
+
bytes asset_id = 1;
|
|
77
|
+
|
|
78
|
+
// The 32-byte asset ID encoded as a hex string (use this for REST).
|
|
79
|
+
string asset_id_str = 2;
|
|
80
|
+
|
|
81
|
+
// The 32-byte asset group key specified as raw bytes (gRPC only).
|
|
82
|
+
bytes group_key = 3;
|
|
83
|
+
|
|
84
|
+
// The 32-byte asset group key encoded as hex string (use this for
|
|
85
|
+
// REST).
|
|
86
|
+
string group_key_str = 4;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// FixedPoint is a scaled integer representation of a fractional number.
|
|
91
|
+
//
|
|
92
|
+
// This type consists of two integer fields: a coefficient and a scale.
|
|
93
|
+
// Using this format enables precise and consistent representation of fractional
|
|
94
|
+
// numbers while avoiding floating-point data types, which are prone to
|
|
95
|
+
// precision errors.
|
|
96
|
+
//
|
|
97
|
+
// The relationship between the fractional representation and its fixed-point
|
|
98
|
+
// representation is expressed as:
|
|
99
|
+
// ```
|
|
100
|
+
// V = F_c / (10^F_s)
|
|
101
|
+
// ```
|
|
102
|
+
// where:
|
|
103
|
+
//
|
|
104
|
+
// * `V` is the fractional value.
|
|
105
|
+
//
|
|
106
|
+
// * `F_c` is the coefficient component of the fixed-point representation. It is
|
|
107
|
+
// the scaled-up fractional value represented as an integer.
|
|
108
|
+
//
|
|
109
|
+
// * `F_s` is the scale component. It is an integer specifying how
|
|
110
|
+
// many decimal places `F_c` should be divided by to obtain the fractional
|
|
111
|
+
// representation.
|
|
112
|
+
message FixedPoint {
|
|
113
|
+
// The coefficient is the fractional value scaled-up as an integer. This
|
|
114
|
+
// integer is represented as a string as it may be too large to fit in a
|
|
115
|
+
// uint64.
|
|
116
|
+
string coefficient = 1;
|
|
117
|
+
|
|
118
|
+
// The scale is the component that determines how many decimal places
|
|
119
|
+
// the coefficient should be divided by to obtain the fractional value.
|
|
120
|
+
uint32 scale = 2;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
message AddAssetBuyOrderRequest {
|
|
124
|
+
// asset_specifier is the subject asset.
|
|
125
|
+
AssetSpecifier asset_specifier = 1;
|
|
126
|
+
|
|
127
|
+
// The maximum amount of the asset that the provider must be willing to
|
|
128
|
+
// offer.
|
|
129
|
+
uint64 asset_max_amt = 2;
|
|
130
|
+
|
|
131
|
+
// The unix timestamp in seconds after which the order is no longer valid.
|
|
132
|
+
uint64 expiry = 3;
|
|
133
|
+
|
|
134
|
+
// The public key of the intended recipient peer for the order.
|
|
135
|
+
bytes peer_pub_key = 4;
|
|
136
|
+
|
|
137
|
+
// timeout_seconds is the number of seconds to wait for the peer to respond
|
|
138
|
+
// with an accepted quote (or a rejection).
|
|
139
|
+
uint32 timeout_seconds = 5;
|
|
140
|
+
|
|
141
|
+
// If set, the check if a channel with the given asset exists with the peer
|
|
142
|
+
// will be skipped. An active channel with the peer is still required for
|
|
143
|
+
// the RFQ negotiation to work. This flag shouldn't be set outside of test
|
|
144
|
+
// scenarios.
|
|
145
|
+
bool skip_asset_channel_check = 6;
|
|
146
|
+
|
|
147
|
+
// An optional text field that can be used to provide additional metadata
|
|
148
|
+
// about the buy order to the price oracle. This can include information
|
|
149
|
+
// about the wallet end user that initiated the transaction, or any
|
|
150
|
+
// authentication information that the price oracle can use to give out a
|
|
151
|
+
// more accurate (or discount) asset rate. Though not verified or enforced
|
|
152
|
+
// by tapd, the suggested format for this field is a JSON string.
|
|
153
|
+
// This field is optional and can be left empty if no metadata is available.
|
|
154
|
+
// The maximum length of this field is 32'768 bytes.
|
|
155
|
+
string price_oracle_metadata = 7;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
message AddAssetBuyOrderResponse {
|
|
159
|
+
oneof response {
|
|
160
|
+
// accepted_quote holds the quote received from the peer as a response
|
|
161
|
+
// to our quote request.
|
|
162
|
+
PeerAcceptedBuyQuote accepted_quote = 1;
|
|
163
|
+
|
|
164
|
+
// invalid_quote is returned if the quote response received from the
|
|
165
|
+
// peer was invalid or insufficient.
|
|
166
|
+
InvalidQuoteResponse invalid_quote = 2;
|
|
167
|
+
|
|
168
|
+
// rejected_quote is returned if the quote request was rejected by the
|
|
169
|
+
// peer.
|
|
170
|
+
RejectedQuoteResponse rejected_quote = 3;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
message AddAssetSellOrderRequest {
|
|
175
|
+
// asset_specifier is the subject asset.
|
|
176
|
+
AssetSpecifier asset_specifier = 1;
|
|
177
|
+
|
|
178
|
+
// The maximum msat amount that the responding peer must agree to pay
|
|
179
|
+
// (units: millisats).
|
|
180
|
+
uint64 payment_max_amt = 2;
|
|
181
|
+
|
|
182
|
+
// The unix timestamp in seconds after which the order is no longer valid.
|
|
183
|
+
uint64 expiry = 3;
|
|
184
|
+
|
|
185
|
+
// The public key of the intended recipient peer for the order.
|
|
186
|
+
bytes peer_pub_key = 4;
|
|
187
|
+
|
|
188
|
+
// timeout_seconds is the number of seconds to wait for the peer to respond
|
|
189
|
+
// with an accepted quote (or a rejection).
|
|
190
|
+
uint32 timeout_seconds = 5;
|
|
191
|
+
|
|
192
|
+
// If set, the check if a channel with the given asset exists with the peer
|
|
193
|
+
// will be skipped. An active channel with the peer is still required for
|
|
194
|
+
// the RFQ negotiation to work. This flag shouldn't be set outside of test
|
|
195
|
+
// scenarios.
|
|
196
|
+
bool skip_asset_channel_check = 6;
|
|
197
|
+
|
|
198
|
+
// An optional text field that can be used to provide additional metadata
|
|
199
|
+
// about the sell order to the price oracle. This can include information
|
|
200
|
+
// about the wallet end user that initiated the transaction, or any
|
|
201
|
+
// authentication information that the price oracle can use to give out a
|
|
202
|
+
// more accurate (or discount) asset rate. Though not verified or enforced
|
|
203
|
+
// by tapd, the suggested format for this field is a JSON string.
|
|
204
|
+
// This field is optional and can be left empty if no metadata is available.
|
|
205
|
+
// The maximum length of this field is 32'768 bytes.
|
|
206
|
+
string price_oracle_metadata = 7;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
message AddAssetSellOrderResponse {
|
|
210
|
+
oneof response {
|
|
211
|
+
// accepted_quote holds the quote received from the peer as a response
|
|
212
|
+
// to our quote request.
|
|
213
|
+
PeerAcceptedSellQuote accepted_quote = 1;
|
|
214
|
+
|
|
215
|
+
// invalid_quote is returned if the quote response received from the
|
|
216
|
+
// peer was invalid or insufficient.
|
|
217
|
+
InvalidQuoteResponse invalid_quote = 2;
|
|
218
|
+
|
|
219
|
+
// rejected_quote is returned if the quote request was rejected by the
|
|
220
|
+
// peer.
|
|
221
|
+
RejectedQuoteResponse rejected_quote = 3;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
message AddAssetSellOfferRequest {
|
|
226
|
+
// asset_specifier is the subject asset.
|
|
227
|
+
AssetSpecifier asset_specifier = 1;
|
|
228
|
+
|
|
229
|
+
// max_units is the maximum amount of the asset to sell.
|
|
230
|
+
uint64 max_units = 2;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
message AddAssetSellOfferResponse {
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
message AddAssetBuyOfferRequest {
|
|
237
|
+
// asset_specifier is the subject asset.
|
|
238
|
+
AssetSpecifier asset_specifier = 1;
|
|
239
|
+
|
|
240
|
+
// max_units is the maximum amount of the asset to buy.
|
|
241
|
+
uint64 max_units = 2;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
message AddAssetBuyOfferResponse {
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
message QueryPeerAcceptedQuotesRequest {
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
message AssetSpec {
|
|
251
|
+
// The 32-byte asset ID specified as raw bytes.
|
|
252
|
+
bytes id = 1;
|
|
253
|
+
|
|
254
|
+
// The 32-byte asset group public key, serialized in BIP340 format.
|
|
255
|
+
// BIP340 defines a canonical encoding for Schnorr public keys.
|
|
256
|
+
// This field is serialized using schnorr.SerializePubKey.
|
|
257
|
+
bytes group_pub_key = 2;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
message PeerAcceptedBuyQuote {
|
|
261
|
+
// Quote counterparty peer.
|
|
262
|
+
string peer = 1;
|
|
263
|
+
|
|
264
|
+
// The unique identifier of the quote request.
|
|
265
|
+
bytes id = 2;
|
|
266
|
+
|
|
267
|
+
// The short channel ID of the channel over which the payment for the quote
|
|
268
|
+
// should be made.
|
|
269
|
+
uint64 scid = 3;
|
|
270
|
+
|
|
271
|
+
// The maximum exchange amount denoted in the subject asset. This includes
|
|
272
|
+
// the user-configured maximum routing fees, so the actual payment amount
|
|
273
|
+
// will be less than this. This just defines the maximum volume that the
|
|
274
|
+
// edge node has accepted to divest with the given rate.
|
|
275
|
+
uint64 asset_max_amount = 4;
|
|
276
|
+
|
|
277
|
+
// ask_asset_rate is the asset to BTC conversion rate represented as a
|
|
278
|
+
// fixed-point number.
|
|
279
|
+
FixedPoint ask_asset_rate = 5;
|
|
280
|
+
|
|
281
|
+
// The unix timestamp in seconds after which the quote is no longer valid.
|
|
282
|
+
uint64 expiry = 6;
|
|
283
|
+
|
|
284
|
+
// The smallest amount of asset units that can be transported within a
|
|
285
|
+
// single HTLC over the Lightning Network with the given rate. This is the
|
|
286
|
+
// asset unit equivalent of 354 satoshis, which is the minimum amount for an
|
|
287
|
+
// HTLC to be above the dust limit.
|
|
288
|
+
uint64 min_transportable_units = 7;
|
|
289
|
+
|
|
290
|
+
// An optional user-provided text field used to provide additional metadata
|
|
291
|
+
// about the buy order to the price oracle. This can include information
|
|
292
|
+
// about the wallet end user that initiated the transaction, or any
|
|
293
|
+
// authentication information that the price oracle can use to give out a
|
|
294
|
+
// more accurate (or discount) asset rate.
|
|
295
|
+
string price_oracle_metadata = 8;
|
|
296
|
+
|
|
297
|
+
// The subject asset specifier.
|
|
298
|
+
AssetSpec asset_spec = 9;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
message PeerAcceptedSellQuote {
|
|
302
|
+
// Quote counterparty peer.
|
|
303
|
+
string peer = 1;
|
|
304
|
+
|
|
305
|
+
// The unique identifier of the quote request.
|
|
306
|
+
bytes id = 2;
|
|
307
|
+
|
|
308
|
+
// scid is the short channel ID of the channel over which the payment for
|
|
309
|
+
// the quote should be made.
|
|
310
|
+
uint64 scid = 3;
|
|
311
|
+
|
|
312
|
+
// asset_amount is the amount of the subject asset.
|
|
313
|
+
uint64 asset_amount = 4;
|
|
314
|
+
|
|
315
|
+
// bid_asset_rate is the asset to BTC conversion rate represented as a
|
|
316
|
+
// fixed-point number.
|
|
317
|
+
FixedPoint bid_asset_rate = 5;
|
|
318
|
+
|
|
319
|
+
// The unix timestamp in seconds after which the quote is no longer valid.
|
|
320
|
+
uint64 expiry = 6;
|
|
321
|
+
|
|
322
|
+
// The minimum amount of milli-satoshis that need to be sent out in order to
|
|
323
|
+
// transport a single asset unit over the Lightning Network with the given
|
|
324
|
+
// rate. This is the base amount of 354,000 milli-satoshi (the minimum
|
|
325
|
+
// amount for a non-dust HTLC) plus the equivalent of one asset unit in
|
|
326
|
+
// milli-satoshis.
|
|
327
|
+
uint64 min_transportable_msat = 7;
|
|
328
|
+
|
|
329
|
+
// An optional user-provided text field used to provide additional metadata
|
|
330
|
+
// about the sell order to the price oracle. This can include information
|
|
331
|
+
// about the wallet end user that initiated the transaction, or any
|
|
332
|
+
// authentication information that the price oracle can use to give out a
|
|
333
|
+
// more accurate (or discount) asset rate.
|
|
334
|
+
string price_oracle_metadata = 8;
|
|
335
|
+
|
|
336
|
+
// The subject asset specifier.
|
|
337
|
+
AssetSpec asset_spec = 9;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// QuoteRespStatus is an enum that represents the status of a quote response.
|
|
341
|
+
enum QuoteRespStatus {
|
|
342
|
+
// INVALID_ASSET_RATES indicates that at least one asset rate in the
|
|
343
|
+
// quote response is invalid.
|
|
344
|
+
INVALID_ASSET_RATES = 0;
|
|
345
|
+
|
|
346
|
+
// INVALID_EXPIRY indicates that the expiry in the quote response is
|
|
347
|
+
// invalid.
|
|
348
|
+
INVALID_EXPIRY = 1;
|
|
349
|
+
|
|
350
|
+
// PRICE_ORACLE_QUERY_ERR indicates that an error occurred when querying the
|
|
351
|
+
// price oracle whilst evaluating the quote response.
|
|
352
|
+
PRICE_ORACLE_QUERY_ERR = 2;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// InvalidQuoteResponse is a message that is returned when a quote response is
|
|
356
|
+
// invalid or insufficient.
|
|
357
|
+
message InvalidQuoteResponse {
|
|
358
|
+
// status is the status of the quote response.
|
|
359
|
+
QuoteRespStatus status = 1;
|
|
360
|
+
|
|
361
|
+
// peer is the quote counterparty peer.
|
|
362
|
+
string peer = 2;
|
|
363
|
+
|
|
364
|
+
// id is the unique identifier of the quote request.
|
|
365
|
+
bytes id = 3;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// RejectedQuoteResponse is a message that is returned when a quote request is
|
|
369
|
+
// rejected by the peer.
|
|
370
|
+
message RejectedQuoteResponse {
|
|
371
|
+
// peer is the quote counterparty peer.
|
|
372
|
+
string peer = 1;
|
|
373
|
+
|
|
374
|
+
// id is the unique identifier of the quote request.
|
|
375
|
+
bytes id = 2;
|
|
376
|
+
|
|
377
|
+
// error_message is a human-readable error message.
|
|
378
|
+
string error_message = 3;
|
|
379
|
+
|
|
380
|
+
// error_code is a machine-readable error code.
|
|
381
|
+
uint32 error_code = 4;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
message QueryPeerAcceptedQuotesResponse {
|
|
385
|
+
// buy_quotes is a list of asset buy quotes which were requested by our
|
|
386
|
+
// node and have been accepted by our peers.
|
|
387
|
+
repeated PeerAcceptedBuyQuote buy_quotes = 1;
|
|
388
|
+
|
|
389
|
+
// sell_quotes is a list of asset sell quotes which were requested by our
|
|
390
|
+
// node and have been accepted by our peers.
|
|
391
|
+
repeated PeerAcceptedSellQuote sell_quotes = 2;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
message SubscribeRfqEventNtfnsRequest {
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
message PeerAcceptedBuyQuoteEvent {
|
|
398
|
+
// Unix timestamp in microseconds.
|
|
399
|
+
uint64 timestamp = 1;
|
|
400
|
+
|
|
401
|
+
// The asset buy quote that was accepted by out peer.
|
|
402
|
+
PeerAcceptedBuyQuote peer_accepted_buy_quote = 2;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
message PeerAcceptedSellQuoteEvent {
|
|
406
|
+
// Unix timestamp in microseconds.
|
|
407
|
+
uint64 timestamp = 1;
|
|
408
|
+
|
|
409
|
+
// The asset sell quote that was accepted by out peer.
|
|
410
|
+
PeerAcceptedSellQuote peer_accepted_sell_quote = 2;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
message AcceptHtlcEvent {
|
|
414
|
+
// Unix timestamp in microseconds.
|
|
415
|
+
uint64 timestamp = 1;
|
|
416
|
+
|
|
417
|
+
// scid is the short channel ID of the channel over which the payment for
|
|
418
|
+
// the quote is made.
|
|
419
|
+
uint64 scid = 2;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
message RfqEvent {
|
|
423
|
+
oneof event {
|
|
424
|
+
// peer_accepted_buy_quote is an event that is emitted when a peer
|
|
425
|
+
// accepted (incoming) asset buy quote message is received.
|
|
426
|
+
PeerAcceptedBuyQuoteEvent peer_accepted_buy_quote = 1;
|
|
427
|
+
|
|
428
|
+
// peer_accepted_sell_offer is an event that is emitted when a peer
|
|
429
|
+
// accepted (incoming) asset sell quote message is received.
|
|
430
|
+
PeerAcceptedSellQuoteEvent peer_accepted_sell_quote = 2;
|
|
431
|
+
|
|
432
|
+
// accept_htlc is an event that is sent when a HTLC is accepted by the
|
|
433
|
+
// RFQ service.
|
|
434
|
+
AcceptHtlcEvent accept_htlc = 3;
|
|
435
|
+
}
|
|
436
|
+
}
|