@babylonlabs-io/ts-sdk 0.37.3 → 0.38.1
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/BTCVaultRegistry.abi-CHFGevwa.cjs +2 -0
- package/dist/BTCVaultRegistry.abi-CHFGevwa.cjs.map +1 -0
- package/dist/{BTCVaultRegistry.abi-DbJ5lsFJ.js → BTCVaultRegistry.abi-Cq9-JlqT.js} +38 -2
- package/dist/BTCVaultRegistry.abi-Cq9-JlqT.js.map +1 -0
- package/dist/PayoutManager-D29D-K-V.js +250 -0
- package/dist/PayoutManager-D29D-K-V.js.map +1 -0
- package/dist/PayoutManager-DERMRuUU.cjs +2 -0
- package/dist/PayoutManager-DERMRuUU.cjs.map +1 -0
- package/dist/{PeginManager-HCYTUzh6.js → PeginManager-Cp2Tn5sH.js} +444 -406
- package/dist/PeginManager-Cp2Tn5sH.js.map +1 -0
- package/dist/PeginManager-DaDs-bGr.cjs +2 -0
- package/dist/PeginManager-DaDs-bGr.cjs.map +1 -0
- package/dist/{ProtocolParams.abi-DXu8L0Fn.js → ProtocolParams.abi-C2brDWTI.js} +8 -3
- package/dist/ProtocolParams.abi-C2brDWTI.js.map +1 -0
- package/dist/ProtocolParams.abi-DQhcqsNr.cjs +2 -0
- package/dist/ProtocolParams.abi-DQhcqsNr.cjs.map +1 -0
- package/dist/assertPsbtUnsignedTxMatches-fNkAaZZm.cjs +2 -0
- package/dist/assertPsbtUnsignedTxMatches-fNkAaZZm.cjs.map +1 -0
- package/dist/assertPsbtUnsignedTxMatches-mTAnLhCz.js +340 -0
- package/dist/assertPsbtUnsignedTxMatches-mTAnLhCz.js.map +1 -0
- package/dist/{buildAndBroadcastRefund-CI_x6OtX.js → buildAndBroadcastRefund-B5cOyUzj.js} +234 -227
- package/dist/buildAndBroadcastRefund-B5cOyUzj.js.map +1 -0
- package/dist/buildAndBroadcastRefund-DVMT-pXQ.cjs +2 -0
- package/dist/buildAndBroadcastRefund-DVMT-pXQ.cjs.map +1 -0
- package/dist/{challengeAssert-D7OCrDIc.js → challengeAssert-CBp4mEs0.js} +2 -2
- package/dist/{challengeAssert-D7OCrDIc.js.map → challengeAssert-CBp4mEs0.js.map} +1 -1
- package/dist/{challengeAssert-CMb7r-je.cjs → challengeAssert-CNRdpCzm.cjs} +2 -2
- package/dist/{challengeAssert-CMb7r-je.cjs.map → challengeAssert-CNRdpCzm.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +38 -38
- package/dist/noPayout-jtZsoOzY.cjs +2 -0
- package/dist/noPayout-jtZsoOzY.cjs.map +1 -0
- package/dist/noPayout-qbaSEKGC.js +145 -0
- package/dist/noPayout-qbaSEKGC.js.map +1 -0
- package/dist/peginInput-BPRB9tUi.js +104 -0
- package/dist/peginInput-BPRB9tUi.js.map +1 -0
- package/dist/peginInput-DH6X4ITS.cjs +2 -0
- package/dist/peginInput-DH6X4ITS.cjs.map +1 -0
- package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/protocol-params-validation.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +12 -1
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +9 -9
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +0 -9
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/types.d.ts +38 -21
- package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +36 -2
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +6 -2
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +2 -2
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +25 -25
- package/dist/tbv/core/managers/PeginManager.d.ts +5 -0
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/managers/pegin/assertAuthAnchorOpReturn.d.ts +37 -0
- package/dist/tbv/core/managers/pegin/assertAuthAnchorOpReturn.d.ts.map +1 -1
- package/dist/tbv/core/managers/pegin/index.d.ts +1 -1
- package/dist/tbv/core/managers/pegin/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +17 -17
- package/dist/tbv/core/primitives/psbt/__tests__/refund.test.d.ts +12 -0
- package/dist/tbv/core/primitives/psbt/__tests__/refund.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +5 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts +4 -2
- package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/services/pegout/state.d.ts +5 -8
- package/dist/tbv/core/services/pegout/state.d.ts.map +1 -1
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +25 -25
- package/dist/tbv/integrations/aave/clients/query.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/index.cjs +1 -1
- package/dist/tbv/integrations/aave/index.cjs.map +1 -1
- package/dist/tbv/integrations/aave/index.js +23 -22
- package/dist/tbv/integrations/aave/index.js.map +1 -1
- package/dist/tbv/integrations/aave/types.d.ts +6 -0
- package/dist/tbv/integrations/aave/types.d.ts.map +1 -1
- package/dist/types-D2jcXfm7.cjs +2 -0
- package/dist/types-D2jcXfm7.cjs.map +1 -0
- package/dist/types-TOmEvvRy.js +322 -0
- package/dist/types-TOmEvvRy.js.map +1 -0
- package/dist/{vault-registry-reader-Blhu9FW2.js → vault-registry-reader-BrARgFre.js} +207 -202
- package/dist/vault-registry-reader-BrARgFre.js.map +1 -0
- package/dist/vault-registry-reader-CbJHSxVe.cjs +2 -0
- package/dist/vault-registry-reader-CbJHSxVe.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/BTCVaultRegistry.abi-DbJ5lsFJ.js.map +0 -1
- package/dist/BTCVaultRegistry.abi-ZdPpION2.cjs +0 -2
- package/dist/BTCVaultRegistry.abi-ZdPpION2.cjs.map +0 -1
- package/dist/PayoutManager-BfT0V-tm.cjs +0 -2
- package/dist/PayoutManager-BfT0V-tm.cjs.map +0 -1
- package/dist/PayoutManager-Cf51DBcu.js +0 -208
- package/dist/PayoutManager-Cf51DBcu.js.map +0 -1
- package/dist/PeginManager-CTznAVPT.cjs +0 -2
- package/dist/PeginManager-CTznAVPT.cjs.map +0 -1
- package/dist/PeginManager-HCYTUzh6.js.map +0 -1
- package/dist/ProtocolParams.abi-BmvHwQJV.cjs +0 -2
- package/dist/ProtocolParams.abi-BmvHwQJV.cjs.map +0 -1
- package/dist/ProtocolParams.abi-DXu8L0Fn.js.map +0 -1
- package/dist/assertPsbtUnsignedTxMatches-CagW7XqW.cjs +0 -2
- package/dist/assertPsbtUnsignedTxMatches-CagW7XqW.cjs.map +0 -1
- package/dist/assertPsbtUnsignedTxMatches-Dry5dTfl.js +0 -266
- package/dist/assertPsbtUnsignedTxMatches-Dry5dTfl.js.map +0 -1
- package/dist/buildAndBroadcastRefund-Bj2e94CC.cjs +0 -2
- package/dist/buildAndBroadcastRefund-Bj2e94CC.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-CI_x6OtX.js.map +0 -1
- package/dist/noPayout-B6s8vrW6.cjs +0 -2
- package/dist/noPayout-B6s8vrW6.cjs.map +0 -1
- package/dist/noPayout-BhgknZBx.js +0 -141
- package/dist/noPayout-BhgknZBx.js.map +0 -1
- package/dist/peginInput-57FK2O99.cjs +0 -2
- package/dist/peginInput-57FK2O99.cjs.map +0 -1
- package/dist/peginInput-CYJzbuwA.js +0 -177
- package/dist/peginInput-CYJzbuwA.js.map +0 -1
- package/dist/types-DnyyBNcC.cjs +0 -2
- package/dist/types-DnyyBNcC.cjs.map +0 -1
- package/dist/types-TiIjyo2b.js +0 -320
- package/dist/types-TiIjyo2b.js.map +0 -1
- package/dist/vault-registry-reader-7gOYnrQD.cjs +0 -2
- package/dist/vault-registry-reader-7gOYnrQD.cjs.map +0 -1
- package/dist/vault-registry-reader-Blhu9FW2.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var fe = Object.defineProperty;
|
|
2
2
|
var me = (t, e, n) => e in t ? fe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var p = (t, e, n) => me(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { D as be, J as
|
|
5
|
-
import { X as
|
|
4
|
+
import { D as be, J as ie, e as _e } from "./types-TOmEvvRy.js";
|
|
5
|
+
import { X as H, C as L, s as S, S as ye, h as Pe } from "./bitcoin-B5aNKtsk.js";
|
|
6
6
|
import { H as T } from "./validation-CxqROCno.js";
|
|
7
|
-
import * as
|
|
8
|
-
import { payments as we, Transaction as
|
|
7
|
+
import * as U from "@bitcoin-js/tiny-secp256k1-asmjs";
|
|
8
|
+
import { payments as we, Transaction as F } from "bitcoinjs-lib";
|
|
9
9
|
import { Buffer as A } from "buffer";
|
|
10
10
|
import { s as W } from "./sha2-BYVxyZzX.js";
|
|
11
|
-
import { B as w } from "./BTCVaultRegistry.abi-
|
|
12
|
-
import { P as _, A as
|
|
11
|
+
import { B as w } from "./BTCVaultRegistry.abi-Cq9-JlqT.js";
|
|
12
|
+
import { P as _, A as M } from "./ProtocolParams.abi-C2brDWTI.js";
|
|
13
13
|
const Q = new Set(Object.values(be)), ve = 200;
|
|
14
14
|
function l(t) {
|
|
15
15
|
var e;
|
|
@@ -27,7 +27,7 @@ const $ = 64;
|
|
|
27
27
|
function v(t) {
|
|
28
28
|
return typeof t == "string" && t.length > 0 && T.test(t);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function se(t) {
|
|
31
31
|
return typeof t == "string" && t.length > 0;
|
|
32
32
|
}
|
|
33
33
|
function oe(t, e) {
|
|
@@ -37,15 +37,15 @@ function oe(t, e) {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
function m(t, e) {
|
|
40
|
-
if (!
|
|
40
|
+
if (!se(t))
|
|
41
41
|
throw new o(
|
|
42
42
|
`VP response validation failed: "${e}" must be a non-empty string, got ${l(t)}`
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
function q(t, e) {
|
|
46
|
-
if (!v(t) || t.length !==
|
|
46
|
+
if (!v(t) || t.length !== H && t.length !== L)
|
|
47
47
|
throw new o(
|
|
48
|
-
`VP response validation failed: "${e}" must be a ${
|
|
48
|
+
`VP response validation failed: "${e}" must be a ${H} or ${L}-char hex string (BTC pubkey), got ${l(t)}`
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
function Ve(t) {
|
|
@@ -143,7 +143,7 @@ function Te(t, e) {
|
|
|
143
143
|
const n = t;
|
|
144
144
|
m(n.wots_pks_json, `${e}.wots_pks_json`), m(n.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Ce(t, e) {
|
|
147
147
|
if (t === null || typeof t != "object")
|
|
148
148
|
throw new o(
|
|
149
149
|
`VP response validation failed: "${e}" must be an object`
|
|
@@ -180,7 +180,7 @@ function ke(t) {
|
|
|
180
180
|
"VP response validation failed: requestDepositorClaimerArtifacts response is not an object"
|
|
181
181
|
);
|
|
182
182
|
const e = t;
|
|
183
|
-
if (!
|
|
183
|
+
if (!se(e.tx_graph_json))
|
|
184
184
|
throw new o(
|
|
185
185
|
`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${l(e.tx_graph_json)}`
|
|
186
186
|
);
|
|
@@ -199,19 +199,19 @@ function ke(t) {
|
|
|
199
199
|
throw new o(
|
|
200
200
|
'VP response validation failed: "babe_sessions" must contain at least one challenger entry'
|
|
201
201
|
);
|
|
202
|
-
for (const [r,
|
|
203
|
-
if (q(r, `babe_sessions["${r}"]`),
|
|
202
|
+
for (const [r, s] of n) {
|
|
203
|
+
if (q(r, `babe_sessions["${r}"]`), s === null || typeof s != "object")
|
|
204
204
|
throw new o(
|
|
205
205
|
`VP response validation failed: "babe_sessions.${r}" must be an object`
|
|
206
206
|
);
|
|
207
|
-
const
|
|
208
|
-
if (!v(
|
|
207
|
+
const i = s;
|
|
208
|
+
if (!v(i.decryptor_artifacts_hex))
|
|
209
209
|
throw new o(
|
|
210
|
-
`VP response validation failed: "babe_sessions.${r}.decryptor_artifacts_hex" must be a non-empty hex string, got ${l(
|
|
210
|
+
`VP response validation failed: "babe_sessions.${r}.decryptor_artifacts_hex" must be a non-empty hex string, got ${l(i.decryptor_artifacts_hex)}`
|
|
211
211
|
);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Se(t) {
|
|
215
215
|
if (t === null || typeof t != "object")
|
|
216
216
|
throw new o(
|
|
217
217
|
"VP response validation failed: pegout status payload is not an object"
|
|
@@ -244,11 +244,7 @@ function Ie(t) {
|
|
|
244
244
|
throw new o(
|
|
245
245
|
`VP response validation failed: "claimer.failed" must be a boolean, got ${l(t.failed)}`
|
|
246
246
|
);
|
|
247
|
-
if (m(t.claim_txid, "claimer.claim_txid"), m(t.claimer_pubkey, "claimer.claimer_pubkey"), m(t.assert_txid, "claimer.assert_txid"),
|
|
248
|
-
throw new o(
|
|
249
|
-
`VP response validation failed: "claimer.challenger_pubkey" must be a string or null, got ${l(t.challenger_pubkey)}`
|
|
250
|
-
);
|
|
251
|
-
if (typeof t.created_at != "number")
|
|
247
|
+
if (m(t.claim_txid, "claimer.claim_txid"), m(t.claimer_pubkey, "claimer.claimer_pubkey"), m(t.assert_txid, "claimer.assert_txid"), typeof t.created_at != "number")
|
|
252
248
|
throw new o(
|
|
253
249
|
`VP response validation failed: "claimer.created_at" must be a number, got ${l(t.created_at)}`
|
|
254
250
|
);
|
|
@@ -291,7 +287,7 @@ function Be(t) {
|
|
|
291
287
|
}
|
|
292
288
|
function Ne(t) {
|
|
293
289
|
ce(t, "batchGetPegoutStatus", (e) => {
|
|
294
|
-
e.result !== null &&
|
|
290
|
+
e.result !== null && Se(e.result);
|
|
295
291
|
});
|
|
296
292
|
}
|
|
297
293
|
function ce(t, e, n) {
|
|
@@ -304,30 +300,30 @@ function ce(t, e, n) {
|
|
|
304
300
|
throw new o(
|
|
305
301
|
`VP response validation failed: "${e}.results" must be an array, got ${l(r.results)}`
|
|
306
302
|
);
|
|
307
|
-
for (let
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
303
|
+
for (let s = 0; s < r.results.length; s++) {
|
|
304
|
+
const i = r.results[s];
|
|
305
|
+
if (i === null || typeof i != "object")
|
|
310
306
|
throw new o(
|
|
311
|
-
`VP response validation failed: "${e}.results[${
|
|
307
|
+
`VP response validation failed: "${e}.results[${s}]" must be an object, got ${l(i)}`
|
|
312
308
|
);
|
|
313
|
-
const a =
|
|
309
|
+
const a = i;
|
|
314
310
|
if (!v(a.pegin_txid) || a.pegin_txid.length !== $)
|
|
315
311
|
throw new o(
|
|
316
|
-
`VP response validation failed: "${e}.results[${
|
|
312
|
+
`VP response validation failed: "${e}.results[${s}].pegin_txid" must be a ${$}-char hex string, got ${l(a.pegin_txid)}`
|
|
317
313
|
);
|
|
318
314
|
if (a.error !== null && typeof a.error != "string")
|
|
319
315
|
throw new o(
|
|
320
|
-
`VP response validation failed: "${e}.results[${
|
|
316
|
+
`VP response validation failed: "${e}.results[${s}].error" must be a string or null, got ${l(a.error)}`
|
|
321
317
|
);
|
|
322
318
|
if (a.result === null && a.error === null)
|
|
323
319
|
throw new o(
|
|
324
|
-
`VP response validation failed: "${e}.results[${
|
|
320
|
+
`VP response validation failed: "${e}.results[${s}]" has neither "result" nor "error" populated`
|
|
325
321
|
);
|
|
326
322
|
if (a.result !== null && a.error !== null)
|
|
327
323
|
throw new o(
|
|
328
|
-
`VP response validation failed: "${e}.results[${
|
|
324
|
+
`VP response validation failed: "${e}.results[${s}]" has both "result" and "error" populated`
|
|
329
325
|
);
|
|
330
|
-
n(a,
|
|
326
|
+
n(a, s);
|
|
331
327
|
}
|
|
332
328
|
}
|
|
333
329
|
function Re(t) {
|
|
@@ -336,7 +332,7 @@ function Re(t) {
|
|
|
336
332
|
'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
|
|
337
333
|
);
|
|
338
334
|
for (let e = 0; e < t.challenger_presign_data.length; e++)
|
|
339
|
-
|
|
335
|
+
Ce(
|
|
340
336
|
t.challenger_presign_data[e],
|
|
341
337
|
`depositor_graph.challenger_presign_data[${e}]`
|
|
342
338
|
);
|
|
@@ -359,7 +355,7 @@ class Oe {
|
|
|
359
355
|
tokenProvider: n == null ? void 0 : n.tokenProvider,
|
|
360
356
|
maxResponseBytes: n == null ? void 0 : n.maxResponseBytes
|
|
361
357
|
};
|
|
362
|
-
this.client = new
|
|
358
|
+
this.client = new ie(r);
|
|
363
359
|
}
|
|
364
360
|
/**
|
|
365
361
|
* Request the payout/claim/assert transactions that the depositor
|
|
@@ -431,35 +427,35 @@ function De(t, e) {
|
|
|
431
427
|
const n = /* @__PURE__ */ new Set();
|
|
432
428
|
for (const u of t)
|
|
433
429
|
n.add(u.toLowerCase());
|
|
434
|
-
const r = /* @__PURE__ */ new Map(),
|
|
430
|
+
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), i = [], a = [];
|
|
435
431
|
for (const u of e) {
|
|
436
|
-
const
|
|
437
|
-
if (!n.has(
|
|
438
|
-
a.push(
|
|
432
|
+
const d = u.pegin_txid.toLowerCase();
|
|
433
|
+
if (!n.has(d)) {
|
|
434
|
+
a.push(d);
|
|
439
435
|
continue;
|
|
440
436
|
}
|
|
441
|
-
if (
|
|
442
|
-
|
|
437
|
+
if (s.has(d)) {
|
|
438
|
+
i.push(d);
|
|
443
439
|
continue;
|
|
444
440
|
}
|
|
445
|
-
|
|
441
|
+
s.add(d), r.set(d, { result: u.result, error: u.error });
|
|
446
442
|
}
|
|
447
443
|
const c = [];
|
|
448
444
|
for (const u of n)
|
|
449
|
-
|
|
450
|
-
return { byTxid: r, missing: c, unexpected: a, duplicate:
|
|
445
|
+
s.has(u) || c.push(u);
|
|
446
|
+
return { byTxid: r, missing: c, unexpected: a, duplicate: i };
|
|
451
447
|
}
|
|
452
448
|
async function lt(t) {
|
|
453
449
|
const {
|
|
454
450
|
items: e,
|
|
455
451
|
getTxid: n,
|
|
456
452
|
batchCall: r,
|
|
457
|
-
onItem:
|
|
458
|
-
onMissing:
|
|
453
|
+
onItem: s,
|
|
454
|
+
onMissing: i,
|
|
459
455
|
onDuplicate: a,
|
|
460
456
|
onDuplicateBatch: c,
|
|
461
457
|
onWholeBatchError: u,
|
|
462
|
-
onUnexpected:
|
|
458
|
+
onUnexpected: d,
|
|
463
459
|
batchSize: f = _e
|
|
464
460
|
} = t;
|
|
465
461
|
if (!Number.isInteger(f) || f <= 0)
|
|
@@ -467,59 +463,59 @@ async function lt(t) {
|
|
|
467
463
|
`batchPollByProvider: batchSize must be a positive integer, got ${f}`
|
|
468
464
|
);
|
|
469
465
|
for (let P = 0; P < e.length; P += f) {
|
|
470
|
-
const x = e.slice(P, P + f),
|
|
471
|
-
for (const
|
|
472
|
-
const b = n(
|
|
473
|
-
|
|
466
|
+
const x = e.slice(P, P + f), C = /* @__PURE__ */ new Map(), K = [];
|
|
467
|
+
for (const h of x) {
|
|
468
|
+
const b = n(h).toLowerCase();
|
|
469
|
+
C.set(b, h), K.push(b);
|
|
474
470
|
}
|
|
475
471
|
let V;
|
|
476
472
|
try {
|
|
477
|
-
const
|
|
478
|
-
V = De(K,
|
|
479
|
-
} catch (
|
|
480
|
-
u(x,
|
|
473
|
+
const h = await r(K);
|
|
474
|
+
V = De(K, h.results);
|
|
475
|
+
} catch (h) {
|
|
476
|
+
u(x, h);
|
|
481
477
|
continue;
|
|
482
478
|
}
|
|
483
|
-
|
|
479
|
+
d && V.unexpected.length > 0 && d(V.unexpected);
|
|
484
480
|
const k = new Set(V.duplicate);
|
|
485
|
-
for (const
|
|
486
|
-
const b =
|
|
481
|
+
for (const h of k) {
|
|
482
|
+
const b = C.get(h);
|
|
487
483
|
b && a(b);
|
|
488
484
|
}
|
|
489
485
|
c && k.size > 0 && c(k.size);
|
|
490
|
-
for (const
|
|
491
|
-
const b =
|
|
492
|
-
b &&
|
|
486
|
+
for (const h of V.missing) {
|
|
487
|
+
const b = C.get(h);
|
|
488
|
+
b && i(b);
|
|
493
489
|
}
|
|
494
|
-
for (const [
|
|
495
|
-
if (k.has(
|
|
496
|
-
const z =
|
|
497
|
-
z &&
|
|
498
|
-
pegin_txid:
|
|
490
|
+
for (const [h, b] of V.byTxid) {
|
|
491
|
+
if (k.has(h)) continue;
|
|
492
|
+
const z = C.get(h);
|
|
493
|
+
z && s(z, {
|
|
494
|
+
pegin_txid: h,
|
|
499
495
|
result: b.result,
|
|
500
496
|
error: b.error
|
|
501
497
|
});
|
|
502
498
|
}
|
|
503
499
|
}
|
|
504
500
|
}
|
|
505
|
-
const je = "BIP0322-signed-message",
|
|
501
|
+
const je = "BIP0322-signed-message", Ue = "TapTweak", le = 32, Ke = 64;
|
|
506
502
|
function ue(t, e) {
|
|
507
|
-
const n = new TextEncoder().encode(t), r = W(n),
|
|
508
|
-
return
|
|
503
|
+
const n = new TextEncoder().encode(t), r = W(n), s = new Uint8Array(r.length * 2 + e.length);
|
|
504
|
+
return s.set(r, 0), s.set(r, r.length), s.set(e, r.length * 2), W(s);
|
|
509
505
|
}
|
|
510
506
|
function Fe(t) {
|
|
511
507
|
if (t.length !== le) return null;
|
|
512
|
-
const e = ue(
|
|
508
|
+
const e = ue(Ue, t), n = U.xOnlyPointAddTweak(t, e);
|
|
513
509
|
return n ? n.xOnlyPubkey : null;
|
|
514
510
|
}
|
|
515
511
|
function Me(t, e, n) {
|
|
516
|
-
if (e.length !== le || n.length !==
|
|
512
|
+
if (e.length !== le || n.length !== Ke) return !1;
|
|
517
513
|
try {
|
|
518
|
-
const r = ue(je, t),
|
|
514
|
+
const r = ue(je, t), s = we.p2tr({
|
|
519
515
|
internalPubkey: A.from(e)
|
|
520
516
|
});
|
|
521
|
-
if (!
|
|
522
|
-
const
|
|
517
|
+
if (!s.output) return !1;
|
|
518
|
+
const i = s.output, a = 0, c = new F();
|
|
523
519
|
c.version = 0, c.locktime = 0;
|
|
524
520
|
const u = A.concat([
|
|
525
521
|
A.from([0, 32]),
|
|
@@ -533,69 +529,69 @@ function Me(t, e, n) {
|
|
|
533
529
|
0,
|
|
534
530
|
// sequence = 0
|
|
535
531
|
u
|
|
536
|
-
), c.addOutput(
|
|
537
|
-
const
|
|
538
|
-
|
|
532
|
+
), c.addOutput(i, a);
|
|
533
|
+
const d = new F();
|
|
534
|
+
d.version = 0, d.locktime = 0;
|
|
539
535
|
const f = c.getHash();
|
|
540
|
-
|
|
541
|
-
const P =
|
|
536
|
+
d.addInput(f, 0, 0), d.addOutput(A.from([106]), a);
|
|
537
|
+
const P = d.hashForWitnessV1(
|
|
542
538
|
0,
|
|
543
|
-
[
|
|
539
|
+
[i],
|
|
544
540
|
[a],
|
|
545
|
-
|
|
541
|
+
F.SIGHASH_DEFAULT
|
|
546
542
|
), x = Fe(e);
|
|
547
|
-
return x ?
|
|
543
|
+
return x ? U.verifySchnorr(P, x, n) : !1;
|
|
548
544
|
} catch {
|
|
549
545
|
return !1;
|
|
550
546
|
}
|
|
551
547
|
}
|
|
552
|
-
function
|
|
548
|
+
function O(t, e) {
|
|
553
549
|
const n = (t & 7) << 5, r = typeof e == "bigint" ? e : BigInt(e);
|
|
554
550
|
if (r < 0n) throw new Error("cborHead: negative argument");
|
|
555
551
|
if (r < 24n) return new Uint8Array([n | Number(r)]);
|
|
556
552
|
if (r < 0x100n) return new Uint8Array([n | 24, Number(r)]);
|
|
557
553
|
if (r < 0x10000n) {
|
|
558
|
-
const
|
|
559
|
-
return new Uint8Array([n | 25,
|
|
554
|
+
const i = Number(r);
|
|
555
|
+
return new Uint8Array([n | 25, i >>> 8 & 255, i & 255]);
|
|
560
556
|
}
|
|
561
557
|
if (r < 0x100000000n) {
|
|
562
|
-
const
|
|
558
|
+
const i = Number(r);
|
|
563
559
|
return new Uint8Array([
|
|
564
560
|
n | 26,
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
561
|
+
i >>> 24 & 255,
|
|
562
|
+
i >>> 16 & 255,
|
|
563
|
+
i >>> 8 & 255,
|
|
564
|
+
i & 255
|
|
569
565
|
]);
|
|
570
566
|
}
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
for (let
|
|
574
|
-
|
|
575
|
-
return
|
|
567
|
+
const s = new Uint8Array(9);
|
|
568
|
+
s[0] = n | 27;
|
|
569
|
+
for (let i = 7; i >= 0; i--)
|
|
570
|
+
s[1 + i] = Number(r >> BigInt((7 - i) * 8)) & 255;
|
|
571
|
+
return s;
|
|
576
572
|
}
|
|
577
|
-
function
|
|
578
|
-
const e = t.reduce((
|
|
573
|
+
function de(...t) {
|
|
574
|
+
const e = t.reduce((s, i) => s + i.length, 0), n = new Uint8Array(e);
|
|
579
575
|
let r = 0;
|
|
580
|
-
for (const
|
|
581
|
-
n.set(
|
|
576
|
+
for (const s of t)
|
|
577
|
+
n.set(s, r), r += s.length;
|
|
582
578
|
return n;
|
|
583
579
|
}
|
|
584
580
|
function J(t) {
|
|
585
|
-
const n = [
|
|
581
|
+
const n = [O(4, t.length)];
|
|
586
582
|
for (const r of t)
|
|
587
|
-
n.push(
|
|
588
|
-
return
|
|
583
|
+
n.push(O(0, r));
|
|
584
|
+
return de(...n);
|
|
589
585
|
}
|
|
590
|
-
function
|
|
586
|
+
function Ge(t, e, n) {
|
|
591
587
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
592
588
|
throw new Error(
|
|
593
589
|
`encodeServerIdentityPayload: expires_at must be a non-negative safe integer, got ${n}`
|
|
594
590
|
);
|
|
595
|
-
const r =
|
|
596
|
-
return
|
|
591
|
+
const r = O(4, 3), s = J(t), i = J(e), a = O(0, n);
|
|
592
|
+
return de(r, s, i, a);
|
|
597
593
|
}
|
|
598
|
-
const
|
|
594
|
+
const Le = new TextEncoder().encode(
|
|
599
595
|
"btc-auth.server-identity.v1"
|
|
600
596
|
), Xe = 2 * 3600;
|
|
601
597
|
class g extends Error {
|
|
@@ -610,21 +606,21 @@ function E(t) {
|
|
|
610
606
|
return e;
|
|
611
607
|
}
|
|
612
608
|
function qe(t) {
|
|
613
|
-
const { proof: e, pinnedServerPubkey: n, now: r } = t,
|
|
614
|
-
if (
|
|
609
|
+
const { proof: e, pinnedServerPubkey: n, now: r } = t, s = t.maxLifetimeSecs ?? Xe, i = S(n).toLowerCase();
|
|
610
|
+
if (i.length !== H || !T.test(i))
|
|
615
611
|
throw new g(
|
|
616
|
-
`pinnedServerPubkey must be 32-byte hex; got ${
|
|
612
|
+
`pinnedServerPubkey must be 32-byte hex; got ${i.length} chars`,
|
|
617
613
|
"invalid_pubkey_encoding"
|
|
618
614
|
);
|
|
619
|
-
const a =
|
|
620
|
-
if (a.length !==
|
|
615
|
+
const a = S(e.server_pubkey).toLowerCase();
|
|
616
|
+
if (a.length !== H || !T.test(a))
|
|
621
617
|
throw new g(
|
|
622
618
|
`server_pubkey must be 32-byte hex; got ${a.length} chars`,
|
|
623
619
|
"invalid_pubkey_encoding"
|
|
624
620
|
);
|
|
625
|
-
if (a !==
|
|
621
|
+
if (a !== i)
|
|
626
622
|
throw new g(
|
|
627
|
-
`server_pubkey does not match pinned value: expected ${
|
|
623
|
+
`server_pubkey does not match pinned value: expected ${i}, got ${a}`,
|
|
628
624
|
"pinned_pubkey_mismatch"
|
|
629
625
|
);
|
|
630
626
|
if (!Number.isSafeInteger(e.expires_at))
|
|
@@ -642,17 +638,17 @@ function qe(t) {
|
|
|
642
638
|
`server identity proof expired at ${e.expires_at}, now ${r}`,
|
|
643
639
|
"expired"
|
|
644
640
|
);
|
|
645
|
-
if (!Number.isSafeInteger(
|
|
641
|
+
if (!Number.isSafeInteger(s) || s <= 0)
|
|
646
642
|
throw new g(
|
|
647
|
-
`maxLifetimeSecs must be a positive safe integer; got ${JSON.stringify(
|
|
643
|
+
`maxLifetimeSecs must be a positive safe integer; got ${JSON.stringify(s)}`,
|
|
648
644
|
"invalid_max_lifetime"
|
|
649
645
|
);
|
|
650
|
-
if (e.expires_at - r >
|
|
646
|
+
if (e.expires_at - r > s)
|
|
651
647
|
throw new g(
|
|
652
|
-
`server identity proof expires too far in the future: expires_at=${e.expires_at}, now=${r}, max lifetime=${
|
|
648
|
+
`server identity proof expires too far in the future: expires_at=${e.expires_at}, now=${r}, max lifetime=${s}s`,
|
|
653
649
|
"expires_too_far"
|
|
654
650
|
);
|
|
655
|
-
const c =
|
|
651
|
+
const c = S(e.ephemeral_pubkey).toLowerCase();
|
|
656
652
|
if (c.length !== L || !T.test(c))
|
|
657
653
|
throw new g(
|
|
658
654
|
`ephemeral_pubkey must be 33-byte compressed hex; got ${c.length} chars`,
|
|
@@ -664,20 +660,20 @@ function qe(t) {
|
|
|
664
660
|
`ephemeral_pubkey must be compressed (prefix 02/03); got ${u}`,
|
|
665
661
|
"invalid_ephemeral_pubkey"
|
|
666
662
|
);
|
|
667
|
-
const
|
|
668
|
-
if (!
|
|
663
|
+
const d = E(c);
|
|
664
|
+
if (!U.isPoint(d))
|
|
669
665
|
throw new g(
|
|
670
666
|
"ephemeral_pubkey is not a valid secp256k1 point",
|
|
671
667
|
"invalid_ephemeral_pubkey"
|
|
672
668
|
);
|
|
673
|
-
const f =
|
|
669
|
+
const f = S(e.signature).toLowerCase();
|
|
674
670
|
if (f.length !== ye || !T.test(f))
|
|
675
671
|
throw new g(
|
|
676
672
|
`signature must be 64-byte Schnorr hex; got ${f.length} chars`,
|
|
677
673
|
"invalid_signature_encoding"
|
|
678
674
|
);
|
|
679
|
-
const P =
|
|
680
|
-
|
|
675
|
+
const P = Ge(
|
|
676
|
+
Le,
|
|
681
677
|
E(c),
|
|
682
678
|
e.expires_at
|
|
683
679
|
);
|
|
@@ -692,13 +688,13 @@ const ze = /* @__PURE__ */ new Set([
|
|
|
692
688
|
"vaultProvider_submitDepositorPresignatures",
|
|
693
689
|
"vaultProvider_requestDepositorPresignTransactions",
|
|
694
690
|
"vaultProvider_requestDepositorClaimerArtifacts"
|
|
695
|
-
]), We = 6e4,
|
|
696
|
-
function
|
|
697
|
-
return new
|
|
691
|
+
]), We = 6e4, X = "auth_createDepositorToken";
|
|
692
|
+
function he(t, e) {
|
|
693
|
+
return new ie({
|
|
698
694
|
baseUrl: t,
|
|
699
695
|
timeout: We,
|
|
700
696
|
headers: e,
|
|
701
|
-
retryableFor: (n) => n ===
|
|
697
|
+
retryableFor: (n) => n === X
|
|
702
698
|
});
|
|
703
699
|
}
|
|
704
700
|
const Y = 4102444800, Qe = 30;
|
|
@@ -732,7 +728,7 @@ class Je {
|
|
|
732
728
|
* guard. Returning `null` here breaks that recursion deterministically.
|
|
733
729
|
*/
|
|
734
730
|
async getToken(e) {
|
|
735
|
-
if (e ===
|
|
731
|
+
if (e === X || !this.authGatedMethods.has(e)) return null;
|
|
736
732
|
const n = this.cached;
|
|
737
733
|
return n && this.now() + this.refreshSkewSecs < n.expiresAt ? n.token : (await this.acquireSingleFlight()).token;
|
|
738
734
|
}
|
|
@@ -759,7 +755,7 @@ class Je {
|
|
|
759
755
|
if (e) return e;
|
|
760
756
|
const n = (async () => {
|
|
761
757
|
try {
|
|
762
|
-
const r = await this.client.call(
|
|
758
|
+
const r = await this.client.call(X, {
|
|
763
759
|
pegin_txid: this.peginTxid,
|
|
764
760
|
auth_anchor: this.authAnchorHex
|
|
765
761
|
});
|
|
@@ -771,16 +767,16 @@ class Je {
|
|
|
771
767
|
throw new Error(
|
|
772
768
|
`VpTokenProvider: invalid token in acquire response (expected non-empty string, got ${typeof r.token})`
|
|
773
769
|
);
|
|
774
|
-
const
|
|
775
|
-
if (!Number.isSafeInteger(r.expires_at) || r.expires_at <=
|
|
770
|
+
const s = this.now();
|
|
771
|
+
if (!Number.isSafeInteger(r.expires_at) || r.expires_at <= s || r.expires_at > Y)
|
|
776
772
|
throw new Error(
|
|
777
|
-
`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(r.expires_at)}; must be a safe integer in (${
|
|
773
|
+
`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(r.expires_at)}; must be a safe integer in (${s}, ${Y}])`
|
|
778
774
|
);
|
|
779
|
-
const
|
|
775
|
+
const i = {
|
|
780
776
|
token: r.token,
|
|
781
777
|
expiresAt: r.expires_at
|
|
782
778
|
};
|
|
783
|
-
return this.cached =
|
|
779
|
+
return this.cached = i, i;
|
|
784
780
|
} finally {
|
|
785
781
|
this.inFlight = null;
|
|
786
782
|
}
|
|
@@ -854,7 +850,7 @@ class Ye {
|
|
|
854
850
|
const pe = new Ye();
|
|
855
851
|
function ut(t) {
|
|
856
852
|
var r;
|
|
857
|
-
const e =
|
|
853
|
+
const e = he(
|
|
858
854
|
t.baseUrl,
|
|
859
855
|
(r = t.options) == null ? void 0 : r.headers
|
|
860
856
|
), n = pe.getOrCreate({
|
|
@@ -868,15 +864,15 @@ function ut(t) {
|
|
|
868
864
|
tokenProvider: n
|
|
869
865
|
});
|
|
870
866
|
}
|
|
871
|
-
function
|
|
867
|
+
function dt(t) {
|
|
872
868
|
pe.getOrCreate({
|
|
873
|
-
client:
|
|
869
|
+
client: he(t.baseUrl, t.headers),
|
|
874
870
|
peginTxid: t.peginTxid,
|
|
875
871
|
authAnchorHex: t.authAnchorHex,
|
|
876
872
|
pinnedServerPubkey: t.pinnedServerPubkey
|
|
877
873
|
});
|
|
878
874
|
}
|
|
879
|
-
async function
|
|
875
|
+
async function ht(t, e) {
|
|
880
876
|
const [n, r] = await t.multicall({
|
|
881
877
|
contracts: [
|
|
882
878
|
{
|
|
@@ -897,29 +893,29 @@ async function dt(t, e) {
|
|
|
897
893
|
applicationRegistry: r
|
|
898
894
|
};
|
|
899
895
|
}
|
|
900
|
-
const
|
|
901
|
-
function
|
|
902
|
-
if (!Number.isInteger(t) || t < 0 || t >
|
|
896
|
+
const G = 65535, Z = 1e4, D = 4294967295, ee = 255;
|
|
897
|
+
function N(t) {
|
|
898
|
+
if (!Number.isInteger(t) || t < 0 || t > D)
|
|
903
899
|
throw new Error(
|
|
904
900
|
`Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`
|
|
905
901
|
);
|
|
906
902
|
}
|
|
907
|
-
function
|
|
903
|
+
function R(t) {
|
|
908
904
|
const e = [];
|
|
909
905
|
if (t.timelockAssert <= 0n && e.push(
|
|
910
906
|
`timelockAssert must be positive, got ${t.timelockAssert}`
|
|
911
|
-
), t.timelockAssert > BigInt(
|
|
912
|
-
`timelockAssert ${t.timelockAssert} exceeds uint16 max (${
|
|
907
|
+
), t.timelockAssert > BigInt(G) && e.push(
|
|
908
|
+
`timelockAssert ${t.timelockAssert} exceeds uint16 max (${G})`
|
|
913
909
|
), t.timelockChallengeAssert <= 0n && e.push(
|
|
914
910
|
`timelockChallengeAssert must be positive, got ${t.timelockChallengeAssert}`
|
|
915
911
|
), t.tRefund <= 0 && e.push(`tRefund must be positive, got ${t.tRefund}`), t.tStale <= 0 && e.push(`tStale must be positive, got ${t.tStale}`), t.securityCouncilKeys.length === 0 && e.push("securityCouncilKeys must not be empty"), t.councilQuorum <= 0 && e.push(`councilQuorum must be positive, got ${t.councilQuorum}`), t.councilQuorum > t.securityCouncilKeys.length && e.push(
|
|
916
912
|
`councilQuorum (${t.councilQuorum}) exceeds securityCouncilKeys count (${t.securityCouncilKeys.length})`
|
|
917
913
|
), t.feeRate <= 0n && e.push(`feeRate must be positive, got ${t.feeRate}`), t.minPeginFeeRate <= 0n && e.push(
|
|
918
914
|
`minPeginFeeRate must be positive, got ${t.minPeginFeeRate}`
|
|
919
|
-
), (!Number.isInteger(t.
|
|
920
|
-
`
|
|
921
|
-
), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth >
|
|
922
|
-
`minPrepeginDepth must be a uint32 in [1, ${
|
|
915
|
+
), (!Number.isInteger(t.proverCircuitVersion) || t.proverCircuitVersion < 0 || t.proverCircuitVersion > G) && e.push(
|
|
916
|
+
`proverCircuitVersion must be a uint16, got ${t.proverCircuitVersion}`
|
|
917
|
+
), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth > D) && e.push(
|
|
918
|
+
`minPrepeginDepth must be a uint32 in [1, ${D}], got ${t.minPrepeginDepth}`
|
|
923
919
|
), t.babeTotalInstances <= 0 && e.push(
|
|
924
920
|
`babeTotalInstances must be positive, got ${t.babeTotalInstances}`
|
|
925
921
|
), t.babeInstancesToFinalize <= 0 && e.push(
|
|
@@ -945,11 +941,13 @@ function ge(t) {
|
|
|
945
941
|
`pegInActivationTimeout must be positive, got ${t.pegInActivationTimeout}`
|
|
946
942
|
), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount > ee) && e.push(
|
|
947
943
|
`maxHtlcOutputCount must be an integer in [1, ${ee}], got ${t.maxHtlcOutputCount}`
|
|
944
|
+
), (typeof t.expiredPegInGraceBlocks != "bigint" || t.expiredPegInGraceBlocks <= 0n) && e.push(
|
|
945
|
+
`expiredPegInGraceBlocks must be a positive bigint, got ${t.expiredPegInGraceBlocks}`
|
|
948
946
|
), e.length > 0)
|
|
949
947
|
throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`);
|
|
950
948
|
}
|
|
951
949
|
function Ze(t) {
|
|
952
|
-
if (ge(t),
|
|
950
|
+
if (ge(t), R(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > D)
|
|
953
951
|
throw new Error(
|
|
954
952
|
`Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`
|
|
955
953
|
);
|
|
@@ -968,7 +966,7 @@ function B(t) {
|
|
|
968
966
|
tRefund: t.tRefund,
|
|
969
967
|
tStale: t.tStale,
|
|
970
968
|
minPeginFeeRate: t.minPeginFeeRate,
|
|
971
|
-
|
|
969
|
+
proverCircuitVersion: t.proverCircuitVersion,
|
|
972
970
|
minPrepeginDepth: t.minPrepeginDepth
|
|
973
971
|
};
|
|
974
972
|
}
|
|
@@ -978,7 +976,8 @@ function ne(t) {
|
|
|
978
976
|
maxPegInAmount: t.maxPegInAmount,
|
|
979
977
|
pegInAckTimeout: t.pegInAckTimeout,
|
|
980
978
|
pegInActivationTimeout: t.pegInActivationTimeout,
|
|
981
|
-
maxHtlcOutputCount: t.maxHtlcOutputCount
|
|
979
|
+
maxHtlcOutputCount: t.maxHtlcOutputCount,
|
|
980
|
+
expiredPegInGraceBlocks: t.expiredPegInGraceBlocks
|
|
982
981
|
};
|
|
983
982
|
}
|
|
984
983
|
function re(t) {
|
|
@@ -1006,7 +1005,7 @@ class pt {
|
|
|
1006
1005
|
abi: _,
|
|
1007
1006
|
functionName: "getLatestOffchainParams"
|
|
1008
1007
|
}), n = B(e);
|
|
1009
|
-
return
|
|
1008
|
+
return R(n), n;
|
|
1010
1009
|
}
|
|
1011
1010
|
async getOffchainParamsByVersion(e) {
|
|
1012
1011
|
const n = await this.publicClient.readContract({
|
|
@@ -1015,7 +1014,7 @@ class pt {
|
|
|
1015
1014
|
functionName: "getOffchainParamsByVersion",
|
|
1016
1015
|
args: [e]
|
|
1017
1016
|
}), r = B(n);
|
|
1018
|
-
return
|
|
1017
|
+
return R(r), r;
|
|
1019
1018
|
}
|
|
1020
1019
|
async getLatestOffchainParamsVersion() {
|
|
1021
1020
|
const e = await this.publicClient.readContract({
|
|
@@ -1023,7 +1022,7 @@ class pt {
|
|
|
1023
1022
|
abi: _,
|
|
1024
1023
|
functionName: "latestOffchainParamsVersion"
|
|
1025
1024
|
}), n = Number(e);
|
|
1026
|
-
return
|
|
1025
|
+
return N(n), n;
|
|
1027
1026
|
}
|
|
1028
1027
|
async getTimelockPeginByVersion(e) {
|
|
1029
1028
|
const n = await this.getOffchainParamsByVersion(e);
|
|
@@ -1056,19 +1055,20 @@ class pt {
|
|
|
1056
1055
|
}
|
|
1057
1056
|
],
|
|
1058
1057
|
allowFailure: !1
|
|
1059
|
-
}), n = ne(e[0]), r = B(e[1]),
|
|
1058
|
+
}), n = ne(e[0]), r = B(e[1]), s = Number(e[2]), i = {
|
|
1060
1059
|
minimumPegInAmount: n.minimumPegInAmount,
|
|
1061
1060
|
maxPegInAmount: n.maxPegInAmount,
|
|
1062
1061
|
pegInAckTimeout: n.pegInAckTimeout,
|
|
1063
1062
|
pegInActivationTimeout: n.pegInActivationTimeout,
|
|
1064
1063
|
maxHtlcOutputCount: n.maxHtlcOutputCount,
|
|
1064
|
+
expiredPegInGraceBlocks: n.expiredPegInGraceBlocks,
|
|
1065
1065
|
timelockPegin: re(r.timelockAssert),
|
|
1066
1066
|
timelockRefund: r.tRefund,
|
|
1067
1067
|
minVpCommissionBps: r.minVpCommissionBps,
|
|
1068
1068
|
offchainParams: r,
|
|
1069
|
-
offchainParamsVersion:
|
|
1069
|
+
offchainParamsVersion: s
|
|
1070
1070
|
};
|
|
1071
|
-
return Ze(
|
|
1071
|
+
return Ze(i), i;
|
|
1072
1072
|
}
|
|
1073
1073
|
/**
|
|
1074
1074
|
* Fetch every historical offchain params version in a single multicall.
|
|
@@ -1084,30 +1084,30 @@ class pt {
|
|
|
1084
1084
|
const n = await this.getLatestOffchainParamsVersion();
|
|
1085
1085
|
if (n === 0)
|
|
1086
1086
|
return { byVersion: /* @__PURE__ */ new Map(), latestVersion: 0 };
|
|
1087
|
-
const r = Array.from({ length: n }, (c, u) => u + 1),
|
|
1087
|
+
const r = Array.from({ length: n }, (c, u) => u + 1), s = r.map((c) => ({
|
|
1088
1088
|
address: this.contractAddress,
|
|
1089
1089
|
abi: _,
|
|
1090
1090
|
functionName: "getOffchainParamsByVersion",
|
|
1091
1091
|
args: [c]
|
|
1092
|
-
})),
|
|
1093
|
-
contracts:
|
|
1092
|
+
})), i = await this.publicClient.multicall({
|
|
1093
|
+
contracts: s,
|
|
1094
1094
|
allowFailure: !1
|
|
1095
1095
|
}), a = /* @__PURE__ */ new Map();
|
|
1096
1096
|
for (let c = 0; c < r.length; c++) {
|
|
1097
|
-
const u = B(
|
|
1097
|
+
const u = B(i[c]);
|
|
1098
1098
|
try {
|
|
1099
|
-
|
|
1100
|
-
} catch (
|
|
1099
|
+
R(u), a.set(r[c], u);
|
|
1100
|
+
} catch (d) {
|
|
1101
1101
|
e == null || e(
|
|
1102
1102
|
r[c],
|
|
1103
|
-
|
|
1103
|
+
d instanceof Error ? d : new Error(String(d))
|
|
1104
1104
|
);
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
return { byVersion: a, latestVersion: n };
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function j(t) {
|
|
1111
1111
|
return t.map((e) => ({
|
|
1112
1112
|
ethAddress: e.ethAddress,
|
|
1113
1113
|
btcPubKey: e.btcPubKey
|
|
@@ -1120,25 +1120,25 @@ class gt {
|
|
|
1120
1120
|
async getVaultKeepersByVersion(e, n) {
|
|
1121
1121
|
const r = await this.publicClient.readContract({
|
|
1122
1122
|
address: this.contractAddress,
|
|
1123
|
-
abi:
|
|
1123
|
+
abi: M,
|
|
1124
1124
|
functionName: "getVaultKeepersByVersion",
|
|
1125
1125
|
args: [e, n]
|
|
1126
1126
|
});
|
|
1127
|
-
return
|
|
1127
|
+
return j(r);
|
|
1128
1128
|
}
|
|
1129
1129
|
async getCurrentVaultKeepers(e) {
|
|
1130
1130
|
const n = await this.publicClient.readContract({
|
|
1131
1131
|
address: this.contractAddress,
|
|
1132
|
-
abi:
|
|
1132
|
+
abi: M,
|
|
1133
1133
|
functionName: "getCurrentVaultKeepers",
|
|
1134
1134
|
args: [e]
|
|
1135
1135
|
});
|
|
1136
|
-
return
|
|
1136
|
+
return j(n);
|
|
1137
1137
|
}
|
|
1138
1138
|
async getCurrentVaultKeepersVersion(e) {
|
|
1139
1139
|
return await this.publicClient.readContract({
|
|
1140
1140
|
address: this.contractAddress,
|
|
1141
|
-
abi:
|
|
1141
|
+
abi: M,
|
|
1142
1142
|
functionName: "getCurrentVaultKeepersVersion",
|
|
1143
1143
|
args: [e]
|
|
1144
1144
|
});
|
|
@@ -1155,7 +1155,7 @@ class ft {
|
|
|
1155
1155
|
functionName: "getUniversalChallengersByVersion",
|
|
1156
1156
|
args: [e]
|
|
1157
1157
|
});
|
|
1158
|
-
return
|
|
1158
|
+
return j(n);
|
|
1159
1159
|
}
|
|
1160
1160
|
async getCurrentUniversalChallengers() {
|
|
1161
1161
|
const e = await this.publicClient.readContract({
|
|
@@ -1163,7 +1163,7 @@ class ft {
|
|
|
1163
1163
|
abi: _,
|
|
1164
1164
|
functionName: "getCurrentUniversalChallengers"
|
|
1165
1165
|
});
|
|
1166
|
-
return
|
|
1166
|
+
return j(e);
|
|
1167
1167
|
}
|
|
1168
1168
|
async getLatestUniversalChallengersVersion() {
|
|
1169
1169
|
return await this.publicClient.readContract({
|
|
@@ -1194,12 +1194,12 @@ class mt {
|
|
|
1194
1194
|
throw new Error(
|
|
1195
1195
|
`getVaultProviderBTCKey returned an unexpected value (vp=${e}, length ${r.length}, prefix "${r.slice(0, 2)}")`
|
|
1196
1196
|
);
|
|
1197
|
-
const
|
|
1198
|
-
if (!
|
|
1197
|
+
const s = r.slice(2);
|
|
1198
|
+
if (!U.isXOnlyPoint(Pe(s)))
|
|
1199
1199
|
throw new Error(
|
|
1200
1200
|
`getVaultProviderBTCKey returned a value that is not on the secp256k1 curve (vp=${e})`
|
|
1201
1201
|
);
|
|
1202
|
-
return
|
|
1202
|
+
return s;
|
|
1203
1203
|
}
|
|
1204
1204
|
async getVaultBasicInfo(e) {
|
|
1205
1205
|
const n = await this.publicClient.readContract({
|
|
@@ -1225,7 +1225,7 @@ class mt {
|
|
|
1225
1225
|
functionName: "getBtcVaultProtocolInfo",
|
|
1226
1226
|
args: [e]
|
|
1227
1227
|
}), r = Number(n.offchainParamsVersion);
|
|
1228
|
-
return
|
|
1228
|
+
return N(r), {
|
|
1229
1229
|
depositorSignedPeginTx: n.depositorSignedPeginTx,
|
|
1230
1230
|
universalChallengersVersion: n.universalChallengersVersion,
|
|
1231
1231
|
appVaultKeepersVersion: n.appVaultKeepersVersion,
|
|
@@ -1236,7 +1236,9 @@ class mt {
|
|
|
1236
1236
|
htlcVout: n.htlcVout,
|
|
1237
1237
|
depositorPopSignature: n.depositorPopSignature,
|
|
1238
1238
|
prePeginTxHash: n.prePeginTxHash,
|
|
1239
|
-
vaultProviderCommissionBps: n.vaultProviderCommissionBps
|
|
1239
|
+
vaultProviderCommissionBps: n.vaultProviderCommissionBps,
|
|
1240
|
+
claimExpiredUntil: n.claimExpiredUntil,
|
|
1241
|
+
vaultCoreVersion: n.vaultCoreVersion
|
|
1240
1242
|
};
|
|
1241
1243
|
}
|
|
1242
1244
|
async getProtocolInfoBatch(e) {
|
|
@@ -1248,24 +1250,27 @@ class mt {
|
|
|
1248
1250
|
args: [r]
|
|
1249
1251
|
})),
|
|
1250
1252
|
allowFailure: !1
|
|
1251
|
-
})).map((r,
|
|
1252
|
-
const
|
|
1253
|
-
if (!
|
|
1253
|
+
})).map((r, s) => {
|
|
1254
|
+
const i = r;
|
|
1255
|
+
if (!i.depositorSignedPeginTx || i.depositorSignedPeginTx === "0x")
|
|
1254
1256
|
throw new Error(
|
|
1255
|
-
`Vault ${e[
|
|
1257
|
+
`Vault ${e[s]} not found on-chain or has no pegin transaction`
|
|
1256
1258
|
);
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1259
|
+
const a = Number(i.offchainParamsVersion);
|
|
1260
|
+
return N(a), {
|
|
1261
|
+
depositorSignedPeginTx: i.depositorSignedPeginTx,
|
|
1262
|
+
universalChallengersVersion: i.universalChallengersVersion,
|
|
1263
|
+
appVaultKeepersVersion: i.appVaultKeepersVersion,
|
|
1264
|
+
offchainParamsVersion: a,
|
|
1265
|
+
verifiedAt: i.verifiedAt,
|
|
1266
|
+
depositorWotsPkHash: i.depositorWotsPkHash,
|
|
1267
|
+
hashlock: i.hashlock,
|
|
1268
|
+
htlcVout: i.htlcVout,
|
|
1269
|
+
depositorPopSignature: i.depositorPopSignature,
|
|
1270
|
+
prePeginTxHash: i.prePeginTxHash,
|
|
1271
|
+
vaultProviderCommissionBps: i.vaultProviderCommissionBps,
|
|
1272
|
+
claimExpiredUntil: i.claimExpiredUntil,
|
|
1273
|
+
vaultCoreVersion: i.vaultCoreVersion
|
|
1269
1274
|
};
|
|
1270
1275
|
});
|
|
1271
1276
|
}
|
|
@@ -1295,13 +1300,13 @@ class mt {
|
|
|
1295
1300
|
})),
|
|
1296
1301
|
allowFailure: !1
|
|
1297
1302
|
})).map((r) => {
|
|
1298
|
-
const
|
|
1299
|
-
if (!
|
|
1303
|
+
const s = r;
|
|
1304
|
+
if (!s.depositorSignedPeginTx || s.depositorSignedPeginTx === "0x")
|
|
1300
1305
|
throw new Error(
|
|
1301
1306
|
"Vault not found on-chain or has no pegin transaction while reading offchain params version"
|
|
1302
1307
|
);
|
|
1303
|
-
const
|
|
1304
|
-
return
|
|
1308
|
+
const i = Number(s.offchainParamsVersion);
|
|
1309
|
+
return N(i), i;
|
|
1305
1310
|
});
|
|
1306
1311
|
}
|
|
1307
1312
|
}
|
|
@@ -1314,15 +1319,15 @@ export {
|
|
|
1314
1319
|
Ye as d,
|
|
1315
1320
|
pe as e,
|
|
1316
1321
|
ut as f,
|
|
1317
|
-
|
|
1322
|
+
R as g,
|
|
1318
1323
|
Ze as h,
|
|
1319
1324
|
ge as i,
|
|
1320
1325
|
pt as j,
|
|
1321
1326
|
ft as k,
|
|
1322
1327
|
gt as l,
|
|
1323
1328
|
mt as m,
|
|
1324
|
-
|
|
1325
|
-
|
|
1329
|
+
dt as p,
|
|
1330
|
+
ht as r,
|
|
1326
1331
|
ke as v
|
|
1327
1332
|
};
|
|
1328
|
-
//# sourceMappingURL=vault-registry-reader-
|
|
1333
|
+
//# sourceMappingURL=vault-registry-reader-BrARgFre.js.map
|