@babylonlabs-io/ts-sdk 0.51.0 → 0.52.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/{PayoutManager-D26nGR-e.js → PayoutManager-BwrV3xFW.js} +2 -2
- package/dist/{PayoutManager-D26nGR-e.js.map → PayoutManager-BwrV3xFW.js.map} +1 -1
- package/dist/{PayoutManager-BZVEyi10.cjs → PayoutManager-CBfHfLfz.cjs} +2 -2
- package/dist/{PayoutManager-BZVEyi10.cjs.map → PayoutManager-CBfHfLfz.cjs.map} +1 -1
- package/dist/{PeginManager-COxRVrxa.js → PeginManager-BGWNJYPk.js} +4 -4
- package/dist/{PeginManager-COxRVrxa.js.map → PeginManager-BGWNJYPk.js.map} +1 -1
- package/dist/{PeginManager-BvxfSwsr.cjs → PeginManager-DDp-ZRIa.cjs} +2 -2
- package/dist/{PeginManager-BvxfSwsr.cjs.map → PeginManager-DDp-ZRIa.cjs.map} +1 -1
- package/dist/buildAndBroadcastRefund-3MLyCOtv.cjs +2 -0
- package/dist/buildAndBroadcastRefund-3MLyCOtv.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-Bmz9WJuN.js → buildAndBroadcastRefund-BAT5A6MP.js} +111 -110
- package/dist/buildAndBroadcastRefund-BAT5A6MP.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +191 -188
- package/dist/noPayout-ChPNKTbm.cjs +2 -0
- package/dist/noPayout-ChPNKTbm.cjs.map +1 -0
- package/dist/{noPayout-C1WCsqfd.js → noPayout-DVx3zxUz.js} +24 -22
- package/dist/noPayout-DVx3zxUz.js.map +1 -0
- package/dist/{peginInput-BPRB9tUi.js → peginInput-B5XDDHpy.js} +17 -15
- package/dist/peginInput-B5XDDHpy.js.map +1 -0
- package/dist/peginInput-De0C6aSj.cjs +2 -0
- package/dist/peginInput-De0C6aSj.cjs.map +1 -0
- package/dist/{peginState-CBAlxgXk.js → peginState-BB81JI6I.js} +17 -12
- package/dist/{peginState-CBAlxgXk.js.map → peginState-BB81JI6I.js.map} +1 -1
- package/dist/peginState-CBBJw4Za.cjs +2 -0
- package/dist/{peginState-BijNNT15.cjs.map → peginState-CBBJw4Za.cjs.map} +1 -1
- package/dist/{reservation-xTL2a9Q-.cjs → reservation-ClEs2X0H.cjs} +2 -2
- package/dist/{reservation-xTL2a9Q-.cjs.map → reservation-ClEs2X0H.cjs.map} +1 -1
- package/dist/{reservation-BxvKbQH2.js → reservation-cHDRn4DA.js} +2 -2
- package/dist/{reservation-BxvKbQH2.js.map → reservation-cHDRn4DA.js.map} +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +189 -186
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/primitives/__tests__/txGraphVersion.test.d.ts +7 -0
- package/dist/tbv/core/primitives/__tests__/txGraphVersion.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.d.ts +2 -1
- package/dist/tbv/core/primitives/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.js +34 -32
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
- package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/txGraphVersion.d.ts +11 -0
- package/dist/tbv/core/primitives/txGraphVersion.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/index.d.ts +1 -1
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts +11 -0
- package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
- 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 +19 -18
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +1 -1
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts +5 -2
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +189 -186
- package/dist/{verifyScriptPathSchnorrSignature-CeZp6tMw.js → verifyScriptPathSchnorrSignature-BKECXOpa.js} +108 -97
- package/dist/verifyScriptPathSchnorrSignature-BKECXOpa.js.map +1 -0
- package/dist/verifyScriptPathSchnorrSignature-CVPh04ZI.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-CVPh04ZI.cjs.map +1 -0
- package/package.json +3 -3
- package/dist/buildAndBroadcastRefund-Bmz9WJuN.js.map +0 -1
- package/dist/buildAndBroadcastRefund-ob1n2iB3.cjs +0 -2
- package/dist/buildAndBroadcastRefund-ob1n2iB3.cjs.map +0 -1
- package/dist/noPayout-C1WCsqfd.js.map +0 -1
- package/dist/noPayout-lyIRiUyG.cjs +0 -2
- package/dist/noPayout-lyIRiUyG.cjs.map +0 -1
- package/dist/peginInput-BPRB9tUi.js.map +0 -1
- package/dist/peginInput-DH6X4ITS.cjs +0 -2
- package/dist/peginInput-DH6X4ITS.cjs.map +0 -1
- package/dist/peginState-BijNNT15.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-CeZp6tMw.js.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs.map +0 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
var J = Object.defineProperty;
|
|
2
2
|
var Z = (e, r, t) => r in e ? J(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
|
-
var
|
|
3
|
+
var R = (e, r, t) => Z(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
4
|
import { B as ee } from "./BTCVaultRegistry.abi-Chs4AFBj.js";
|
|
5
5
|
import { e as te, v as re, s as p, u as X, p as A, f as E } from "./bitcoin-B5aNKtsk.js";
|
|
6
|
-
import { v as ne, P as oe, f as ae } from "./PayoutManager-
|
|
6
|
+
import { v as ne, P as oe, f as ae } from "./PayoutManager-BwrV3xFW.js";
|
|
7
7
|
import { D as w, c as se, a as ie, R as ue, d as z } from "./types-CQDRQvV-.js";
|
|
8
8
|
import { Transaction as C, Psbt as le } from "bitcoinjs-lib";
|
|
9
|
-
import { c as ce, d as V, e as N, f as H } from "./verifyScriptPathSchnorrSignature-
|
|
10
|
-
import { c as
|
|
9
|
+
import { c as ce, d as V, e as N, f as H, T as he } from "./verifyScriptPathSchnorrSignature-BKECXOpa.js";
|
|
10
|
+
import { c as de, a as pe, b as ge } from "./noPayout-DVx3zxUz.js";
|
|
11
11
|
import { c as O } from "./signing-DaLvGwQe.js";
|
|
12
|
-
const
|
|
13
|
-
function
|
|
12
|
+
const fe = /^0x[0-9a-fA-F]{64}$/, me = /^0x[0-9a-fA-F]{40}$/, Pe = /^0x([0-9a-fA-F]{2})*$/;
|
|
13
|
+
function $(e, r) {
|
|
14
14
|
if (e.length !== 66)
|
|
15
15
|
throw new Error(
|
|
16
16
|
`${r} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
|
|
17
17
|
);
|
|
18
|
-
if (!
|
|
18
|
+
if (!fe.test(e))
|
|
19
19
|
throw new Error(
|
|
20
20
|
`${r} must contain only hex characters after the 0x prefix`
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
if (!
|
|
23
|
+
function be(e, r) {
|
|
24
|
+
if (!me.test(e))
|
|
25
25
|
throw new Error(
|
|
26
26
|
`${r} must be a 20-byte 0x-prefixed hex address (42 chars)`
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
if (!
|
|
29
|
+
function ye(e, r) {
|
|
30
|
+
if (!Pe.test(e))
|
|
31
31
|
throw new Error(
|
|
32
32
|
`${r} must be a 0x-prefixed hex string with an even number of hex chars`
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
35
|
+
async function it(e) {
|
|
36
36
|
const {
|
|
37
37
|
btcVaultRegistryAddress: r,
|
|
38
38
|
vaultId: t,
|
|
@@ -41,27 +41,27 @@ async function st(e) {
|
|
|
41
41
|
writeContract: u,
|
|
42
42
|
signal: a
|
|
43
43
|
} = e;
|
|
44
|
-
a == null || a.throwIfAborted(),
|
|
44
|
+
a == null || a.throwIfAborted(), be(r, "btcVaultRegistryAddress"), $(t, "vaultId");
|
|
45
45
|
const i = te(e.secret);
|
|
46
|
-
if (
|
|
46
|
+
if ($(i, "secret"), n !== void 0 && ($(n, "hashlock"), !ne(i, n)))
|
|
47
47
|
throw new Error(
|
|
48
48
|
"Invalid secret: SHA256(secret) does not match the provided hashlock"
|
|
49
49
|
);
|
|
50
|
-
return
|
|
50
|
+
return ye(s, "activationMetadata"), u({
|
|
51
51
|
address: r,
|
|
52
52
|
abi: ee,
|
|
53
53
|
functionName: "activateVaultWithSecret",
|
|
54
54
|
args: [t, i, s]
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const we = 1e4;
|
|
58
58
|
async function G(e) {
|
|
59
59
|
const {
|
|
60
60
|
statusReader: r,
|
|
61
61
|
peginTxid: t,
|
|
62
62
|
targetStatuses: n,
|
|
63
63
|
timeoutMs: s,
|
|
64
|
-
pollIntervalMs: u =
|
|
64
|
+
pollIntervalMs: u = we,
|
|
65
65
|
signal: a
|
|
66
66
|
} = e, i = Date.now();
|
|
67
67
|
for (; ; ) {
|
|
@@ -107,25 +107,25 @@ async function G(e) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const xe = 300 * 1e3, ve = /* @__PURE__ */ new Set([
|
|
111
111
|
w.PENDING_DEPOSITOR_WOTS_PK,
|
|
112
112
|
...z
|
|
113
113
|
]);
|
|
114
|
-
async function
|
|
114
|
+
async function ut(e) {
|
|
115
115
|
const {
|
|
116
116
|
statusReader: r,
|
|
117
117
|
wotsSubmitter: t,
|
|
118
118
|
peginTxid: n,
|
|
119
119
|
depositorPk: s,
|
|
120
120
|
wotsPublicKeys: u,
|
|
121
|
-
timeoutMs: a =
|
|
121
|
+
timeoutMs: a = xe,
|
|
122
122
|
signal: i
|
|
123
123
|
} = e;
|
|
124
124
|
i == null || i.throwIfAborted();
|
|
125
125
|
const o = await G({
|
|
126
126
|
statusReader: r,
|
|
127
127
|
peginTxid: n,
|
|
128
|
-
targetStatuses:
|
|
128
|
+
targetStatuses: ve,
|
|
129
129
|
timeoutMs: a,
|
|
130
130
|
signal: i
|
|
131
131
|
});
|
|
@@ -138,8 +138,8 @@ async function it(e) {
|
|
|
138
138
|
i
|
|
139
139
|
));
|
|
140
140
|
}
|
|
141
|
-
const K = 1,
|
|
142
|
-
function
|
|
141
|
+
const K = 1, Ee = 1;
|
|
142
|
+
function Te(e, r) {
|
|
143
143
|
const t = p(r).toLowerCase(), s = e.map((u) => p(u).toLowerCase()).filter((u) => u !== t);
|
|
144
144
|
if (s.length === 0)
|
|
145
145
|
throw new Error(
|
|
@@ -151,7 +151,7 @@ function Ee(e, r) {
|
|
|
151
151
|
);
|
|
152
152
|
return s;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function ke(e, r, t) {
|
|
155
155
|
const n = t.map(
|
|
156
156
|
(c) => p(c).toLowerCase()
|
|
157
157
|
), s = r.filter((c) => n.includes(c));
|
|
@@ -172,28 +172,28 @@ function Te(e, r, t) {
|
|
|
172
172
|
"Depositor graph challenger set does not match expected (local ∪ universal)" + (l.length > 0 ? ` (missing: ${l.join(", ")})` : "") + (h.length > 0 ? ` (unexpected: ${h.join(", ")})` : "")
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function _e(e, r) {
|
|
176
176
|
const t = e.ins[r];
|
|
177
177
|
return X(new Uint8Array(t.hash).slice().reverse());
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function B(e, r, t, n, s) {
|
|
180
180
|
const u = e.ins[r];
|
|
181
181
|
if (u.index !== 0)
|
|
182
182
|
throw new Error(
|
|
183
183
|
`NoPayout (challenger ${s}) input ${r} expected to spend ${n} vout 0, got vout ${u.index}`
|
|
184
184
|
);
|
|
185
|
-
const a = t.getId(), i =
|
|
185
|
+
const a = t.getId(), i = _e(e, r);
|
|
186
186
|
if (i !== a)
|
|
187
187
|
throw new Error(
|
|
188
188
|
`NoPayout (challenger ${s}) input ${r} does not reference ${n} (expected txid ${a}, got ${i})`
|
|
189
189
|
);
|
|
190
190
|
}
|
|
191
|
-
async function
|
|
192
|
-
const n = [], s = [], u = [], a =
|
|
191
|
+
async function Se(e, r, t) {
|
|
192
|
+
const n = [], s = [], u = [], a = Te(
|
|
193
193
|
t.vaultKeeperBtcPubkeys,
|
|
194
194
|
t.depositorBtcPubkey
|
|
195
195
|
);
|
|
196
|
-
|
|
196
|
+
ke(
|
|
197
197
|
e.challenger_presign_data,
|
|
198
198
|
a,
|
|
199
199
|
t.universalChallengerBtcPubkeys
|
|
@@ -210,7 +210,7 @@ async function _e(e, r, t) {
|
|
|
210
210
|
network: t.network,
|
|
211
211
|
claimerBtcPubkey: t.depositorBtcPubkey,
|
|
212
212
|
registeredPayoutScriptPubKey: t.registeredPayoutScriptPubKey,
|
|
213
|
-
commissionBps:
|
|
213
|
+
commissionBps: Ee
|
|
214
214
|
});
|
|
215
215
|
n.push(i.psbtHex), s.push(
|
|
216
216
|
O(
|
|
@@ -222,7 +222,7 @@ async function _e(e, r, t) {
|
|
|
222
222
|
p(e.assert_tx.tx_hex)
|
|
223
223
|
);
|
|
224
224
|
for (const h of e.challenger_presign_data) {
|
|
225
|
-
const c = p(h.challenger_pubkey), d = n.length, P = await
|
|
225
|
+
const c = p(h.challenger_pubkey), d = n.length, P = await Ce({
|
|
226
226
|
challenger: h,
|
|
227
227
|
challengerPubkey: c,
|
|
228
228
|
claimerPubkey: o,
|
|
@@ -242,7 +242,7 @@ async function _e(e, r, t) {
|
|
|
242
242
|
}
|
|
243
243
|
return { psbtHexes: n, signOptions: s, challengerEntries: u };
|
|
244
244
|
}
|
|
245
|
-
async function
|
|
245
|
+
async function Ce(e) {
|
|
246
246
|
const {
|
|
247
247
|
challenger: r,
|
|
248
248
|
challengerPubkey: t,
|
|
@@ -251,7 +251,7 @@ async function Se(e) {
|
|
|
251
251
|
assertTxParsed: u,
|
|
252
252
|
ctx: a
|
|
253
253
|
} = e;
|
|
254
|
-
|
|
254
|
+
de(
|
|
255
255
|
r.nopayout_tx.tx_hex,
|
|
256
256
|
t,
|
|
257
257
|
a.network
|
|
@@ -267,19 +267,19 @@ async function Se(e) {
|
|
|
267
267
|
throw new Error(
|
|
268
268
|
`NoPayout (challenger ${t}) must have exactly 3 inputs, got ${i.ins.length}`
|
|
269
269
|
);
|
|
270
|
-
|
|
270
|
+
B(
|
|
271
271
|
i,
|
|
272
272
|
0,
|
|
273
273
|
u,
|
|
274
274
|
"Assert",
|
|
275
275
|
t
|
|
276
|
-
),
|
|
276
|
+
), B(
|
|
277
277
|
i,
|
|
278
278
|
1,
|
|
279
279
|
o,
|
|
280
280
|
"ChallengeAssertX",
|
|
281
281
|
t
|
|
282
|
-
),
|
|
282
|
+
), B(
|
|
283
283
|
i,
|
|
284
284
|
2,
|
|
285
285
|
l,
|
|
@@ -294,11 +294,12 @@ async function Se(e) {
|
|
|
294
294
|
script_pubkey: X(new Uint8Array(c.script)),
|
|
295
295
|
value: c.value
|
|
296
296
|
}));
|
|
297
|
-
return
|
|
297
|
+
return pe({
|
|
298
298
|
noPayoutTxHex: r.nopayout_tx.tx_hex,
|
|
299
299
|
challengerPubkey: t,
|
|
300
300
|
prevouts: h,
|
|
301
301
|
connectorParams: {
|
|
302
|
+
txGraphVersion: he,
|
|
302
303
|
claimer: n,
|
|
303
304
|
localChallengers: s,
|
|
304
305
|
universalChallengers: a.universalChallengerBtcPubkeys,
|
|
@@ -308,7 +309,7 @@ async function Se(e) {
|
|
|
308
309
|
}
|
|
309
310
|
});
|
|
310
311
|
}
|
|
311
|
-
function
|
|
312
|
+
function Ae(e, r, t) {
|
|
312
313
|
V(e[0]);
|
|
313
314
|
const s = N(
|
|
314
315
|
e[0].returnedPsbtHex,
|
|
@@ -343,7 +344,7 @@ function Ce(e, r, t) {
|
|
|
343
344
|
per_challenger: u
|
|
344
345
|
};
|
|
345
346
|
}
|
|
346
|
-
async function
|
|
347
|
+
async function Re(e, r, t) {
|
|
347
348
|
if (typeof e.signPsbts == "function")
|
|
348
349
|
return e.signPsbts(r, t);
|
|
349
350
|
const n = [];
|
|
@@ -355,11 +356,11 @@ async function $e(e) {
|
|
|
355
356
|
const { depositorGraph: r, btcWallet: t, signingContext: n } = e, s = await t.getPublicKeyHex(), { depositorPubkey: u } = re(
|
|
356
357
|
s,
|
|
357
358
|
p(n.depositorBtcPubkey)
|
|
358
|
-
), { psbtHexes: a, signOptions: i, challengerEntries: o } = await
|
|
359
|
+
), { psbtHexes: a, signOptions: i, challengerEntries: o } = await Se(
|
|
359
360
|
r,
|
|
360
361
|
s,
|
|
361
362
|
n
|
|
362
|
-
), l = await
|
|
363
|
+
), l = await Re(
|
|
363
364
|
t,
|
|
364
365
|
a,
|
|
365
366
|
i
|
|
@@ -372,7 +373,7 @@ async function $e(e) {
|
|
|
372
373
|
requestedPsbtHex: c,
|
|
373
374
|
returnedPsbtHex: l[d]
|
|
374
375
|
}));
|
|
375
|
-
return
|
|
376
|
+
return Ae(
|
|
376
377
|
h,
|
|
377
378
|
o,
|
|
378
379
|
u
|
|
@@ -383,11 +384,11 @@ const Be = 1200 * 1e3, q = /* @__PURE__ */ new Set([
|
|
|
383
384
|
w.PENDING_ACTIVATION,
|
|
384
385
|
w.ACTIVATED_PENDING_BROADCAST,
|
|
385
386
|
w.ACTIVATED
|
|
386
|
-
]),
|
|
387
|
+
]), Ie = /* @__PURE__ */ new Set([
|
|
387
388
|
w.PENDING_DEPOSITOR_SIGNATURES,
|
|
388
389
|
...q
|
|
389
390
|
]);
|
|
390
|
-
function
|
|
391
|
+
function Ve(e) {
|
|
391
392
|
return e.map((r) => ({
|
|
392
393
|
claimerPubkeyXOnly: A(r.claimer_pubkey),
|
|
393
394
|
payoutTxHex: r.payout_tx.tx_hex,
|
|
@@ -397,7 +398,7 @@ function Ie(e) {
|
|
|
397
398
|
function _(e) {
|
|
398
399
|
return A(e).toLowerCase();
|
|
399
400
|
}
|
|
400
|
-
function
|
|
401
|
+
function Ne(e, r, t, n) {
|
|
401
402
|
const s = _(n), u = [
|
|
402
403
|
_(r),
|
|
403
404
|
...t.map(_)
|
|
@@ -438,7 +439,7 @@ function U(e, r) {
|
|
|
438
439
|
commissionBps: r.commissionBps
|
|
439
440
|
};
|
|
440
441
|
}
|
|
441
|
-
async function
|
|
442
|
+
async function He(e, r, t, n) {
|
|
442
443
|
const s = new oe({
|
|
443
444
|
network: r.network,
|
|
444
445
|
btcWallet: e
|
|
@@ -466,7 +467,7 @@ async function Ne(e, r, t, n) {
|
|
|
466
467
|
};
|
|
467
468
|
return n == null || n(u, u), i;
|
|
468
469
|
}
|
|
469
|
-
async function
|
|
470
|
+
async function lt(e) {
|
|
470
471
|
const {
|
|
471
472
|
statusReader: r,
|
|
472
473
|
presignClient: t,
|
|
@@ -480,7 +481,7 @@ async function ut(e) {
|
|
|
480
481
|
} = e, h = await G({
|
|
481
482
|
statusReader: r,
|
|
482
483
|
peginTxid: s,
|
|
483
|
-
targetStatuses:
|
|
484
|
+
targetStatuses: Ie,
|
|
484
485
|
timeoutMs: i,
|
|
485
486
|
signal: o
|
|
486
487
|
});
|
|
@@ -496,7 +497,7 @@ async function ut(e) {
|
|
|
496
497
|
);
|
|
497
498
|
o == null || o.throwIfAborted();
|
|
498
499
|
const d = _(u);
|
|
499
|
-
|
|
500
|
+
Ne(
|
|
500
501
|
c.txs,
|
|
501
502
|
a.vaultProviderBtcPubkey,
|
|
502
503
|
a.vaultKeeperBtcPubkeys,
|
|
@@ -504,7 +505,7 @@ async function ut(e) {
|
|
|
504
505
|
);
|
|
505
506
|
const P = c.txs.filter(
|
|
506
507
|
(v) => _(v.claimer_pubkey) !== d
|
|
507
|
-
), m =
|
|
508
|
+
), m = Ve(P), y = await He(
|
|
508
509
|
n,
|
|
509
510
|
a,
|
|
510
511
|
m,
|
|
@@ -540,10 +541,10 @@ async function ut(e) {
|
|
|
540
541
|
o
|
|
541
542
|
);
|
|
542
543
|
}
|
|
543
|
-
function
|
|
544
|
+
function Oe(e) {
|
|
544
545
|
return /^[0-9a-fA-F]{64}$/.test(e);
|
|
545
546
|
}
|
|
546
|
-
function
|
|
547
|
+
function ct(e) {
|
|
547
548
|
const {
|
|
548
549
|
amountSats: r,
|
|
549
550
|
minDeposit: t,
|
|
@@ -554,7 +555,7 @@ function lt(e) {
|
|
|
554
555
|
} = e;
|
|
555
556
|
return !(r <= 0n || r < t || n && n > 0n && r > n || u == null || a == null || r + u + a > s);
|
|
556
557
|
}
|
|
557
|
-
function
|
|
558
|
+
function ht(e, r, t) {
|
|
558
559
|
return e <= 0n ? {
|
|
559
560
|
valid: !1,
|
|
560
561
|
error: "Deposit amount must be greater than zero"
|
|
@@ -566,7 +567,7 @@ function ct(e, r, t) {
|
|
|
566
567
|
error: `Maximum deposit is ${E(t)} BTC`
|
|
567
568
|
} : { valid: !0 };
|
|
568
569
|
}
|
|
569
|
-
function
|
|
570
|
+
function dt(e) {
|
|
570
571
|
const { amount: r, effectiveRemaining: t } = e;
|
|
571
572
|
return t === null ? { valid: !0 } : t === 0n ? {
|
|
572
573
|
valid: !1,
|
|
@@ -576,7 +577,7 @@ function ht(e) {
|
|
|
576
577
|
error: `Vault size exceeds remaining capacity (${E(t)} BTC)`
|
|
577
578
|
} : { valid: !0 };
|
|
578
579
|
}
|
|
579
|
-
function
|
|
580
|
+
function pt(e, r) {
|
|
580
581
|
if (!e || e.length === 0)
|
|
581
582
|
return {
|
|
582
583
|
valid: !1,
|
|
@@ -592,7 +593,7 @@ function dt(e, r) {
|
|
|
592
593
|
error: "Invalid vault provider selected"
|
|
593
594
|
} : { valid: !0 };
|
|
594
595
|
}
|
|
595
|
-
function
|
|
596
|
+
function De(e, r, t) {
|
|
596
597
|
if (!e || e.length === 0)
|
|
597
598
|
return {
|
|
598
599
|
valid: !1,
|
|
@@ -618,30 +619,30 @@ function Oe(e, r, t) {
|
|
|
618
619
|
}
|
|
619
620
|
return { valid: !0 };
|
|
620
621
|
}
|
|
621
|
-
function
|
|
622
|
+
function Ke(e) {
|
|
622
623
|
const r = p(e);
|
|
623
|
-
return
|
|
624
|
+
return Oe(r) ? { valid: !0 } : {
|
|
624
625
|
valid: !1,
|
|
625
626
|
error: "Invalid pubkey format: must be 64 hex characters (32-byte x-only public key, no 0x prefix)"
|
|
626
627
|
};
|
|
627
628
|
}
|
|
628
|
-
function
|
|
629
|
+
function Ue(e) {
|
|
629
630
|
if (!e || e.length === 0)
|
|
630
631
|
throw new Error(
|
|
631
632
|
"No vault keepers available. The system requires at least one vault keeper to create a deposit."
|
|
632
633
|
);
|
|
633
634
|
}
|
|
634
|
-
function
|
|
635
|
+
function Fe(e) {
|
|
635
636
|
if (!e || e.length === 0)
|
|
636
637
|
throw new Error(
|
|
637
638
|
"No universal challengers available. The system requires at least one universal challenger to create a deposit."
|
|
638
639
|
);
|
|
639
640
|
}
|
|
640
|
-
function
|
|
641
|
+
function Me(e) {
|
|
641
642
|
if (e.length === 0)
|
|
642
643
|
throw new Error("No spendable UTXOs available");
|
|
643
644
|
}
|
|
644
|
-
function
|
|
645
|
+
function gt(e) {
|
|
645
646
|
const {
|
|
646
647
|
vaultAmounts: r,
|
|
647
648
|
confirmedUTXOs: t,
|
|
@@ -650,19 +651,19 @@ function pt(e) {
|
|
|
650
651
|
universalChallengerBtcPubkeys: u,
|
|
651
652
|
minDeposit: a,
|
|
652
653
|
maxDeposit: i
|
|
653
|
-
} = e, o =
|
|
654
|
+
} = e, o = De(
|
|
654
655
|
r,
|
|
655
656
|
a,
|
|
656
657
|
i
|
|
657
658
|
);
|
|
658
659
|
if (!o.valid)
|
|
659
660
|
throw new Error(o.error);
|
|
660
|
-
const l =
|
|
661
|
+
const l = Ke(n);
|
|
661
662
|
if (!l.valid)
|
|
662
663
|
throw new Error(l.error);
|
|
663
|
-
|
|
664
|
+
Ue(s), Fe(u), Me(t);
|
|
664
665
|
}
|
|
665
|
-
async function
|
|
666
|
+
async function ft(e) {
|
|
666
667
|
const {
|
|
667
668
|
vaultRegistryReader: r,
|
|
668
669
|
vaultKeeperReader: t,
|
|
@@ -720,10 +721,10 @@ class j extends Error {
|
|
|
720
721
|
super(r), this.name = "RegisteredVaultVersionMismatchError";
|
|
721
722
|
}
|
|
722
723
|
}
|
|
723
|
-
function
|
|
724
|
+
function mt(e) {
|
|
724
725
|
return e instanceof j || e instanceof Error && e.name === "RegisteredVaultVersionMismatchError";
|
|
725
726
|
}
|
|
726
|
-
async function
|
|
727
|
+
async function Pt(e) {
|
|
727
728
|
const {
|
|
728
729
|
vaultRegistryReader: r,
|
|
729
730
|
vaultIds: t,
|
|
@@ -746,42 +747,42 @@ async function mt(e) {
|
|
|
746
747
|
);
|
|
747
748
|
}
|
|
748
749
|
var Q = /* @__PURE__ */ ((e) => (e.CLAIM_EVENT_RECEIVED = "ClaimEventReceived", e.CLAIM_BROADCAST = "ClaimBroadcast", e.ASSERT_BROADCAST = "AssertBroadcast", e.PAYOUT_BROADCAST = "PayoutBroadcast", e.PAYOUT_BLOCKED = "PayoutBlocked", e))(Q || {});
|
|
749
|
-
const
|
|
750
|
+
const Le = /* @__PURE__ */ new Set([
|
|
750
751
|
"PayoutBroadcast",
|
|
751
752
|
"PayoutBlocked"
|
|
752
753
|
/* PAYOUT_BLOCKED */
|
|
753
754
|
]);
|
|
754
|
-
function
|
|
755
|
+
function bt(e) {
|
|
755
756
|
return Object.values(Q).includes(
|
|
756
757
|
e
|
|
757
758
|
);
|
|
758
759
|
}
|
|
759
|
-
function
|
|
760
|
-
return !!e &&
|
|
760
|
+
function yt(e) {
|
|
761
|
+
return !!e && Le.has(e);
|
|
761
762
|
}
|
|
762
|
-
class
|
|
763
|
+
class Xe extends Error {
|
|
763
764
|
constructor(t, n) {
|
|
764
765
|
super(`Refund not yet mature (BIP68 not final): ${n.message}`);
|
|
765
|
-
|
|
766
|
-
|
|
766
|
+
R(this, "vaultId");
|
|
767
|
+
R(this, "cause");
|
|
767
768
|
this.name = "BIP68NotMatureError", this.vaultId = t, this.cause = n;
|
|
768
769
|
}
|
|
769
770
|
}
|
|
770
|
-
const
|
|
771
|
-
function
|
|
771
|
+
const ze = /^0x[0-9a-fA-F]{64}$/, Ge = /^(?:0x)?(?:[0-9a-fA-F]{2})+$/, W = /^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/, Y = 160, F = 2e3, M = 10n, L = 100n;
|
|
772
|
+
function wt(e) {
|
|
772
773
|
if (!Number.isFinite(e) || e <= 0)
|
|
773
774
|
throw new Error(
|
|
774
775
|
`feeRateSatsVb must be a positive finite number, got ${e}`
|
|
775
776
|
);
|
|
776
777
|
return BigInt(Math.ceil(e * Y));
|
|
777
778
|
}
|
|
778
|
-
const
|
|
779
|
+
const qe = 1, je = /non-BIP68-final/i;
|
|
779
780
|
function D(e, r) {
|
|
780
781
|
if (e.length !== 66)
|
|
781
782
|
throw new Error(
|
|
782
783
|
`${r} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
|
|
783
784
|
);
|
|
784
|
-
if (!
|
|
785
|
+
if (!ze.test(e))
|
|
785
786
|
throw new Error(
|
|
786
787
|
`${r} must contain only hex characters after the 0x prefix`
|
|
787
788
|
);
|
|
@@ -790,7 +791,7 @@ function I(e, r) {
|
|
|
790
791
|
if (!Number.isInteger(e) || e < 0)
|
|
791
792
|
throw new Error(`${r} must be a non-negative integer, got ${e}`);
|
|
792
793
|
}
|
|
793
|
-
function
|
|
794
|
+
function Qe(e) {
|
|
794
795
|
if (D(e.hashlock, "hashlock"), !Number.isInteger(e.htlcVout) || e.htlcVout < 0)
|
|
795
796
|
throw new Error(
|
|
796
797
|
`htlcVout must be a non-negative integer, got ${e.htlcVout}`
|
|
@@ -826,7 +827,7 @@ function je(e) {
|
|
|
826
827
|
"universalChallengersVersion"
|
|
827
828
|
), typeof e.unsignedPrePeginTxHex != "string" || e.unsignedPrePeginTxHex.length === 0)
|
|
828
829
|
throw new Error("unsignedPrePeginTxHex must be a non-empty hex string");
|
|
829
|
-
if (!
|
|
830
|
+
if (!Ge.test(e.unsignedPrePeginTxHex))
|
|
830
831
|
throw new Error(
|
|
831
832
|
"unsignedPrePeginTxHex must be a hex byte string (optional 0x prefix, even length)"
|
|
832
833
|
);
|
|
@@ -837,7 +838,7 @@ function je(e) {
|
|
|
837
838
|
if (typeof e.amount != "bigint" || e.amount <= 0n)
|
|
838
839
|
throw new Error(`amount must be a positive bigint, got ${e.amount}`);
|
|
839
840
|
}
|
|
840
|
-
function
|
|
841
|
+
function We(e) {
|
|
841
842
|
if (!e.vaultProviderPubkey || !W.test(e.vaultProviderPubkey))
|
|
842
843
|
throw new Error("vaultProviderPubkey must be 32 or 33 bytes of hex");
|
|
843
844
|
if (e.vaultKeeperPubkeys.length === 0)
|
|
@@ -863,7 +864,7 @@ function Qe(e) {
|
|
|
863
864
|
`councilQuorum (${e.councilQuorum}) must be in [1, councilSize=${e.councilSize}]`
|
|
864
865
|
);
|
|
865
866
|
}
|
|
866
|
-
function
|
|
867
|
+
function Ye(e) {
|
|
867
868
|
const r = le.fromHex(e);
|
|
868
869
|
try {
|
|
869
870
|
r.finalizeAllInputs();
|
|
@@ -874,7 +875,7 @@ function We(e) {
|
|
|
874
875
|
}
|
|
875
876
|
return r.extractTransaction().toHex();
|
|
876
877
|
}
|
|
877
|
-
async function
|
|
878
|
+
async function xt(e) {
|
|
878
879
|
const {
|
|
879
880
|
vaultId: r,
|
|
880
881
|
readVault: t,
|
|
@@ -886,9 +887,9 @@ async function wt(e) {
|
|
|
886
887
|
} = e;
|
|
887
888
|
i == null || i.throwIfAborted(), D(r, "vaultId");
|
|
888
889
|
const o = await t();
|
|
889
|
-
|
|
890
|
+
Qe(o), i == null || i.throwIfAborted();
|
|
890
891
|
const l = await n(o);
|
|
891
|
-
if (
|
|
892
|
+
if (We(l), i == null || i.throwIfAborted(), !Number.isFinite(s) || s <= 0)
|
|
892
893
|
throw new Error(`feeRate must be a positive number, got ${s}`);
|
|
893
894
|
if (s > F)
|
|
894
895
|
throw new Error(
|
|
@@ -920,7 +921,7 @@ async function wt(e) {
|
|
|
920
921
|
throw new Error(
|
|
921
922
|
`Funded Pre-PegIn tx has ${x.outs.length} outputs but batch requires at least ${o.batch.length} HTLC outputs. Refund refused — funded tx shape disagrees with sibling vector.`
|
|
922
923
|
);
|
|
923
|
-
const { psbtHex: b } = await
|
|
924
|
+
const { psbtHex: b } = await ge({
|
|
924
925
|
prePeginParams: {
|
|
925
926
|
depositorPubkey: d,
|
|
926
927
|
vaultProviderPubkey: p(l.vaultProviderPubkey),
|
|
@@ -955,7 +956,7 @@ async function wt(e) {
|
|
|
955
956
|
i == null || i.throwIfAborted();
|
|
956
957
|
const v = O(
|
|
957
958
|
o.depositorBtcPubkey,
|
|
958
|
-
|
|
959
|
+
qe
|
|
959
960
|
), T = await u(b, v);
|
|
960
961
|
V({
|
|
961
962
|
requestedPsbtHex: b,
|
|
@@ -972,40 +973,40 @@ async function wt(e) {
|
|
|
972
973
|
signerXOnlyPubkeyHex: d,
|
|
973
974
|
inputIndex: k
|
|
974
975
|
});
|
|
975
|
-
const S =
|
|
976
|
+
const S = Ye(T);
|
|
976
977
|
i == null || i.throwIfAborted();
|
|
977
978
|
try {
|
|
978
979
|
return await a(S);
|
|
979
980
|
} catch (f) {
|
|
980
|
-
throw f instanceof Error &&
|
|
981
|
+
throw f instanceof Error && je.test(f.message) ? new Xe(r, f) : f;
|
|
981
982
|
}
|
|
982
983
|
}
|
|
983
984
|
export {
|
|
984
|
-
|
|
985
|
+
Xe as B,
|
|
985
986
|
Q as C,
|
|
986
987
|
j as R,
|
|
987
|
-
|
|
988
|
+
it as a,
|
|
988
989
|
$e as b,
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
990
|
+
dt as c,
|
|
991
|
+
pt as d,
|
|
992
|
+
De as e,
|
|
993
|
+
Ke as f,
|
|
994
|
+
gt as g,
|
|
995
|
+
ft as h,
|
|
996
|
+
ct as i,
|
|
997
|
+
mt as j,
|
|
998
|
+
Pt as k,
|
|
999
|
+
bt as l,
|
|
1000
|
+
yt as m,
|
|
1001
|
+
xt as n,
|
|
1002
|
+
wt as o,
|
|
1002
1003
|
L as p,
|
|
1003
1004
|
M as q,
|
|
1004
|
-
|
|
1005
|
-
|
|
1005
|
+
lt as r,
|
|
1006
|
+
ut as s,
|
|
1006
1007
|
F as t,
|
|
1007
1008
|
Y as u,
|
|
1008
|
-
|
|
1009
|
+
ht as v,
|
|
1009
1010
|
G as w
|
|
1010
1011
|
};
|
|
1011
|
-
//# sourceMappingURL=buildAndBroadcastRefund-
|
|
1012
|
+
//# sourceMappingURL=buildAndBroadcastRefund-BAT5A6MP.js.map
|