@babylonlabs-io/ts-sdk 0.61.0 → 0.62.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/PeginManager-BgBt4hqp.cjs +2 -0
- package/dist/PeginManager-BgBt4hqp.cjs.map +1 -0
- package/dist/{PeginManager-C2vPVud-.js → PeginManager-C8kIl0gw.js} +79 -68
- package/dist/PeginManager-C8kIl0gw.js.map +1 -0
- package/dist/{batchPoll-C3eKPYOC.js → batchPoll-9w-Gv5dt.js} +2 -2
- package/dist/batchPoll-9w-Gv5dt.js.map +1 -0
- package/dist/{batchPoll-CbbCcNZP.cjs → batchPoll-WMXweT_O.cjs} +2 -2
- package/dist/batchPoll-WMXweT_O.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-CoPc7UHA.js → buildAndBroadcastRefund-CH2awK6h.js} +552 -447
- package/dist/buildAndBroadcastRefund-CH2awK6h.js.map +1 -0
- package/dist/buildAndBroadcastRefund-CYzhA_B8.cjs +2 -0
- package/dist/buildAndBroadcastRefund-CYzhA_B8.cjs.map +1 -0
- package/dist/errors-BxL9QObN.js +137 -0
- package/dist/errors-BxL9QObN.js.map +1 -0
- package/dist/errors-DwjbI9h1.cjs +2 -0
- package/dist/errors-DwjbI9h1.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +204 -193
- package/dist/{mempoolApi-DC7pID6B.js → mempoolApi-BXaOZL_I.js} +29 -53
- package/dist/mempoolApi-BXaOZL_I.js.map +1 -0
- package/dist/mempoolApi-Bsurcl43.cjs +2 -0
- package/dist/mempoolApi-Bsurcl43.cjs.map +1 -0
- package/dist/{noPayout-qUEtRKc_.cjs → noPayout-CbxQqBw1.cjs} +2 -2
- package/dist/{noPayout-qUEtRKc_.cjs.map → noPayout-CbxQqBw1.cjs.map} +1 -1
- package/dist/{noPayout-DuE-UyhQ.js → noPayout-oaUVsEjk.js} +2 -2
- package/dist/{noPayout-DuE-UyhQ.js.map → noPayout-oaUVsEjk.js.map} +1 -1
- package/dist/parseFundingOutpoints-CIO9Ok1L.cjs +2 -0
- package/dist/parseFundingOutpoints-CIO9Ok1L.cjs.map +1 -0
- package/dist/parseFundingOutpoints-pBRE11Hr.js +92 -0
- package/dist/parseFundingOutpoints-pBRE11Hr.js.map +1 -0
- package/dist/{signPsbtsWithFallback-eY1YgV13.js → signPsbtsWithFallback-DC4rUCsy.js} +5 -5
- package/dist/{signPsbtsWithFallback-eY1YgV13.js.map → signPsbtsWithFallback-DC4rUCsy.js.map} +1 -1
- package/dist/{signPsbtsWithFallback-Xs4jZw5z.cjs → signPsbtsWithFallback-DbOmw8Ou.cjs} +2 -2
- package/dist/{signPsbtsWithFallback-Xs4jZw5z.cjs.map → signPsbtsWithFallback-DbOmw8Ou.cjs.map} +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +0 -6
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +0 -6
- 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 +2 -2
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsCore.test.d.ts +16 -0
- package/dist/tbv/core/deposit-terms/__tests__/rebuildDepositTermsCore.test.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts +33 -0
- package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/index.d.ts +2 -0
- package/dist/tbv/core/deposit-terms/index.d.ts.map +1 -1
- package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts +36 -0
- package/dist/tbv/core/deposit-terms/rebuildDepositTermsCore.d.ts.map +1 -0
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +200 -189
- package/dist/tbv/core/managers/PeginManager.d.ts +8 -0
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/__tests__/PeginManager.rebuildDepositTerms.test.d.ts +12 -0
- package/dist/tbv/core/managers/__tests__/PeginManager.rebuildDepositTerms.test.d.ts.map +1 -0
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +2 -2
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts +3 -0
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/__tests__/peginRegistrationDepth.test.d.ts +2 -0
- package/dist/tbv/core/services/deposit/__tests__/peginRegistrationDepth.test.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/index.d.ts +1 -0
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/peginRegistrationDepth.d.ts +87 -0
- package/dist/tbv/core/services/deposit/peginRegistrationDepth.d.ts.map +1 -0
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +48 -42
- package/dist/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.d.ts +11 -0
- package/dist/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts +4 -0
- package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/index.cjs +1 -1
- package/dist/tbv/core/vault-secrets/index.d.ts +1 -1
- package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/index.js +9 -8
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +200 -189
- package/dist/{verifyScriptPathSchnorrSignature-CYjK4IP_.cjs → verifyScriptPathSchnorrSignature-B8zK1ctE.cjs} +2 -2
- package/dist/verifyScriptPathSchnorrSignature-B8zK1ctE.cjs.map +1 -0
- package/dist/{verifyScriptPathSchnorrSignature-Bav08_7R.js → verifyScriptPathSchnorrSignature-XsICweGG.js} +2 -1
- package/dist/verifyScriptPathSchnorrSignature-XsICweGG.js.map +1 -0
- package/dist/waitForTransactionReceiptSmartAware-AgZ-3WV_.cjs.map +1 -1
- package/dist/waitForTransactionReceiptSmartAware-lobLm0q0.js.map +1 -1
- package/package.json +1 -1
- package/dist/PeginManager-C2vPVud-.js.map +0 -1
- package/dist/PeginManager-Cu5Dh6L-.cjs +0 -2
- package/dist/PeginManager-Cu5Dh6L-.cjs.map +0 -1
- package/dist/batchPoll-C3eKPYOC.js.map +0 -1
- package/dist/batchPoll-CbbCcNZP.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-BqYlx6rb.cjs +0 -2
- package/dist/buildAndBroadcastRefund-BqYlx6rb.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-CoPc7UHA.js.map +0 -1
- package/dist/errors-2aF9oRwM.cjs +0 -2
- package/dist/errors-2aF9oRwM.cjs.map +0 -1
- package/dist/errors-kXGQXKxZ.js +0 -28
- package/dist/errors-kXGQXKxZ.js.map +0 -1
- package/dist/mempoolApi-BxhMqJ4f.cjs +0 -2
- package/dist/mempoolApi-BxhMqJ4f.cjs.map +0 -1
- package/dist/mempoolApi-DC7pID6B.js.map +0 -1
- package/dist/parseFundingOutpoints-DUuOAUjA.cjs +0 -2
- package/dist/parseFundingOutpoints-DUuOAUjA.cjs.map +0 -1
- package/dist/parseFundingOutpoints-deCXK7ft.js +0 -86
- package/dist/parseFundingOutpoints-deCXK7ft.js.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-Bav08_7R.js.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-CYjK4IP_.cjs.map +0 -1
|
@@ -9,17 +9,17 @@ import { isAddressEqual as lt, encodeFunctionData as Q, zeroAddress as zt } from
|
|
|
9
9
|
import { B as H } from "./BTCVaultRegistry.abi-B3BLhpJ4.js";
|
|
10
10
|
import { h as R } from "./errors-Blc-JWnI.js";
|
|
11
11
|
import { expandWotsSeed as Yt, expandHashlockSecret as jt, expandAuthAnchor as Qt, deriveVaultId as ut } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
12
|
-
import { a as ht, b as Zt, d as dt, f as Jt } from "./verifyScriptPathSchnorrSignature-
|
|
12
|
+
import { a as ht, b as Zt, d as dt, f as Jt } from "./verifyScriptPathSchnorrSignature-XsICweGG.js";
|
|
13
13
|
import { b as te, e as ee, f as se } from "./peginInput-HQPWZfly.js";
|
|
14
14
|
import { p as oe, h as Z, u as J, e as _, i as gt, s as E, k as ft, X as ne } from "./bitcoin-d9eaaZB_.js";
|
|
15
|
-
import {
|
|
16
|
-
import { c as ie } from "./signing-DaLvGwQe.js";
|
|
15
|
+
import { c as re } from "./signing-DaLvGwQe.js";
|
|
17
16
|
import { M as pt } from "./validation-Dj3dqYtl.js";
|
|
18
|
-
import { p as
|
|
19
|
-
import { c as
|
|
20
|
-
import { s as
|
|
21
|
-
import { p as
|
|
22
|
-
import {
|
|
17
|
+
import { p as ie, d as Ct } from "./parseFundingOutpoints-pBRE11Hr.js";
|
|
18
|
+
import { c as ae, b as ce, s as mt, d as le } from "./signPsbtsWithFallback-DC4rUCsy.js";
|
|
19
|
+
import { s as ue, f as X, i as he, w as bt } from "./waitForTransactionReceiptSmartAware-lobLm0q0.js";
|
|
20
|
+
import { p as de, f as ge } from "./fundPeginTransaction-B2wyjqp0.js";
|
|
21
|
+
import { M as D, B as fe } from "./constants-GjWXdaqV.js";
|
|
22
|
+
import { p as pe, V as me, i as be } from "./mempoolApi-BXaOZL_I.js";
|
|
23
23
|
const U = /* @__PURE__ */ BigInt(2 ** 32 - 1), Pt = /* @__PURE__ */ BigInt(32);
|
|
24
24
|
function Pe(s, e = !1) {
|
|
25
25
|
return e ? { h: Number(s & U), l: Number(s >> Pt & U) } : { h: Number(s >> Pt & U) | 0, l: Number(s & U) | 0 };
|
|
@@ -48,7 +48,7 @@ function Be(s) {
|
|
|
48
48
|
throw new Error(
|
|
49
49
|
`buildDepositTerms: maxAcceptableCommissionBps must be an integer in [0, ${D}), got ${s.maxAcceptableCommissionBps}`
|
|
50
50
|
);
|
|
51
|
-
const t = BigInt(
|
|
51
|
+
const t = BigInt(fe), o = s.peginAmounts.map(
|
|
52
52
|
(n, r) => ({
|
|
53
53
|
htlcVout: r,
|
|
54
54
|
vaultProviderBtcPubkey: s.vaultProviderBtcPubkey,
|
|
@@ -75,6 +75,17 @@ function Be(s) {
|
|
|
75
75
|
vaults: o
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
+
const tt = 25, _t = 9999;
|
|
79
|
+
function K(s) {
|
|
80
|
+
if (!Number.isInteger(s) || s < 0 || s >= D)
|
|
81
|
+
throw new Error(
|
|
82
|
+
`Quoted commissionBps must be an integer in [0, ${D}), got ${s}`
|
|
83
|
+
);
|
|
84
|
+
return Math.min(
|
|
85
|
+
s + tt,
|
|
86
|
+
_t
|
|
87
|
+
);
|
|
88
|
+
}
|
|
78
89
|
const Ee = /^0x[0-9a-f]+$/i, Ae = /^[0-9a-f]+$/i, Ce = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
79
90
|
function $(s) {
|
|
80
91
|
if (typeof s != "string" || s.length === 0)
|
|
@@ -120,7 +131,7 @@ async function Se(s) {
|
|
|
120
131
|
throw new Error(
|
|
121
132
|
"A deposit-approval wallet must also implement deriveContextHash, but this one does not."
|
|
122
133
|
);
|
|
123
|
-
const l =
|
|
134
|
+
const l = ie(o);
|
|
124
135
|
(await Ct(
|
|
125
136
|
{ deriveContextHash: e.deriveContextHash.bind(e) },
|
|
126
137
|
{
|
|
@@ -148,19 +159,19 @@ const Ie = /* @__PURE__ */ Uint8Array.from([
|
|
|
148
159
|
14,
|
|
149
160
|
11,
|
|
150
161
|
8
|
|
151
|
-
]),
|
|
152
|
-
const t = [[
|
|
162
|
+
]), St = Uint8Array.from(new Array(16).fill(0).map((s, e) => e)), He = St.map((s) => (9 * s + 5) % 16), It = /* @__PURE__ */ (() => {
|
|
163
|
+
const t = [[St], [He]];
|
|
153
164
|
for (let o = 0; o < 4; o++)
|
|
154
165
|
for (let n of t)
|
|
155
166
|
n.push(n[o].map((r) => Ie[r]));
|
|
156
167
|
return t;
|
|
157
|
-
})(),
|
|
168
|
+
})(), Ht = It[0], Rt = It[1], $t = /* @__PURE__ */ [
|
|
158
169
|
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
159
170
|
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
160
171
|
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
161
172
|
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
162
173
|
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
163
|
-
].map((s) => Uint8Array.from(s)), Re = /* @__PURE__ */
|
|
174
|
+
].map((s) => Uint8Array.from(s)), Re = /* @__PURE__ */ Ht.map((s, e) => s.map((t) => $t[e][t])), $e = /* @__PURE__ */ Rt.map((s, e) => s.map((t) => $t[e][t])), Oe = /* @__PURE__ */ Uint32Array.from([
|
|
164
175
|
0,
|
|
165
176
|
1518500249,
|
|
166
177
|
1859775393,
|
|
@@ -198,7 +209,7 @@ class Me extends Kt {
|
|
|
198
209
|
F[d] = t.getUint32(o, !0);
|
|
199
210
|
let n = this.h0 | 0, r = n, i = this.h1 | 0, a = i, c = this.h2 | 0, l = c, u = this.h3 | 0, m = u, P = this.h4 | 0, w = P;
|
|
200
211
|
for (let d = 0; d < 5; d++) {
|
|
201
|
-
const B = 4 - d, k = Oe[d], f = Ve[d], A =
|
|
212
|
+
const B = 4 - d, k = Oe[d], f = Ve[d], A = Ht[d], p = Rt[d], b = Re[d], T = $e[d];
|
|
202
213
|
for (let h = 0; h < 16; h++) {
|
|
203
214
|
const x = M(n + wt(d, i, c, u) + F[A[h]] + k, b[h]) + P | 0;
|
|
204
215
|
n = P, P = u, u = M(c, 10) | 0, c = i, i = x;
|
|
@@ -217,15 +228,15 @@ class Me extends Kt {
|
|
|
217
228
|
this.destroyed = !0, W(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
218
229
|
}
|
|
219
230
|
}
|
|
220
|
-
const Ue = /* @__PURE__ */ vt(() => new Me()), Fe = BigInt(0), V = BigInt(1), Ne = BigInt(2), We = BigInt(7), De = BigInt(256), Le = BigInt(113),
|
|
231
|
+
const Ue = /* @__PURE__ */ vt(() => new Me()), Fe = BigInt(0), V = BigInt(1), Ne = BigInt(2), We = BigInt(7), De = BigInt(256), Le = BigInt(113), Ot = [], Vt = [], Mt = [];
|
|
221
232
|
for (let s = 0, e = V, t = 1, o = 0; s < 24; s++) {
|
|
222
|
-
[t, o] = [o, (2 * t + 3 * o) % 5],
|
|
233
|
+
[t, o] = [o, (2 * t + 3 * o) % 5], Ot.push(2 * (5 * o + t)), Vt.push((s + 1) * (s + 2) / 2 % 64);
|
|
223
234
|
let n = Fe;
|
|
224
235
|
for (let r = 0; r < 7; r++)
|
|
225
236
|
e = (e << V ^ (e >> We) * Le) % De, e & Ne && (n ^= V << (V << BigInt(r)) - V);
|
|
226
|
-
|
|
237
|
+
Mt.push(n);
|
|
227
238
|
}
|
|
228
|
-
const
|
|
239
|
+
const Ut = we(Mt, !0), Xe = Ut[0], Ke = Ut[1], xt = (s, e, t) => t > 32 ? ke(s, e, t) : xe(s, e, t), yt = (s, e, t) => t > 32 ? Te(s, e, t) : ye(s, e, t);
|
|
229
240
|
function qe(s, e = 24) {
|
|
230
241
|
const t = new Uint32Array(10);
|
|
231
242
|
for (let o = 24 - e; o < 24; o++) {
|
|
@@ -238,7 +249,7 @@ function qe(s, e = 24) {
|
|
|
238
249
|
}
|
|
239
250
|
let n = s[2], r = s[3];
|
|
240
251
|
for (let i = 0; i < 24; i++) {
|
|
241
|
-
const a =
|
|
252
|
+
const a = Vt[i], c = xt(n, r, a), l = yt(n, r, a), u = Ot[i];
|
|
242
253
|
n = s[u], r = s[u + 1], s[u] = c, s[u + 1] = l;
|
|
243
254
|
}
|
|
244
255
|
for (let i = 0; i < 50; i += 10) {
|
|
@@ -327,11 +338,11 @@ class st {
|
|
|
327
338
|
return e || (e = new st(t, o, n, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = o, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
|
|
328
339
|
}
|
|
329
340
|
}
|
|
330
|
-
const Ge = (s, e, t, o = {}) => vt(() => new st(e, s, t), o), ze = /* @__PURE__ */ Ge(1, 136, 32), kt = 64, C = 20,
|
|
341
|
+
const Ge = (s, e, t, o = {}) => vt(() => new st(e, s, t), o), ze = /* @__PURE__ */ Ge(1, 136, 32), kt = 64, C = 20, et = 4, Ft = 2, Ye = 0, je = 1, N = [64, 64], Qe = (s) => Array.from(s).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
331
342
|
function ot(s) {
|
|
332
343
|
return Ue(Bt(s));
|
|
333
344
|
}
|
|
334
|
-
function
|
|
345
|
+
function Nt(s) {
|
|
335
346
|
return (1 << s) - 1;
|
|
336
347
|
}
|
|
337
348
|
function Ze(s) {
|
|
@@ -340,10 +351,10 @@ function Ze(s) {
|
|
|
340
351
|
return Math.max(e, 2);
|
|
341
352
|
}
|
|
342
353
|
function Je(s) {
|
|
343
|
-
const e =
|
|
354
|
+
const e = et, t = s * Nt(e);
|
|
344
355
|
return { d: e, n: s, checksum_radix: Ze(t) };
|
|
345
356
|
}
|
|
346
|
-
function
|
|
357
|
+
function q(s, e) {
|
|
347
358
|
const t = [];
|
|
348
359
|
let o = e;
|
|
349
360
|
for (; o > 0; )
|
|
@@ -354,28 +365,28 @@ function K(s, e) {
|
|
|
354
365
|
n[s.length + r] = t[r];
|
|
355
366
|
return ot(n);
|
|
356
367
|
}
|
|
357
|
-
function
|
|
368
|
+
function G(s, e) {
|
|
358
369
|
let t = s;
|
|
359
370
|
for (let o = 0; o < e; o++)
|
|
360
371
|
t = ot(t);
|
|
361
372
|
return t;
|
|
362
373
|
}
|
|
363
374
|
function ts(s, e) {
|
|
364
|
-
const t =
|
|
375
|
+
const t = Nt(e.d), o = e.checksum_radix - 1, n = Math.floor(e.n * t / e.checksum_radix), r = [];
|
|
365
376
|
for (let u = 0; u < e.n; u++) {
|
|
366
|
-
const m =
|
|
377
|
+
const m = q(s, u + Ft), P = G(m, t);
|
|
367
378
|
r.push(Array.from(P));
|
|
368
379
|
}
|
|
369
|
-
const i =
|
|
380
|
+
const i = q(
|
|
370
381
|
s,
|
|
371
382
|
Ye
|
|
372
|
-
), a =
|
|
383
|
+
), a = G(
|
|
373
384
|
i,
|
|
374
385
|
o
|
|
375
|
-
), c =
|
|
386
|
+
), c = q(
|
|
376
387
|
s,
|
|
377
388
|
je
|
|
378
|
-
), l =
|
|
389
|
+
), l = G(
|
|
379
390
|
c,
|
|
380
391
|
n
|
|
381
392
|
);
|
|
@@ -399,9 +410,9 @@ async function es(s) {
|
|
|
399
410
|
const i = ot(r);
|
|
400
411
|
try {
|
|
401
412
|
const a = ts(i, n);
|
|
402
|
-
if (a.config.d !==
|
|
413
|
+
if (a.config.d !== et)
|
|
403
414
|
throw new Error(
|
|
404
|
-
`Block ${t}: expected d=${
|
|
415
|
+
`Block ${t}: expected d=${et}, got d=${a.config.d}`
|
|
405
416
|
);
|
|
406
417
|
if (a.config.n !== o)
|
|
407
418
|
throw new Error(
|
|
@@ -438,7 +449,7 @@ async function es(s) {
|
|
|
438
449
|
s.fill(0);
|
|
439
450
|
}
|
|
440
451
|
}
|
|
441
|
-
function
|
|
452
|
+
function z(s, e, t) {
|
|
442
453
|
if (s.length !== C)
|
|
443
454
|
throw new Error(
|
|
444
455
|
`Block ${e} ${t}: expected ${C} bytes, got ${s.length}`
|
|
@@ -456,13 +467,13 @@ function ss(s) {
|
|
|
456
467
|
throw new Error("Public keys array must not be empty");
|
|
457
468
|
for (let r = 0; r < s.length; r++) {
|
|
458
469
|
const i = s[r];
|
|
459
|
-
|
|
470
|
+
z(i.checksum_minor_terminal, r, "checksum_minor_terminal"), z(i.checksum_major_terminal, r, "checksum_major_terminal");
|
|
460
471
|
for (let a = 0; a < i.message_terminals.length; a++)
|
|
461
|
-
|
|
472
|
+
z(i.message_terminals[a], r, `message_terminal[${a}]`);
|
|
462
473
|
}
|
|
463
474
|
let e = 0;
|
|
464
475
|
for (const r of s)
|
|
465
|
-
e +=
|
|
476
|
+
e += Ft + r.message_terminals.length;
|
|
466
477
|
const t = new Uint8Array(e * C);
|
|
467
478
|
let o = 0;
|
|
468
479
|
for (const r of s) {
|
|
@@ -487,7 +498,7 @@ async function os(s, e) {
|
|
|
487
498
|
const c = await jt(s, i);
|
|
488
499
|
try {
|
|
489
500
|
const l = J(c);
|
|
490
|
-
n.push(l), r.push(
|
|
501
|
+
n.push(l), r.push(ae(_(l)).slice(2));
|
|
491
502
|
} finally {
|
|
492
503
|
c.fill(0);
|
|
493
504
|
}
|
|
@@ -497,18 +508,7 @@ async function os(s, e) {
|
|
|
497
508
|
}
|
|
498
509
|
return { perVaultWotsKeys: t, wotsPkHashes: o, htlcSecretHexes: n, hashlocks: r };
|
|
499
510
|
}
|
|
500
|
-
const
|
|
501
|
-
function z(s) {
|
|
502
|
-
if (!Number.isInteger(s) || s < 0 || s >= D)
|
|
503
|
-
throw new Error(
|
|
504
|
-
`Quoted commissionBps must be an integer in [0, ${D}), got ${s}`
|
|
505
|
-
);
|
|
506
|
-
return Math.min(
|
|
507
|
-
s + et,
|
|
508
|
-
Wt
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
const Y = "00".repeat(32);
|
|
511
|
+
const Wt = 0, Y = "00".repeat(32);
|
|
512
512
|
function ns(s, e) {
|
|
513
513
|
const t = {
|
|
514
514
|
bitcoin: "bc",
|
|
@@ -598,7 +598,7 @@ class Is {
|
|
|
598
598
|
throw new Error(
|
|
599
599
|
`Internal invariant violation: htlcVout/index mismatch at vault ${f} (expected ${f}, got ${d.perVault[f].htlcVout})`
|
|
600
600
|
);
|
|
601
|
-
|
|
601
|
+
ce(
|
|
602
602
|
d.fundedPrePeginTxHex,
|
|
603
603
|
e.amounts.length,
|
|
604
604
|
c
|
|
@@ -656,11 +656,11 @@ class Is {
|
|
|
656
656
|
councilSize: t.councilSize,
|
|
657
657
|
network: this.config.btcNetwork,
|
|
658
658
|
authAnchorHash: Y
|
|
659
|
-
}), i =
|
|
659
|
+
}), i = ue(
|
|
660
660
|
[...t.availableUTXOs],
|
|
661
661
|
r.totalOutputValue,
|
|
662
662
|
t.mempoolFeeRate,
|
|
663
|
-
|
|
663
|
+
de(r.htlcValues.length, !0)
|
|
664
664
|
);
|
|
665
665
|
return {
|
|
666
666
|
selectedUTXOs: i.selectedUTXOs,
|
|
@@ -705,7 +705,7 @@ class Is {
|
|
|
705
705
|
councilSize: a.councilSize,
|
|
706
706
|
network: this.config.btcNetwork,
|
|
707
707
|
authAnchorHash: r
|
|
708
|
-
}, d = await ht(w), B = ft(this.config.btcNetwork), k =
|
|
708
|
+
}, d = await ht(w), B = ft(this.config.btcNetwork), k = ge({
|
|
709
709
|
unfundedTxHex: d.psbtHex,
|
|
710
710
|
selectedUTXOs: i.selectedUTXOs,
|
|
711
711
|
changeAddress: a.changeAddress,
|
|
@@ -738,7 +738,7 @@ class Is {
|
|
|
738
738
|
network: this.config.btcNetwork
|
|
739
739
|
});
|
|
740
740
|
p.push(v), b.push(I.psbtHex), T.push(
|
|
741
|
-
|
|
741
|
+
re(t, 1)
|
|
742
742
|
);
|
|
743
743
|
}
|
|
744
744
|
const h = Be({
|
|
@@ -752,7 +752,7 @@ class Is {
|
|
|
752
752
|
vaultProviderBtcPubkey: l,
|
|
753
753
|
vaultKeeperBtcPubkeys: u,
|
|
754
754
|
universalChallengerBtcPubkeys: m,
|
|
755
|
-
maxAcceptableCommissionBps:
|
|
755
|
+
maxAcceptableCommissionBps: K(
|
|
756
756
|
a.commissionBps
|
|
757
757
|
),
|
|
758
758
|
peginAmounts: a.amounts,
|
|
@@ -760,7 +760,7 @@ class Is {
|
|
|
760
760
|
peginMaxFee: d.minPeginFee
|
|
761
761
|
});
|
|
762
762
|
mt(this.config.btcWallet) && await this.config.btcWallet.approveDepositTerms(h);
|
|
763
|
-
const x = await
|
|
763
|
+
const x = await le(
|
|
764
764
|
this.config.btcWallet,
|
|
765
765
|
b,
|
|
766
766
|
T
|
|
@@ -808,6 +808,14 @@ class Is {
|
|
|
808
808
|
* 5. Finalizes and extracts the transaction
|
|
809
809
|
* 6. Broadcasts via mempool API
|
|
810
810
|
*
|
|
811
|
+
* IMPORTANT — this method does NOT gate on Ethereum finality. Committing
|
|
812
|
+
* BTC to the HTLC while the peg-in registration is still reorg-exposed can
|
|
813
|
+
* strand the deposit: the vault record disappears from the chain while the
|
|
814
|
+
* BTC stays locked until the HTLC refund timelock. Callers must await
|
|
815
|
+
* `waitForPeginRegistrationDepth` for the registered vault(s) before calling
|
|
816
|
+
* this. The gate is not applied here because the params carry no vault ID —
|
|
817
|
+
* adding one would be a breaking signature change.
|
|
818
|
+
*
|
|
811
819
|
* @param params - Transaction hex and depositor public key
|
|
812
820
|
* @returns The broadcasted Bitcoin transaction ID
|
|
813
821
|
* @throws Error if signing or broadcasting fails
|
|
@@ -843,7 +851,7 @@ class Is {
|
|
|
843
851
|
`Implied transaction fee (${w} sat) exceeds maximum reasonable fee (${pt} sat). This may indicate manipulated UTXO data.`
|
|
844
852
|
);
|
|
845
853
|
for (const { input: p, utxoData: b, txid: T, vout: h } of u) {
|
|
846
|
-
const x =
|
|
854
|
+
const x = he(
|
|
847
855
|
{
|
|
848
856
|
value: b.value,
|
|
849
857
|
scriptPubKey: b.scriptPubKey
|
|
@@ -1086,7 +1094,7 @@ class Is {
|
|
|
1086
1094
|
),
|
|
1087
1095
|
hashlock: h.hashlock,
|
|
1088
1096
|
htlcVout: h.htlcVout,
|
|
1089
|
-
referralCode:
|
|
1097
|
+
referralCode: Wt,
|
|
1090
1098
|
depositorPayoutBtcAddress: l[x],
|
|
1091
1099
|
depositorWotsPkHash: h.depositorWotsPkHash
|
|
1092
1100
|
})), A = Q({
|
|
@@ -1158,13 +1166,13 @@ class Is {
|
|
|
1158
1166
|
);
|
|
1159
1167
|
}
|
|
1160
1168
|
if (t !== void 0) {
|
|
1161
|
-
if (o > t +
|
|
1169
|
+
if (o > t + tt)
|
|
1162
1170
|
throw new Error(
|
|
1163
|
-
`Vault provider commission changed since quote: quoted ${t} bps, chain currently reports ${o} bps (allowed drift ${
|
|
1171
|
+
`Vault provider commission changed since quote: quoted ${t} bps, chain currently reports ${o} bps (allowed drift ${tt} bps). Please refresh to see the new commission and try again.`
|
|
1164
1172
|
);
|
|
1165
|
-
return
|
|
1173
|
+
return K(t);
|
|
1166
1174
|
}
|
|
1167
|
-
return
|
|
1175
|
+
return K(o);
|
|
1168
1176
|
}
|
|
1169
1177
|
/**
|
|
1170
1178
|
* Check if a vault already exists for a given vault ID.
|
|
@@ -1294,7 +1302,7 @@ function hs(s, e) {
|
|
|
1294
1302
|
),
|
|
1295
1303
|
hashlock: t(32),
|
|
1296
1304
|
htlcVout: e,
|
|
1297
|
-
referralCode:
|
|
1305
|
+
referralCode: Wt,
|
|
1298
1306
|
depositorPayoutBtcAddress: t(ls),
|
|
1299
1307
|
depositorWotsPkHash: t(32)
|
|
1300
1308
|
};
|
|
@@ -1325,7 +1333,7 @@ async function Hs(s) {
|
|
|
1325
1333
|
args: [
|
|
1326
1334
|
o,
|
|
1327
1335
|
n,
|
|
1328
|
-
|
|
1336
|
+
_t,
|
|
1329
1337
|
c
|
|
1330
1338
|
]
|
|
1331
1339
|
});
|
|
@@ -1337,11 +1345,14 @@ async function Hs(s) {
|
|
|
1337
1345
|
});
|
|
1338
1346
|
}
|
|
1339
1347
|
export {
|
|
1348
|
+
tt as C,
|
|
1349
|
+
_t as M,
|
|
1340
1350
|
Is as P,
|
|
1341
|
-
|
|
1351
|
+
K as a,
|
|
1342
1352
|
Be as b,
|
|
1343
1353
|
ss as c,
|
|
1344
1354
|
es as d,
|
|
1345
|
-
Hs as e
|
|
1355
|
+
Hs as e,
|
|
1356
|
+
Se as f
|
|
1346
1357
|
};
|
|
1347
|
-
//# sourceMappingURL=PeginManager-
|
|
1358
|
+
//# sourceMappingURL=PeginManager-C8kIl0gw.js.map
|