@babylonlabs-io/ts-sdk 0.59.1 → 0.60.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/{PeginManager-1R9dMB1G.js → PeginManager-DKyNgvq1.js} +2 -2
- package/dist/{PeginManager-1R9dMB1G.js.map → PeginManager-DKyNgvq1.js.map} +1 -1
- package/dist/{batchPoll-L9LzMl1E.js → batchPoll-C3eKPYOC.js} +234 -210
- package/dist/batchPoll-C3eKPYOC.js.map +1 -0
- package/dist/batchPoll-CbbCcNZP.cjs +2 -0
- package/dist/batchPoll-CbbCcNZP.cjs.map +1 -0
- package/dist/buildAndBroadcastRefund-BqYlx6rb.cjs +2 -0
- package/dist/buildAndBroadcastRefund-BqYlx6rb.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-DpF_b3d9.js → buildAndBroadcastRefund-CoPc7UHA.js} +154 -148
- package/dist/buildAndBroadcastRefund-CoPc7UHA.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/mempoolApi-BxhMqJ4f.cjs.map +1 -1
- package/dist/{mempoolApi-BQKF5MTr.js → mempoolApi-DC7pID6B.js} +12 -6
- package/dist/mempoolApi-DC7pID6B.js.map +1 -0
- package/dist/signPsbtsWithFallback-Xs4jZw5z.cjs.map +1 -1
- package/dist/signPsbtsWithFallback-eY1YgV13.js.map +1 -1
- package/dist/tbv/core/clients/eth/__tests__/operation-key-reader.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/operation-key-reader.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/operation-key-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +7 -5
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +11 -5
- 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/depositTerms.d.ts +10 -18
- package/dist/tbv/core/deposit-terms/depositTerms.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +4 -4
- package/dist/tbv/core/managers/index.js +1 -1
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/__tests__/signDepositorGraphImportBoundary.test.d.ts +12 -0
- package/dist/tbv/core/services/deposit/__tests__/signDepositorGraphImportBoundary.test.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.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/index.cjs +1 -1
- package/dist/tbv/index.js +4 -4
- package/dist/verifyScriptPathSchnorrSignature-Bav08_7R.js.map +1 -1
- package/dist/verifyScriptPathSchnorrSignature-CYjK4IP_.cjs.map +1 -1
- package/package.json +1 -1
- package/dist/batchPoll-C4hwVFa8.cjs +0 -2
- package/dist/batchPoll-C4hwVFa8.cjs.map +0 -1
- package/dist/batchPoll-L9LzMl1E.js.map +0 -1
- package/dist/buildAndBroadcastRefund-DpF_b3d9.js.map +0 -1
- package/dist/buildAndBroadcastRefund-rSxXMwFd.cjs +0 -2
- package/dist/buildAndBroadcastRefund-rSxXMwFd.cjs.map +0 -1
- package/dist/mempoolApi-BQKF5MTr.js.map +0 -1
|
@@ -49,7 +49,7 @@ async function Bt(e) {
|
|
|
49
49
|
vaultId: r,
|
|
50
50
|
hashlock: n,
|
|
51
51
|
activationMetadata: a,
|
|
52
|
-
writeContract:
|
|
52
|
+
writeContract: l,
|
|
53
53
|
signal: o
|
|
54
54
|
} = e;
|
|
55
55
|
o == null || o.throwIfAborted();
|
|
@@ -59,7 +59,7 @@ async function Bt(e) {
|
|
|
59
59
|
secret: e.secret,
|
|
60
60
|
hashlock: n
|
|
61
61
|
});
|
|
62
|
-
return Oe(a, "activationMetadata"),
|
|
62
|
+
return Oe(a, "activationMetadata"), l({
|
|
63
63
|
address: t,
|
|
64
64
|
abi: te,
|
|
65
65
|
functionName: "activateVaultWithSecret",
|
|
@@ -67,8 +67,8 @@ async function Bt(e) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
async function At(e) {
|
|
70
|
-
const { btcVaultRegistryAddress: t, vaultId: r, hashlock: n, writeContract: a, signal:
|
|
71
|
-
|
|
70
|
+
const { btcVaultRegistryAddress: t, vaultId: r, hashlock: n, writeContract: a, signal: l } = e;
|
|
71
|
+
l == null || l.throwIfAborted();
|
|
72
72
|
const o = oe({
|
|
73
73
|
btcVaultRegistryAddress: t,
|
|
74
74
|
vaultId: r,
|
|
@@ -84,7 +84,7 @@ async function At(e) {
|
|
|
84
84
|
}
|
|
85
85
|
const G = 1, He = 1;
|
|
86
86
|
function Ne(e, t) {
|
|
87
|
-
const r = d(t).toLowerCase(), a = e.map((
|
|
87
|
+
const r = d(t).toLowerCase(), a = e.map((l) => d(l).toLowerCase()).filter((l) => l !== r);
|
|
88
88
|
if (a.length === 0)
|
|
89
89
|
throw new Error(
|
|
90
90
|
"Cannot derive localChallengers: vault keeper set is empty (or contains only the depositor)"
|
|
@@ -103,14 +103,14 @@ function De(e, t, r) {
|
|
|
103
103
|
throw new Error(
|
|
104
104
|
`Cannot validate challenger set: vault keepers and universal challengers overlap (${a.join(", ")})`
|
|
105
105
|
);
|
|
106
|
-
const
|
|
106
|
+
const l = [...t, ...n], o = e.map(
|
|
107
107
|
(c) => d(c.challenger_pubkey).toLowerCase()
|
|
108
108
|
), s = new Set(o);
|
|
109
109
|
if (s.size !== o.length)
|
|
110
110
|
throw new Error(
|
|
111
111
|
"Depositor graph contains duplicate challenger entries in challenger_presign_data"
|
|
112
112
|
);
|
|
113
|
-
const
|
|
113
|
+
const u = new Set(l), i = l.filter((c) => !s.has(c)), p = o.filter((c) => !u.has(c));
|
|
114
114
|
if (i.length > 0 || p.length > 0)
|
|
115
115
|
throw new Error(
|
|
116
116
|
"Depositor graph challenger set does not match expected (local ∪ universal)" + (i.length > 0 ? ` (missing: ${i.join(", ")})` : "") + (p.length > 0 ? ` (unexpected: ${p.join(", ")})` : "")
|
|
@@ -121,10 +121,10 @@ function Fe(e, t) {
|
|
|
121
121
|
return re(new Uint8Array(r.hash).slice().reverse());
|
|
122
122
|
}
|
|
123
123
|
function V(e, t, r, n, a) {
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
124
|
+
const l = e.ins[t];
|
|
125
|
+
if (l.index !== 0)
|
|
126
126
|
throw new Error(
|
|
127
|
-
`NoPayout (challenger ${a}) input ${t} expected to spend ${n} vout 0, got vout ${
|
|
127
|
+
`NoPayout (challenger ${a}) input ${t} expected to spend ${n} vout 0, got vout ${l.index}`
|
|
128
128
|
);
|
|
129
129
|
const o = r.getId(), s = Fe(e, t);
|
|
130
130
|
if (s !== o)
|
|
@@ -133,7 +133,7 @@ function V(e, t, r, n, a) {
|
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
async function Me(e, t, r) {
|
|
136
|
-
const n = [], a = [],
|
|
136
|
+
const n = [], a = [], l = [], o = Ne(
|
|
137
137
|
r.vaultKeeperBtcPubkeys,
|
|
138
138
|
r.depositorBtcPubkey
|
|
139
139
|
);
|
|
@@ -168,29 +168,29 @@ async function Me(e, t, r) {
|
|
|
168
168
|
G
|
|
169
169
|
)
|
|
170
170
|
);
|
|
171
|
-
const
|
|
171
|
+
const u = d(r.depositorBtcPubkey), i = $.fromHex(
|
|
172
172
|
d(e.assert_tx.tx_hex)
|
|
173
173
|
);
|
|
174
174
|
for (const p of e.challenger_presign_data) {
|
|
175
|
-
const c = d(p.challenger_pubkey), h = n.length,
|
|
175
|
+
const c = d(p.challenger_pubkey), h = n.length, g = await Ue({
|
|
176
176
|
challenger: p,
|
|
177
177
|
challengerPubkey: c,
|
|
178
|
-
claimerPubkey:
|
|
178
|
+
claimerPubkey: u,
|
|
179
179
|
localChallengers: o,
|
|
180
180
|
assertTxParsed: i,
|
|
181
181
|
ctx: r
|
|
182
182
|
});
|
|
183
|
-
n.push(
|
|
183
|
+
n.push(g), a.push(
|
|
184
184
|
M(
|
|
185
185
|
t,
|
|
186
186
|
G
|
|
187
187
|
)
|
|
188
|
-
),
|
|
188
|
+
), l.push({
|
|
189
189
|
challengerPubkey: c,
|
|
190
190
|
noPayoutIdx: h
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
return { psbtHexes: n, signOptions: a, challengerEntries:
|
|
193
|
+
return { psbtHexes: n, signOptions: a, challengerEntries: l };
|
|
194
194
|
}
|
|
195
195
|
async function Ue(e) {
|
|
196
196
|
const {
|
|
@@ -198,7 +198,7 @@ async function Ue(e) {
|
|
|
198
198
|
challengerPubkey: r,
|
|
199
199
|
claimerPubkey: n,
|
|
200
200
|
localChallengers: a,
|
|
201
|
-
assertTxParsed:
|
|
201
|
+
assertTxParsed: l,
|
|
202
202
|
ctx: o
|
|
203
203
|
} = e;
|
|
204
204
|
$e(
|
|
@@ -208,7 +208,7 @@ async function Ue(e) {
|
|
|
208
208
|
);
|
|
209
209
|
const s = $.fromHex(
|
|
210
210
|
d(t.nopayout_tx.tx_hex)
|
|
211
|
-
),
|
|
211
|
+
), u = $.fromHex(
|
|
212
212
|
d(t.challenge_assert_x_tx.tx_hex)
|
|
213
213
|
), i = $.fromHex(
|
|
214
214
|
d(t.challenge_assert_y_tx.tx_hex)
|
|
@@ -220,13 +220,13 @@ async function Ue(e) {
|
|
|
220
220
|
V(
|
|
221
221
|
s,
|
|
222
222
|
0,
|
|
223
|
-
|
|
223
|
+
l,
|
|
224
224
|
"Assert",
|
|
225
225
|
r
|
|
226
226
|
), V(
|
|
227
227
|
s,
|
|
228
228
|
1,
|
|
229
|
-
|
|
229
|
+
u,
|
|
230
230
|
"ChallengeAssertX",
|
|
231
231
|
r
|
|
232
232
|
), V(
|
|
@@ -237,8 +237,8 @@ async function Ue(e) {
|
|
|
237
237
|
r
|
|
238
238
|
);
|
|
239
239
|
const p = [
|
|
240
|
-
u.outs[0],
|
|
241
240
|
l.outs[0],
|
|
241
|
+
u.outs[0],
|
|
242
242
|
i.outs[0]
|
|
243
243
|
].map((c) => ({
|
|
244
244
|
script_pubkey: re(new Uint8Array(c.script)),
|
|
@@ -271,7 +271,7 @@ function Le(e, t, r) {
|
|
|
271
271
|
signerXOnlyPubkeyHex: r,
|
|
272
272
|
inputIndex: 0
|
|
273
273
|
});
|
|
274
|
-
const
|
|
274
|
+
const l = {};
|
|
275
275
|
for (const o of t) {
|
|
276
276
|
N(e[o.noPayoutIdx]);
|
|
277
277
|
const s = D(
|
|
@@ -283,7 +283,7 @@ function Le(e, t, r) {
|
|
|
283
283
|
signatureHex: s,
|
|
284
284
|
signerXOnlyPubkeyHex: r,
|
|
285
285
|
inputIndex: 0
|
|
286
|
-
}),
|
|
286
|
+
}), l[o.challengerPubkey] = {
|
|
287
287
|
nopayout_signature: s
|
|
288
288
|
};
|
|
289
289
|
}
|
|
@@ -291,14 +291,14 @@ function Le(e, t, r) {
|
|
|
291
291
|
payout_signatures: {
|
|
292
292
|
payout_signature: a
|
|
293
293
|
},
|
|
294
|
-
per_challenger:
|
|
294
|
+
per_challenger: l
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
297
|
async function ze(e) {
|
|
298
|
-
const { depositorGraph: t, btcWallet: r, signingContext: n } = e, a = await r.getPublicKeyHex(), { depositorPubkey:
|
|
298
|
+
const { depositorGraph: t, btcWallet: r, signingContext: n } = e, a = await r.getPublicKeyHex(), { depositorPubkey: l } = ye(
|
|
299
299
|
a,
|
|
300
300
|
d(n.depositorBtcPubkey)
|
|
301
|
-
), { psbtHexes: o, signOptions: s, challengerEntries:
|
|
301
|
+
), { psbtHexes: o, signOptions: s, challengerEntries: u } = await Me(
|
|
302
302
|
t,
|
|
303
303
|
a,
|
|
304
304
|
n
|
|
@@ -312,8 +312,8 @@ async function ze(e) {
|
|
|
312
312
|
}));
|
|
313
313
|
return Le(
|
|
314
314
|
p,
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
u,
|
|
316
|
+
l
|
|
317
317
|
);
|
|
318
318
|
}
|
|
319
319
|
const Xe = 1e4;
|
|
@@ -323,7 +323,7 @@ async function ae(e) {
|
|
|
323
323
|
peginTxid: r,
|
|
324
324
|
targetStatuses: n,
|
|
325
325
|
timeoutMs: a,
|
|
326
|
-
pollIntervalMs:
|
|
326
|
+
pollIntervalMs: l = Xe,
|
|
327
327
|
signal: o
|
|
328
328
|
} = e, s = Date.now();
|
|
329
329
|
for (; ; ) {
|
|
@@ -336,26 +336,26 @@ async function ae(e) {
|
|
|
336
336
|
`Polling timeout after ${a}ms for pegin ${r.slice(0, 8)}… (target: ${[...n].join(", ")})`
|
|
337
337
|
);
|
|
338
338
|
try {
|
|
339
|
-
const
|
|
339
|
+
const u = await t.getPeginStatus(
|
|
340
340
|
{ pegin_txid: r },
|
|
341
341
|
o
|
|
342
342
|
);
|
|
343
|
-
if (
|
|
343
|
+
if (u.pegin_txid.toLowerCase() !== r.toLowerCase())
|
|
344
344
|
throw new Error(
|
|
345
|
-
`getPeginStatus returned status for pegin ${
|
|
345
|
+
`getPeginStatus returned status for pegin ${u.pegin_txid.slice(0, 8)}…, requested ${r.slice(0, 8)}…`
|
|
346
346
|
);
|
|
347
|
-
const i =
|
|
347
|
+
const i = u.status;
|
|
348
348
|
if (n.has(i) || i === E.ACTIVATED)
|
|
349
349
|
return i;
|
|
350
350
|
if (i === E.EXPIRED || xe.has(i))
|
|
351
351
|
throw new Error(
|
|
352
352
|
`Pegin ${r.slice(0, 8)}… reached terminal status "${i}" while waiting for ${[...n].join(", ")}`
|
|
353
353
|
);
|
|
354
|
-
} catch (
|
|
355
|
-
if (!(
|
|
356
|
-
throw
|
|
354
|
+
} catch (u) {
|
|
355
|
+
if (!(u instanceof Ee && u.code === Ce.PEGIN_NOT_FOUND))
|
|
356
|
+
throw u;
|
|
357
357
|
}
|
|
358
|
-
await new Promise((
|
|
358
|
+
await new Promise((u, i) => {
|
|
359
359
|
const p = () => {
|
|
360
360
|
clearTimeout(c), i(
|
|
361
361
|
new Error(
|
|
@@ -363,8 +363,8 @@ async function ae(e) {
|
|
|
363
363
|
)
|
|
364
364
|
);
|
|
365
365
|
}, c = setTimeout(() => {
|
|
366
|
-
o == null || o.removeEventListener("abort", p),
|
|
367
|
-
},
|
|
366
|
+
o == null || o.removeEventListener("abort", p), u();
|
|
367
|
+
}, l);
|
|
368
368
|
o == null || o.addEventListener("abort", p, { once: !0 });
|
|
369
369
|
});
|
|
370
370
|
}
|
|
@@ -389,21 +389,27 @@ function w(e) {
|
|
|
389
389
|
return L(e).toLowerCase();
|
|
390
390
|
}
|
|
391
391
|
function Qe(e, t) {
|
|
392
|
-
const r = (
|
|
392
|
+
const r = (u, i, p) => {
|
|
393
393
|
throw new Error(
|
|
394
|
-
`Deposit terms ${
|
|
394
|
+
`Deposit terms ${u} (${String(i)}) does not match the vault's version-locked signing context (${String(p)}); refusing to sign payouts against terms that describe a different graph.`
|
|
395
395
|
);
|
|
396
|
+
}, n = [
|
|
397
|
+
["protocolFeeRate", e.protocolFeeRate, t.protocolFeeRate],
|
|
398
|
+
["vaultCoreVersion", e.vaultCoreVersion, t.vaultCoreVersion],
|
|
399
|
+
["timelockPegin", e.timelockPegin, t.timelockPegin],
|
|
400
|
+
["timelockAssert", e.timelockAssert, t.timelockAssert]
|
|
401
|
+
];
|
|
402
|
+
for (const [u, i, p] of n)
|
|
403
|
+
i !== p && r(u, i, p);
|
|
404
|
+
const a = (u) => u.map(w).sort(), l = (u, i) => {
|
|
405
|
+
const p = a(u), c = a(i);
|
|
406
|
+
return p.length === c.length && p.every((h, g) => h === c[g]);
|
|
396
407
|
};
|
|
397
|
-
e.
|
|
398
|
-
const n = (s) => s.map(w).sort(), a = (s, l) => {
|
|
399
|
-
const i = n(s), p = n(l);
|
|
400
|
-
return i.length === p.length && i.every((c, h) => c === p[h]);
|
|
401
|
-
};
|
|
402
|
-
a(e.vaultKeeperBtcPubkeys, t.vaultKeeperBtcPubkeys) || r(
|
|
408
|
+
l(e.vaultKeeperBtcPubkeys, t.vaultKeeperBtcPubkeys) || r(
|
|
403
409
|
"vaultKeeperBtcPubkeys",
|
|
404
410
|
e.vaultKeeperBtcPubkeys.join(","),
|
|
405
411
|
t.vaultKeeperBtcPubkeys.join(",")
|
|
406
|
-
),
|
|
412
|
+
), l(
|
|
407
413
|
e.universalChallengerBtcPubkeys,
|
|
408
414
|
t.universalChallengerBtcPubkeys
|
|
409
415
|
) || r(
|
|
@@ -411,21 +417,21 @@ function Qe(e, t) {
|
|
|
411
417
|
e.universalChallengerBtcPubkeys.join(","),
|
|
412
418
|
t.universalChallengerBtcPubkeys.join(",")
|
|
413
419
|
);
|
|
414
|
-
const
|
|
415
|
-
(
|
|
420
|
+
const o = w(t.vaultProviderBtcPubkey), s = e.vaults.map(
|
|
421
|
+
(u) => w(u.vaultProviderBtcPubkey)
|
|
416
422
|
);
|
|
417
|
-
|
|
423
|
+
s.includes(o) || r(
|
|
418
424
|
"vaults[].vaultProviderBtcPubkey",
|
|
419
|
-
|
|
425
|
+
s.join(",") || "<no vaults>",
|
|
420
426
|
t.vaultProviderBtcPubkey
|
|
421
427
|
);
|
|
422
428
|
}
|
|
423
429
|
function We(e, t, r, n) {
|
|
424
|
-
const a = w(n),
|
|
430
|
+
const a = w(n), l = [
|
|
425
431
|
w(t),
|
|
426
432
|
...r.map(w)
|
|
427
|
-
], o = new Set(
|
|
428
|
-
if (o.size !==
|
|
433
|
+
], o = new Set(l);
|
|
434
|
+
if (o.size !== l.length)
|
|
429
435
|
throw new Error(
|
|
430
436
|
"Cannot validate claimer set: signing context contains duplicate vault provider or vault keeper key"
|
|
431
437
|
);
|
|
@@ -438,7 +444,7 @@ function We(e, t, r, n) {
|
|
|
438
444
|
);
|
|
439
445
|
if (new Set(s).size !== s.length)
|
|
440
446
|
throw new Error("Presign response contains duplicate claimer entries");
|
|
441
|
-
const
|
|
447
|
+
const u = s.filter((h) => h !== a), i = new Set(u), p = l.filter((h) => !i.has(h)), c = u.filter((h) => !o.has(h));
|
|
442
448
|
if (p.length > 0 || c.length > 0)
|
|
443
449
|
throw new Error(
|
|
444
450
|
"Presign response claimer set does not match expected (vault provider ∪ vault keepers)" + (p.length > 0 ? ` (missing: ${p.join(", ")})` : "") + (c.length > 0 ? ` (unexpected: ${c.join(", ")})` : "")
|
|
@@ -469,8 +475,8 @@ async function Ye(e, t, r, n) {
|
|
|
469
475
|
const a = new we({
|
|
470
476
|
network: t.network,
|
|
471
477
|
btcWallet: e
|
|
472
|
-
}),
|
|
473
|
-
n == null || n(0,
|
|
478
|
+
}), l = r.length;
|
|
479
|
+
n == null || n(0, l);
|
|
474
480
|
let o;
|
|
475
481
|
if (a.supportsBatchSigning())
|
|
476
482
|
o = (await a.signPayoutTransactionsBatch(
|
|
@@ -478,20 +484,20 @@ async function Ye(e, t, r, n) {
|
|
|
478
484
|
)).map((i) => i.payoutSignature);
|
|
479
485
|
else {
|
|
480
486
|
o = [];
|
|
481
|
-
for (let
|
|
482
|
-
n == null || n(
|
|
487
|
+
for (let u = 0; u < r.length; u++) {
|
|
488
|
+
n == null || n(u, l);
|
|
483
489
|
const i = await a.signPayoutTransaction(
|
|
484
|
-
j(r[
|
|
490
|
+
j(r[u], t)
|
|
485
491
|
);
|
|
486
492
|
o.push(i.signature);
|
|
487
493
|
}
|
|
488
494
|
}
|
|
489
495
|
const s = {};
|
|
490
|
-
for (let
|
|
491
|
-
s[r[
|
|
492
|
-
payout_signature: o[
|
|
496
|
+
for (let u = 0; u < r.length; u++)
|
|
497
|
+
s[r[u].claimerPubkeyXOnly] = {
|
|
498
|
+
payout_signature: o[u]
|
|
493
499
|
};
|
|
494
|
-
return n == null || n(
|
|
500
|
+
return n == null || n(l, l), s;
|
|
495
501
|
}
|
|
496
502
|
async function Rt(e) {
|
|
497
503
|
const {
|
|
@@ -499,17 +505,17 @@ async function Rt(e) {
|
|
|
499
505
|
presignClient: r,
|
|
500
506
|
btcWallet: n,
|
|
501
507
|
peginTxid: a,
|
|
502
|
-
depositorPk:
|
|
508
|
+
depositorPk: l,
|
|
503
509
|
signingContext: o,
|
|
504
510
|
depositTerms: s,
|
|
505
|
-
timeoutMs:
|
|
511
|
+
timeoutMs: u = Ge,
|
|
506
512
|
signal: i,
|
|
507
513
|
onProgress: p
|
|
508
514
|
} = e, c = await ae({
|
|
509
515
|
statusReader: t,
|
|
510
516
|
peginTxid: a,
|
|
511
517
|
targetStatuses: je,
|
|
512
|
-
timeoutMs:
|
|
518
|
+
timeoutMs: u,
|
|
513
519
|
signal: i
|
|
514
520
|
});
|
|
515
521
|
if (se.has(c))
|
|
@@ -524,20 +530,20 @@ async function Rt(e) {
|
|
|
524
530
|
const h = await r.requestDepositorPresignTransactions(
|
|
525
531
|
{
|
|
526
532
|
pegin_txid: a,
|
|
527
|
-
depositor_pk:
|
|
533
|
+
depositor_pk: l
|
|
528
534
|
},
|
|
529
535
|
i
|
|
530
536
|
);
|
|
531
537
|
i == null || i.throwIfAborted();
|
|
532
|
-
const
|
|
538
|
+
const g = w(l);
|
|
533
539
|
We(
|
|
534
540
|
h.txs,
|
|
535
541
|
o.vaultProviderBtcPubkey,
|
|
536
542
|
o.vaultKeeperBtcPubkeys,
|
|
537
|
-
|
|
543
|
+
l
|
|
538
544
|
);
|
|
539
545
|
const v = h.txs.filter(
|
|
540
|
-
(y) => w(y.claimer_pubkey) !==
|
|
546
|
+
(y) => w(y.claimer_pubkey) !== g
|
|
541
547
|
), T = qe(v), x = await Ye(
|
|
542
548
|
n,
|
|
543
549
|
o,
|
|
@@ -551,7 +557,7 @@ async function Rt(e) {
|
|
|
551
557
|
signingContext: {
|
|
552
558
|
vaultCoreVersion: o.vaultCoreVersion,
|
|
553
559
|
peginTxHex: o.peginTxHex,
|
|
554
|
-
depositorBtcPubkey:
|
|
560
|
+
depositorBtcPubkey: l,
|
|
555
561
|
vaultProviderBtcPubkey: o.vaultProviderBtcPubkey,
|
|
556
562
|
vaultKeeperBtcPubkeys: o.vaultKeeperBtcPubkeys,
|
|
557
563
|
universalChallengerBtcPubkeys: o.universalChallengerBtcPubkeys,
|
|
@@ -568,10 +574,10 @@ async function Rt(e) {
|
|
|
568
574
|
});
|
|
569
575
|
i == null || i.throwIfAborted();
|
|
570
576
|
const b = { ...x };
|
|
571
|
-
b[d(
|
|
577
|
+
b[d(l)] = m.payout_signatures, await r.submitDepositorPresignatures(
|
|
572
578
|
{
|
|
573
579
|
pegin_txid: a,
|
|
574
|
-
depositor_pk:
|
|
580
|
+
depositor_pk: l,
|
|
575
581
|
signatures: b,
|
|
576
582
|
depositor_claimer_presignatures: m
|
|
577
583
|
},
|
|
@@ -588,23 +594,23 @@ async function Vt(e) {
|
|
|
588
594
|
wotsSubmitter: r,
|
|
589
595
|
peginTxid: n,
|
|
590
596
|
depositorPk: a,
|
|
591
|
-
wotsPublicKeys:
|
|
597
|
+
wotsPublicKeys: l,
|
|
592
598
|
timeoutMs: o = Je,
|
|
593
599
|
signal: s
|
|
594
600
|
} = e;
|
|
595
601
|
s == null || s.throwIfAborted();
|
|
596
|
-
const
|
|
602
|
+
const u = await ae({
|
|
597
603
|
statusReader: t,
|
|
598
604
|
peginTxid: n,
|
|
599
605
|
targetStatuses: Ze,
|
|
600
606
|
timeoutMs: o,
|
|
601
607
|
signal: s
|
|
602
608
|
});
|
|
603
|
-
ne.has(
|
|
609
|
+
ne.has(u) || (s == null || s.throwIfAborted(), await r.submitDepositorWotsKey(
|
|
604
610
|
{
|
|
605
611
|
pegin_txid: n,
|
|
606
612
|
depositor_pk: a,
|
|
607
|
-
wots_public_keys:
|
|
613
|
+
wots_public_keys: l
|
|
608
614
|
},
|
|
609
615
|
s
|
|
610
616
|
));
|
|
@@ -638,7 +644,7 @@ async function Kt(e) {
|
|
|
638
644
|
hintBtcPubkey: r,
|
|
639
645
|
registrationBtcPubkey: n,
|
|
640
646
|
readCurrentOperationBtcPubkey: a,
|
|
641
|
-
context:
|
|
647
|
+
context: l
|
|
642
648
|
} = e;
|
|
643
649
|
if (!r) return;
|
|
644
650
|
const o = k(r);
|
|
@@ -648,19 +654,19 @@ async function Kt(e) {
|
|
|
648
654
|
);
|
|
649
655
|
if (o !== s)
|
|
650
656
|
throw new Error(
|
|
651
|
-
`Vault provider BTC pubkey mismatch for ${t}: indexer hint matches neither the registration key nor the current operation key on-chain.${
|
|
657
|
+
`Vault provider BTC pubkey mismatch for ${t}: indexer hint matches neither the registration key nor the current operation key on-chain.${l ? ` ${l}` : ""}`
|
|
652
658
|
);
|
|
653
659
|
}
|
|
654
660
|
function O(e, t, r) {
|
|
655
661
|
const n = `${e} operation key (admin=${t.ethAddress})`, a = X(
|
|
656
662
|
t.btcPubKey,
|
|
657
663
|
`${e} roster key (admin=${t.ethAddress})`
|
|
658
|
-
),
|
|
664
|
+
), l = X(r, n);
|
|
659
665
|
return {
|
|
660
666
|
adminAddress: t.ethAddress,
|
|
661
667
|
genesisBtcPubkey: a,
|
|
662
|
-
operationBtcPubkey:
|
|
663
|
-
rotated:
|
|
668
|
+
operationBtcPubkey: l,
|
|
669
|
+
rotated: l !== a
|
|
664
670
|
};
|
|
665
671
|
}
|
|
666
672
|
function tt(e) {
|
|
@@ -688,20 +694,20 @@ function ie(e, t, r) {
|
|
|
688
694
|
t.vaultProvider
|
|
689
695
|
), a = e.vaultKeepers.map(
|
|
690
696
|
(o, s) => O("vault keeper", o, t.vaultKeepers[s])
|
|
691
|
-
),
|
|
697
|
+
), l = e.universalChallengers.map(
|
|
692
698
|
(o, s) => O("universal challenger", o, t.universalChallengers[s])
|
|
693
699
|
);
|
|
694
700
|
return tt([
|
|
695
701
|
n,
|
|
696
702
|
...a,
|
|
697
|
-
...
|
|
703
|
+
...l
|
|
698
704
|
]), {
|
|
699
705
|
vaultProvider: n,
|
|
700
706
|
vaultKeepers: a,
|
|
701
|
-
universalChallengers:
|
|
707
|
+
universalChallengers: l,
|
|
702
708
|
// Derived from the pairs, never the reverse — see ParticipantKeySet.
|
|
703
709
|
vaultKeeperOperationKeysSorted: a.map((o) => o.operationBtcPubkey).sort(),
|
|
704
|
-
universalChallengerOperationKeysSorted:
|
|
710
|
+
universalChallengerOperationKeysSorted: l.map((o) => o.operationBtcPubkey).sort(),
|
|
705
711
|
resolvedAt: r,
|
|
706
712
|
query: e
|
|
707
713
|
};
|
|
@@ -729,27 +735,27 @@ async function It(e) {
|
|
|
729
735
|
vaultKeeperReader: r,
|
|
730
736
|
universalChallengerReader: n,
|
|
731
737
|
vaultProviderEthAddress: a,
|
|
732
|
-
applicationEntryPoint:
|
|
738
|
+
applicationEntryPoint: l,
|
|
733
739
|
expectedVaultProviderBtcPubkey: o,
|
|
734
740
|
expectedVaultKeeperBtcPubkeys: s,
|
|
735
|
-
expectedUniversalChallengerBtcPubkeys:
|
|
741
|
+
expectedUniversalChallengerBtcPubkeys: u,
|
|
736
742
|
operationKeyReader: i,
|
|
737
743
|
onIndexerServingOperationKeys: p,
|
|
738
744
|
onIndexerHintsInconsistent: c
|
|
739
745
|
} = e, [
|
|
740
746
|
h,
|
|
741
|
-
|
|
747
|
+
g,
|
|
742
748
|
v
|
|
743
749
|
] = await Promise.all([
|
|
744
750
|
t.getVaultProviderGenesisBtcPubKey(
|
|
745
751
|
a
|
|
746
752
|
),
|
|
747
|
-
r.getCurrentVaultKeepersVersion(
|
|
753
|
+
r.getCurrentVaultKeepersVersion(l),
|
|
748
754
|
n.getLatestUniversalChallengersVersion()
|
|
749
755
|
]), [T, x] = await Promise.all([
|
|
750
756
|
r.getVaultKeepersByVersion(
|
|
751
|
-
|
|
752
|
-
|
|
757
|
+
l,
|
|
758
|
+
g
|
|
753
759
|
),
|
|
754
760
|
n.getUniversalChallengersByVersion(
|
|
755
761
|
v
|
|
@@ -763,7 +769,7 @@ async function It(e) {
|
|
|
763
769
|
query: {
|
|
764
770
|
vaultProviderEthAddress: a,
|
|
765
771
|
vaultProviderGenesisBtcPubkey: `0x${h}`,
|
|
766
|
-
applicationEntryPoint:
|
|
772
|
+
applicationEntryPoint: l,
|
|
767
773
|
vaultKeepers: T,
|
|
768
774
|
universalChallengers: x
|
|
769
775
|
}
|
|
@@ -782,7 +788,7 @@ async function It(e) {
|
|
|
782
788
|
m.vaultKeepers,
|
|
783
789
|
y.vaultKeepers
|
|
784
790
|
), B = q(
|
|
785
|
-
|
|
791
|
+
u,
|
|
786
792
|
m.universalChallengers,
|
|
787
793
|
y.universalChallengers
|
|
788
794
|
);
|
|
@@ -792,13 +798,13 @@ async function It(e) {
|
|
|
792
798
|
);
|
|
793
799
|
if (!K(_))
|
|
794
800
|
throw new Error(
|
|
795
|
-
`Vault keeper BTC pubkeys (v${
|
|
801
|
+
`Vault keeper BTC pubkeys (v${g}) indexer set does not match ApplicationRegistry on-chain set. Refresh and try again.`
|
|
796
802
|
);
|
|
797
803
|
if (!K(B))
|
|
798
804
|
throw new Error(
|
|
799
805
|
`Universal challenger BTC pubkeys (v${v}) indexer set does not match ProtocolParams on-chain set. Refresh and try again.`
|
|
800
806
|
);
|
|
801
|
-
const
|
|
807
|
+
const f = [S, _, B], de = f.some((P) => P.registration && !P.operation), z = f.some((P) => P.operation && !P.registration);
|
|
802
808
|
if (de && z) {
|
|
803
809
|
const P = `Indexer participant hints are internally inconsistent for vault provider ${a}: some roles match the registration keys while others match the rotated operation keys.`;
|
|
804
810
|
throw c == null || c(P), new Error(`${P} Refresh and try again.`);
|
|
@@ -809,7 +815,7 @@ async function It(e) {
|
|
|
809
815
|
vaultProviderBtcPubkeyXOnly: y.vaultProvider,
|
|
810
816
|
vaultKeeperBtcPubkeysSorted: y.vaultKeepers,
|
|
811
817
|
universalChallengerBtcPubkeysSorted: y.universalChallengers,
|
|
812
|
-
expectedAppVaultKeepersVersion:
|
|
818
|
+
expectedAppVaultKeepersVersion: g,
|
|
813
819
|
expectedUniversalChallengersVersion: v,
|
|
814
820
|
registrationKeys: m,
|
|
815
821
|
participantKeys: b
|
|
@@ -824,10 +830,10 @@ function Ot(e) {
|
|
|
824
830
|
minDeposit: r,
|
|
825
831
|
maxDeposit: n,
|
|
826
832
|
btcBalance: a,
|
|
827
|
-
estimatedFeeSats:
|
|
833
|
+
estimatedFeeSats: l,
|
|
828
834
|
depositorClaimValue: o
|
|
829
835
|
} = e;
|
|
830
|
-
return !(t <= 0n || t < r || n && n > 0n && t > n ||
|
|
836
|
+
return !(t <= 0n || t < r || n && n > 0n && t > n || l == null || o == null || t + l + o > a);
|
|
831
837
|
}
|
|
832
838
|
function Ht(e, t, r) {
|
|
833
839
|
return e <= 0n ? {
|
|
@@ -922,20 +928,20 @@ function Ft(e) {
|
|
|
922
928
|
confirmedUTXOs: r,
|
|
923
929
|
vaultProviderBtcPubkey: n,
|
|
924
930
|
vaultKeeperBtcPubkeys: a,
|
|
925
|
-
universalChallengerBtcPubkeys:
|
|
931
|
+
universalChallengerBtcPubkeys: l,
|
|
926
932
|
minDeposit: o,
|
|
927
933
|
maxDeposit: s
|
|
928
|
-
} = e,
|
|
934
|
+
} = e, u = at(
|
|
929
935
|
t,
|
|
930
936
|
o,
|
|
931
937
|
s
|
|
932
938
|
);
|
|
933
|
-
if (!
|
|
934
|
-
throw new Error(
|
|
939
|
+
if (!u.valid)
|
|
940
|
+
throw new Error(u.error);
|
|
935
941
|
const i = st(n);
|
|
936
942
|
if (!i.valid)
|
|
937
943
|
throw new Error(i.error);
|
|
938
|
-
it(a), ut(
|
|
944
|
+
it(a), ut(l), lt(r);
|
|
939
945
|
}
|
|
940
946
|
class ue extends Error {
|
|
941
947
|
constructor(t) {
|
|
@@ -949,16 +955,16 @@ function Y(e, t, r) {
|
|
|
949
955
|
return t.length === r.length && t.every((n, a) => n === r[a]) ? null : `${e} expected [${t.join(", ")}], got [${r.join(", ")}]`;
|
|
950
956
|
}
|
|
951
957
|
async function Ut(e) {
|
|
952
|
-
const { vaultRegistryReader: t, operationKeyReader: r, vaultIds: n, expected: a } = e,
|
|
958
|
+
const { vaultRegistryReader: t, operationKeyReader: r, vaultIds: n, expected: a } = e, l = a.query;
|
|
953
959
|
if (n.length === 0) return;
|
|
954
960
|
const o = await t.getVaultKeyEpochsBatch(n), s = [];
|
|
955
|
-
for (const [
|
|
956
|
-
const p = n[
|
|
961
|
+
for (const [u, i] of o.entries()) {
|
|
962
|
+
const p = n[u];
|
|
957
963
|
let c;
|
|
958
964
|
try {
|
|
959
965
|
c = await nt({
|
|
960
966
|
operationKeyReader: r,
|
|
961
|
-
query:
|
|
967
|
+
query: l,
|
|
962
968
|
epochs: i
|
|
963
969
|
});
|
|
964
970
|
} catch (v) {
|
|
@@ -976,12 +982,12 @@ async function Ut(e) {
|
|
|
976
982
|
c.vaultKeeperOperationKeysSorted
|
|
977
983
|
);
|
|
978
984
|
h && s.push(h);
|
|
979
|
-
const
|
|
985
|
+
const g = Y(
|
|
980
986
|
`vault ${p}: universal challenger keys`,
|
|
981
987
|
a.universalChallengerOperationKeysSorted,
|
|
982
988
|
c.universalChallengerOperationKeysSorted
|
|
983
989
|
);
|
|
984
|
-
|
|
990
|
+
g && s.push(g);
|
|
985
991
|
}
|
|
986
992
|
if (s.length > 0)
|
|
987
993
|
throw new ue(
|
|
@@ -1002,23 +1008,23 @@ async function zt(e) {
|
|
|
1002
1008
|
vaultIds: r,
|
|
1003
1009
|
expectedOffchainParamsVersion: n,
|
|
1004
1010
|
expectedAppVaultKeepersVersion: a,
|
|
1005
|
-
expectedUniversalChallengersVersion:
|
|
1011
|
+
expectedUniversalChallengersVersion: l,
|
|
1006
1012
|
expectedVaultCoreVersion: o
|
|
1007
|
-
} = e, s = await t.getProtocolInfoBatch(r),
|
|
1013
|
+
} = e, s = await t.getProtocolInfoBatch(r), u = [];
|
|
1008
1014
|
if (s.forEach((i, p) => {
|
|
1009
1015
|
const c = r[p];
|
|
1010
|
-
i.offchainParamsVersion !== n &&
|
|
1016
|
+
i.offchainParamsVersion !== n && u.push(
|
|
1011
1017
|
`vault ${c}: offchainParams expected v${n}, got v${i.offchainParamsVersion}`
|
|
1012
|
-
), i.appVaultKeepersVersion !== a &&
|
|
1018
|
+
), i.appVaultKeepersVersion !== a && u.push(
|
|
1013
1019
|
`vault ${c}: appVaultKeepers expected v${a}, got v${i.appVaultKeepersVersion}`
|
|
1014
|
-
), i.universalChallengersVersion !==
|
|
1015
|
-
`vault ${c}: universalChallengers expected v${
|
|
1016
|
-
), i.vaultCoreVersion !== o &&
|
|
1020
|
+
), i.universalChallengersVersion !== l && u.push(
|
|
1021
|
+
`vault ${c}: universalChallengers expected v${l}, got v${i.universalChallengersVersion}`
|
|
1022
|
+
), i.vaultCoreVersion !== o && u.push(
|
|
1017
1023
|
`vault ${c}: vaultCoreVersion expected v${o} (build-time active), got v${i.vaultCoreVersion}`
|
|
1018
1024
|
);
|
|
1019
|
-
}),
|
|
1025
|
+
}), u.length > 0)
|
|
1020
1026
|
throw new le(
|
|
1021
|
-
`Aborting BTC broadcast: signer-set or offchain-params versions changed during registration (${
|
|
1027
|
+
`Aborting BTC broadcast: signer-set or offchain-params versions changed during registration (${u.join("; ")}). The Pre-PegIn was not broadcast; the registered ETH vault will time out per protocol rules.`
|
|
1022
1028
|
);
|
|
1023
1029
|
}
|
|
1024
1030
|
var ce = /* @__PURE__ */ ((e) => (e.CLAIM_EVENT_RECEIVED = "ClaimEventReceived", e.CLAIM_BROADCAST = "ClaimBroadcast", e.ASSERT_BROADCAST = "AssertBroadcast", e.PAYOUT_BROADCAST = "PayoutBroadcast", e.PAYOUT_BLOCKED = "PayoutBlocked", e))(ce || {});
|
|
@@ -1159,54 +1165,54 @@ async function qt(e) {
|
|
|
1159
1165
|
readVault: r,
|
|
1160
1166
|
readPrePeginContext: n,
|
|
1161
1167
|
feeRate: a,
|
|
1162
|
-
signPsbt:
|
|
1168
|
+
signPsbt: l,
|
|
1163
1169
|
broadcastTx: o,
|
|
1164
1170
|
signal: s
|
|
1165
1171
|
} = e;
|
|
1166
1172
|
s == null || s.throwIfAborted(), U(t, "vaultId");
|
|
1167
|
-
const
|
|
1168
|
-
vt(
|
|
1169
|
-
const i = await n(
|
|
1173
|
+
const u = await r();
|
|
1174
|
+
vt(u), s == null || s.throwIfAborted();
|
|
1175
|
+
const i = await n(u);
|
|
1170
1176
|
if (yt(i), s == null || s.throwIfAborted(), !Number.isFinite(a) || a <= 0)
|
|
1171
1177
|
throw new Error(`feeRate must be a positive number, got ${a}`);
|
|
1172
1178
|
if (a > J)
|
|
1173
1179
|
throw new Error(
|
|
1174
1180
|
`feeRate ${a} sat/vB exceeds refund safety cap ${J} sat/vB; refusing to sign refund.`
|
|
1175
1181
|
);
|
|
1176
|
-
const p = BigInt(Math.ceil(a * he)), c =
|
|
1182
|
+
const p = BigInt(Math.ceil(a * he)), c = u.amount * Z / ee;
|
|
1177
1183
|
if (p > c)
|
|
1178
1184
|
throw new Error(
|
|
1179
|
-
`Refund fee ${p} sats exceeds the per-vault safety cap of ${c} sats (${Z}/${ee} of vault.amount=${
|
|
1185
|
+
`Refund fee ${p} sats exceeds the per-vault safety cap of ${c} sats (${Z}/${ee} of vault.amount=${u.amount}); refusing to sign refund.`
|
|
1180
1186
|
);
|
|
1181
1187
|
s == null || s.throwIfAborted();
|
|
1182
1188
|
const h = L(
|
|
1183
|
-
|
|
1184
|
-
),
|
|
1185
|
-
if (v !== void 0 && v.vout !==
|
|
1189
|
+
u.depositorBtcPubkey
|
|
1190
|
+
), g = d(u.unsignedPrePeginTxHex), v = ke(g);
|
|
1191
|
+
if (v !== void 0 && v.vout !== u.batch.length)
|
|
1186
1192
|
throw new Error(
|
|
1187
|
-
`Auth-anchor OP_RETURN at vout ${v.vout} does not match batch size (${
|
|
1193
|
+
`Auth-anchor OP_RETURN at vout ${v.vout} does not match batch size (${u.batch.length} HTLC outputs expect the anchor at vout ${u.batch.length}). Refund refused — sibling HTLC vector is incomplete.`
|
|
1188
1194
|
);
|
|
1189
1195
|
const T = v == null ? void 0 : v.hash;
|
|
1190
1196
|
let x;
|
|
1191
1197
|
try {
|
|
1192
|
-
x = $.fromHex(
|
|
1193
|
-
} catch (
|
|
1198
|
+
x = $.fromHex(g);
|
|
1199
|
+
} catch (f) {
|
|
1194
1200
|
throw new Error(
|
|
1195
|
-
`Failed to parse funded Pre-PegIn transaction hex: ${
|
|
1201
|
+
`Failed to parse funded Pre-PegIn transaction hex: ${f instanceof Error ? f.message : String(f)}`
|
|
1196
1202
|
);
|
|
1197
1203
|
}
|
|
1198
|
-
if (x.outs.length <
|
|
1204
|
+
if (x.outs.length < u.batch.length)
|
|
1199
1205
|
throw new Error(
|
|
1200
|
-
`Funded Pre-PegIn tx has ${x.outs.length} outputs but batch requires at least ${
|
|
1206
|
+
`Funded Pre-PegIn tx has ${x.outs.length} outputs but batch requires at least ${u.batch.length} HTLC outputs. Refund refused — funded tx shape disagrees with sibling vector.`
|
|
1201
1207
|
);
|
|
1202
1208
|
const { psbtHex: m } = await Be({
|
|
1203
1209
|
prePeginParams: {
|
|
1204
|
-
vaultCoreVersion:
|
|
1210
|
+
vaultCoreVersion: u.vaultCoreVersion,
|
|
1205
1211
|
depositorPubkey: h,
|
|
1206
1212
|
vaultProviderPubkey: d(i.vaultProviderPubkey),
|
|
1207
1213
|
vaultKeeperPubkeys: i.vaultKeeperPubkeys.map(d),
|
|
1208
1214
|
universalChallengerPubkeys: i.universalChallengerPubkeys.map(d),
|
|
1209
|
-
hashlocks:
|
|
1215
|
+
hashlocks: u.batch.map((f) => d(f.hashlock)),
|
|
1210
1216
|
timelockRefund: i.timelockRefund,
|
|
1211
1217
|
// `batch[i].amount` is the on-chain vault deposit (peg-in) amount, which
|
|
1212
1218
|
// is exactly what WASM's `pegInAmounts` expects — it re-adds the protocol
|
|
@@ -1214,7 +1220,7 @@ async function qt(e) {
|
|
|
1214
1220
|
// HTLC output. `buildRefundPsbt`'s value cross-check then binds the result
|
|
1215
1221
|
// to the funded tx bytes, refusing the refund if the template's HTLC value
|
|
1216
1222
|
// disagrees with the on-chain commitment.
|
|
1217
|
-
pegInAmounts:
|
|
1223
|
+
pegInAmounts: u.batch.map((f) => f.amount),
|
|
1218
1224
|
feeRate: i.feeRate,
|
|
1219
1225
|
minPeginFeeRate: i.minPeginFeeRate,
|
|
1220
1226
|
numLocalChallengers: i.numLocalChallengers,
|
|
@@ -1223,20 +1229,20 @@ async function qt(e) {
|
|
|
1223
1229
|
network: i.network,
|
|
1224
1230
|
authAnchorHash: T
|
|
1225
1231
|
},
|
|
1226
|
-
fundedPrePeginTxHex:
|
|
1227
|
-
htlcVout:
|
|
1232
|
+
fundedPrePeginTxHex: g,
|
|
1233
|
+
htlcVout: u.htlcVout,
|
|
1228
1234
|
refundFee: p,
|
|
1229
1235
|
// buildRefundPsbt's top-level `hashlock` param is documented as "no 0x
|
|
1230
1236
|
// prefix" and flows into the WASM HTLC connector derivation; a prefixed
|
|
1231
1237
|
// value would derive the wrong refund script leaf and yield an
|
|
1232
1238
|
// unspendable PSBT. Match the `hashlocks` array handling above.
|
|
1233
|
-
hashlock: d(
|
|
1239
|
+
hashlock: d(u.hashlock)
|
|
1234
1240
|
});
|
|
1235
1241
|
s == null || s.throwIfAborted();
|
|
1236
1242
|
const b = M(
|
|
1237
|
-
|
|
1243
|
+
u.depositorBtcPubkey,
|
|
1238
1244
|
gt
|
|
1239
|
-
), y = await
|
|
1245
|
+
), y = await l(m, b);
|
|
1240
1246
|
N({
|
|
1241
1247
|
requestedPsbtHex: m,
|
|
1242
1248
|
returnedPsbtHex: y
|
|
@@ -1256,8 +1262,8 @@ async function qt(e) {
|
|
|
1256
1262
|
s == null || s.throwIfAborted();
|
|
1257
1263
|
try {
|
|
1258
1264
|
return await o(B);
|
|
1259
|
-
} catch (
|
|
1260
|
-
throw
|
|
1265
|
+
} catch (f) {
|
|
1266
|
+
throw f instanceof Error && ft.test(f.message) ? new pt(t, f) : f;
|
|
1261
1267
|
}
|
|
1262
1268
|
}
|
|
1263
1269
|
export {
|
|
@@ -1298,4 +1304,4 @@ export {
|
|
|
1298
1304
|
Xt as y,
|
|
1299
1305
|
Gt as z
|
|
1300
1306
|
};
|
|
1301
|
-
//# sourceMappingURL=buildAndBroadcastRefund-
|
|
1307
|
+
//# sourceMappingURL=buildAndBroadcastRefund-CoPc7UHA.js.map
|