@babylonlabs-io/ts-sdk 3.3.0 → 4.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/dist/{BTCVaultRegistry.abi-BzNTa_EU.js → BTCVaultRegistry.abi-DnP4UkB5.js} +9 -140
- package/dist/BTCVaultRegistry.abi-DnP4UkB5.js.map +1 -0
- package/dist/{BTCVaultRegistry.abi-BH2-LHxN.cjs → BTCVaultRegistry.abi-DzbfZ9_s.cjs} +2 -2
- package/dist/BTCVaultRegistry.abi-DzbfZ9_s.cjs.map +1 -0
- package/dist/{PayoutManager-xEGvTbhL.js → PayoutManager-BUWP-H-q.js} +3 -3
- package/dist/PayoutManager-BUWP-H-q.js.map +1 -0
- package/dist/{PayoutManager-B1Ev0r7o.cjs → PayoutManager-Dopxq_Jv.cjs} +2 -2
- package/dist/PayoutManager-Dopxq_Jv.cjs.map +1 -0
- package/dist/PeginManager-CMbRRTnr.cjs +2 -0
- package/dist/{PeginManager-Co43rW_x.cjs.map → PeginManager-CMbRRTnr.cjs.map} +1 -1
- package/dist/{PeginManager-BJnUgW8C.js → PeginManager-Cas6_j7t.js} +118 -107
- package/dist/{PeginManager-BJnUgW8C.js.map → PeginManager-Cas6_j7t.js.map} +1 -1
- package/dist/{ProtocolParams.abi-Cv77fsUe.js → ProtocolParams.abi-CuDl7AuC.js} +3 -3
- package/dist/{ProtocolParams.abi-Cv77fsUe.js.map → ProtocolParams.abi-CuDl7AuC.js.map} +1 -1
- package/dist/{ProtocolParams.abi-BgEZaQ2I.cjs → ProtocolParams.abi-DWfIh6VH.cjs} +2 -2
- package/dist/{ProtocolParams.abi-BgEZaQ2I.cjs.map → ProtocolParams.abi-DWfIh6VH.cjs.map} +1 -1
- package/dist/VaultErrors.abi-Dc3UnB_h.js +5 -0
- package/dist/{VaultErrors.abi-Boz4w97c.js.map → VaultErrors.abi-Dc3UnB_h.js.map} +1 -1
- package/dist/VaultErrors.abi-Hjn1CdLs.cjs +2 -0
- package/dist/{VaultErrors.abi-DQ18kM0L.cjs.map → VaultErrors.abi-Hjn1CdLs.cjs.map} +1 -1
- package/dist/buildAndBroadcastReclaim-CVmG3ldA.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-CVmG3ldA.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-CQANDXVJ.js → buildAndBroadcastReclaim-XRWuJWVL.js} +48 -50
- package/dist/buildAndBroadcastReclaim-XRWuJWVL.js.map +1 -0
- package/dist/{challengeAssert-C3eMcM5Y.cjs → challengeAssert-BE6Wm4x1.cjs} +2 -2
- package/dist/challengeAssert-BE6Wm4x1.cjs.map +1 -0
- package/dist/{challengeAssert-B2otuf7y.js → challengeAssert-DUKSjirl.js} +3 -3
- package/dist/challengeAssert-DUKSjirl.js.map +1 -0
- package/dist/constants-BCg6O0PX.cjs +2 -0
- package/dist/constants-BCg6O0PX.cjs.map +1 -0
- package/dist/constants-CmDDuM3L.js +50 -0
- package/dist/constants-CmDDuM3L.js.map +1 -0
- package/dist/{index-BRsWXDlv.js → index-B-9aXMxk.js} +6 -6
- package/dist/{index-BRsWXDlv.js.map → index-B-9aXMxk.js.map} +1 -1
- package/dist/{index-C6avwx1s.cjs → index-Dn7RlsKK.cjs} +2 -2
- package/dist/{index-C6avwx1s.cjs.map → index-Dn7RlsKK.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +16 -16
- package/dist/pegin-registration-client-DLlaZbsZ.cjs +2 -0
- package/dist/pegin-registration-client-DLlaZbsZ.cjs.map +1 -0
- package/dist/{pegin-registration-client-Cvjk4ILq.js → pegin-registration-client-ZI0k10_3.js} +90 -96
- package/dist/pegin-registration-client-ZI0k10_3.js.map +1 -0
- package/dist/{primeVpAuth-D4UWXQ76.js → primeVpAuth-C-ET0XF4.js} +2 -2
- package/dist/{primeVpAuth-D4UWXQ76.js.map → primeVpAuth-C-ET0XF4.js.map} +1 -1
- package/dist/{primeVpAuth-CXNXYKrh.cjs → primeVpAuth-Ch-ig2My.cjs} +2 -2
- package/dist/{primeVpAuth-CXNXYKrh.cjs.map → primeVpAuth-Ch-ig2My.cjs.map} +1 -1
- package/dist/registration-records-CKc0OVuK.cjs +2 -0
- package/dist/registration-records-CKc0OVuK.cjs.map +1 -0
- package/dist/{registration-records-DJJC2NiO.js → registration-records-D39ApuHS.js} +141 -141
- package/dist/registration-records-D39ApuHS.js.map +1 -0
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts +5 -0
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts.map +1 -1
- package/dist/{signer-set-reader-GrFe_rsW.cjs → signer-set-reader-CJfV-GDz.cjs} +2 -2
- package/dist/{signer-set-reader-GrFe_rsW.cjs.map → signer-set-reader-CJfV-GDz.cjs.map} +1 -1
- package/dist/{signer-set-reader-CSUe92zE.js → signer-set-reader-DiwLeqik.js} +3 -3
- package/dist/{signer-set-reader-CSUe92zE.js.map → signer-set-reader-DiwLeqik.js.map} +1 -1
- package/dist/tbv/core/clients/eth/index.cjs +1 -1
- package/dist/tbv/core/clients/eth/index.js +4 -4
- package/dist/tbv/core/clients/eth/protocol-params-validation.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/registration-logs-error.d.ts +6 -6
- package/dist/tbv/core/clients/eth/registration-records.d.ts +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +12 -13
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +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 +6 -6
- package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
- package/dist/tbv/core/clients/vault-provider/status/index.js +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +5 -111
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +2 -2
- package/dist/tbv/core/contracts/abis/vaultErrors.abi.json.d.ts +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +3 -3
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsCore.test.d.ts +1 -1
- package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts +1 -1
- package/dist/tbv/core/deposit-terms/depositTerms.d.ts +5 -5
- package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +16 -16
- package/dist/tbv/core/managers/PeginManager.d.ts +2 -1
- 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/primitives/__tests__/vaultCoreVersion.test.d.ts +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +3 -3
- package/dist/tbv/core/primitives/psbt/__tests__/deriveExpectedPeginPayoutScriptPubKey.test.d.ts +1 -1
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/constants.d.ts +38 -13
- package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/depositorClaim.d.ts +3 -6
- package/dist/tbv/core/primitives/psbt/depositorClaim.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +3 -5
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/recovery/peginParamsCandidates.d.ts +1 -1
- package/dist/tbv/core/recovery/reconstructPeginParams.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/__tests__/realWasmWatchtowerArtifacts.test.d.ts +2 -2
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts +2 -1
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts +1 -1
- package/dist/tbv/core/services/delegated-claim/deriveClaimerWotsKeypair.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts +2 -1
- package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts +1 -1
- package/dist/tbv/core/services/delegated-claim/readDelegatedClaimVaultContext.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts +3 -3
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/types.d.ts +5 -6
- package/dist/tbv/core/services/delegated-claim/types.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/__tests__/signDepositorGraph.realGraph.test.d.ts +3 -3
- package/dist/tbv/core/services/deposit/signDepositorGraph.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/wasm/index.cjs.map +1 -1
- package/dist/tbv/core/wasm/index.d.ts +8 -11
- package/dist/tbv/core/wasm/index.d.ts.map +1 -1
- package/dist/tbv/core/wasm/index.js.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +16 -16
- package/dist/toRefundInputs-BSQjDOK9.cjs +2 -0
- package/dist/toRefundInputs-BSQjDOK9.cjs.map +1 -0
- package/dist/{toRefundInputs-Dzw1cteD.js → toRefundInputs-BbbvPb2A.js} +175 -173
- package/dist/toRefundInputs-BbbvPb2A.js.map +1 -0
- package/dist/{types-BC2TGzcp.cjs → types-BnZIbDHb.cjs} +2 -2
- package/dist/types-BnZIbDHb.cjs.map +1 -0
- package/dist/{types-24A9Qoxb.js → types-K_aM5GZO.js} +39 -39
- package/dist/types-K_aM5GZO.js.map +1 -0
- package/dist/{verifyKeyPathSchnorrSignature-IIj3Z2se.js → verifyKeyPathSchnorrSignature-DPXOFOol.js} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-IIj3Z2se.js.map → verifyKeyPathSchnorrSignature-DPXOFOol.js.map} +1 -1
- package/dist/{verifyKeyPathSchnorrSignature-BRTpEH9X.cjs → verifyKeyPathSchnorrSignature-DcxCojp0.cjs} +2 -2
- package/dist/{verifyKeyPathSchnorrSignature-BRTpEH9X.cjs.map → verifyKeyPathSchnorrSignature-DcxCojp0.cjs.map} +1 -1
- package/dist/verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-CgDa9Rcg.cjs.map +1 -0
- package/dist/{verifyScriptPathSchnorrSignature-owu3BfyT.js → verifyScriptPathSchnorrSignature-D-fdi-sG.js} +462 -459
- package/dist/verifyScriptPathSchnorrSignature-D-fdi-sG.js.map +1 -0
- package/package.json +3 -3
- package/dist/BTCVaultRegistry.abi-BH2-LHxN.cjs.map +0 -1
- package/dist/BTCVaultRegistry.abi-BzNTa_EU.js.map +0 -1
- package/dist/PayoutManager-B1Ev0r7o.cjs.map +0 -1
- package/dist/PayoutManager-xEGvTbhL.js.map +0 -1
- package/dist/PeginManager-Co43rW_x.cjs +0 -2
- package/dist/VaultErrors.abi-Boz4w97c.js +0 -5
- package/dist/VaultErrors.abi-DQ18kM0L.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-CQANDXVJ.js.map +0 -1
- package/dist/buildAndBroadcastReclaim-DPk36Uhp.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-DPk36Uhp.cjs.map +0 -1
- package/dist/challengeAssert-B2otuf7y.js.map +0 -1
- package/dist/challengeAssert-C3eMcM5Y.cjs.map +0 -1
- package/dist/constants-CAm10Qwp.cjs +0 -2
- package/dist/constants-CAm10Qwp.cjs.map +0 -1
- package/dist/constants-CvQZuxKv.js +0 -48
- package/dist/constants-CvQZuxKv.js.map +0 -1
- package/dist/pegin-registration-client-CdRyXP3j.cjs +0 -2
- package/dist/pegin-registration-client-CdRyXP3j.cjs.map +0 -1
- package/dist/pegin-registration-client-Cvjk4ILq.js.map +0 -1
- package/dist/registration-records-DJJC2NiO.js.map +0 -1
- package/dist/registration-records-XQMIKjGV.cjs +0 -2
- package/dist/registration-records-XQMIKjGV.cjs.map +0 -1
- package/dist/toRefundInputs-DTuWi--u.cjs +0 -2
- package/dist/toRefundInputs-DTuWi--u.cjs.map +0 -1
- package/dist/toRefundInputs-Dzw1cteD.js.map +0 -1
- package/dist/types-24A9Qoxb.js.map +0 -1
- package/dist/types-BC2TGzcp.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-CahYx5Td.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-CahYx5Td.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-owu3BfyT.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var b = (t, e, n) =>
|
|
4
|
-
import { s as
|
|
5
|
-
import { c as
|
|
6
|
-
import { j as E } from "./constants-
|
|
7
|
-
import { isAddress as
|
|
8
|
-
const
|
|
1
|
+
var Z = Object.defineProperty;
|
|
2
|
+
var tt = (t, e, n) => e in t ? Z(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var b = (t, e, n) => tt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { s as x, b as F, a as et } from "./secp256k1-BuxBFUHm.js";
|
|
5
|
+
import { c as nt, H as ot, r as $, a as R, h as U, b as B, s as A } from "./sha2-YqVHJiFj.js";
|
|
6
|
+
import { j as E, k as _, M as S } from "./constants-CmDDuM3L.js";
|
|
7
|
+
import { isAddress as it, keccak256 as st, encodeAbiParameters as rt } from "viem";
|
|
8
|
+
const ut = /* @__PURE__ */ Uint8Array.from([
|
|
9
9
|
7,
|
|
10
10
|
4,
|
|
11
11
|
13,
|
|
@@ -22,36 +22,36 @@ const rt = /* @__PURE__ */ Uint8Array.from([
|
|
|
22
22
|
14,
|
|
23
23
|
11,
|
|
24
24
|
8
|
|
25
|
-
]),
|
|
26
|
-
const n = [[
|
|
25
|
+
]), O = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), ct = O.map((t) => (9 * t + 5) % 16), L = /* @__PURE__ */ (() => {
|
|
26
|
+
const n = [[O], [ct]];
|
|
27
27
|
for (let o = 0; o < 4; o++)
|
|
28
28
|
for (let i of n)
|
|
29
|
-
i.push(i[o].map((u) =>
|
|
29
|
+
i.push(i[o].map((u) => ut[u]));
|
|
30
30
|
return n;
|
|
31
|
-
})(),
|
|
31
|
+
})(), M = L[0], H = L[1], K = /* @__PURE__ */ [
|
|
32
32
|
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
33
33
|
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
34
34
|
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
35
35
|
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
36
36
|
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
37
|
-
].map((t) => Uint8Array.from(t)),
|
|
37
|
+
].map((t) => Uint8Array.from(t)), at = /* @__PURE__ */ M.map((t, e) => t.map((n) => K[e][n])), ft = /* @__PURE__ */ H.map((t, e) => t.map((n) => K[e][n])), lt = /* @__PURE__ */ Uint32Array.from([
|
|
38
38
|
0,
|
|
39
39
|
1518500249,
|
|
40
40
|
1859775393,
|
|
41
41
|
2400959708,
|
|
42
42
|
2840853838
|
|
43
|
-
]),
|
|
43
|
+
]), ht = /* @__PURE__ */ Uint32Array.from([
|
|
44
44
|
1352829926,
|
|
45
45
|
1548603684,
|
|
46
46
|
1836072691,
|
|
47
47
|
2053994217,
|
|
48
48
|
0
|
|
49
49
|
]);
|
|
50
|
-
function
|
|
50
|
+
function V(t, e, n, o) {
|
|
51
51
|
return t === 0 ? e ^ n ^ o : t === 1 ? e & n | ~e & o : t === 2 ? (e | ~n) ^ o : t === 3 ? e & o | n & ~o : e ^ (n | ~o);
|
|
52
52
|
}
|
|
53
53
|
const I = /* @__PURE__ */ new Uint32Array(16);
|
|
54
|
-
class
|
|
54
|
+
class dt extends ot {
|
|
55
55
|
constructor() {
|
|
56
56
|
super(64, 20, 8, !0);
|
|
57
57
|
b(this, "h0", 1732584193);
|
|
@@ -61,28 +61,28 @@ class ht extends nt {
|
|
|
61
61
|
b(this, "h4", -1009589776);
|
|
62
62
|
}
|
|
63
63
|
get() {
|
|
64
|
-
const { h0: n, h1: o, h2: i, h3: u, h4:
|
|
65
|
-
return [n, o, i, u,
|
|
64
|
+
const { h0: n, h1: o, h2: i, h3: u, h4: f } = this;
|
|
65
|
+
return [n, o, i, u, f];
|
|
66
66
|
}
|
|
67
|
-
set(n, o, i, u,
|
|
68
|
-
this.h0 = n | 0, this.h1 = o | 0, this.h2 = i | 0, this.h3 = u | 0, this.h4 =
|
|
67
|
+
set(n, o, i, u, f) {
|
|
68
|
+
this.h0 = n | 0, this.h1 = o | 0, this.h2 = i | 0, this.h3 = u | 0, this.h4 = f | 0;
|
|
69
69
|
}
|
|
70
70
|
process(n, o) {
|
|
71
71
|
for (let r = 0; r < 16; r++, o += 4)
|
|
72
72
|
I[r] = n.getUint32(o, !0);
|
|
73
|
-
let i = this.h0 | 0, u = i,
|
|
73
|
+
let i = this.h0 | 0, u = i, f = this.h1 | 0, h = f, d = this.h2 | 0, p = d, m = this.h3 | 0, y = m, s = this.h4 | 0, c = s;
|
|
74
74
|
for (let r = 0; r < 5; r++) {
|
|
75
|
-
const
|
|
75
|
+
const a = 4 - r, g = lt[r], Y = ht[r], G = M[r], Q = H[r], q = at[r], J = ft[r];
|
|
76
76
|
for (let l = 0; l < 16; l++) {
|
|
77
|
-
const
|
|
78
|
-
i = s, s = m, m =
|
|
77
|
+
const v = $(i + V(r, f, d, m) + I[G[l]] + g, q[l]) + s | 0;
|
|
78
|
+
i = s, s = m, m = $(d, 10) | 0, d = f, f = v;
|
|
79
79
|
}
|
|
80
80
|
for (let l = 0; l < 16; l++) {
|
|
81
|
-
const
|
|
82
|
-
u = c, c =
|
|
81
|
+
const v = $(u + V(a, h, p, y) + I[Q[l]] + Y, J[l]) + c | 0;
|
|
82
|
+
u = c, c = y, y = $(p, 10) | 0, p = h, h = v;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
this.set(this.h1 + d +
|
|
85
|
+
this.set(this.h1 + d + y | 0, this.h2 + m + c | 0, this.h3 + s + u | 0, this.h4 + i + h | 0, this.h0 + f + p | 0);
|
|
86
86
|
}
|
|
87
87
|
roundClean() {
|
|
88
88
|
R(I);
|
|
@@ -91,80 +91,80 @@ class ht extends nt {
|
|
|
91
91
|
this.destroyed = !0, R(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
function
|
|
94
|
+
const mt = /* @__PURE__ */ nt(() => new dt()), P = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn, pt = 7n;
|
|
95
|
+
function gt(t, e, n) {
|
|
96
96
|
let o = 1n, i = t % n, u = e;
|
|
97
97
|
for (; u > 0n; )
|
|
98
98
|
(u & 1n) === 1n && (o = o * i % n), i = i * i % n, u >>= 1n;
|
|
99
99
|
return o;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function bt(t) {
|
|
102
102
|
const e = BigInt(`0x${t}`);
|
|
103
|
-
if (e >=
|
|
104
|
-
const o = (e * e %
|
|
103
|
+
if (e >= P) return !1;
|
|
104
|
+
const o = (e * e % P * e % P + pt) % P, i = gt(
|
|
105
105
|
o,
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
P + 1n >> 2n,
|
|
107
|
+
P
|
|
108
108
|
);
|
|
109
|
-
return i * i %
|
|
109
|
+
return i * i % P === o;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function X(t, e) {
|
|
112
112
|
const n = t.toLowerCase();
|
|
113
113
|
if (!/^0x[0-9a-f]{64}$/.test(n))
|
|
114
114
|
throw new Error(
|
|
115
115
|
`${e} returned an unexpected value (length ${n.length}, prefix "${n.slice(0, 2)}")`
|
|
116
116
|
);
|
|
117
117
|
const o = n.slice(2);
|
|
118
|
-
if (!
|
|
118
|
+
if (!bt(o))
|
|
119
119
|
throw new Error(
|
|
120
120
|
`${e} returned a value that is not on the secp256k1 curve`
|
|
121
121
|
);
|
|
122
122
|
return o;
|
|
123
123
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
124
|
+
const Pt = "5120", T = "0014", yt = 20, N = 33, xt = 65, $t = 2, It = 3, wt = 4;
|
|
125
|
+
function D(t, e) {
|
|
126
126
|
const n = t.startsWith("0x") || t.startsWith("0X") ? t.slice(2) : t;
|
|
127
127
|
if (!/^(?:[0-9a-fA-F]{2})+$/.test(n))
|
|
128
128
|
throw new Error(`${e} must be non-empty, even-length hex`);
|
|
129
129
|
return `0x${n.toLowerCase()}`;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const e =
|
|
133
|
-
|
|
131
|
+
function Et(t) {
|
|
132
|
+
const e = U(t), n = x.utils.lift_x(BigInt(`0x${t}`)), o = x.utils.bytesToNumberBE(
|
|
133
|
+
x.utils.taggedHash("TapTweak", e)
|
|
134
134
|
);
|
|
135
|
-
if (o >=
|
|
135
|
+
if (o >= F.CURVE.n)
|
|
136
136
|
throw new Error("Proof of possession BTC pubkey has an invalid TapTweak");
|
|
137
|
-
const i = o === 0n ? n : n.add(
|
|
138
|
-
return `0x${
|
|
139
|
-
|
|
137
|
+
const i = o === 0n ? n : n.add(x.Point.BASE.multiply(o));
|
|
138
|
+
return `0x${Pt}${B(
|
|
139
|
+
x.utils.pointToBytes(i)
|
|
140
140
|
)}`;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
const e =
|
|
142
|
+
function Ct(t) {
|
|
143
|
+
const e = D(t, "depositorBtcPubkeyRaw"), n = U(e.slice(2));
|
|
144
144
|
if (n.length === 32)
|
|
145
145
|
return {
|
|
146
|
-
xOnlyPubkey:
|
|
146
|
+
xOnlyPubkey: X(e, "Payout BTC pubkey")
|
|
147
147
|
};
|
|
148
|
-
const o = n.length ===
|
|
148
|
+
const o = n.length === N && (n[0] === $t || n[0] === It), i = n.length === xt && n[0] === wt;
|
|
149
149
|
if (!o && !i)
|
|
150
150
|
throw new Error(
|
|
151
151
|
"depositorBtcPubkeyRaw must be x-only, compressed, or uncompressed"
|
|
152
152
|
);
|
|
153
153
|
try {
|
|
154
|
-
|
|
154
|
+
F.Point.fromBytes(n);
|
|
155
155
|
} catch {
|
|
156
156
|
throw new Error("depositorBtcPubkeyRaw is not a valid BTC pubkey");
|
|
157
157
|
}
|
|
158
158
|
return {
|
|
159
|
-
xOnlyPubkey: B(n.subarray(1,
|
|
159
|
+
xOnlyPubkey: B(n.subarray(1, N)),
|
|
160
160
|
compressedPubkey: o ? n : void 0
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
function vt(t) {
|
|
164
|
-
return `0x${T}${B(
|
|
164
|
+
return `0x${T}${B(mt(A(t)))}`;
|
|
165
165
|
}
|
|
166
166
|
function Ht(t, e, n) {
|
|
167
|
-
const o =
|
|
167
|
+
const o = D(
|
|
168
168
|
t,
|
|
169
169
|
"depositorPayoutScriptPubKey"
|
|
170
170
|
);
|
|
@@ -172,27 +172,27 @@ function Ht(t, e, n) {
|
|
|
172
172
|
throw new Error(
|
|
173
173
|
`depositorPayoutScriptPubKey exceeds ${E} bytes`
|
|
174
174
|
);
|
|
175
|
-
const i = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, u =
|
|
175
|
+
const i = e.startsWith("0x") || e.startsWith("0X") ? e.slice(2) : e, u = X(
|
|
176
176
|
`0x${i}`,
|
|
177
177
|
"Proof of possession BTC pubkey"
|
|
178
|
-
),
|
|
179
|
-
if (
|
|
178
|
+
), f = Ct(n);
|
|
179
|
+
if (f.xOnlyPubkey !== u)
|
|
180
180
|
throw new Error(
|
|
181
181
|
"depositorBtcPubkeyRaw does not match the proof of possession BTC pubkey"
|
|
182
182
|
);
|
|
183
|
-
if (o ===
|
|
183
|
+
if (o === Et(u))
|
|
184
184
|
return o;
|
|
185
185
|
if (o.startsWith(`0x${T}`) && o.length === 2 + T.length + yt * 2) {
|
|
186
|
-
if (!
|
|
186
|
+
if (!f.compressedPubkey)
|
|
187
187
|
throw new Error("A P2WPKH payout requires a compressed BTC pubkey");
|
|
188
|
-
if (o === vt(
|
|
188
|
+
if (o === vt(f.compressedPubkey))
|
|
189
189
|
return o;
|
|
190
190
|
}
|
|
191
191
|
throw new Error(
|
|
192
192
|
"depositorPayoutScriptPubKey does not match the proof of possession BTC pubkey"
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function kt(t, e) {
|
|
196
196
|
const n = t.startsWith("0x") ? t.slice(2) : t;
|
|
197
197
|
if (n.length === 0 || n.length % 2 !== 0)
|
|
198
198
|
throw new Error(`${e} must be non-empty, even-length hex`);
|
|
@@ -203,12 +203,12 @@ function Ct(t, e) {
|
|
|
203
203
|
o[i] = Number.parseInt(n.slice(i * 2, i * 2 + 2), 16);
|
|
204
204
|
return o;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function At(t) {
|
|
207
207
|
return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join(
|
|
208
208
|
""
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function Tt(t) {
|
|
212
212
|
const e = new Uint8Array(
|
|
213
213
|
t.reduce((o, i) => o + i.length, 0)
|
|
214
214
|
);
|
|
@@ -217,7 +217,7 @@ function At(t) {
|
|
|
217
217
|
e.set(o, n), n += o.length;
|
|
218
218
|
return e;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Bt(t) {
|
|
221
221
|
let e = 0;
|
|
222
222
|
const n = (s, c) => {
|
|
223
223
|
if (!Number.isSafeInteger(s) || s < 0)
|
|
@@ -228,28 +228,28 @@ function Tt(t) {
|
|
|
228
228
|
return e += s, r;
|
|
229
229
|
}, o = (s, c) => {
|
|
230
230
|
const r = n(s, c);
|
|
231
|
-
let
|
|
231
|
+
let a = 0n;
|
|
232
232
|
for (let g = r.length - 1; g >= 0; g--)
|
|
233
|
-
|
|
234
|
-
return
|
|
233
|
+
a = a << 8n | BigInt(r[g]);
|
|
234
|
+
return a;
|
|
235
235
|
}, i = (s) => {
|
|
236
236
|
const c = e, r = n(1, s)[0];
|
|
237
|
-
let
|
|
237
|
+
let a;
|
|
238
238
|
if (r < 253)
|
|
239
|
-
|
|
239
|
+
a = BigInt(r);
|
|
240
240
|
else if (r === 253) {
|
|
241
|
-
if (
|
|
241
|
+
if (a = o(2, s), a < 0xfdn) throw new Error(`Non-canonical ${s}`);
|
|
242
242
|
} else if (r === 254) {
|
|
243
|
-
if (
|
|
244
|
-
} else if (
|
|
245
|
-
if (
|
|
243
|
+
if (a = o(4, s), a <= 0xffffn) throw new Error(`Non-canonical ${s}`);
|
|
244
|
+
} else if (a = o(8, s), a <= 0xffffffffn) throw new Error(`Non-canonical ${s}`);
|
|
245
|
+
if (a > BigInt(Number.MAX_SAFE_INTEGER))
|
|
246
246
|
throw new Error(`${s} exceeds JavaScript's safe integer range`);
|
|
247
247
|
return {
|
|
248
248
|
encoded: t.slice(c, e),
|
|
249
|
-
value: Number(
|
|
249
|
+
value: Number(a)
|
|
250
250
|
};
|
|
251
|
-
}, u = n(4, "version"),
|
|
252
|
-
|
|
251
|
+
}, u = n(4, "version"), f = t[e] === 0 && t[e + 1] === 1;
|
|
252
|
+
f && (e += 2);
|
|
253
253
|
const h = i("input count"), d = [];
|
|
254
254
|
for (let s = 0; s < h.value; s++) {
|
|
255
255
|
const c = e;
|
|
@@ -264,75 +264,75 @@ function Tt(t) {
|
|
|
264
264
|
const r = i(`output ${s} script length`);
|
|
265
265
|
n(r.value, `output ${s} script`), m.push(t.slice(c, e));
|
|
266
266
|
}
|
|
267
|
-
if (
|
|
267
|
+
if (f) {
|
|
268
268
|
let s = !1;
|
|
269
269
|
for (let c = 0; c < h.value; c++) {
|
|
270
270
|
const r = i(`input ${c} witness item count`);
|
|
271
271
|
s || (s = r.value > 0);
|
|
272
|
-
for (let
|
|
272
|
+
for (let a = 0; a < r.value; a++) {
|
|
273
273
|
const g = i(
|
|
274
|
-
`input ${c} witness item ${
|
|
274
|
+
`input ${c} witness item ${a} length`
|
|
275
275
|
);
|
|
276
|
-
n(g.value, `input ${c} witness item ${
|
|
276
|
+
n(g.value, `input ${c} witness item ${a}`);
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
if (!s)
|
|
280
280
|
throw new Error("Bitcoin transaction has superfluous witness marker");
|
|
281
281
|
}
|
|
282
|
-
const
|
|
282
|
+
const y = n(4, "locktime");
|
|
283
283
|
if (e !== t.length)
|
|
284
284
|
throw new Error(
|
|
285
285
|
`Bitcoin transaction has ${t.length - e} trailing byte(s)`
|
|
286
286
|
);
|
|
287
|
-
return
|
|
287
|
+
return Tt([
|
|
288
288
|
u,
|
|
289
289
|
h.encoded,
|
|
290
290
|
...d,
|
|
291
291
|
p.encoded,
|
|
292
292
|
...m,
|
|
293
|
-
|
|
293
|
+
y
|
|
294
294
|
]);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const e =
|
|
298
|
-
|
|
296
|
+
function Rt(t) {
|
|
297
|
+
const e = Bt(
|
|
298
|
+
kt(t, "transactionHex")
|
|
299
299
|
), n = A(A(e));
|
|
300
|
-
return n.reverse(), `0x${
|
|
300
|
+
return n.reverse(), `0x${At(n)}`;
|
|
301
301
|
}
|
|
302
302
|
function Kt(t, e) {
|
|
303
303
|
const n = t.startsWith("0x") ? t : `0x${t}`;
|
|
304
304
|
if (!/^0x[0-9a-fA-F]{64}$/.test(n))
|
|
305
305
|
throw new Error("peginTxHash must be a 32-byte hex value");
|
|
306
306
|
const o = e.startsWith("0x") ? e : `0x${e}`;
|
|
307
|
-
if (!
|
|
307
|
+
if (!it(o, { strict: !0 }))
|
|
308
308
|
throw new Error(`Invalid depositor Ethereum address: ${e}`);
|
|
309
|
-
return
|
|
310
|
-
|
|
309
|
+
return st(
|
|
310
|
+
rt(
|
|
311
311
|
[{ type: "bytes32" }, { type: "address" }],
|
|
312
312
|
[n, o]
|
|
313
313
|
)
|
|
314
314
|
).slice(2);
|
|
315
315
|
}
|
|
316
|
-
const
|
|
317
|
-
class
|
|
318
|
-
constructor(e, n, o, i, u = "the vault has not been redeemed for this key, or the node did not serve the block. Redeem first, or try again.",
|
|
316
|
+
const W = "VaultClaimableByNotFoundError";
|
|
317
|
+
class _t extends Error {
|
|
318
|
+
constructor(e, n, o, i, u = "the vault has not been redeemed for this key, or the node did not serve the block. Redeem first, or try again.", f) {
|
|
319
319
|
super(
|
|
320
320
|
`No VaultClaimableBy log for vault ${e} and claimer ${n} in blocks ${o}..${i}: ${u}`,
|
|
321
|
-
|
|
322
|
-
), this.vaultId = e, this.claimerPk = n, this.fromBlock = o, this.toBlock = i, this.name =
|
|
321
|
+
f
|
|
322
|
+
), this.vaultId = e, this.claimerPk = n, this.fromBlock = o, this.toBlock = i, this.name = W;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
return t instanceof
|
|
325
|
+
function Xt(t) {
|
|
326
|
+
return t instanceof _t ? !0 : typeof t != "object" || t === null ? !1 : t.name === W;
|
|
327
327
|
}
|
|
328
|
-
const k = 65535,
|
|
329
|
-
function
|
|
330
|
-
if (!Number.isInteger(t) || t < 0 || t >
|
|
328
|
+
const k = 65535, C = 4294967295, w = 255;
|
|
329
|
+
function Dt(t) {
|
|
330
|
+
if (!Number.isInteger(t) || t < 0 || t > C)
|
|
331
331
|
throw new Error(
|
|
332
332
|
`Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`
|
|
333
333
|
);
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function St(t) {
|
|
336
336
|
const e = [];
|
|
337
337
|
if (t.timelockAssert <= 0n && e.push(
|
|
338
338
|
`timelockAssert must be positive, got ${t.timelockAssert}`
|
|
@@ -346,22 +346,22 @@ function _t(t) {
|
|
|
346
346
|
`minPeginFeeRate must be positive, got ${t.minPeginFeeRate}`
|
|
347
347
|
), (!Number.isInteger(t.proverCircuitVersion) || t.proverCircuitVersion < 0 || t.proverCircuitVersion > k) && e.push(
|
|
348
348
|
`proverCircuitVersion must be a uint16, got ${t.proverCircuitVersion}`
|
|
349
|
-
), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth >
|
|
350
|
-
`minPrepeginDepth must be a uint32 in [1, ${
|
|
349
|
+
), (!Number.isInteger(t.minPrepeginDepth) || t.minPrepeginDepth <= 0 || t.minPrepeginDepth > C) && e.push(
|
|
350
|
+
`minPrepeginDepth must be a uint32 in [1, ${C}], got ${t.minPrepeginDepth}`
|
|
351
351
|
), t.babeTotalInstances <= 0 && e.push(
|
|
352
352
|
`babeTotalInstances must be positive, got ${t.babeTotalInstances}`
|
|
353
353
|
), t.babeInstancesToFinalize <= 0 && e.push(
|
|
354
354
|
`babeInstancesToFinalize must be positive, got ${t.babeInstancesToFinalize}`
|
|
355
355
|
), t.babeInstancesToFinalize > t.babeTotalInstances && e.push(
|
|
356
356
|
`babeInstancesToFinalize (${t.babeInstancesToFinalize}) exceeds babeTotalInstances (${t.babeTotalInstances})`
|
|
357
|
-
), (t.
|
|
358
|
-
`
|
|
357
|
+
), (t.maxVpCommissionBps < _ || t.maxVpCommissionBps >= S) && e.push(
|
|
358
|
+
`maxVpCommissionBps must be in [${_}, ${S}), got ${t.maxVpCommissionBps}`
|
|
359
359
|
), e.length > 0)
|
|
360
360
|
throw new Error(
|
|
361
361
|
`Invalid offchain protocol parameters: ${e.join("; ")}`
|
|
362
362
|
);
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function Vt(t) {
|
|
365
365
|
const e = [];
|
|
366
366
|
if (t.minimumPegInAmount <= 0n && e.push(
|
|
367
367
|
`minimumPegInAmount must be positive, got ${t.minimumPegInAmount}`
|
|
@@ -380,70 +380,70 @@ function St(t) {
|
|
|
380
380
|
), e.length > 0)
|
|
381
381
|
throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
if (
|
|
383
|
+
function Wt(t) {
|
|
384
|
+
if (Vt(t), St(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > C)
|
|
385
385
|
throw new Error(
|
|
386
386
|
`Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`
|
|
387
387
|
);
|
|
388
|
-
|
|
388
|
+
et(
|
|
389
389
|
t.activeVaultCoreVersion,
|
|
390
390
|
"ProtocolParams.activeVaultCoreVersion()"
|
|
391
391
|
);
|
|
392
392
|
}
|
|
393
|
-
const
|
|
394
|
-
class
|
|
393
|
+
const j = "RegistrationLogsUnavailableError";
|
|
394
|
+
class z extends Error {
|
|
395
395
|
/**
|
|
396
|
-
* `message` replaces the empty-answer wording
|
|
397
|
-
*
|
|
396
|
+
* `message` replaces the empty-answer wording when the block's logs arrived
|
|
397
|
+
* but none is for the vault asked for; the caller names that vault.
|
|
398
398
|
*/
|
|
399
399
|
constructor(n, o) {
|
|
400
400
|
super(
|
|
401
401
|
o ?? `The Ethereum node returned no registration logs for block ${n}, which holds a vault registration; the node may not have indexed that block yet. Try again.`
|
|
402
402
|
);
|
|
403
403
|
b(this, "blockNumber");
|
|
404
|
-
this.name =
|
|
404
|
+
this.name = j, this.blockNumber = n;
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
function
|
|
408
|
-
return t instanceof
|
|
407
|
+
function jt(t) {
|
|
408
|
+
return t instanceof z ? !0 : typeof t != "object" || t === null ? !1 : t.name === j;
|
|
409
409
|
}
|
|
410
|
-
const
|
|
411
|
-
function
|
|
410
|
+
const Nt = 2;
|
|
411
|
+
function zt(t, e, n) {
|
|
412
412
|
const o = e.toLowerCase(), i = t.find((u) => u.vaultId === o);
|
|
413
413
|
if (i === void 0)
|
|
414
|
-
throw new
|
|
414
|
+
throw new z(
|
|
415
415
|
n,
|
|
416
|
-
`Vault ${e} has no
|
|
416
|
+
`Vault ${e} has no PegInSubmitted registration log at its on-chain registration block ${n}: either the node served a partial answer for block ${n} (retry, preferably another node) or the vault was not registered in this block`
|
|
417
417
|
);
|
|
418
418
|
return i;
|
|
419
419
|
}
|
|
420
|
-
function zt(t) {
|
|
421
|
-
return Bt(t.unsignedPrePeginTx);
|
|
422
|
-
}
|
|
423
420
|
function Yt(t) {
|
|
424
|
-
|
|
421
|
+
return Rt(t.unsignedPrePeginTx);
|
|
422
|
+
}
|
|
423
|
+
function Gt(t) {
|
|
424
|
+
const e = (t.depositorPayoutScriptPubKey.length - Nt) / 2;
|
|
425
425
|
if (e === 0 || e > E)
|
|
426
426
|
throw new Error(
|
|
427
|
-
`
|
|
427
|
+
`PegInSubmitted log for vault ${t.vaultId} carries a ${e}-byte depositorPayoutBtcAddress; expected 1..${E} bytes`
|
|
428
428
|
);
|
|
429
429
|
}
|
|
430
430
|
export {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
431
|
+
z as R,
|
|
432
|
+
_t as V,
|
|
433
|
+
X as a,
|
|
434
|
+
Wt as b,
|
|
435
|
+
Vt as c,
|
|
436
436
|
Kt as d,
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
437
|
+
jt as e,
|
|
438
|
+
Gt as f,
|
|
439
|
+
zt as g,
|
|
440
|
+
Rt as h,
|
|
441
|
+
Xt as i,
|
|
442
|
+
Dt as j,
|
|
443
443
|
Ht as k,
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
444
|
+
mt as l,
|
|
445
|
+
Et as m,
|
|
446
|
+
Yt as r,
|
|
447
|
+
St as v
|
|
448
448
|
};
|
|
449
|
-
//# sourceMappingURL=registration-records-
|
|
449
|
+
//# sourceMappingURL=registration-records-D39ApuHS.js.map
|