@arkade-os/swap 0.1.8 → 0.1.10
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/dist/advanced.cjs +1125 -554
- package/dist/advanced.d.cts +19 -21
- package/dist/advanced.d.ts +19 -21
- package/dist/advanced.js +40 -34
- package/dist/{chunk-ISWLKKSS.js → chunk-2HQZLIVX.js} +106 -39
- package/dist/{chunk-5QPJWOCN.js → chunk-6RJVT65W.js} +2 -0
- package/dist/chunk-AUJDREZN.js +445 -0
- package/dist/{chunk-ZBJGLLYV.js → chunk-FWRDAL73.js} +157 -477
- package/dist/{chunk-PDNVKH5L.js → chunk-LCO6AJOS.js} +453 -70
- package/dist/index.cjs +1110 -542
- package/dist/index.d.cts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +24 -22
- package/dist/{lockupContract-DguuT7NK.d.cts → lockupContract-BTTRVwOt.d.cts} +1 -1
- package/dist/{lockupContract-BUOsghl1.d.ts → lockupContract-aFarhlxj.d.ts} +1 -1
- package/dist/node/index.d.cts +97 -67
- package/dist/node/index.d.ts +97 -67
- package/dist/nostr.cjs +925 -516
- package/dist/nostr.d.cts +1 -1
- package/dist/nostr.d.ts +1 -1
- package/dist/nostr.js +3 -2
- package/dist/{offerFillPlan-_AOLo6kh.d.ts → offerFillPlan-CJC5tnEd.d.ts} +10 -42
- package/dist/{offerFillPlan-Bp6-z6dS.d.cts → offerFillPlan-FmyaQoYT.d.cts} +10 -42
- package/dist/protocol.cjs +1082 -188
- package/dist/protocol.d.cts +42 -23
- package/dist/protocol.d.ts +42 -23
- package/dist/protocol.js +20 -7
- package/dist/repositories/realm/index.d.cts +3 -2
- package/dist/repositories/realm/index.d.ts +3 -2
- package/dist/repositories/sqlite/index.d.cts +3 -2
- package/dist/repositories/sqlite/index.d.ts +3 -2
- package/dist/{repository-CkKK0dGO.d.ts → repository-CwwhIAEd.d.cts} +406 -74
- package/dist/{repository--pfikw2R.d.cts → repository-DO6QKxBx.d.ts} +406 -74
- package/dist/{rfq-IzhOCG02.d.ts → rfq-CYxOyniL.d.ts} +52 -11
- package/dist/rfq-contract.cjs +3 -0
- package/dist/rfq-contract.d.cts +3 -1
- package/dist/rfq-contract.d.ts +3 -1
- package/dist/rfq-contract.js +3 -1
- package/dist/{rfq-BRpo5uWU.d.cts → rfq-nMGywkqI.d.cts} +52 -11
- package/dist/verify-ENO36VPK.js +33 -0
- package/dist/{watch-pvTVFp6-.d.cts → watch-DpDSP2tu.d.cts} +4 -3
- package/dist/{watch-DDNycuUa.d.ts → watch-_fZSgx_l.d.ts} +4 -3
- package/package.json +2 -2
- package/dist/offer-BhonWuKR.d.ts +0 -274
- package/dist/offer-D_qHpWo2.d.cts +0 -274
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddressMismatch,
|
|
3
|
+
SwapRefusal,
|
|
4
|
+
assertFundable,
|
|
5
|
+
assertReceivable,
|
|
6
|
+
quoteCarrierSats
|
|
7
|
+
} from "./chunk-LCO6AJOS.js";
|
|
8
|
+
|
|
9
|
+
// src/client/verify.ts
|
|
10
|
+
import { hex } from "@scure/base";
|
|
11
|
+
|
|
12
|
+
// src/client/errors.ts
|
|
13
|
+
var AmbiguousDestination = class extends Error {
|
|
14
|
+
constructor(destination, detail) {
|
|
15
|
+
super(`cannot route ${JSON.stringify(destination)}: ${detail}`);
|
|
16
|
+
this.destination = destination;
|
|
17
|
+
}
|
|
18
|
+
destination;
|
|
19
|
+
name = "AmbiguousDestination";
|
|
20
|
+
};
|
|
21
|
+
var UnsupportedRoute = class extends Error {
|
|
22
|
+
name = "UnsupportedRoute";
|
|
23
|
+
give;
|
|
24
|
+
take;
|
|
25
|
+
constructor(detail, corridors = {}) {
|
|
26
|
+
super(`unsupported route: ${detail}`);
|
|
27
|
+
this.give = corridors.give;
|
|
28
|
+
this.take = corridors.take;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var DiscoverySnapshotUnavailable = class extends Error {
|
|
32
|
+
constructor(network, detail) {
|
|
33
|
+
super(`cannot resolve on ${network} offline: ${detail}`);
|
|
34
|
+
this.network = network;
|
|
35
|
+
}
|
|
36
|
+
network;
|
|
37
|
+
name = "DiscoverySnapshotUnavailable";
|
|
38
|
+
};
|
|
39
|
+
var AmountMismatch = class extends Error {
|
|
40
|
+
constructor(sources) {
|
|
41
|
+
super(`exactly one amount may be pinned; got ${sources[0]} and ${sources[1]}`);
|
|
42
|
+
this.sources = sources;
|
|
43
|
+
}
|
|
44
|
+
sources;
|
|
45
|
+
name = "AmountMismatch";
|
|
46
|
+
};
|
|
47
|
+
var AmountEncodingUnsupported = class extends Error {
|
|
48
|
+
constructor(field, value, detail, options) {
|
|
49
|
+
super(`${field}: ${detail}`, options);
|
|
50
|
+
this.field = field;
|
|
51
|
+
this.value = value;
|
|
52
|
+
}
|
|
53
|
+
field;
|
|
54
|
+
value;
|
|
55
|
+
name = "AmountEncodingUnsupported";
|
|
56
|
+
};
|
|
57
|
+
var QuoteVerificationFailed = class extends Error {
|
|
58
|
+
constructor(check, expected, actual, options) {
|
|
59
|
+
super(`quote failed the ${check} check \u2014 refusing to fund`, options);
|
|
60
|
+
this.check = check;
|
|
61
|
+
this.expected = expected;
|
|
62
|
+
this.actual = actual;
|
|
63
|
+
}
|
|
64
|
+
check;
|
|
65
|
+
name = "QuoteVerificationFailed";
|
|
66
|
+
expected;
|
|
67
|
+
actual;
|
|
68
|
+
};
|
|
69
|
+
var QuoteExpired = class extends Error {
|
|
70
|
+
constructor(quoteId, expiresAt, now) {
|
|
71
|
+
super(`quote ${quoteId} expired at ${expiresAt}, ${now - expiresAt} ago`);
|
|
72
|
+
this.quoteId = quoteId;
|
|
73
|
+
this.expiresAt = expiresAt;
|
|
74
|
+
this.now = now;
|
|
75
|
+
}
|
|
76
|
+
quoteId;
|
|
77
|
+
expiresAt;
|
|
78
|
+
now;
|
|
79
|
+
name = "QuoteExpired";
|
|
80
|
+
};
|
|
81
|
+
var MaxFeeExceeded = class extends Error {
|
|
82
|
+
constructor(quoteId, asset, fee, maxFee) {
|
|
83
|
+
super(`fee ${fee} of ${asset} exceeds the ${maxFee} ceiling`);
|
|
84
|
+
this.quoteId = quoteId;
|
|
85
|
+
this.asset = asset;
|
|
86
|
+
this.fee = fee;
|
|
87
|
+
this.maxFee = maxFee;
|
|
88
|
+
}
|
|
89
|
+
quoteId;
|
|
90
|
+
asset;
|
|
91
|
+
fee;
|
|
92
|
+
maxFee;
|
|
93
|
+
name = "MaxFeeExceeded";
|
|
94
|
+
};
|
|
95
|
+
var InsufficientFunds = class extends Error {
|
|
96
|
+
constructor(asset, required, available) {
|
|
97
|
+
super(
|
|
98
|
+
`funding needs ${required} of ${asset}` + (available === void 0 ? "" : `, wallet holds ${available}`)
|
|
99
|
+
);
|
|
100
|
+
this.asset = asset;
|
|
101
|
+
this.required = required;
|
|
102
|
+
this.available = available;
|
|
103
|
+
}
|
|
104
|
+
asset;
|
|
105
|
+
required;
|
|
106
|
+
name = "InsufficientFunds";
|
|
107
|
+
available;
|
|
108
|
+
};
|
|
109
|
+
var AcceptConflict = class extends Error {
|
|
110
|
+
constructor(quoteId, swapId, fields) {
|
|
111
|
+
super(`accept ${quoteId} conflicts with swap ${swapId} on ${fields.join(", ")}`);
|
|
112
|
+
this.quoteId = quoteId;
|
|
113
|
+
this.swapId = swapId;
|
|
114
|
+
this.fields = fields;
|
|
115
|
+
}
|
|
116
|
+
quoteId;
|
|
117
|
+
swapId;
|
|
118
|
+
fields;
|
|
119
|
+
name = "AcceptConflict";
|
|
120
|
+
};
|
|
121
|
+
var ClientDisposed = class extends Error {
|
|
122
|
+
constructor(method) {
|
|
123
|
+
super(`${method}() called after the client was disposed`);
|
|
124
|
+
this.method = method;
|
|
125
|
+
}
|
|
126
|
+
method;
|
|
127
|
+
name = "ClientDisposed";
|
|
128
|
+
};
|
|
129
|
+
var NotCancellable = class extends Error {
|
|
130
|
+
constructor(swapId) {
|
|
131
|
+
super(`swap ${swapId} is not a cancellable asset swap`);
|
|
132
|
+
this.swapId = swapId;
|
|
133
|
+
}
|
|
134
|
+
swapId;
|
|
135
|
+
name = "NotCancellable";
|
|
136
|
+
};
|
|
137
|
+
var InconsistentRoute = class extends Error {
|
|
138
|
+
constructor(asset, destination) {
|
|
139
|
+
super(`destination ${JSON.stringify(destination)} is not on ${asset}'s chain`);
|
|
140
|
+
this.asset = asset;
|
|
141
|
+
this.destination = destination;
|
|
142
|
+
}
|
|
143
|
+
asset;
|
|
144
|
+
destination;
|
|
145
|
+
name = "InconsistentRoute";
|
|
146
|
+
};
|
|
147
|
+
var OperatorUnreachable = class extends Error {
|
|
148
|
+
name = "OperatorUnreachable";
|
|
149
|
+
constructor(detail, options) {
|
|
150
|
+
super(`cannot derive a covenant: ${detail}`, options);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
var MissingCorridorDep = class extends Error {
|
|
154
|
+
constructor(corridor, dep) {
|
|
155
|
+
super(`the ${corridor} corridor has no ${dep}`);
|
|
156
|
+
this.corridor = corridor;
|
|
157
|
+
this.dep = dep;
|
|
158
|
+
}
|
|
159
|
+
corridor;
|
|
160
|
+
dep;
|
|
161
|
+
name = "MissingCorridorDep";
|
|
162
|
+
};
|
|
163
|
+
var SWAP_ERRORS = {
|
|
164
|
+
AmbiguousDestination,
|
|
165
|
+
UnsupportedRoute,
|
|
166
|
+
DiscoverySnapshotUnavailable,
|
|
167
|
+
AmountMismatch,
|
|
168
|
+
AmountEncodingUnsupported,
|
|
169
|
+
QuoteVerificationFailed,
|
|
170
|
+
SwapRefusal,
|
|
171
|
+
QuoteExpired,
|
|
172
|
+
MaxFeeExceeded,
|
|
173
|
+
InsufficientFunds,
|
|
174
|
+
AcceptConflict,
|
|
175
|
+
ClientDisposed,
|
|
176
|
+
NotCancellable,
|
|
177
|
+
InconsistentRoute,
|
|
178
|
+
OperatorUnreachable,
|
|
179
|
+
MissingCorridorDep
|
|
180
|
+
};
|
|
181
|
+
var SWAP_ERROR_NAMES = Object.keys(SWAP_ERRORS);
|
|
182
|
+
function isSwapError(e, name) {
|
|
183
|
+
if (!(e instanceof Error)) return false;
|
|
184
|
+
const table = SWAP_ERRORS;
|
|
185
|
+
const ctor = table[e.name];
|
|
186
|
+
if (ctor === void 0 || !(e instanceof ctor)) return false;
|
|
187
|
+
return name === void 0 || e.name === name;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// src/client/policy.ts
|
|
191
|
+
var DEFAULT_MAX_REFUND_WINDOW_SECONDS = 30 * 24 * 3600;
|
|
192
|
+
|
|
193
|
+
// src/client/verify.ts
|
|
194
|
+
var reasonOf = (error) => error instanceof Error && typeof error.reason === "string" ? error.reason : void 0;
|
|
195
|
+
var CHECK_BY_REASON = {
|
|
196
|
+
invoice_expired: "invoice",
|
|
197
|
+
invoice_undecodable: "invoice",
|
|
198
|
+
invoice_hash_mismatch: "invoice",
|
|
199
|
+
invoice_amount_mismatch: "invoice",
|
|
200
|
+
insufficient_headroom: "refund_window",
|
|
201
|
+
missing_refund_locktime: "refund_window",
|
|
202
|
+
claim_window_too_short: "refund_window",
|
|
203
|
+
confirmations_out_of_range: "refund_window",
|
|
204
|
+
timelock_order: "refund_window",
|
|
205
|
+
quote_malformed: "refund_window"
|
|
206
|
+
};
|
|
207
|
+
var gated = (run, quote) => {
|
|
208
|
+
try {
|
|
209
|
+
run();
|
|
210
|
+
} catch (error) {
|
|
211
|
+
const reason = reasonOf(error);
|
|
212
|
+
if (reason === "quote_expired") {
|
|
213
|
+
throw new QuoteExpired(quote.id, quote.expiresAt, quote.now);
|
|
214
|
+
}
|
|
215
|
+
const check = reason === void 0 ? void 0 : CHECK_BY_REASON[reason];
|
|
216
|
+
if (check === void 0) throw error;
|
|
217
|
+
throw new QuoteVerificationFailed(
|
|
218
|
+
check,
|
|
219
|
+
void 0,
|
|
220
|
+
error instanceof Error ? error.message : String(error),
|
|
221
|
+
{ cause: error }
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var verifyResponder = (input) => {
|
|
226
|
+
if (!input.pinnable || input.expected === void 0) {
|
|
227
|
+
throw new QuoteVerificationFailed(
|
|
228
|
+
"responder",
|
|
229
|
+
"a registry-served card naming the solver's discovery key",
|
|
230
|
+
input.expected === void 0 ? "the card names no discovery key" : "the card came out of the local cache, which does not authenticate it"
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
if (input.attested === void 0) {
|
|
234
|
+
throw new QuoteVerificationFailed(
|
|
235
|
+
"responder",
|
|
236
|
+
input.expected,
|
|
237
|
+
"the transport attests nobody"
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
if (input.attested !== input.expected) {
|
|
241
|
+
throw new QuoteVerificationFailed("responder", input.expected, input.attested);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
var verifyTaker = (input) => {
|
|
245
|
+
const xOnly = (key) => typeof key === "string" && /^[0-9a-f]{64}$/i.test(key) ? hex.decode(key.toLowerCase()) : void 0;
|
|
246
|
+
const taker = xOnly(input.solverPubkey);
|
|
247
|
+
const attested = xOnly(input.attested);
|
|
248
|
+
if (taker === void 0 || attested === void 0 || hex.encode(taker) !== hex.encode(attested)) {
|
|
249
|
+
throw new QuoteVerificationFailed("responder", input.attested, String(input.solverPubkey));
|
|
250
|
+
}
|
|
251
|
+
return taker;
|
|
252
|
+
};
|
|
253
|
+
var verifyPair = (quoted, requested) => {
|
|
254
|
+
if (quoted !== requested) {
|
|
255
|
+
throw new QuoteVerificationFailed("pair", requested, String(quoted));
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
var verifyingDerivation = (derive) => {
|
|
259
|
+
try {
|
|
260
|
+
return derive();
|
|
261
|
+
} catch (error) {
|
|
262
|
+
if (error instanceof AddressMismatch) {
|
|
263
|
+
const derived = Array.isArray(error.derived) ? error.derived.join(", ") : error.derived;
|
|
264
|
+
throw new QuoteVerificationFailed("lockup_address", derived, error.quoted, {
|
|
265
|
+
cause: error
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
if (error instanceof Error) {
|
|
269
|
+
throw new QuoteVerificationFailed("lockup_address", void 0, error.message, {
|
|
270
|
+
cause: error
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
throw error;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
var verifySendWindow = (input) => {
|
|
277
|
+
gated(
|
|
278
|
+
() => assertFundable({
|
|
279
|
+
quote: input.quote,
|
|
280
|
+
now: input.now,
|
|
281
|
+
...input.invoiceExpiresAt === void 0 ? {} : { invoiceExpiresAt: input.invoiceExpiresAt },
|
|
282
|
+
...input.onchain === void 0 ? {} : { onchain: input.onchain }
|
|
283
|
+
}),
|
|
284
|
+
{ id: input.quoteId, expiresAt: input.quote.valid_until, now: input.now }
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
var verifyReceiveWindow = (input) => {
|
|
288
|
+
gated(
|
|
289
|
+
() => assertReceivable({
|
|
290
|
+
quote: input.quote,
|
|
291
|
+
payDeadline: input.payDeadline,
|
|
292
|
+
now: input.now
|
|
293
|
+
}),
|
|
294
|
+
{ id: input.quoteId, expiresAt: input.payDeadline, now: input.now }
|
|
295
|
+
);
|
|
296
|
+
};
|
|
297
|
+
var verifySendInvoice = (input) => {
|
|
298
|
+
const invoiced = input.invoiced;
|
|
299
|
+
if (input.take !== invoiced) {
|
|
300
|
+
throw new QuoteVerificationFailed("invoice", `${invoiced}`, `${input.take}`);
|
|
301
|
+
}
|
|
302
|
+
if (input.give < input.take) {
|
|
303
|
+
throw new QuoteVerificationFailed(
|
|
304
|
+
"invoice",
|
|
305
|
+
`at least the invoice's ${invoiced}`,
|
|
306
|
+
`${input.give}, a negative spread`
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
var verifyReceiveInvoiceFacts = (input) => {
|
|
311
|
+
let decoded;
|
|
312
|
+
try {
|
|
313
|
+
decoded = input.decode(input.invoice);
|
|
314
|
+
} catch (cause) {
|
|
315
|
+
throw new QuoteVerificationFailed(
|
|
316
|
+
"invoice",
|
|
317
|
+
"a decodable BOLT11",
|
|
318
|
+
cause instanceof Error ? cause.message : String(cause),
|
|
319
|
+
{ cause }
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
if (!Number.isFinite(decoded.expiresAt)) {
|
|
323
|
+
throw new QuoteVerificationFailed("invoice", "a finite expiry", `${decoded.expiresAt}`);
|
|
324
|
+
}
|
|
325
|
+
if (!Number.isFinite(input.validUntil)) {
|
|
326
|
+
throw new QuoteVerificationFailed(
|
|
327
|
+
"refund_window",
|
|
328
|
+
"a finite valid_until",
|
|
329
|
+
`${input.validUntil}`
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
if (decoded.paymentHash !== input.paymentHash) {
|
|
333
|
+
throw new QuoteVerificationFailed("invoice", input.paymentHash, decoded.paymentHash);
|
|
334
|
+
}
|
|
335
|
+
if (!Number.isSafeInteger(decoded.amountSats) || decoded.amountSats <= 0) {
|
|
336
|
+
throw new QuoteVerificationFailed(
|
|
337
|
+
"invoice",
|
|
338
|
+
`${input.payAmount}`,
|
|
339
|
+
"the invoice names no amount"
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
if (BigInt(decoded.amountSats) !== input.payAmount) {
|
|
343
|
+
throw new QuoteVerificationFailed("invoice", `${input.payAmount}`, `${decoded.amountSats}`);
|
|
344
|
+
}
|
|
345
|
+
return { payDeadline: Math.min(decoded.expiresAt, input.validUntil) };
|
|
346
|
+
};
|
|
347
|
+
var verifyQuoteTtl = (input) => {
|
|
348
|
+
const floor = input.floorSeconds ?? 0;
|
|
349
|
+
if (input.expiresAt - input.now <= floor) {
|
|
350
|
+
throw new QuoteExpired(input.quoteId, input.expiresAt, input.now);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
var CSV_GRANULARITY_SECONDS = 512;
|
|
354
|
+
var verifyRefundWindow = (input) => {
|
|
355
|
+
const max = input.maxSeconds ?? DEFAULT_MAX_REFUND_WINDOW_SECONDS;
|
|
356
|
+
const window = input.refundLocktime - input.now;
|
|
357
|
+
if (!(window <= max)) {
|
|
358
|
+
throw new QuoteVerificationFailed("refund_window", `at most ${max}s`, `${window}s`);
|
|
359
|
+
}
|
|
360
|
+
const delay = input.refundWithoutReceiverDelay;
|
|
361
|
+
if (delay !== void 0 && !(delay < max + CSV_GRANULARITY_SECONDS)) {
|
|
362
|
+
throw new QuoteVerificationFailed(
|
|
363
|
+
"refund_window",
|
|
364
|
+
`a solo-refund delay of at most ${max}s`,
|
|
365
|
+
`${delay}s`
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
var verifyQuotedAmount = (input) => {
|
|
370
|
+
verifyPinnedAmount(input);
|
|
371
|
+
if (input.take > input.give) {
|
|
372
|
+
throw new QuoteVerificationFailed(
|
|
373
|
+
"pair",
|
|
374
|
+
`${input.pair} give >= take`,
|
|
375
|
+
`give=${input.give} take=${input.take}`
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
var verifyCrossAssetAmount = (input) => {
|
|
380
|
+
verifyPinnedAmount(input);
|
|
381
|
+
if (input.give <= 0n || input.take <= 0n) {
|
|
382
|
+
throw new QuoteVerificationFailed(
|
|
383
|
+
"pair",
|
|
384
|
+
`${input.pair} give > 0 take > 0`,
|
|
385
|
+
`give=${input.give} take=${input.take}`
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
var verifiedCarrierSats = (quote) => {
|
|
390
|
+
try {
|
|
391
|
+
return quoteCarrierSats(quote);
|
|
392
|
+
} catch (error) {
|
|
393
|
+
if (reasonOf(error) !== "carrier_malformed") throw error;
|
|
394
|
+
throw new QuoteVerificationFailed(
|
|
395
|
+
"pair",
|
|
396
|
+
"carrier_sats a non-negative integer",
|
|
397
|
+
String(quote.carrier_sats),
|
|
398
|
+
{ cause: error }
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
var verifyPinnedAmount = (input) => {
|
|
403
|
+
const quoted = input.pinned.on === "give" ? input.give : input.take;
|
|
404
|
+
if (quoted !== input.pinned.value) {
|
|
405
|
+
throw new QuoteVerificationFailed(
|
|
406
|
+
"pair",
|
|
407
|
+
`${input.pair} ${input.pinned.on}=${input.pinned.value}`,
|
|
408
|
+
`${input.pair} ${input.pinned.on}=${quoted}`
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export {
|
|
414
|
+
DEFAULT_MAX_REFUND_WINDOW_SECONDS,
|
|
415
|
+
verifyResponder,
|
|
416
|
+
verifyTaker,
|
|
417
|
+
verifyPair,
|
|
418
|
+
verifyingDerivation,
|
|
419
|
+
verifySendWindow,
|
|
420
|
+
verifyReceiveWindow,
|
|
421
|
+
verifySendInvoice,
|
|
422
|
+
verifyReceiveInvoiceFacts,
|
|
423
|
+
verifyQuoteTtl,
|
|
424
|
+
verifyRefundWindow,
|
|
425
|
+
verifyQuotedAmount,
|
|
426
|
+
verifyCrossAssetAmount,
|
|
427
|
+
verifiedCarrierSats,
|
|
428
|
+
AmbiguousDestination,
|
|
429
|
+
UnsupportedRoute,
|
|
430
|
+
DiscoverySnapshotUnavailable,
|
|
431
|
+
AmountMismatch,
|
|
432
|
+
AmountEncodingUnsupported,
|
|
433
|
+
QuoteVerificationFailed,
|
|
434
|
+
QuoteExpired,
|
|
435
|
+
MaxFeeExceeded,
|
|
436
|
+
InsufficientFunds,
|
|
437
|
+
AcceptConflict,
|
|
438
|
+
ClientDisposed,
|
|
439
|
+
NotCancellable,
|
|
440
|
+
InconsistentRoute,
|
|
441
|
+
OperatorUnreachable,
|
|
442
|
+
MissingCorridorDep,
|
|
443
|
+
SWAP_ERROR_NAMES,
|
|
444
|
+
isSwapError
|
|
445
|
+
};
|