@babylonlabs-io/ts-sdk 0.21.0 → 0.23.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/{buildAndBroadcastRefund-DWEQvj9T.cjs → buildAndBroadcastRefund-BDGGbGeK.cjs} +2 -2
- package/dist/buildAndBroadcastRefund-BDGGbGeK.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-DnTQkCgG.js → buildAndBroadcastRefund-D7NCbgtv.js} +79 -77
- package/dist/buildAndBroadcastRefund-D7NCbgtv.js.map +1 -0
- package/dist/errors-BcpQEG62.cjs +2 -0
- package/dist/errors-BcpQEG62.cjs.map +1 -0
- package/dist/errors-D3a9XcIX.js +1275 -0
- package/dist/errors-D3a9XcIX.js.map +1 -0
- package/dist/{index-DNSV--0P.cjs → index-BAECy2oz.cjs} +2 -2
- package/dist/{index-DNSV--0P.cjs.map → index-BAECy2oz.cjs.map} +1 -1
- package/dist/{index-BORWfdUU.js → index-DLtpqdlu.js} +3 -2
- package/dist/{index-BORWfdUU.js.map → index-DLtpqdlu.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +36 -35
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +16 -15
- package/dist/tbv/core/clients/vault-provider/index.d.ts +1 -1
- package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +34 -33
- package/dist/tbv/core/managers/PayoutManager.d.ts +1 -1
- package/dist/tbv/core/managers/PeginManager.d.ts +57 -51
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.d.ts +7 -6
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +1 -1
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +5 -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 +34 -33
- package/dist/testing/MockBitcoinWallet.d.ts +2 -2
- package/dist/testing/MockBitcoinWallet.d.ts.map +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +14 -14
- package/dist/testing/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/buildAndBroadcastRefund-DWEQvj9T.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-DnTQkCgG.js.map +0 -1
- package/dist/errors-Cbyg_QQf.cjs +0 -2
- package/dist/errors-Cbyg_QQf.cjs.map +0 -1
- package/dist/errors-DvIudLXV.js +0 -1232
- package/dist/errors-DvIudLXV.js.map +0 -1
|
@@ -2,13 +2,13 @@ var ke = Object.defineProperty;
|
|
|
2
2
|
var Be = (e, t, r) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var f = (e, t, r) => Be(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { B as He, c as _e, a as Ie, R as Ce, d as be, D as O } from "./types-DWjaqVfP.js";
|
|
5
|
-
import { v as ne, b as Le, s as
|
|
5
|
+
import { v as ne, b as Le, s as w, e as $e, p as M, f as L } from "./bitcoin-nOOgeRyl.js";
|
|
6
6
|
import * as Re from "bitcoinjs-lib";
|
|
7
7
|
import { Transaction as Oe, Psbt as ee } from "bitcoinjs-lib";
|
|
8
8
|
import { Buffer as xe } from "buffer";
|
|
9
|
-
import { c as
|
|
9
|
+
import { c as G } from "./signing-DeWVBl7m.js";
|
|
10
10
|
import "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
11
|
-
import { a as se, e as
|
|
11
|
+
import { a as se, e as W, b as Ne } from "./payout-DzGsAnhf.js";
|
|
12
12
|
class Ue {
|
|
13
13
|
/**
|
|
14
14
|
* Creates a new PayoutManager instance.
|
|
@@ -61,10 +61,10 @@ class Ue {
|
|
|
61
61
|
network: this.config.network
|
|
62
62
|
}), c = await this.config.btcWallet.signPsbt(
|
|
63
63
|
s.psbtHex,
|
|
64
|
-
|
|
64
|
+
G(r, 1)
|
|
65
65
|
);
|
|
66
66
|
return {
|
|
67
|
-
signature:
|
|
67
|
+
signature: W(c, n),
|
|
68
68
|
depositorBtcPubkey: n
|
|
69
69
|
};
|
|
70
70
|
}
|
|
@@ -120,7 +120,7 @@ class Ue {
|
|
|
120
120
|
timelockPegin: o.timelockPegin,
|
|
121
121
|
network: this.config.network
|
|
122
122
|
});
|
|
123
|
-
n.push(h.psbtHex), s.push(
|
|
123
|
+
n.push(h.psbtHex), s.push(G(r, 1));
|
|
124
124
|
}
|
|
125
125
|
const a = await this.config.btcWallet.signPsbts(
|
|
126
126
|
n,
|
|
@@ -132,7 +132,7 @@ class Ue {
|
|
|
132
132
|
);
|
|
133
133
|
const i = [];
|
|
134
134
|
for (let o = 0; o < t.length; o++) {
|
|
135
|
-
const u = c[o], h =
|
|
135
|
+
const u = c[o], h = W(
|
|
136
136
|
a[o],
|
|
137
137
|
u
|
|
138
138
|
);
|
|
@@ -163,9 +163,9 @@ class Ue {
|
|
|
163
163
|
"Invalid registeredPayoutScriptPubKey: not valid hex"
|
|
164
164
|
);
|
|
165
165
|
const n = xe.from(
|
|
166
|
-
|
|
166
|
+
w(r),
|
|
167
167
|
"hex"
|
|
168
|
-
), s = Oe.fromHex(
|
|
168
|
+
), s = Oe.fromHex(w(t));
|
|
169
169
|
if (s.outs.length === 0)
|
|
170
170
|
throw new Error("Payout transaction has no outputs");
|
|
171
171
|
if (!s.outs.reduce(
|
|
@@ -217,7 +217,7 @@ function N(...e) {
|
|
|
217
217
|
for (let t = 0; t < e.length; t++)
|
|
218
218
|
e[t].fill(0);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function q(e) {
|
|
221
221
|
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
222
222
|
}
|
|
223
223
|
function m(e, t) {
|
|
@@ -275,7 +275,7 @@ class ye {
|
|
|
275
275
|
f(this, "length", 0);
|
|
276
276
|
f(this, "pos", 0);
|
|
277
277
|
f(this, "destroyed", !1);
|
|
278
|
-
this.blockLen = t, this.outputLen = r, this.padOffset = n, this.isLE = s, this.buffer = new Uint8Array(t), this.view =
|
|
278
|
+
this.blockLen = t, this.outputLen = r, this.padOffset = n, this.isLE = s, this.buffer = new Uint8Array(t), this.view = q(this.buffer);
|
|
279
279
|
}
|
|
280
280
|
update(t) {
|
|
281
281
|
ie(this), te(t);
|
|
@@ -283,7 +283,7 @@ class ye {
|
|
|
283
283
|
for (let a = 0; a < c; ) {
|
|
284
284
|
const i = Math.min(s - this.pos, c - a);
|
|
285
285
|
if (i === s) {
|
|
286
|
-
const o =
|
|
286
|
+
const o = q(t);
|
|
287
287
|
for (; s <= c - a; a += s)
|
|
288
288
|
this.process(o, a);
|
|
289
289
|
continue;
|
|
@@ -300,7 +300,7 @@ class ye {
|
|
|
300
300
|
for (let l = a; l < s; l++)
|
|
301
301
|
r[l] = 0;
|
|
302
302
|
n.setBigUint64(s - 8, BigInt(this.length * 8), c), this.process(n, 0);
|
|
303
|
-
const i =
|
|
303
|
+
const i = q(t), o = this.outputLen;
|
|
304
304
|
if (o % 4)
|
|
305
305
|
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
306
306
|
const u = o / 4, h = this.get();
|
|
@@ -333,7 +333,7 @@ const B = /* @__PURE__ */ Uint32Array.from([
|
|
|
333
333
|
2600822924,
|
|
334
334
|
528734635,
|
|
335
335
|
1541459225
|
|
336
|
-
]),
|
|
336
|
+
]), P = /* @__PURE__ */ Uint32Array.from([
|
|
337
337
|
1779033703,
|
|
338
338
|
4089235720,
|
|
339
339
|
3144134277,
|
|
@@ -570,28 +570,28 @@ class it extends ye {
|
|
|
570
570
|
}
|
|
571
571
|
// prettier-ignore
|
|
572
572
|
get() {
|
|
573
|
-
const { Ah: t, Al: r, Bh: n, Bl: s, Ch: c, Cl: a, Dh: i, Dl: o, Eh: u, El: h, Fh: l, Fl: d, Gh: x, Gl: y, Hh: p, Hl:
|
|
574
|
-
return [t, r, n, s, c, a, i, o, u, h, l, d, x, y, p,
|
|
573
|
+
const { Ah: t, Al: r, Bh: n, Bl: s, Ch: c, Cl: a, Dh: i, Dl: o, Eh: u, El: h, Fh: l, Fl: d, Gh: x, Gl: y, Hh: p, Hl: g } = this;
|
|
574
|
+
return [t, r, n, s, c, a, i, o, u, h, l, d, x, y, p, g];
|
|
575
575
|
}
|
|
576
576
|
// prettier-ignore
|
|
577
|
-
set(t, r, n, s, c, a, i, o, u, h, l, d, x, y, p,
|
|
578
|
-
this.Ah = t | 0, this.Al = r | 0, this.Bh = n | 0, this.Bl = s | 0, this.Ch = c | 0, this.Cl = a | 0, this.Dh = i | 0, this.Dl = o | 0, this.Eh = u | 0, this.El = h | 0, this.Fh = l | 0, this.Fl = d | 0, this.Gh = x | 0, this.Gl = y | 0, this.Hh = p | 0, this.Hl =
|
|
577
|
+
set(t, r, n, s, c, a, i, o, u, h, l, d, x, y, p, g) {
|
|
578
|
+
this.Ah = t | 0, this.Al = r | 0, this.Bh = n | 0, this.Bl = s | 0, this.Ch = c | 0, this.Cl = a | 0, this.Dh = i | 0, this.Dl = o | 0, this.Eh = u | 0, this.El = h | 0, this.Fh = l | 0, this.Fl = d | 0, this.Gh = x | 0, this.Gl = y | 0, this.Hh = p | 0, this.Hl = g | 0;
|
|
579
579
|
}
|
|
580
580
|
process(t, r) {
|
|
581
581
|
for (let b = 0; b < 16; b++, r += 4)
|
|
582
582
|
_[b] = t.getUint32(r), I[b] = t.getUint32(r += 4);
|
|
583
583
|
for (let b = 16; b < 80; b++) {
|
|
584
|
-
const v = _[b - 15] | 0, k = I[b - 15] | 0,
|
|
585
|
-
_[b] =
|
|
584
|
+
const v = _[b - 15] | 0, k = I[b - 15] | 0, z = $(v, k, 1) ^ $(v, k, 8) ^ ce(v, k, 7), X = R(v, k, 1) ^ R(v, k, 8) ^ ue(v, k, 7), E = _[b - 2] | 0, T = I[b - 2] | 0, U = $(E, T, 19) ^ F(E, T, 61) ^ ce(E, T, 6), j = R(E, T, 19) ^ K(E, T, 61) ^ ue(E, T, 6), D = Qe(X, j, I[b - 7], I[b - 16]), Y = Je(D, z, U, _[b - 7], _[b - 16]);
|
|
585
|
+
_[b] = Y | 0, I[b] = D | 0;
|
|
586
586
|
}
|
|
587
|
-
let { Ah: n, Al: s, Bh: c, Bl: a, Ch: i, Cl: o, Dh: u, Dl: h, Eh: l, El: d, Fh: x, Fl: y, Gh: p, Gl:
|
|
587
|
+
let { Ah: n, Al: s, Bh: c, Bl: a, Ch: i, Cl: o, Dh: u, Dl: h, Eh: l, El: d, Fh: x, Fl: y, Gh: p, Gl: g, Hh: A, Hl: C } = this;
|
|
588
588
|
for (let b = 0; b < 80; b++) {
|
|
589
|
-
const v = $(l, d, 14) ^ $(l, d, 18) ^ F(l, d, 41), k = R(l, d, 14) ^ R(l, d, 18) ^ K(l, d, 41),
|
|
590
|
-
A = p | 0, C =
|
|
589
|
+
const v = $(l, d, 14) ^ $(l, d, 18) ^ F(l, d, 41), k = R(l, d, 14) ^ R(l, d, 18) ^ K(l, d, 41), z = l & x ^ ~l & p, X = d & y ^ ~d & g, E = Ze(C, k, X, ot[b], I[b]), T = et(E, A, v, z, st[b], _[b]), U = E | 0, j = $(n, s, 28) ^ F(n, s, 34) ^ F(n, s, 39), D = R(n, s, 28) ^ K(n, s, 34) ^ K(n, s, 39), Y = n & c ^ n & i ^ c & i, ve = s & a ^ s & o ^ a & o;
|
|
590
|
+
A = p | 0, C = g | 0, p = x | 0, g = y | 0, x = l | 0, y = d | 0, { h: l, l: d } = S(u | 0, h | 0, T | 0, U | 0), u = i | 0, h = o | 0, i = c | 0, o = a | 0, c = n | 0, a = s | 0;
|
|
591
591
|
const re = Ye(U, D, ve);
|
|
592
|
-
n = qe(re, T,
|
|
592
|
+
n = qe(re, T, j, Y), s = re | 0;
|
|
593
593
|
}
|
|
594
|
-
({ h: n, l: s } = S(this.Ah | 0, this.Al | 0, n | 0, s | 0)), { h: c, l: a } = S(this.Bh | 0, this.Bl | 0, c | 0, a | 0), { h: i, l: o } = S(this.Ch | 0, this.Cl | 0, i | 0, o | 0), { h: u, l: h } = S(this.Dh | 0, this.Dl | 0, u | 0, h | 0), { h: l, l: d } = S(this.Eh | 0, this.El | 0, l | 0, d | 0), { h: x, l: y } = S(this.Fh | 0, this.Fl | 0, x | 0, y | 0), { h: p, l:
|
|
594
|
+
({ h: n, l: s } = S(this.Ah | 0, this.Al | 0, n | 0, s | 0)), { h: c, l: a } = S(this.Bh | 0, this.Bl | 0, c | 0, a | 0), { h: i, l: o } = S(this.Ch | 0, this.Cl | 0, i | 0, o | 0), { h: u, l: h } = S(this.Dh | 0, this.Dl | 0, u | 0, h | 0), { h: l, l: d } = S(this.Eh | 0, this.El | 0, l | 0, d | 0), { h: x, l: y } = S(this.Fh | 0, this.Fl | 0, x | 0, y | 0), { h: p, l: g } = S(this.Gh | 0, this.Gl | 0, p | 0, g | 0), { h: A, l: C } = S(this.Hh | 0, this.Hl | 0, A | 0, C | 0), this.set(n, s, c, a, i, o, u, h, l, d, x, y, p, g, A, C);
|
|
595
595
|
}
|
|
596
596
|
roundClean() {
|
|
597
597
|
N(_, I);
|
|
@@ -603,22 +603,22 @@ class it extends ye {
|
|
|
603
603
|
class at extends it {
|
|
604
604
|
constructor() {
|
|
605
605
|
super(64);
|
|
606
|
-
f(this, "Ah",
|
|
607
|
-
f(this, "Al",
|
|
608
|
-
f(this, "Bh",
|
|
609
|
-
f(this, "Bl",
|
|
610
|
-
f(this, "Ch",
|
|
611
|
-
f(this, "Cl",
|
|
612
|
-
f(this, "Dh",
|
|
613
|
-
f(this, "Dl",
|
|
614
|
-
f(this, "Eh",
|
|
615
|
-
f(this, "El",
|
|
616
|
-
f(this, "Fh",
|
|
617
|
-
f(this, "Fl",
|
|
618
|
-
f(this, "Gh",
|
|
619
|
-
f(this, "Gl",
|
|
620
|
-
f(this, "Hh",
|
|
621
|
-
f(this, "Hl",
|
|
606
|
+
f(this, "Ah", P[0] | 0);
|
|
607
|
+
f(this, "Al", P[1] | 0);
|
|
608
|
+
f(this, "Bh", P[2] | 0);
|
|
609
|
+
f(this, "Bl", P[3] | 0);
|
|
610
|
+
f(this, "Ch", P[4] | 0);
|
|
611
|
+
f(this, "Cl", P[5] | 0);
|
|
612
|
+
f(this, "Dh", P[6] | 0);
|
|
613
|
+
f(this, "Dl", P[7] | 0);
|
|
614
|
+
f(this, "Eh", P[8] | 0);
|
|
615
|
+
f(this, "El", P[9] | 0);
|
|
616
|
+
f(this, "Fh", P[10] | 0);
|
|
617
|
+
f(this, "Fl", P[11] | 0);
|
|
618
|
+
f(this, "Gh", P[12] | 0);
|
|
619
|
+
f(this, "Gl", P[13] | 0);
|
|
620
|
+
f(this, "Hh", P[14] | 0);
|
|
621
|
+
f(this, "Hl", P[15] | 0);
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
624
|
const ct = /* @__PURE__ */ pe(
|
|
@@ -659,7 +659,7 @@ function ft(e, t) {
|
|
|
659
659
|
return Z(e, "Secret"), Z(t, "Hashlock"), Pe(t), lt(e).toLowerCase() === t.toLowerCase();
|
|
660
660
|
}
|
|
661
661
|
const ht = /^0x[0-9a-fA-F]{64}$/, dt = /^0x[0-9a-fA-F]{40}$/, bt = /^0x([0-9a-fA-F]{2})*$/;
|
|
662
|
-
function
|
|
662
|
+
function Q(e, t) {
|
|
663
663
|
if (e.length !== 66)
|
|
664
664
|
throw new Error(
|
|
665
665
|
`${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
|
|
@@ -690,9 +690,9 @@ async function br(e) {
|
|
|
690
690
|
writeContract: c,
|
|
691
691
|
signal: a
|
|
692
692
|
} = e;
|
|
693
|
-
a == null || a.throwIfAborted(), xt(t, "btcVaultRegistryAddress"),
|
|
693
|
+
a == null || a.throwIfAborted(), xt(t, "btcVaultRegistryAddress"), Q(r, "vaultId");
|
|
694
694
|
const i = $e(e.secret);
|
|
695
|
-
if (
|
|
695
|
+
if (Q(i, "secret"), n !== void 0 && (Q(n, "hashlock"), !ft(i, n)))
|
|
696
696
|
throw new Error(
|
|
697
697
|
"Invalid secret: SHA256(secret) does not match the provided hashlock"
|
|
698
698
|
);
|
|
@@ -784,7 +784,7 @@ async function xr(e) {
|
|
|
784
784
|
}
|
|
785
785
|
const Pt = 1;
|
|
786
786
|
function mt(e, t, r) {
|
|
787
|
-
const n = ee.fromBase64(e), s = n.data.getTransaction().toString("hex").toLowerCase(), c =
|
|
787
|
+
const n = ee.fromBase64(e), s = n.data.getTransaction().toString("hex").toLowerCase(), c = w(t).toLowerCase();
|
|
788
788
|
if (s !== c)
|
|
789
789
|
throw new Error(
|
|
790
790
|
`PSBT integrity check failed for ${r}: unsigned transaction does not match tx_hex`
|
|
@@ -804,7 +804,7 @@ function fe(e, t, r) {
|
|
|
804
804
|
return Et(n).toHex();
|
|
805
805
|
}
|
|
806
806
|
function Tt(e, t) {
|
|
807
|
-
const r = [], n = [], s = [], c =
|
|
807
|
+
const r = [], n = [], s = [], c = G(
|
|
808
808
|
t,
|
|
809
809
|
Pt
|
|
810
810
|
), a = fe(
|
|
@@ -814,7 +814,7 @@ function Tt(e, t) {
|
|
|
814
814
|
);
|
|
815
815
|
r.push(a), n.push(c);
|
|
816
816
|
for (const i of e.challenger_presign_data) {
|
|
817
|
-
const o =
|
|
817
|
+
const o = w(i.challenger_pubkey), u = r.length, h = fe(
|
|
818
818
|
i.nopayout_psbt,
|
|
819
819
|
i.nopayout_tx.tx_hex,
|
|
820
820
|
`nopayout (challenger ${o})`
|
|
@@ -827,13 +827,13 @@ function Tt(e, t) {
|
|
|
827
827
|
return { psbtHexes: r, signOptions: n, challengerEntries: s };
|
|
828
828
|
}
|
|
829
829
|
function St(e, t, r) {
|
|
830
|
-
const n =
|
|
830
|
+
const n = W(
|
|
831
831
|
e[0],
|
|
832
832
|
r
|
|
833
833
|
), s = {};
|
|
834
834
|
for (const c of t)
|
|
835
835
|
s[c.challengerPubkey] = {
|
|
836
|
-
nopayout_signature:
|
|
836
|
+
nopayout_signature: W(
|
|
837
837
|
e[c.noPayoutIdx],
|
|
838
838
|
r
|
|
839
839
|
)
|
|
@@ -854,7 +854,7 @@ async function At(e, t, r) {
|
|
|
854
854
|
return n;
|
|
855
855
|
}
|
|
856
856
|
async function vt(e) {
|
|
857
|
-
const { depositorGraph: t, depositorBtcPubkey: r, btcWallet: n } = e, s =
|
|
857
|
+
const { depositorGraph: t, depositorBtcPubkey: r, btcWallet: n } = e, s = w(r), c = await n.getPublicKeyHex(), { psbtHexes: a, signOptions: i, challengerEntries: o } = Tt(t, c), u = await At(
|
|
858
858
|
n,
|
|
859
859
|
a,
|
|
860
860
|
i
|
|
@@ -879,7 +879,7 @@ const kt = 1200 * 1e3, Ee = /* @__PURE__ */ new Set([
|
|
|
879
879
|
]);
|
|
880
880
|
function Ht(e) {
|
|
881
881
|
return e.map((t) => ({
|
|
882
|
-
claimerPubkeyXOnly:
|
|
882
|
+
claimerPubkeyXOnly: M(t.claimer_pubkey),
|
|
883
883
|
payoutTxHex: t.payout_tx.tx_hex,
|
|
884
884
|
assertTxHex: t.assert_tx.tx_hex
|
|
885
885
|
}));
|
|
@@ -893,15 +893,15 @@ function _t(e) {
|
|
|
893
893
|
return t.toString("hex");
|
|
894
894
|
}
|
|
895
895
|
function It(e, t) {
|
|
896
|
-
const r =
|
|
896
|
+
const r = w(e).toLowerCase(), n = w(
|
|
897
897
|
t.vaultProviderBtcPubkey
|
|
898
|
-
).toLowerCase(), s =
|
|
898
|
+
).toLowerCase(), s = w(
|
|
899
899
|
t.depositorBtcPubkey
|
|
900
900
|
).toLowerCase();
|
|
901
901
|
if (r === n || r === s)
|
|
902
902
|
return t.registeredPayoutScriptPubKey;
|
|
903
903
|
if (!t.vaultKeeperBtcPubkeys.some(
|
|
904
|
-
(i) =>
|
|
904
|
+
(i) => w(i).toLowerCase() === r
|
|
905
905
|
))
|
|
906
906
|
throw new Error(
|
|
907
907
|
`Unknown claimer pubkey ${r}: not VP, depositor, or a registered vault keeper`
|
|
@@ -981,8 +981,8 @@ async function pr(e) {
|
|
|
981
981
|
o
|
|
982
982
|
);
|
|
983
983
|
o == null || o.throwIfAborted();
|
|
984
|
-
const d =
|
|
985
|
-
(C) =>
|
|
984
|
+
const d = M(c), x = l.txs.filter(
|
|
985
|
+
(C) => M(C.claimer_pubkey) !== d
|
|
986
986
|
), y = Ht(x), p = await Ct(
|
|
987
987
|
n,
|
|
988
988
|
a,
|
|
@@ -990,19 +990,19 @@ async function pr(e) {
|
|
|
990
990
|
u
|
|
991
991
|
);
|
|
992
992
|
o == null || o.throwIfAborted();
|
|
993
|
-
const
|
|
993
|
+
const g = await vt({
|
|
994
994
|
depositorGraph: l.depositor_graph,
|
|
995
995
|
depositorBtcPubkey: c,
|
|
996
996
|
btcWallet: n
|
|
997
997
|
});
|
|
998
998
|
o == null || o.throwIfAborted();
|
|
999
999
|
const A = { ...p };
|
|
1000
|
-
A[
|
|
1000
|
+
A[w(c)] = g.payout_signatures, await r.submitDepositorPresignatures(
|
|
1001
1001
|
{
|
|
1002
1002
|
pegin_txid: s,
|
|
1003
1003
|
depositor_pk: c,
|
|
1004
1004
|
signatures: A,
|
|
1005
|
-
depositor_claimer_presignatures:
|
|
1005
|
+
depositor_claimer_presignatures: g
|
|
1006
1006
|
},
|
|
1007
1007
|
o
|
|
1008
1008
|
);
|
|
@@ -1086,7 +1086,7 @@ function $t(e, t, r) {
|
|
|
1086
1086
|
return { valid: !0 };
|
|
1087
1087
|
}
|
|
1088
1088
|
function Rt(e) {
|
|
1089
|
-
const t =
|
|
1089
|
+
const t = w(e);
|
|
1090
1090
|
return Lt(t) ? { valid: !0 } : {
|
|
1091
1091
|
valid: !1,
|
|
1092
1092
|
error: "Invalid pubkey format: must be 64 hex characters (32-byte x-only public key, no 0x prefix)"
|
|
@@ -1173,7 +1173,7 @@ function Ae(e, t) {
|
|
|
1173
1173
|
`${t} must contain only hex characters after the 0x prefix`
|
|
1174
1174
|
);
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function J(e, t) {
|
|
1177
1177
|
if (!Number.isInteger(e) || e < 0)
|
|
1178
1178
|
throw new Error(`${t} must be a non-negative integer, got ${e}`);
|
|
1179
1179
|
}
|
|
@@ -1182,7 +1182,7 @@ function zt(e) {
|
|
|
1182
1182
|
throw new Error(
|
|
1183
1183
|
`htlcVout must be an integer 0-${de}, got ${e.htlcVout}`
|
|
1184
1184
|
);
|
|
1185
|
-
if (
|
|
1185
|
+
if (J(e.offchainParamsVersion, "offchainParamsVersion"), J(e.appVaultKeepersVersion, "appVaultKeepersVersion"), J(
|
|
1186
1186
|
e.universalChallengersVersion,
|
|
1187
1187
|
"universalChallengersVersion"
|
|
1188
1188
|
), typeof e.unsignedPrePeginTxHex != "string" || e.unsignedPrePeginTxHex.length === 0)
|
|
@@ -1249,13 +1249,15 @@ async function Sr(e) {
|
|
|
1249
1249
|
throw new Error(`feeRate must be a positive number, got ${s}`);
|
|
1250
1250
|
const h = BigInt(Math.ceil(s * Mt));
|
|
1251
1251
|
i == null || i.throwIfAborted();
|
|
1252
|
-
const
|
|
1252
|
+
const l = M(
|
|
1253
|
+
o.depositorBtcPubkey
|
|
1254
|
+
), { psbtHex: d } = await Ne({
|
|
1253
1255
|
prePeginParams: {
|
|
1254
|
-
depositorPubkey:
|
|
1255
|
-
vaultProviderPubkey:
|
|
1256
|
-
vaultKeeperPubkeys: u.vaultKeeperPubkeys.map(
|
|
1257
|
-
universalChallengerPubkeys: u.universalChallengerPubkeys.map(
|
|
1258
|
-
hashlocks: [
|
|
1256
|
+
depositorPubkey: l,
|
|
1257
|
+
vaultProviderPubkey: w(u.vaultProviderPubkey),
|
|
1258
|
+
vaultKeeperPubkeys: u.vaultKeeperPubkeys.map(w),
|
|
1259
|
+
universalChallengerPubkeys: u.universalChallengerPubkeys.map(w),
|
|
1260
|
+
hashlocks: [w(o.hashlock)],
|
|
1259
1261
|
timelockRefund: u.timelockRefund,
|
|
1260
1262
|
pegInAmounts: [o.amount],
|
|
1261
1263
|
feeRate: u.feeRate,
|
|
@@ -1264,25 +1266,25 @@ async function Sr(e) {
|
|
|
1264
1266
|
councilSize: u.councilSize,
|
|
1265
1267
|
network: u.network
|
|
1266
1268
|
},
|
|
1267
|
-
fundedPrePeginTxHex:
|
|
1269
|
+
fundedPrePeginTxHex: w(o.unsignedPrePeginTxHex),
|
|
1268
1270
|
htlcVout: o.htlcVout,
|
|
1269
1271
|
refundFee: h,
|
|
1270
1272
|
// buildRefundPsbt's top-level `hashlock` param is documented as "no 0x
|
|
1271
1273
|
// prefix" and flows into the WASM HTLC connector derivation; a prefixed
|
|
1272
1274
|
// value would derive the wrong refund script leaf and yield an
|
|
1273
1275
|
// unspendable PSBT. Match the `hashlocks` array handling above.
|
|
1274
|
-
hashlock:
|
|
1276
|
+
hashlock: w(o.hashlock)
|
|
1275
1277
|
});
|
|
1276
1278
|
i == null || i.throwIfAborted();
|
|
1277
|
-
const
|
|
1279
|
+
const x = G(
|
|
1278
1280
|
o.depositorBtcPubkey,
|
|
1279
1281
|
Gt
|
|
1280
|
-
),
|
|
1282
|
+
), y = await c(d, x), p = jt(y);
|
|
1281
1283
|
i == null || i.throwIfAborted();
|
|
1282
1284
|
try {
|
|
1283
|
-
return await a(
|
|
1284
|
-
} catch (
|
|
1285
|
-
throw
|
|
1285
|
+
return await a(p);
|
|
1286
|
+
} catch (g) {
|
|
1287
|
+
throw g instanceof Error && Wt.test(g.message) ? new Vt(t, g) : g;
|
|
1286
1288
|
}
|
|
1287
1289
|
}
|
|
1288
1290
|
export {
|
|
@@ -1295,7 +1297,7 @@ export {
|
|
|
1295
1297
|
fr as G,
|
|
1296
1298
|
ye as H,
|
|
1297
1299
|
hr as I,
|
|
1298
|
-
|
|
1300
|
+
q as J,
|
|
1299
1301
|
cr as K,
|
|
1300
1302
|
ar as L,
|
|
1301
1303
|
dr as M,
|
|
@@ -1328,4 +1330,4 @@ export {
|
|
|
1328
1330
|
oe as y,
|
|
1329
1331
|
sr as z
|
|
1330
1332
|
};
|
|
1331
|
-
//# sourceMappingURL=buildAndBroadcastRefund-
|
|
1333
|
+
//# sourceMappingURL=buildAndBroadcastRefund-D7NCbgtv.js.map
|