@babylonlabs-io/ts-sdk 3.0.1 → 3.0.2
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/buildAndBroadcastReclaim-B8aFMGf-.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-B8aFMGf-.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-C55KaRJF.js → buildAndBroadcastReclaim-D5520lbL.js} +821 -750
- package/dist/buildAndBroadcastReclaim-D5520lbL.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +1 -1
- package/dist/tbv/core/services/deposit/graphFingerprint.d.ts +39 -0
- package/dist/tbv/core/services/deposit/graphFingerprint.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.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 +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +1 -1
- package/package.json +3 -3
- package/dist/buildAndBroadcastReclaim-C55KaRJF.js.map +0 -1
- package/dist/buildAndBroadcastReclaim-CefzR6i_.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-CefzR6i_.cjs.map +0 -1
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { B as
|
|
5
|
-
import { e as
|
|
6
|
-
import { v as
|
|
7
|
-
import { Buffer as
|
|
8
|
-
import { b as
|
|
9
|
-
import { buildClaimPsbt as
|
|
10
|
-
import { p as
|
|
11
|
-
import { Psbt as
|
|
12
|
-
import { m as
|
|
13
|
-
import { d as
|
|
14
|
-
import { d as
|
|
15
|
-
import { zeroAddress as
|
|
16
|
-
import { v as
|
|
17
|
-
import { h as
|
|
18
|
-
import { d as
|
|
19
|
-
import { a as
|
|
20
|
-
const
|
|
21
|
-
function
|
|
1
|
+
var dt = Object.defineProperty;
|
|
2
|
+
var gt = (e, t, r) => t in e ? dt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var K = (e, t, r) => gt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { B as Me } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
|
|
5
|
+
import { e as Fe, s as b, i as ft, c as C, v as yt, u as Le, p as Q, f as H } from "./bitcoin-C-TuHb-v.js";
|
|
6
|
+
import { v as bt, d as Ue, s as mt, P as vt, a as Pt } from "./PayoutManager-BSwbUQeF.js";
|
|
7
|
+
import { Buffer as A } from "buffer";
|
|
8
|
+
import { b as xt, a as U, c as wt } from "./signing-Dhr2t0Z6.js";
|
|
9
|
+
import { buildClaimPsbt as Et, buildAssertClaimerPsbt as _t, buildPayoutClaimerPsbt as kt, buildWronglyChallengedPsbts as Tt, buildPayoutDepositorPsbt as $t, finalizeClaimTx as Ct, buildWatchtowerArtifacts as At, extractTapScriptSig as St, expandWotsSeed as It, wotsKeypairFromSeed as Rt, validateWotsKeypairAgainstGraph as Bt, verifyWatchtowerArtifacts as Vt, deriveVaultId as Ht } from "./tbv/core/wasm/index.js";
|
|
10
|
+
import { p as Ge, P as G, f as Ot, i as X, g as q, j } from "./verifyScriptPathSchnorrSignature-CpjSTfMj.js";
|
|
11
|
+
import { Psbt as Xe, Transaction as B } from "bitcoinjs-lib";
|
|
12
|
+
import { m as ge, n as fe, N as J, o as ye, D as be } from "./constants-D5vORbQE.js";
|
|
13
|
+
import { d as Nt } from "./deriveVaultRoot-BcvmER1E.js";
|
|
14
|
+
import { d as Kt, a as me } from "./onChainBtcPubkey-CCTdl53s.js";
|
|
15
|
+
import { zeroAddress as Dt, isAddress as Mt, isAddressEqual as Ft } from "viem";
|
|
16
|
+
import { v as ve, D as R, c as Lt, b as Ut, R as Gt, d as qe } from "./state-CFn1rT74.js";
|
|
17
|
+
import { h as Pe, b as Xt, s as qt, j as jt } from "./sha2-YqVHJiFj.js";
|
|
18
|
+
import { d as zt, c as Wt, b as Yt, f as je, e as Qt, a as Jt } from "./noPayout-qBXWKwav.js";
|
|
19
|
+
import { a as Zt } from "./secp256k1-D-H9jmd7.js";
|
|
20
|
+
const er = /^0x[0-9a-fA-F]{64}$/, tr = /^0x[0-9a-fA-F]{40}$/, rr = /^0x([0-9a-fA-F]{2})*$/;
|
|
21
|
+
function Z(e, t) {
|
|
22
22
|
if (e.length !== 66)
|
|
23
23
|
throw new Error(
|
|
24
24
|
`${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
|
|
25
25
|
);
|
|
26
|
-
if (!
|
|
26
|
+
if (!er.test(e))
|
|
27
27
|
throw new Error(
|
|
28
28
|
`${t} must contain only hex characters after the 0x prefix`
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
if (!
|
|
31
|
+
function or(e, t) {
|
|
32
|
+
if (!tr.test(e))
|
|
33
33
|
throw new Error(
|
|
34
34
|
`${t} must be a 20-byte 0x-prefixed hex address (42 chars)`
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
if (!
|
|
37
|
+
function nr(e, t) {
|
|
38
|
+
if (!rr.test(e))
|
|
39
39
|
throw new Error(
|
|
40
40
|
`${t} must be a 0x-prefixed hex string with an even number of hex chars`
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
const t =
|
|
46
|
-
if (
|
|
43
|
+
function ze(e) {
|
|
44
|
+
or(e.btcVaultRegistryAddress, "btcVaultRegistryAddress"), Z(e.vaultId, "vaultId");
|
|
45
|
+
const t = Fe(e.secret);
|
|
46
|
+
if (Z(t, "secret"), e.hashlock !== void 0 && (Z(e.hashlock, "hashlock"), !bt(t, e.hashlock)))
|
|
47
47
|
throw new Error(
|
|
48
48
|
"Invalid secret: SHA256(secret) does not match the provided hashlock"
|
|
49
49
|
);
|
|
50
50
|
return t;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function Uo(e) {
|
|
53
53
|
const {
|
|
54
54
|
btcVaultRegistryAddress: t,
|
|
55
55
|
vaultId: r,
|
|
@@ -59,23 +59,23 @@ async function Oo(e) {
|
|
|
59
59
|
signal: a
|
|
60
60
|
} = e;
|
|
61
61
|
a == null || a.throwIfAborted();
|
|
62
|
-
const s =
|
|
62
|
+
const s = ze({
|
|
63
63
|
btcVaultRegistryAddress: t,
|
|
64
64
|
vaultId: r,
|
|
65
65
|
secret: e.secret,
|
|
66
66
|
hashlock: o
|
|
67
67
|
});
|
|
68
|
-
return
|
|
68
|
+
return nr(n, "activationMetadata"), i({
|
|
69
69
|
address: t,
|
|
70
|
-
abi:
|
|
70
|
+
abi: Me,
|
|
71
71
|
functionName: "activateVaultWithSecret",
|
|
72
72
|
args: [r, s, n]
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
async function
|
|
75
|
+
async function Go(e) {
|
|
76
76
|
const { btcVaultRegistryAddress: t, vaultId: r, hashlock: o, writeContract: n, signal: i } = e;
|
|
77
77
|
i == null || i.throwIfAborted();
|
|
78
|
-
const a =
|
|
78
|
+
const a = ze({
|
|
79
79
|
btcVaultRegistryAddress: t,
|
|
80
80
|
vaultId: r,
|
|
81
81
|
secret: e.secret,
|
|
@@ -83,155 +83,155 @@ async function No(e) {
|
|
|
83
83
|
});
|
|
84
84
|
return n({
|
|
85
85
|
address: t,
|
|
86
|
-
abi:
|
|
86
|
+
abi: Me,
|
|
87
87
|
functionName: "activateVaultWithSecretAndRedeem",
|
|
88
88
|
args: [r, a]
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
class
|
|
91
|
+
class sr extends Error {
|
|
92
92
|
constructor(t, r) {
|
|
93
93
|
super(
|
|
94
94
|
"Transaction graph's challenger set does not match the vault's (local ∪ universal)" + (t.length > 0 ? ` (missing: ${t.join(", ")})` : "") + (r.length > 0 ? ` (unexpected: ${r.join(", ")})` : "") + ". Refusing to sign an incomplete or padded challenger set."
|
|
95
95
|
), this.missing = t, this.unexpected = r, this.name = "ChallengerSetMismatchError";
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
const t =
|
|
98
|
+
function ar(e) {
|
|
99
|
+
const t = Ge({
|
|
100
100
|
claimerBtcPubkey: e.depositorBtcPubkey,
|
|
101
101
|
depositorBtcPubkey: e.depositorBtcPubkey,
|
|
102
102
|
vaultProviderBtcPubkey: e.vaultProviderBtcPubkey,
|
|
103
103
|
vaultKeeperBtcPubkeys: e.vaultKeeperBtcPubkeys
|
|
104
|
-
}), r = e.universalChallengerBtcPubkeys.map(
|
|
104
|
+
}), r = e.universalChallengerBtcPubkeys.map(xe), o = t.filter((c) => r.includes(c));
|
|
105
105
|
if (o.length > 0)
|
|
106
106
|
throw new Error(
|
|
107
107
|
`Cannot check the challenger set: vault keepers and universal challengers overlap (${o.join(", ")}).`
|
|
108
108
|
);
|
|
109
|
-
const n = e.graphChallengerPubkeys.map(
|
|
109
|
+
const n = e.graphChallengerPubkeys.map(xe), i = new Set(n);
|
|
110
110
|
if (i.size !== n.length)
|
|
111
111
|
throw new Error(
|
|
112
112
|
"Transaction graph lists the same challenger more than once."
|
|
113
113
|
);
|
|
114
|
-
const a = [...t, ...r], s = new Set(a), u = a.filter((
|
|
115
|
-
if (u.length > 0 ||
|
|
116
|
-
throw new
|
|
114
|
+
const a = [...t, ...r], s = new Set(a), u = a.filter((c) => !i.has(c)), l = n.filter((c) => !s.has(c));
|
|
115
|
+
if (u.length > 0 || l.length > 0)
|
|
116
|
+
throw new sr(u, l);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
return
|
|
118
|
+
function xe(e) {
|
|
119
|
+
return b(e).toLowerCase();
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
class
|
|
121
|
+
const We = 0;
|
|
122
|
+
class ir extends Error {
|
|
123
123
|
constructor(t, r) {
|
|
124
124
|
super(
|
|
125
|
-
`Payout transaction output ${
|
|
125
|
+
`Payout transaction output ${We} pays ${r}, not the vault's registered payout script ${t}. Refusing to sign a payout to another destination.`
|
|
126
126
|
), this.expectedScriptHex = t, this.actualScriptHex = r, this.name = "PayoutDestinationError";
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function ur(e) {
|
|
130
130
|
let t;
|
|
131
131
|
try {
|
|
132
|
-
t =
|
|
132
|
+
t = Xe.fromBase64(e.payoutPsbtBase64);
|
|
133
133
|
} catch (u) {
|
|
134
134
|
throw new Error("Payout PSBT cannot be parsed.", { cause: u });
|
|
135
135
|
}
|
|
136
|
-
const { version: r, locktime: o, outs: n } =
|
|
137
|
-
if (r !==
|
|
136
|
+
const { version: r, locktime: o, outs: n } = cr(t);
|
|
137
|
+
if (r !== ge || o !== fe)
|
|
138
138
|
throw new Error(
|
|
139
|
-
`Payout transaction has version ${r} and locktime ${o}, expected ${
|
|
139
|
+
`Payout transaction has version ${r} and locktime ${o}, expected ${ge} and ${fe}.`
|
|
140
140
|
);
|
|
141
|
-
if (n.length !==
|
|
141
|
+
if (n.length !== J)
|
|
142
142
|
throw new Error(
|
|
143
|
-
`Payout transaction has ${n.length} output(s), expected exactly ${
|
|
143
|
+
`Payout transaction has ${n.length} output(s), expected exactly ${J} for a depositor-as-claimer payout.`
|
|
144
144
|
);
|
|
145
|
-
const i =
|
|
145
|
+
const i = b(
|
|
146
146
|
e.registeredPayoutScriptPubKey
|
|
147
147
|
).toLowerCase();
|
|
148
148
|
if (i.length === 0)
|
|
149
149
|
throw new Error(
|
|
150
150
|
"registeredPayoutScriptPubKey is empty; the vault's on-chain payout script is required to check the Payout destination."
|
|
151
151
|
);
|
|
152
|
-
const a = n[
|
|
153
|
-
if (!
|
|
154
|
-
throw new
|
|
155
|
-
const s = n[
|
|
156
|
-
if (s.value !==
|
|
152
|
+
const a = n[We].script.toString("hex").toLowerCase();
|
|
153
|
+
if (!A.from(a, "hex").equals(A.from(i, "hex")))
|
|
154
|
+
throw new ir(i, a);
|
|
155
|
+
const s = n[J - 1];
|
|
156
|
+
if (s.value !== ye)
|
|
157
157
|
throw new Error(
|
|
158
|
-
`Payout CPFP anchor value ${s.value} sats must equal ${
|
|
158
|
+
`Payout CPFP anchor value ${s.value} sats must equal ${ye} sats.`
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function cr(e) {
|
|
162
162
|
return {
|
|
163
163
|
version: e.version,
|
|
164
164
|
locktime: e.locktime,
|
|
165
165
|
outs: e.txOutputs.map((t) => ({
|
|
166
|
-
script:
|
|
166
|
+
script: A.from(t.script),
|
|
167
167
|
value: t.value
|
|
168
168
|
}))
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
const
|
|
172
|
-
class
|
|
171
|
+
const Ye = 0;
|
|
172
|
+
class lr extends Error {
|
|
173
173
|
constructor(t, r, o) {
|
|
174
174
|
super(
|
|
175
175
|
`Transaction graph does not belong to vault ${t}: its Claim spends PegIn ${o}, which derives vault ${r}. Refusing to sign for a graph served for another vault.`
|
|
176
176
|
), this.expectedVaultId = t, this.derivedVaultId = r, this.peginTxid = o, this.name = "VaultIdBindingError";
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function hr(e) {
|
|
180
180
|
let t;
|
|
181
181
|
try {
|
|
182
|
-
t =
|
|
182
|
+
t = Xe.fromBase64(e);
|
|
183
183
|
} catch (o) {
|
|
184
184
|
throw new Error("Claim PSBT cannot be parsed.", { cause: o });
|
|
185
185
|
}
|
|
186
|
-
const r = t.txInputs[
|
|
186
|
+
const r = t.txInputs[Ye];
|
|
187
187
|
if (!r)
|
|
188
188
|
throw new Error("Claim PSBT carries no PegIn input to bind the vault to.");
|
|
189
|
-
return
|
|
189
|
+
return Je(r.hash);
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
const t = e.ins[
|
|
191
|
+
function pr(e) {
|
|
192
|
+
const t = e.ins[Ye];
|
|
193
193
|
if (!t)
|
|
194
194
|
throw new Error(
|
|
195
195
|
"Artifacts file's claim_tx carries no PegIn input to bind the vault to."
|
|
196
196
|
);
|
|
197
|
-
return
|
|
197
|
+
return Je(t.hash);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
const t =
|
|
201
|
-
|
|
202
|
-
), r =
|
|
199
|
+
function Qe(e) {
|
|
200
|
+
const t = z(
|
|
201
|
+
Kt(e.peginTxid, e.depositorEthAddress)
|
|
202
|
+
), r = z(e.expectedVaultId);
|
|
203
203
|
if (t !== r)
|
|
204
|
-
throw new
|
|
204
|
+
throw new lr(r, t, e.peginTxid);
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function z(e) {
|
|
207
207
|
return `0x${(e.startsWith("0x") ? e.slice(2) : e).toLowerCase()}`;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return
|
|
209
|
+
function Je(e) {
|
|
210
|
+
return A.from(e).reverse().toString("hex");
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
async function
|
|
212
|
+
const dr = 0, gr = 0, fr = 1, yr = 0, br = 0;
|
|
213
|
+
async function Xo(e) {
|
|
214
214
|
const { txGraphVersion: t } = e.vault, r = e.source.txGraphJson, [o, n, i, a] = await Promise.all([
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
Et(t, r),
|
|
216
|
+
_t(t, r),
|
|
217
|
+
kt(t, r),
|
|
218
|
+
Tt(t, r)
|
|
219
219
|
]);
|
|
220
|
-
|
|
221
|
-
peginTxid:
|
|
220
|
+
Qe({
|
|
221
|
+
peginTxid: hr(o),
|
|
222
222
|
depositorEthAddress: e.vault.depositorEthAddress,
|
|
223
223
|
expectedVaultId: e.vault.vaultId
|
|
224
224
|
});
|
|
225
|
-
const s = await
|
|
225
|
+
const s = await $t(
|
|
226
226
|
t,
|
|
227
227
|
r
|
|
228
228
|
);
|
|
229
|
-
for (const
|
|
230
|
-
|
|
231
|
-
payoutPsbtBase64:
|
|
229
|
+
for (const x of [i, s])
|
|
230
|
+
ur({
|
|
231
|
+
payoutPsbtBase64: x,
|
|
232
232
|
registeredPayoutScriptPubKey: e.vault.registeredPayoutScriptPubKey
|
|
233
233
|
});
|
|
234
|
-
|
|
234
|
+
ar({
|
|
235
235
|
graphChallengerPubkeys: Object.keys(a),
|
|
236
236
|
depositorBtcPubkey: e.depositorPublicKey,
|
|
237
237
|
vaultProviderBtcPubkey: e.vault.vaultProviderBtcPubkey,
|
|
@@ -239,45 +239,45 @@ async function Ho(e) {
|
|
|
239
239
|
universalChallengerBtcPubkeys: e.vault.universalChallengerBtcPubkeys
|
|
240
240
|
});
|
|
241
241
|
const u = [
|
|
242
|
-
{ psbtBase64: o, inputIndex:
|
|
243
|
-
{ psbtBase64: n, inputIndex:
|
|
244
|
-
{ psbtBase64: i, inputIndex:
|
|
242
|
+
{ psbtBase64: o, inputIndex: dr },
|
|
243
|
+
{ psbtBase64: n, inputIndex: gr },
|
|
244
|
+
{ psbtBase64: i, inputIndex: fr },
|
|
245
245
|
{
|
|
246
246
|
psbtBase64: s,
|
|
247
|
-
inputIndex:
|
|
247
|
+
inputIndex: yr
|
|
248
248
|
}
|
|
249
|
-
],
|
|
250
|
-
for (const
|
|
251
|
-
for (const
|
|
252
|
-
u.push({ psbtBase64:
|
|
253
|
-
const
|
|
249
|
+
], l = Object.keys(a);
|
|
250
|
+
for (const x of l)
|
|
251
|
+
for (const w of a[x])
|
|
252
|
+
u.push({ psbtBase64: w, inputIndex: br });
|
|
253
|
+
const c = await vr(
|
|
254
254
|
e.btcWallet,
|
|
255
255
|
e.depositorPublicKey,
|
|
256
256
|
e.btcNetwork,
|
|
257
257
|
u
|
|
258
258
|
);
|
|
259
259
|
let h = 0;
|
|
260
|
-
const p =
|
|
261
|
-
for (const
|
|
262
|
-
const
|
|
263
|
-
|
|
260
|
+
const p = c[h++], d = c[h++], g = c[h++], y = c[h++], f = {};
|
|
261
|
+
for (const x of l) {
|
|
262
|
+
const w = a[x].length;
|
|
263
|
+
f[x] = c.slice(
|
|
264
264
|
h,
|
|
265
|
-
h +
|
|
266
|
-
), h +=
|
|
265
|
+
h + w
|
|
266
|
+
), h += w;
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const P = await Ct(
|
|
269
269
|
t,
|
|
270
270
|
r,
|
|
271
271
|
p
|
|
272
272
|
);
|
|
273
|
-
return
|
|
273
|
+
return At({
|
|
274
274
|
txGraphVersion: t,
|
|
275
275
|
graphJson: r,
|
|
276
|
-
signedClaimTxHex:
|
|
276
|
+
signedClaimTxHex: P,
|
|
277
277
|
assertClaimerSigHex: d,
|
|
278
278
|
payoutClaimerSigHex: g,
|
|
279
|
-
wronglyChallengedSigs:
|
|
280
|
-
depositorPayoutSigHex:
|
|
279
|
+
wronglyChallengedSigs: f,
|
|
280
|
+
depositorPayoutSigHex: y,
|
|
281
281
|
verifyingKeyHex: e.source.verifyingKeyHex,
|
|
282
282
|
claimableEventBlockNumber: e.vault.claimableEventBlockNumber,
|
|
283
283
|
proverCircuitVersion: e.vault.proverCircuitVersion,
|
|
@@ -286,7 +286,7 @@ async function Ho(e) {
|
|
|
286
286
|
expectedVaultCoreVersion: e.vault.vaultCoreVersion
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function we(e) {
|
|
290
290
|
const t = e.replace(/^0x/, "").toLowerCase();
|
|
291
291
|
if (t.length === 66) return t.slice(2);
|
|
292
292
|
if (t.length === 64) return t;
|
|
@@ -294,29 +294,29 @@ function Pe(e) {
|
|
|
294
294
|
`Public key must be 33-byte compressed or 32-byte x-only hex, got ${t.length / 2} bytes.`
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
|
-
async function
|
|
297
|
+
async function mr(e, t, r) {
|
|
298
298
|
const o = await e.getPublicKeyHex();
|
|
299
|
-
if (
|
|
299
|
+
if (we(o) !== we(t))
|
|
300
300
|
throw new Error(
|
|
301
301
|
"Connected wallet does not hold the vault's depositor key. Select the account that made the deposit, then try again."
|
|
302
302
|
);
|
|
303
303
|
const n = await e.getAddress();
|
|
304
|
-
if (!
|
|
304
|
+
if (!ft(n, t, r))
|
|
305
305
|
throw new Error(
|
|
306
306
|
`Connected wallet reports address "${n}", which is not derived from the vault's depositor key. Select the account that made the deposit, then try again.`
|
|
307
307
|
);
|
|
308
308
|
return n;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
311
|
-
const n = await
|
|
310
|
+
async function vr(e, t, r, o) {
|
|
311
|
+
const n = await mr(
|
|
312
312
|
e,
|
|
313
313
|
t,
|
|
314
314
|
r
|
|
315
|
-
), i = await
|
|
315
|
+
), i = await Ue(
|
|
316
316
|
e,
|
|
317
|
-
o.map((a) =>
|
|
317
|
+
o.map((a) => Pr(a.psbtBase64)),
|
|
318
318
|
o.map(
|
|
319
|
-
(a) =>
|
|
319
|
+
(a) => xt(
|
|
320
320
|
t,
|
|
321
321
|
a.inputIndex,
|
|
322
322
|
n
|
|
@@ -325,31 +325,31 @@ async function gr(e, t, r, o) {
|
|
|
325
325
|
);
|
|
326
326
|
return Promise.all(
|
|
327
327
|
i.map(
|
|
328
|
-
(a, s) =>
|
|
328
|
+
(a, s) => St(xr(a), o[s].inputIndex)
|
|
329
329
|
)
|
|
330
330
|
);
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
return
|
|
332
|
+
function Pr(e) {
|
|
333
|
+
return A.from(e, "base64").toString("hex");
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
return
|
|
335
|
+
function xr(e) {
|
|
336
|
+
return A.from(e, "hex").toString("base64");
|
|
337
337
|
}
|
|
338
|
-
async function
|
|
339
|
-
const t = await
|
|
338
|
+
async function qo(e) {
|
|
339
|
+
const t = await Nt(e.btcWallet, e.vaultContext);
|
|
340
340
|
let r;
|
|
341
341
|
try {
|
|
342
|
-
r = await
|
|
342
|
+
r = await It(t, e.htlcVout);
|
|
343
343
|
} finally {
|
|
344
344
|
t.fill(0);
|
|
345
345
|
}
|
|
346
346
|
let o;
|
|
347
347
|
try {
|
|
348
|
-
o = await
|
|
348
|
+
o = await Rt(r);
|
|
349
349
|
} finally {
|
|
350
350
|
r.fill(0);
|
|
351
351
|
}
|
|
352
|
-
return
|
|
352
|
+
return wr(o.pk_hash, e.expectedWotsPkHash), await Bt(
|
|
353
353
|
e.txGraphVersion,
|
|
354
354
|
o.keypair,
|
|
355
355
|
e.txGraphJson
|
|
@@ -358,61 +358,61 @@ async function Ko(e) {
|
|
|
358
358
|
pkHash: o.pk_hash
|
|
359
359
|
};
|
|
360
360
|
}
|
|
361
|
-
function
|
|
362
|
-
if (
|
|
361
|
+
function wr(e, t) {
|
|
362
|
+
if (L(e) !== L(t))
|
|
363
363
|
throw new Error(
|
|
364
|
-
`Derived WOTS public-key hash ${
|
|
364
|
+
`Derived WOTS public-key hash ${L(e)} does not match the vault's on-chain depositorWotsPkHash ${L(t)}. The wallet, the HTLC output index, or the derivation itself is not the one this vault was created with.`
|
|
365
365
|
);
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function L(e) {
|
|
368
368
|
return `0x${(e.startsWith("0x") ? e.slice(2) : e).toLowerCase()}`;
|
|
369
369
|
}
|
|
370
|
-
const
|
|
371
|
-
class
|
|
370
|
+
const Er = 3;
|
|
371
|
+
class _r extends Error {
|
|
372
372
|
constructor(t, r) {
|
|
373
373
|
super(
|
|
374
374
|
`Artifacts belong to vault ${r}, not ${t}. Select the artifacts file saved for this vault.`
|
|
375
375
|
), this.expectedVaultId = t, this.actualVaultId = r, this.name = "ArtifactsVaultMismatchError";
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function kr(e) {
|
|
379
379
|
let t;
|
|
380
380
|
try {
|
|
381
381
|
t = JSON.parse(e);
|
|
382
382
|
} catch (a) {
|
|
383
383
|
throw new Error("Artifacts file is not valid JSON.", { cause: a });
|
|
384
384
|
}
|
|
385
|
-
const r =
|
|
385
|
+
const r = Ee(t.vault_id, "vault_id"), o = Tr(Ee(t.claim_tx, "claim_tx")), n = ee(
|
|
386
386
|
t.prover_circuit_version,
|
|
387
387
|
"prover_circuit_version"
|
|
388
388
|
), i = t.claimable_event_block_number === void 0 ? 0n : BigInt(
|
|
389
|
-
|
|
389
|
+
ee(
|
|
390
390
|
t.claimable_event_block_number,
|
|
391
391
|
"claimable_event_block_number"
|
|
392
392
|
)
|
|
393
393
|
);
|
|
394
394
|
return {
|
|
395
|
-
vaultCoreVersion: t.vault_core_version === void 0 ? void 0 :
|
|
395
|
+
vaultCoreVersion: t.vault_core_version === void 0 ? void 0 : ee(t.vault_core_version, "vault_core_version"),
|
|
396
396
|
vaultId: r,
|
|
397
397
|
claimTxid: o.getId(),
|
|
398
|
-
peginTxid:
|
|
398
|
+
peginTxid: pr(o),
|
|
399
399
|
proverCircuitVersion: n,
|
|
400
400
|
claimableEventBlockNumber: i,
|
|
401
401
|
babeSessionChallengerPubkeys: Object.keys(
|
|
402
|
-
|
|
402
|
+
$r(t.babe_sessions, "babe_sessions")
|
|
403
403
|
)
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
|
-
async function
|
|
407
|
-
const t =
|
|
406
|
+
async function jo(e) {
|
|
407
|
+
const t = kr(e.artifactsJson), r = z(e.expectedVaultId), o = z(t.vaultId);
|
|
408
408
|
if (r !== o)
|
|
409
|
-
throw new
|
|
410
|
-
|
|
409
|
+
throw new _r(r, o);
|
|
410
|
+
Qe({
|
|
411
411
|
peginTxid: t.peginTxid,
|
|
412
412
|
depositorEthAddress: e.depositorEthAddress,
|
|
413
413
|
expectedVaultId: r
|
|
414
414
|
});
|
|
415
|
-
const n = e.txGraphVersion ??
|
|
415
|
+
const n = e.txGraphVersion ?? Er;
|
|
416
416
|
if (t.vaultCoreVersion !== void 0 && t.vaultCoreVersion !== n)
|
|
417
417
|
throw new Error(
|
|
418
418
|
`Artifacts record vault core version ${t.vaultCoreVersion}, but verification was asked for version ${n}.`
|
|
@@ -421,9 +421,9 @@ async function Do(e) {
|
|
|
421
421
|
throw new Error(
|
|
422
422
|
"Artifacts carry no claimable event block number. They were assembled before the Ethereum withdrawal was initiated; assemble them again."
|
|
423
423
|
);
|
|
424
|
-
return await
|
|
424
|
+
return await Vt(n, e.artifactsJson), t;
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function Tr(e) {
|
|
427
427
|
try {
|
|
428
428
|
return B.fromHex(e);
|
|
429
429
|
} catch (t) {
|
|
@@ -432,51 +432,51 @@ function wr(e) {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function Ee(e, t) {
|
|
436
436
|
if (typeof e != "string" || e.length === 0)
|
|
437
437
|
throw new Error(`Artifacts file is missing a usable "${t}".`);
|
|
438
438
|
return e;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function ee(e, t) {
|
|
441
441
|
if (typeof e != "number" || !Number.isSafeInteger(e) || e < 0)
|
|
442
442
|
throw new Error(`Artifacts file is missing a usable "${t}".`);
|
|
443
443
|
return e;
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function $r(e, t) {
|
|
446
446
|
if (e === void 0) return {};
|
|
447
447
|
if (typeof e != "object" || e === null || Array.isArray(e))
|
|
448
448
|
throw new Error(`Artifacts file is missing a usable "${t}".`);
|
|
449
449
|
return e;
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
class
|
|
451
|
+
const Cr = 8, Ar = 6e3, Sr = 10 * 6e4, Ir = 10;
|
|
452
|
+
class Ze extends Error {
|
|
453
453
|
constructor(t) {
|
|
454
454
|
super(t), this.name = "PeginRegistrationMissingError";
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
|
-
class
|
|
457
|
+
class et extends Error {
|
|
458
458
|
constructor(t) {
|
|
459
459
|
super(t), this.name = "PeginRegistrationNotFinalError";
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
return e instanceof
|
|
462
|
+
function Rr(e) {
|
|
463
|
+
return e instanceof Ze || e instanceof Error && e.name === "PeginRegistrationMissingError";
|
|
464
464
|
}
|
|
465
|
-
function
|
|
466
|
-
return e instanceof
|
|
465
|
+
function zo(e) {
|
|
466
|
+
return e instanceof et || e instanceof Error && e.name === "PeginRegistrationNotFinalError";
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function _e(e) {
|
|
469
469
|
const { currentBlock: t, createdAtBlock: r } = e, o = t - r + 1n;
|
|
470
470
|
return o < 0n ? 0 : Number(o);
|
|
471
471
|
}
|
|
472
|
-
async function
|
|
472
|
+
async function Wo(e) {
|
|
473
473
|
const {
|
|
474
474
|
vaultRegistryReader: t,
|
|
475
475
|
getBlockNumber: r,
|
|
476
476
|
vaultIds: o,
|
|
477
|
-
required: n =
|
|
478
|
-
pollIntervalMs: i =
|
|
479
|
-
timeoutMs: a =
|
|
477
|
+
required: n = Cr,
|
|
478
|
+
pollIntervalMs: i = Ar,
|
|
479
|
+
timeoutMs: a = Sr,
|
|
480
480
|
signal: s,
|
|
481
481
|
onProgress: u
|
|
482
482
|
} = e;
|
|
@@ -484,70 +484,70 @@ async function Fo(e) {
|
|
|
484
484
|
throw new Error(
|
|
485
485
|
"waitForPeginRegistrationDepth requires at least one vault ID"
|
|
486
486
|
);
|
|
487
|
-
const
|
|
488
|
-
let
|
|
487
|
+
const l = Date.now();
|
|
488
|
+
let c = !1, h = 0, p;
|
|
489
489
|
for (; ; ) {
|
|
490
490
|
if (s != null && s.aborted)
|
|
491
491
|
throw new Error(
|
|
492
492
|
`Aborted while waiting for peg-in registration depth (${o.length} vault(s))`
|
|
493
493
|
);
|
|
494
|
-
if (Date.now() -
|
|
495
|
-
throw new
|
|
494
|
+
if (Date.now() - l >= a)
|
|
495
|
+
throw new et(
|
|
496
496
|
`Peg-in registration did not reach ${n} Ethereum confirmations within ${a}ms. The registration transaction was submitted but is not yet final, so the Pre-PegIn Bitcoin transaction was never sent and no funds are at risk. Resume this deposit from the dashboard once the network settles.` + (p instanceof Error ? ` Last read error: ${p.message}` : "")
|
|
497
497
|
);
|
|
498
498
|
try {
|
|
499
499
|
const d = await r(), g = await Promise.all(
|
|
500
|
-
o.map((
|
|
501
|
-
),
|
|
502
|
-
(
|
|
500
|
+
o.map((f) => t.getVaultBasicInfo(f))
|
|
501
|
+
), y = g.findIndex(
|
|
502
|
+
(f) => f.depositor === Dt || f.createdAt === 0n
|
|
503
503
|
);
|
|
504
|
-
if (
|
|
505
|
-
if (h += 1, !
|
|
506
|
-
throw new
|
|
507
|
-
`Vault ${o[
|
|
504
|
+
if (y !== -1) {
|
|
505
|
+
if (h += 1, !c && h > Ir)
|
|
506
|
+
throw new Ze(
|
|
507
|
+
`Vault ${o[y]} is still not visible on-chain after ${h} reads — the registration does not exist.`
|
|
508
508
|
);
|
|
509
509
|
console.warn(
|
|
510
|
-
`Peg-in registration for vault ${o[
|
|
510
|
+
`Peg-in registration for vault ${o[y]} is not visible in chain state at block ${d} — a lagging RPC backend or an Ethereum reorg. Still polling.`
|
|
511
511
|
), u == null || u({ confirmations: 0, required: n });
|
|
512
512
|
} else {
|
|
513
|
-
|
|
514
|
-
let
|
|
513
|
+
c = !0, h = 0, p = void 0;
|
|
514
|
+
let f = g[0], P = _e({
|
|
515
515
|
currentBlock: d,
|
|
516
516
|
createdAtBlock: g[0].createdAt
|
|
517
517
|
});
|
|
518
|
-
for (const
|
|
519
|
-
const
|
|
518
|
+
for (const x of g.slice(1)) {
|
|
519
|
+
const w = _e({
|
|
520
520
|
currentBlock: d,
|
|
521
|
-
createdAtBlock:
|
|
521
|
+
createdAtBlock: x.createdAt
|
|
522
522
|
});
|
|
523
|
-
|
|
523
|
+
w < P && (P = w, f = x);
|
|
524
524
|
}
|
|
525
|
-
if (u == null || u({ confirmations:
|
|
526
|
-
return { confirmations:
|
|
525
|
+
if (u == null || u({ confirmations: P, required: n }), P >= n)
|
|
526
|
+
return { confirmations: P, basicInfo: f };
|
|
527
527
|
}
|
|
528
528
|
} catch (d) {
|
|
529
|
-
if (
|
|
529
|
+
if (Rr(d))
|
|
530
530
|
throw d;
|
|
531
531
|
console.warn(
|
|
532
532
|
`Registration-depth read failed (retrying in ${i}ms): ` + (d instanceof Error ? d.message : String(d))
|
|
533
533
|
), p = d;
|
|
534
534
|
}
|
|
535
535
|
await new Promise((d, g) => {
|
|
536
|
-
const
|
|
537
|
-
clearTimeout(
|
|
536
|
+
const y = () => {
|
|
537
|
+
clearTimeout(f), g(
|
|
538
538
|
new Error(
|
|
539
539
|
`Aborted while waiting for peg-in registration depth (${o.length} vault(s))`
|
|
540
540
|
)
|
|
541
541
|
);
|
|
542
|
-
},
|
|
543
|
-
s == null || s.removeEventListener("abort",
|
|
542
|
+
}, f = setTimeout(() => {
|
|
543
|
+
s == null || s.removeEventListener("abort", y), d();
|
|
544
544
|
}, i);
|
|
545
|
-
s == null || s.addEventListener("abort",
|
|
545
|
+
s == null || s.addEventListener("abort", y, { once: !0 });
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
const
|
|
550
|
-
class
|
|
549
|
+
const Br = /^(?:[0-9a-f]{2})*$/, Vr = /^[0-9a-f]{64}$/, Hr = /^([0-9a-f]{64}):(0|[1-9][0-9]*)$/, Or = -2147483648, Nr = 2147483647, te = 4294967295, ke = 2, Te = 2, W = 0;
|
|
550
|
+
class m extends Error {
|
|
551
551
|
constructor(t) {
|
|
552
552
|
super(t), this.name = "GraphFingerprintError";
|
|
553
553
|
}
|
|
@@ -555,264 +555,317 @@ class P extends Error {
|
|
|
555
555
|
function E(e, t, r) {
|
|
556
556
|
const o = e[t];
|
|
557
557
|
if (o === void 0)
|
|
558
|
-
throw new
|
|
558
|
+
throw new m(`Graph tx ${r} is missing "${t}"`);
|
|
559
559
|
return o;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function M(e, t) {
|
|
562
562
|
if (!Array.isArray(e))
|
|
563
|
-
throw new
|
|
563
|
+
throw new m(`Graph tx ${t} is not an array`);
|
|
564
564
|
return e;
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function S(e, t) {
|
|
567
567
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
568
|
-
throw new
|
|
568
|
+
throw new m(`Graph tx ${t} is not an object`);
|
|
569
569
|
return e;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function D(e, t, r, o) {
|
|
572
572
|
if (typeof e != "number" || !Number.isSafeInteger(e) || e < r || e > o)
|
|
573
|
-
throw new
|
|
573
|
+
throw new m(
|
|
574
574
|
`Graph tx ${t} is not an integer in [${r}, ${o}]`
|
|
575
575
|
);
|
|
576
576
|
return e;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
579
|
-
if (typeof e != "string" || !
|
|
580
|
-
throw new
|
|
578
|
+
function re(e, t) {
|
|
579
|
+
if (typeof e != "string" || !Br.test(e))
|
|
580
|
+
throw new m(
|
|
581
581
|
`Graph tx ${t} is not lowercase hex without a prefix`
|
|
582
582
|
);
|
|
583
|
-
return
|
|
583
|
+
return A.from(e, "hex");
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
if (typeof e != "string" || !
|
|
587
|
-
throw new
|
|
585
|
+
function Y(e, t) {
|
|
586
|
+
if (typeof e != "string" || !Vr.test(e))
|
|
587
|
+
throw new m(
|
|
588
588
|
`Graph ${t} is not 32 bytes of lowercase hex`
|
|
589
589
|
);
|
|
590
590
|
return e;
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
const r =
|
|
594
|
-
return o.version =
|
|
592
|
+
function $e(e, t) {
|
|
593
|
+
const r = S(e, t), o = new B();
|
|
594
|
+
return o.version = D(
|
|
595
595
|
E(r, "version", t),
|
|
596
596
|
`${t}.version`,
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
), o.locktime =
|
|
597
|
+
Or,
|
|
598
|
+
Nr
|
|
599
|
+
), o.locktime = D(
|
|
600
600
|
E(r, "lock_time", t),
|
|
601
601
|
`${t}.lock_time`,
|
|
602
602
|
0,
|
|
603
|
-
|
|
604
|
-
),
|
|
605
|
-
const a = `${t}.input[${i}]`, s =
|
|
606
|
-
if (!
|
|
607
|
-
throw new
|
|
603
|
+
te
|
|
604
|
+
), M(E(r, "input", t), `${t}.input`).forEach((n, i) => {
|
|
605
|
+
const a = `${t}.input[${i}]`, s = S(n, a), u = E(s, "previous_output", a), l = typeof u == "string" && Hr.exec(u);
|
|
606
|
+
if (!l)
|
|
607
|
+
throw new m(
|
|
608
608
|
`Graph tx ${a}.previous_output is not "<txid>:<vout>"`
|
|
609
609
|
);
|
|
610
|
-
const
|
|
610
|
+
const c = D(Number(l[2]), `${a}.previous_output vout`, 0, te);
|
|
611
611
|
o.addInput(
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
), o.ins[i].witness =
|
|
612
|
+
A.from(l[1], "hex").reverse(),
|
|
613
|
+
c,
|
|
614
|
+
D(E(s, "sequence", a), `${a}.sequence`, 0, te),
|
|
615
|
+
re(E(s, "script_sig", a), `${a}.script_sig`)
|
|
616
|
+
), o.ins[i].witness = M(
|
|
617
617
|
E(s, "witness", a),
|
|
618
618
|
`${a}.witness`
|
|
619
|
-
).map((h, p) =>
|
|
620
|
-
}),
|
|
621
|
-
const a = `${t}.output[${i}]`, s =
|
|
619
|
+
).map((h, p) => re(h, `${a}.witness[${p}]`));
|
|
620
|
+
}), M(E(r, "output", t), `${t}.output`).forEach((n, i) => {
|
|
621
|
+
const a = `${t}.output[${i}]`, s = S(n, a);
|
|
622
622
|
o.addOutput(
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
re(E(s, "script_pubkey", a), `${a}.script_pubkey`),
|
|
624
|
+
D(E(s, "value", a), `${a}.value`, 0, Number.MAX_SAFE_INTEGER)
|
|
625
625
|
);
|
|
626
626
|
}), new Uint8Array(o.toBuffer());
|
|
627
627
|
}
|
|
628
|
-
function
|
|
629
|
-
const r =
|
|
628
|
+
function O(e, t) {
|
|
629
|
+
const r = b(e).toLowerCase();
|
|
630
630
|
let o;
|
|
631
631
|
try {
|
|
632
632
|
o = B.fromHex(r);
|
|
633
633
|
} catch (n) {
|
|
634
|
-
throw new
|
|
634
|
+
throw new m(
|
|
635
635
|
`Presign ${t} is not one transaction: ${n instanceof Error ? n.message : String(n)}`
|
|
636
636
|
);
|
|
637
637
|
}
|
|
638
638
|
if (o.toHex() !== r)
|
|
639
|
-
throw new
|
|
639
|
+
throw new m(
|
|
640
640
|
`Presign ${t} is not a canonical transaction encoding`
|
|
641
641
|
);
|
|
642
642
|
return o;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function tt(e, t) {
|
|
645
|
+
const r = e.ins[t];
|
|
646
|
+
if (r)
|
|
647
|
+
return {
|
|
648
|
+
txid: A.from(r.hash).reverse().toString("hex"),
|
|
649
|
+
vout: r.index
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
function rt(e, t) {
|
|
653
|
+
if (!e.outs[W])
|
|
654
|
+
throw new m(
|
|
655
|
+
`Presign ${t}.claim_tx must have output ${W}`
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
function Kr(e, t, r) {
|
|
659
|
+
if (e.ins.length !== 1)
|
|
660
|
+
throw new m(
|
|
661
|
+
`Presign ${r}.claim_tx must have exactly one input, got ${e.ins.length}`
|
|
662
|
+
);
|
|
663
|
+
rt(e, r);
|
|
664
|
+
const o = tt(e, 0);
|
|
665
|
+
if ((o == null ? void 0 : o.txid) !== t || o.vout !== G) {
|
|
666
|
+
const n = o ? `${o.txid}:${o.vout}` : "no input";
|
|
667
|
+
throw new m(
|
|
668
|
+
`Presign ${r}.claim_tx must spend ${t}:${G}, got ${n}`
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
function le(e, t, r) {
|
|
673
|
+
const o = tt(e, 0);
|
|
674
|
+
if ((o == null ? void 0 : o.txid) !== t || o.vout !== W) {
|
|
675
|
+
const n = o ? `${o.txid}:${o.vout}` : "no input";
|
|
676
|
+
throw new m(
|
|
677
|
+
`Presign ${r}.assert_tx input 0 must spend ${t}:${W}, got ${n}`
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
function ot(e) {
|
|
682
|
+
const t = O(e.peginTxHex, `${e.path}.pegin_tx`), r = O(e.claimTxHex, `${e.path}.claim_tx`), o = O(e.assertTxHex, `${e.path}.assert_tx`);
|
|
683
|
+
return { peginTx: t, claimTx: r, assertTx: o };
|
|
684
|
+
}
|
|
685
|
+
function Dr(e) {
|
|
686
|
+
const t = O(e.claimTxHex, `${e.path}.claim_tx`), r = O(e.assertTxHex, `${e.path}.assert_tx`);
|
|
687
|
+
rt(t, e.path), le(r, t.getId(), e.path);
|
|
688
|
+
}
|
|
689
|
+
function Mr(e) {
|
|
690
|
+
const { peginTx: t, claimTx: r, assertTx: o } = ot(e);
|
|
691
|
+
Kr(r, t.getId(), e.path), le(o, r.getId(), e.path);
|
|
692
|
+
}
|
|
693
|
+
function Fr(e, t) {
|
|
645
694
|
const [r, ...o] = e.ins;
|
|
646
695
|
if (!r || o.length > 0)
|
|
647
|
-
throw new
|
|
696
|
+
throw new m(
|
|
648
697
|
`Presign claim_tx must have exactly one input, got ${e.ins.length}`
|
|
649
698
|
);
|
|
650
|
-
const n =
|
|
651
|
-
if (n !== t || r.index !==
|
|
652
|
-
throw new
|
|
653
|
-
`Presign claim_tx must spend ${t}:${
|
|
699
|
+
const n = A.from(r.hash).reverse().toString("hex");
|
|
700
|
+
if (n !== t || r.index !== G)
|
|
701
|
+
throw new m(
|
|
702
|
+
`Presign claim_tx must spend ${t}:${G}, got ${n}:${r.index}`
|
|
654
703
|
);
|
|
655
|
-
if (e.version !==
|
|
656
|
-
throw new
|
|
657
|
-
`Presign claim_tx version must be ${
|
|
704
|
+
if (e.version !== ke)
|
|
705
|
+
throw new m(
|
|
706
|
+
`Presign claim_tx version must be ${ke}, got ${e.version}`
|
|
658
707
|
);
|
|
659
708
|
if (r.witness.length > 0)
|
|
660
|
-
throw new
|
|
709
|
+
throw new m(
|
|
661
710
|
`Presign claim_tx input must have an empty witness, got ${r.witness.length} item(s)`
|
|
662
711
|
);
|
|
663
|
-
if (e.outs.length !==
|
|
664
|
-
throw new
|
|
665
|
-
`Presign claim_tx must have exactly ${
|
|
712
|
+
if (e.outs.length !== Te)
|
|
713
|
+
throw new m(
|
|
714
|
+
`Presign claim_tx must have exactly ${Te} outputs, got ${e.outs.length}`
|
|
666
715
|
);
|
|
667
716
|
}
|
|
668
|
-
function
|
|
717
|
+
function nt(e) {
|
|
669
718
|
const t = [...e.challengers].sort(
|
|
670
719
|
(o, n) => o.pubkey < n.pubkey ? -1 : o.pubkey > n.pubkey ? 1 : 0
|
|
671
720
|
), r = [e.peginTx, e.claimTx, e.assertTx, e.payoutTx];
|
|
672
721
|
return t.forEach((o, n) => {
|
|
673
|
-
const i =
|
|
722
|
+
const i = Y(o.pubkey, "challenger pubkey");
|
|
674
723
|
if (n > 0 && t[n - 1].pubkey === i)
|
|
675
|
-
throw new
|
|
676
|
-
r.push(
|
|
724
|
+
throw new m(`Graph lists challenger ${i} twice`);
|
|
725
|
+
r.push(Pe(i), o.nopayoutTx);
|
|
677
726
|
for (const a of o.outputLabelHashes)
|
|
678
|
-
r.push(
|
|
679
|
-
}),
|
|
727
|
+
r.push(Pe(Y(a, "output_label_hashes entry")));
|
|
728
|
+
}), Xt(qt(jt(...r)));
|
|
680
729
|
}
|
|
681
|
-
function
|
|
682
|
-
const t =
|
|
730
|
+
function Lr(e) {
|
|
731
|
+
const t = b(e.peginTxid).toLowerCase(), { peginTx: r, claimTx: o, assertTx: n } = ot({
|
|
732
|
+
peginTxHex: e.peginTxHex,
|
|
733
|
+
claimTxHex: e.claimTxHex,
|
|
734
|
+
assertTxHex: e.assertTxHex,
|
|
735
|
+
path: "depositor_graph"
|
|
736
|
+
});
|
|
683
737
|
if (r.getId() !== t)
|
|
684
|
-
throw new
|
|
738
|
+
throw new m(
|
|
685
739
|
`Presign pegin_tx hashes to ${r.getId()}, expected ${t}`
|
|
686
740
|
);
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
(a) => f(a).toLowerCase()
|
|
741
|
+
Fr(o, t), le(n, o.getId(), "depositor_graph");
|
|
742
|
+
const i = (a) => new Uint8Array(a.toBuffer());
|
|
743
|
+
return nt({
|
|
744
|
+
peginTx: i(r),
|
|
745
|
+
claimTx: i(o),
|
|
746
|
+
assertTx: i(n),
|
|
747
|
+
payoutTx: i(O(e.payoutTxHex, "payout_tx")),
|
|
748
|
+
challengers: e.challengers.map((a) => ({
|
|
749
|
+
pubkey: C(a.challenger_pubkey),
|
|
750
|
+
nopayoutTx: i(O(a.nopayout_tx.tx_hex, "nopayout_tx")),
|
|
751
|
+
outputLabelHashes: a.output_label_hashes.map(
|
|
752
|
+
(s) => b(s).toLowerCase()
|
|
700
753
|
)
|
|
701
754
|
}))
|
|
702
755
|
});
|
|
703
756
|
}
|
|
704
|
-
function
|
|
705
|
-
const t = (o) =>
|
|
757
|
+
function Ur(e) {
|
|
758
|
+
const t = (o) => $e(S(E(e, o, "graph"), o).tx, o), r = S(
|
|
706
759
|
E(e, "challenger_subgraphs", "graph"),
|
|
707
760
|
"challenger_subgraphs"
|
|
708
761
|
);
|
|
709
|
-
return
|
|
762
|
+
return nt({
|
|
710
763
|
peginTx: t("pegin_tx"),
|
|
711
764
|
claimTx: t("claim_tx"),
|
|
712
765
|
assertTx: t("assert_tx"),
|
|
713
766
|
payoutTx: t("payout_tx"),
|
|
714
767
|
challengers: Object.entries(r).map(([o, n]) => {
|
|
715
|
-
const i = `challenger_subgraphs[${o}]`, a =
|
|
768
|
+
const i = `challenger_subgraphs[${o}]`, a = S(n, i);
|
|
716
769
|
return {
|
|
717
770
|
pubkey: o,
|
|
718
|
-
nopayoutTx:
|
|
719
|
-
|
|
771
|
+
nopayoutTx: $e(
|
|
772
|
+
S(E(a, "nopayout_tx", i), `${i}.nopayout_tx`).tx,
|
|
720
773
|
`${i}.nopayout_tx`
|
|
721
774
|
),
|
|
722
|
-
outputLabelHashes:
|
|
775
|
+
outputLabelHashes: M(
|
|
723
776
|
E(a, "output_label_hashes", i),
|
|
724
777
|
`${i}.output_label_hashes`
|
|
725
778
|
).map(
|
|
726
|
-
(s, u) =>
|
|
779
|
+
(s, u) => Y(s, `${i}.output_label_hashes[${u}]`)
|
|
727
780
|
)
|
|
728
781
|
};
|
|
729
782
|
})
|
|
730
783
|
});
|
|
731
784
|
}
|
|
732
|
-
function
|
|
733
|
-
const t =
|
|
785
|
+
function Gr(e) {
|
|
786
|
+
const t = S(
|
|
734
787
|
E(e, "challenger_pubkeys", "graph"),
|
|
735
788
|
"challenger_pubkeys"
|
|
736
789
|
), r = /* @__PURE__ */ new Set();
|
|
737
790
|
for (const o of ["local", "universal"])
|
|
738
|
-
|
|
791
|
+
M(
|
|
739
792
|
E(t, o, "challenger_pubkeys"),
|
|
740
793
|
`challenger_pubkeys.${o}`
|
|
741
794
|
).forEach((n, i) => {
|
|
742
|
-
const a =
|
|
795
|
+
const a = Y(n, `challenger_pubkeys.${o}[${i}]`);
|
|
743
796
|
if (r.has(a))
|
|
744
|
-
throw new
|
|
797
|
+
throw new m(
|
|
745
798
|
`Graph declares challenger ${a} more than once`
|
|
746
799
|
);
|
|
747
800
|
r.add(a);
|
|
748
801
|
});
|
|
749
802
|
return r;
|
|
750
803
|
}
|
|
751
|
-
function
|
|
752
|
-
const r =
|
|
804
|
+
function Yo(e, t) {
|
|
805
|
+
const r = Ur(e);
|
|
753
806
|
if (r !== t)
|
|
754
|
-
throw new
|
|
807
|
+
throw new m(
|
|
755
808
|
`Graph fingerprint ${r} does not match the presign fingerprint ${t}`
|
|
756
809
|
);
|
|
757
810
|
const o = Object.keys(
|
|
758
|
-
|
|
759
|
-
), n =
|
|
811
|
+
S(e.challenger_subgraphs, "challenger_subgraphs")
|
|
812
|
+
), n = Gr(e);
|
|
760
813
|
if (o.length !== n.size || o.some((i) => !n.has(i)))
|
|
761
|
-
throw new
|
|
814
|
+
throw new m(
|
|
762
815
|
`Graph challenger_subgraphs keys ${o.join(", ")} do not match challenger_pubkeys ${[...n].join(", ")}`
|
|
763
816
|
);
|
|
764
817
|
}
|
|
765
|
-
const
|
|
766
|
-
function
|
|
818
|
+
const Xr = 1;
|
|
819
|
+
function qr(e, t, r) {
|
|
767
820
|
const o = r.map(
|
|
768
|
-
(h) =>
|
|
821
|
+
(h) => b(h).toLowerCase()
|
|
769
822
|
), n = t.filter((h) => o.includes(h));
|
|
770
823
|
if (n.length > 0)
|
|
771
824
|
throw new Error(
|
|
772
825
|
`Cannot validate challenger set: vault keepers and universal challengers overlap (${n.join(", ")})`
|
|
773
826
|
);
|
|
774
827
|
const i = [...t, ...o], a = e.map(
|
|
775
|
-
(h) =>
|
|
828
|
+
(h) => b(h.challenger_pubkey).toLowerCase()
|
|
776
829
|
), s = new Set(a);
|
|
777
830
|
if (s.size !== a.length)
|
|
778
831
|
throw new Error(
|
|
779
832
|
"Depositor graph contains duplicate challenger entries in challenger_presign_data"
|
|
780
833
|
);
|
|
781
|
-
const u = new Set(i),
|
|
782
|
-
if (
|
|
834
|
+
const u = new Set(i), l = i.filter((h) => !s.has(h)), c = a.filter((h) => !u.has(h));
|
|
835
|
+
if (l.length > 0 || c.length > 0)
|
|
783
836
|
throw new Error(
|
|
784
|
-
"Depositor graph challenger set does not match expected (local ∪ universal)" + (
|
|
837
|
+
"Depositor graph challenger set does not match expected (local ∪ universal)" + (l.length > 0 ? ` (missing: ${l.join(", ")})` : "") + (c.length > 0 ? ` (unexpected: ${c.join(", ")})` : "")
|
|
785
838
|
);
|
|
786
839
|
}
|
|
787
|
-
function
|
|
840
|
+
function jr(e, t) {
|
|
788
841
|
const r = e.ins[t];
|
|
789
|
-
return
|
|
842
|
+
return Le(new Uint8Array(r.hash).slice().reverse());
|
|
790
843
|
}
|
|
791
|
-
function
|
|
844
|
+
function oe(e, t, r, o, n) {
|
|
792
845
|
const i = e.ins[t];
|
|
793
846
|
if (i.index !== 0)
|
|
794
847
|
throw new Error(
|
|
795
848
|
`NoPayout (challenger ${n}) input ${t} expected to spend ${o} vout 0, got vout ${i.index}`
|
|
796
849
|
);
|
|
797
|
-
const a = r.getId(), s =
|
|
850
|
+
const a = r.getId(), s = jr(e, t);
|
|
798
851
|
if (s !== a)
|
|
799
852
|
throw new Error(
|
|
800
853
|
`NoPayout (challenger ${n}) input ${t} does not reference ${o} (expected txid ${a}, got ${s})`
|
|
801
854
|
);
|
|
802
855
|
}
|
|
803
|
-
async function
|
|
804
|
-
const o = [], n = [], i = [], a =
|
|
856
|
+
async function zr(e, t, r) {
|
|
857
|
+
const o = [], n = [], i = [], a = Ge({
|
|
805
858
|
claimerBtcPubkey: r.depositorBtcPubkey,
|
|
806
859
|
depositorBtcPubkey: r.depositorBtcPubkey,
|
|
807
860
|
vaultProviderBtcPubkey: r.vaultProviderBtcPubkey,
|
|
808
861
|
vaultKeeperBtcPubkeys: r.vaultKeeperBtcPubkeys
|
|
809
862
|
});
|
|
810
|
-
|
|
863
|
+
qr(
|
|
811
864
|
e.challenger_presign_data,
|
|
812
865
|
a,
|
|
813
866
|
r.universalChallengerBtcPubkeys
|
|
814
867
|
);
|
|
815
|
-
const s = await
|
|
868
|
+
const s = await Ot({
|
|
816
869
|
vaultCoreVersion: r.vaultCoreVersion,
|
|
817
870
|
vkClaimerPayoutScriptPubKeys: r.vkClaimerPayoutScriptPubKeys,
|
|
818
871
|
vpCommissionScriptPubKey: r.vpCommissionScriptPubKey,
|
|
@@ -828,33 +881,33 @@ async function Mr(e, t, r) {
|
|
|
828
881
|
network: r.network,
|
|
829
882
|
claimerBtcPubkey: r.depositorBtcPubkey,
|
|
830
883
|
registeredPayoutScriptPubKey: r.registeredPayoutScriptPubKey,
|
|
831
|
-
commissionBps:
|
|
884
|
+
commissionBps: Xr,
|
|
832
885
|
protocolFeeRate: r.protocolFeeRate,
|
|
833
886
|
councilMembers: r.councilMembers,
|
|
834
887
|
councilQuorum: r.councilQuorum
|
|
835
888
|
});
|
|
836
889
|
o.push(s.psbtHex), n.push(
|
|
837
|
-
|
|
890
|
+
U(
|
|
838
891
|
t,
|
|
839
|
-
|
|
892
|
+
be
|
|
840
893
|
)
|
|
841
894
|
);
|
|
842
|
-
const u =
|
|
843
|
-
|
|
895
|
+
const u = b(r.depositorBtcPubkey), l = B.fromHex(
|
|
896
|
+
b(e.assert_tx.tx_hex)
|
|
844
897
|
);
|
|
845
|
-
for (const
|
|
846
|
-
const h =
|
|
847
|
-
challenger:
|
|
898
|
+
for (const c of e.challenger_presign_data) {
|
|
899
|
+
const h = b(c.challenger_pubkey), p = o.length, d = await Wr({
|
|
900
|
+
challenger: c,
|
|
848
901
|
challengerPubkey: h,
|
|
849
902
|
claimerPubkey: u,
|
|
850
903
|
localChallengers: a,
|
|
851
|
-
assertTxParsed:
|
|
904
|
+
assertTxParsed: l,
|
|
852
905
|
ctx: r
|
|
853
906
|
});
|
|
854
907
|
o.push(d), n.push(
|
|
855
|
-
|
|
908
|
+
U(
|
|
856
909
|
t,
|
|
857
|
-
|
|
910
|
+
be
|
|
858
911
|
)
|
|
859
912
|
), i.push({
|
|
860
913
|
challengerPubkey: h,
|
|
@@ -863,7 +916,7 @@ async function Mr(e, t, r) {
|
|
|
863
916
|
}
|
|
864
917
|
return { psbtHexes: o, signOptions: n, challengerEntries: i };
|
|
865
918
|
}
|
|
866
|
-
async function
|
|
919
|
+
async function Wr(e) {
|
|
867
920
|
const {
|
|
868
921
|
challenger: t,
|
|
869
922
|
challengerPubkey: r,
|
|
@@ -872,53 +925,53 @@ async function Fr(e) {
|
|
|
872
925
|
assertTxParsed: i,
|
|
873
926
|
ctx: a
|
|
874
927
|
} = e;
|
|
875
|
-
|
|
928
|
+
zt(
|
|
876
929
|
t.nopayout_tx.tx_hex,
|
|
877
930
|
r,
|
|
878
931
|
a.network
|
|
879
932
|
);
|
|
880
933
|
const s = B.fromHex(
|
|
881
|
-
|
|
934
|
+
b(t.nopayout_tx.tx_hex)
|
|
882
935
|
), u = B.fromHex(
|
|
883
|
-
|
|
884
|
-
),
|
|
885
|
-
|
|
936
|
+
b(t.challenge_assert_x_tx.tx_hex)
|
|
937
|
+
), l = B.fromHex(
|
|
938
|
+
b(t.challenge_assert_y_tx.tx_hex)
|
|
886
939
|
);
|
|
887
940
|
if (s.ins.length !== 3)
|
|
888
941
|
throw new Error(
|
|
889
942
|
`NoPayout (challenger ${r}) must have exactly 3 inputs, got ${s.ins.length}`
|
|
890
943
|
);
|
|
891
|
-
|
|
944
|
+
oe(
|
|
892
945
|
s,
|
|
893
946
|
0,
|
|
894
947
|
i,
|
|
895
948
|
"Assert",
|
|
896
949
|
r
|
|
897
|
-
),
|
|
950
|
+
), oe(
|
|
898
951
|
s,
|
|
899
952
|
1,
|
|
900
953
|
u,
|
|
901
954
|
"ChallengeAssertX",
|
|
902
955
|
r
|
|
903
|
-
),
|
|
956
|
+
), oe(
|
|
904
957
|
s,
|
|
905
958
|
2,
|
|
906
|
-
|
|
959
|
+
l,
|
|
907
960
|
"ChallengeAssertY",
|
|
908
961
|
r
|
|
909
962
|
);
|
|
910
|
-
const
|
|
963
|
+
const c = [
|
|
911
964
|
i.outs[0],
|
|
912
965
|
u.outs[0],
|
|
913
|
-
|
|
966
|
+
l.outs[0]
|
|
914
967
|
].map((h) => ({
|
|
915
|
-
script_pubkey:
|
|
968
|
+
script_pubkey: Le(new Uint8Array(h.script)),
|
|
916
969
|
value: h.value
|
|
917
970
|
}));
|
|
918
|
-
return
|
|
971
|
+
return Wt({
|
|
919
972
|
noPayoutTxHex: t.nopayout_tx.tx_hex,
|
|
920
973
|
challengerPubkey: r,
|
|
921
|
-
prevouts:
|
|
974
|
+
prevouts: c,
|
|
922
975
|
connectorParams: {
|
|
923
976
|
txGraphVersion: a.vaultCoreVersion,
|
|
924
977
|
claimer: o,
|
|
@@ -930,13 +983,13 @@ async function Fr(e) {
|
|
|
930
983
|
}
|
|
931
984
|
});
|
|
932
985
|
}
|
|
933
|
-
function
|
|
934
|
-
|
|
935
|
-
const n =
|
|
986
|
+
function Yr(e, t, r) {
|
|
987
|
+
X(e[0]);
|
|
988
|
+
const n = q(
|
|
936
989
|
e[0].returnedPsbtHex,
|
|
937
990
|
r
|
|
938
991
|
);
|
|
939
|
-
|
|
992
|
+
j({
|
|
940
993
|
requestedPsbtHex: e[0].requestedPsbtHex,
|
|
941
994
|
signatureHex: n,
|
|
942
995
|
signerXOnlyPubkeyHex: r,
|
|
@@ -944,12 +997,12 @@ function Lr(e, t, r) {
|
|
|
944
997
|
});
|
|
945
998
|
const i = {};
|
|
946
999
|
for (const a of t) {
|
|
947
|
-
|
|
948
|
-
const s =
|
|
1000
|
+
X(e[a.noPayoutIdx]);
|
|
1001
|
+
const s = q(
|
|
949
1002
|
e[a.noPayoutIdx].returnedPsbtHex,
|
|
950
1003
|
r
|
|
951
1004
|
);
|
|
952
|
-
|
|
1005
|
+
j({
|
|
953
1006
|
requestedPsbtHex: e[a.noPayoutIdx].requestedPsbtHex,
|
|
954
1007
|
signatureHex: s,
|
|
955
1008
|
signerXOnlyPubkeyHex: r,
|
|
@@ -965,109 +1018,116 @@ function Lr(e, t, r) {
|
|
|
965
1018
|
per_challenger: i
|
|
966
1019
|
};
|
|
967
1020
|
}
|
|
968
|
-
async function
|
|
969
|
-
const { depositorGraph: t, btcWallet: r, signingContext: o } = e
|
|
1021
|
+
async function Qr(e) {
|
|
1022
|
+
const { depositorGraph: t, btcWallet: r, signingContext: o } = e;
|
|
1023
|
+
Mr({
|
|
1024
|
+
peginTxHex: o.peginTxHex,
|
|
1025
|
+
claimTxHex: t.claim_tx.tx_hex,
|
|
1026
|
+
assertTxHex: t.assert_tx.tx_hex,
|
|
1027
|
+
path: "depositor_graph"
|
|
1028
|
+
});
|
|
1029
|
+
const n = await r.getPublicKeyHex(), { depositorPubkey: i } = yt(
|
|
970
1030
|
n,
|
|
971
|
-
|
|
972
|
-
), { psbtHexes: a, signOptions: s, challengerEntries: u } = await
|
|
1031
|
+
b(o.depositorBtcPubkey)
|
|
1032
|
+
), { psbtHexes: a, signOptions: s, challengerEntries: u } = await zr(
|
|
973
1033
|
t,
|
|
974
1034
|
n,
|
|
975
1035
|
o
|
|
976
|
-
),
|
|
1036
|
+
), l = await Ue(
|
|
977
1037
|
r,
|
|
978
1038
|
a,
|
|
979
1039
|
s
|
|
980
|
-
),
|
|
1040
|
+
), c = a.map((h, p) => ({
|
|
981
1041
|
requestedPsbtHex: h,
|
|
982
|
-
returnedPsbtHex:
|
|
1042
|
+
returnedPsbtHex: l[p]
|
|
983
1043
|
}));
|
|
984
|
-
return
|
|
985
|
-
|
|
1044
|
+
return Yr(
|
|
1045
|
+
c,
|
|
986
1046
|
u,
|
|
987
1047
|
i
|
|
988
1048
|
);
|
|
989
1049
|
}
|
|
990
|
-
const
|
|
991
|
-
async function
|
|
1050
|
+
const Jr = 1e4, N = 10;
|
|
1051
|
+
async function st(e) {
|
|
992
1052
|
const {
|
|
993
1053
|
statusReader: t,
|
|
994
1054
|
vaultId: r,
|
|
995
1055
|
peginTxid: o,
|
|
996
1056
|
targetStatuses: n,
|
|
997
1057
|
timeoutMs: i,
|
|
998
|
-
pollIntervalMs: a =
|
|
1058
|
+
pollIntervalMs: a = Jr,
|
|
999
1059
|
signal: s
|
|
1000
1060
|
} = e, u = Date.now();
|
|
1001
1061
|
for (; ; ) {
|
|
1002
1062
|
if (s != null && s.aborted)
|
|
1003
1063
|
throw new Error(
|
|
1004
|
-
`Polling aborted for vault ${r.slice(0,
|
|
1064
|
+
`Polling aborted for vault ${r.slice(0, N)}… (target: ${[...n].join(", ")})`
|
|
1005
1065
|
);
|
|
1006
1066
|
if (Date.now() - u >= i)
|
|
1007
1067
|
throw new Error(
|
|
1008
|
-
`Polling timeout after ${i}ms for vault ${r.slice(0,
|
|
1068
|
+
`Polling timeout after ${i}ms for vault ${r.slice(0, N)}… (target: ${[...n].join(", ")})`
|
|
1009
1069
|
);
|
|
1010
1070
|
try {
|
|
1011
|
-
const
|
|
1071
|
+
const l = await t.getPeginStatusByVaultId(
|
|
1012
1072
|
{ vault_id: r },
|
|
1013
1073
|
s
|
|
1014
1074
|
);
|
|
1015
|
-
if (
|
|
1075
|
+
if (ve(l.vault_id) !== ve(r))
|
|
1016
1076
|
throw new Error(
|
|
1017
|
-
`getPeginStatusByVaultId returned status for vault ${
|
|
1077
|
+
`getPeginStatusByVaultId returned status for vault ${l.vault_id.slice(0, N)}…, requested ${r.slice(0, N)}…`
|
|
1018
1078
|
);
|
|
1019
|
-
if (
|
|
1079
|
+
if (l.pegin_txid.toLowerCase() !== o.toLowerCase())
|
|
1020
1080
|
throw new Error(
|
|
1021
|
-
`getPeginStatusByVaultId returned status for pegin ${
|
|
1081
|
+
`getPeginStatusByVaultId returned status for pegin ${l.pegin_txid.slice(0, 8)}…, requested ${o.slice(0, 8)}…`
|
|
1022
1082
|
);
|
|
1023
|
-
const
|
|
1024
|
-
if (n.has(
|
|
1025
|
-
return
|
|
1026
|
-
if (
|
|
1083
|
+
const c = l.status;
|
|
1084
|
+
if (n.has(c) || c === R.ACTIVATED)
|
|
1085
|
+
return c;
|
|
1086
|
+
if (c === R.EXPIRED || Lt.has(c))
|
|
1027
1087
|
throw new Error(
|
|
1028
|
-
`Vault ${r.slice(0,
|
|
1088
|
+
`Vault ${r.slice(0, N)}… reached terminal status "${c}" while waiting for ${[...n].join(", ")}`
|
|
1029
1089
|
);
|
|
1030
|
-
} catch (
|
|
1031
|
-
if (!(
|
|
1032
|
-
throw
|
|
1090
|
+
} catch (l) {
|
|
1091
|
+
if (!(l instanceof Ut && l.code === Gt.PEGIN_NOT_FOUND))
|
|
1092
|
+
throw l;
|
|
1033
1093
|
}
|
|
1034
|
-
await new Promise((
|
|
1094
|
+
await new Promise((l, c) => {
|
|
1035
1095
|
const h = () => {
|
|
1036
|
-
clearTimeout(p),
|
|
1096
|
+
clearTimeout(p), c(
|
|
1037
1097
|
new Error(
|
|
1038
|
-
`Polling aborted for vault ${r.slice(0,
|
|
1098
|
+
`Polling aborted for vault ${r.slice(0, N)}… (target: ${[...n].join(", ")})`
|
|
1039
1099
|
)
|
|
1040
1100
|
);
|
|
1041
1101
|
}, p = setTimeout(() => {
|
|
1042
|
-
s == null || s.removeEventListener("abort", h),
|
|
1102
|
+
s == null || s.removeEventListener("abort", h), l();
|
|
1043
1103
|
}, a);
|
|
1044
1104
|
s == null || s.addEventListener("abort", h, { once: !0 });
|
|
1045
1105
|
});
|
|
1046
1106
|
}
|
|
1047
1107
|
}
|
|
1048
|
-
const
|
|
1108
|
+
const Zr = 1200 * 1e3, at = /* @__PURE__ */ new Set([
|
|
1049
1109
|
R.PENDING_ACKS,
|
|
1050
1110
|
R.PENDING_ACTIVATION,
|
|
1051
1111
|
R.ACTIVATED_PENDING_BROADCAST,
|
|
1052
1112
|
R.ACTIVATED
|
|
1053
|
-
]),
|
|
1113
|
+
]), eo = /* @__PURE__ */ new Set([
|
|
1054
1114
|
R.PENDING_DEPOSITOR_SIGNATURES,
|
|
1055
|
-
...
|
|
1115
|
+
...at
|
|
1056
1116
|
]);
|
|
1057
|
-
function
|
|
1117
|
+
function to(e) {
|
|
1058
1118
|
return e.map((t) => ({
|
|
1059
|
-
claimerPubkeyXOnly:
|
|
1119
|
+
claimerPubkeyXOnly: Q(t.claimer_pubkey),
|
|
1060
1120
|
payoutTxHex: t.payout_tx.tx_hex,
|
|
1061
1121
|
assertTxHex: t.assert_tx.tx_hex
|
|
1062
1122
|
}));
|
|
1063
1123
|
}
|
|
1064
|
-
function
|
|
1065
|
-
return
|
|
1124
|
+
function I(e) {
|
|
1125
|
+
return Q(e).toLowerCase();
|
|
1066
1126
|
}
|
|
1067
|
-
function
|
|
1068
|
-
const r = (u,
|
|
1127
|
+
function ro(e, t) {
|
|
1128
|
+
const r = (u, l, c) => {
|
|
1069
1129
|
throw new Error(
|
|
1070
|
-
`Deposit terms ${u} (${String(
|
|
1130
|
+
`Deposit terms ${u} (${String(l)}) does not match the vault's version-locked signing context (${String(c)}); refusing to sign payouts against terms that describe a different graph.`
|
|
1071
1131
|
);
|
|
1072
1132
|
}, o = [
|
|
1073
1133
|
["protocolFeeRate", e.protocolFeeRate, t.protocolFeeRate],
|
|
@@ -1075,11 +1135,11 @@ function zr(e, t) {
|
|
|
1075
1135
|
["timelockPegin", e.timelockPegin, t.timelockPegin],
|
|
1076
1136
|
["timelockAssert", e.timelockAssert, t.timelockAssert]
|
|
1077
1137
|
];
|
|
1078
|
-
for (const [u,
|
|
1079
|
-
|
|
1080
|
-
const n = (u) => u.map(
|
|
1081
|
-
const
|
|
1082
|
-
return
|
|
1138
|
+
for (const [u, l, c] of o)
|
|
1139
|
+
l !== c && r(u, l, c);
|
|
1140
|
+
const n = (u) => u.map(I).sort(), i = (u, l) => {
|
|
1141
|
+
const c = n(u), h = n(l);
|
|
1142
|
+
return c.length === h.length && c.every((p, d) => p === h[d]);
|
|
1083
1143
|
};
|
|
1084
1144
|
i(e.vaultKeeperBtcPubkeys, t.vaultKeeperBtcPubkeys) || r(
|
|
1085
1145
|
"vaultKeeperBtcPubkeys",
|
|
@@ -1093,8 +1153,8 @@ function zr(e, t) {
|
|
|
1093
1153
|
e.universalChallengerBtcPubkeys.join(","),
|
|
1094
1154
|
t.universalChallengerBtcPubkeys.join(",")
|
|
1095
1155
|
);
|
|
1096
|
-
const a =
|
|
1097
|
-
(u) =>
|
|
1156
|
+
const a = I(t.vaultProviderBtcPubkey), s = e.vaults.map(
|
|
1157
|
+
(u) => I(u.vaultProviderBtcPubkey)
|
|
1098
1158
|
);
|
|
1099
1159
|
s.includes(a) || r(
|
|
1100
1160
|
"vaults[].vaultProviderBtcPubkey",
|
|
@@ -1102,10 +1162,10 @@ function zr(e, t) {
|
|
|
1102
1162
|
t.vaultProviderBtcPubkey
|
|
1103
1163
|
);
|
|
1104
1164
|
}
|
|
1105
|
-
function
|
|
1106
|
-
const n =
|
|
1107
|
-
|
|
1108
|
-
...r.map(
|
|
1165
|
+
function oo(e, t, r, o) {
|
|
1166
|
+
const n = I(o), i = [
|
|
1167
|
+
I(t),
|
|
1168
|
+
...r.map(I)
|
|
1109
1169
|
], a = new Set(i);
|
|
1110
1170
|
if (a.size !== i.length)
|
|
1111
1171
|
throw new Error(
|
|
@@ -1116,17 +1176,17 @@ function Wr(e, t, r, o) {
|
|
|
1116
1176
|
"Cannot validate claimer set: depositor key overlaps with vault provider or vault keeper set"
|
|
1117
1177
|
);
|
|
1118
1178
|
const s = e.map(
|
|
1119
|
-
(p) =>
|
|
1179
|
+
(p) => I(p.claimer_pubkey)
|
|
1120
1180
|
);
|
|
1121
1181
|
if (new Set(s).size !== s.length)
|
|
1122
1182
|
throw new Error("Presign response contains duplicate claimer entries");
|
|
1123
|
-
const u = s.filter((p) => p !== n),
|
|
1124
|
-
if (
|
|
1183
|
+
const u = s.filter((p) => p !== n), l = new Set(u), c = i.filter((p) => !l.has(p)), h = u.filter((p) => !a.has(p));
|
|
1184
|
+
if (c.length > 0 || h.length > 0)
|
|
1125
1185
|
throw new Error(
|
|
1126
|
-
"Presign response claimer set does not match expected (vault provider ∪ vault keepers)" + (
|
|
1186
|
+
"Presign response claimer set does not match expected (vault provider ∪ vault keepers)" + (c.length > 0 ? ` (missing: ${c.join(", ")})` : "") + (h.length > 0 ? ` (unexpected: ${h.join(", ")})` : "")
|
|
1127
1187
|
);
|
|
1128
1188
|
}
|
|
1129
|
-
function
|
|
1189
|
+
function Ce(e, t) {
|
|
1130
1190
|
return {
|
|
1131
1191
|
vaultCoreVersion: t.vaultCoreVersion,
|
|
1132
1192
|
payoutTxHex: e.payoutTxHex,
|
|
@@ -1148,8 +1208,8 @@ function Te(e, t) {
|
|
|
1148
1208
|
vpCommissionScriptPubKey: t.vpCommissionScriptPubKey
|
|
1149
1209
|
};
|
|
1150
1210
|
}
|
|
1151
|
-
async function
|
|
1152
|
-
const n = new
|
|
1211
|
+
async function no(e, t, r, o) {
|
|
1212
|
+
const n = new vt({
|
|
1153
1213
|
network: t.network,
|
|
1154
1214
|
btcWallet: e
|
|
1155
1215
|
}), i = r.length;
|
|
@@ -1157,16 +1217,16 @@ async function Yr(e, t, r, o) {
|
|
|
1157
1217
|
let a;
|
|
1158
1218
|
if (n.supportsBatchSigning())
|
|
1159
1219
|
a = (await n.signPayoutTransactionsBatch(
|
|
1160
|
-
r.map((
|
|
1161
|
-
)).map((
|
|
1220
|
+
r.map((l) => Ce(l, t))
|
|
1221
|
+
)).map((l) => l.payoutSignature);
|
|
1162
1222
|
else {
|
|
1163
1223
|
a = [];
|
|
1164
1224
|
for (let u = 0; u < r.length; u++) {
|
|
1165
1225
|
o == null || o(u, i);
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1226
|
+
const l = await n.signPayoutTransaction(
|
|
1227
|
+
Ce(r[u], t)
|
|
1168
1228
|
);
|
|
1169
|
-
a.push(
|
|
1229
|
+
a.push(l.signature);
|
|
1170
1230
|
}
|
|
1171
1231
|
}
|
|
1172
1232
|
const s = {};
|
|
@@ -1176,7 +1236,7 @@ async function Yr(e, t, r, o) {
|
|
|
1176
1236
|
};
|
|
1177
1237
|
return o == null || o(i, i), s;
|
|
1178
1238
|
}
|
|
1179
|
-
async function
|
|
1239
|
+
async function Qo(e) {
|
|
1180
1240
|
const {
|
|
1181
1241
|
statusReader: t,
|
|
1182
1242
|
presignClient: r,
|
|
@@ -1186,60 +1246,71 @@ async function Uo(e) {
|
|
|
1186
1246
|
depositorPk: a,
|
|
1187
1247
|
signingContext: s,
|
|
1188
1248
|
depositTerms: u,
|
|
1189
|
-
timeoutMs:
|
|
1190
|
-
signal:
|
|
1249
|
+
timeoutMs: l = Zr,
|
|
1250
|
+
signal: c,
|
|
1191
1251
|
onProgress: h,
|
|
1192
1252
|
recordGraphFingerprint: p
|
|
1193
|
-
} = e, d = await
|
|
1253
|
+
} = e, d = await st({
|
|
1194
1254
|
statusReader: t,
|
|
1195
1255
|
vaultId: n,
|
|
1196
1256
|
peginTxid: i,
|
|
1197
|
-
targetStatuses:
|
|
1198
|
-
timeoutMs:
|
|
1199
|
-
signal:
|
|
1257
|
+
targetStatuses: eo,
|
|
1258
|
+
timeoutMs: l,
|
|
1259
|
+
signal: c
|
|
1200
1260
|
});
|
|
1201
|
-
if (
|
|
1261
|
+
if (at.has(d))
|
|
1202
1262
|
return;
|
|
1203
|
-
|
|
1263
|
+
c == null || c.throwIfAborted(), u !== void 0 && ro(u, s);
|
|
1264
|
+
const g = mt(o) ? o : void 0;
|
|
1265
|
+
let y;
|
|
1266
|
+
if (g) {
|
|
1204
1267
|
if (!u)
|
|
1205
1268
|
throw new Error(
|
|
1206
1269
|
"runDepositorPresignFlow: this wallet requires approved deposit terms but none were provided. Fresh deposits must pass PreparePeginResult.depositTerms; resume flows must rebuild them from on-chain state (the vault app's rebuildDepositTerms)."
|
|
1207
1270
|
);
|
|
1208
|
-
|
|
1271
|
+
y = u;
|
|
1209
1272
|
}
|
|
1210
|
-
const
|
|
1273
|
+
const f = await r.requestDepositorPresignTransactions(
|
|
1211
1274
|
{
|
|
1212
1275
|
pegin_txid: i,
|
|
1213
1276
|
depositor_pk: a
|
|
1214
1277
|
},
|
|
1215
|
-
|
|
1278
|
+
c
|
|
1216
1279
|
);
|
|
1217
|
-
|
|
1218
|
-
|
|
1280
|
+
c == null || c.throwIfAborted(), f.txs.forEach((V, F) => {
|
|
1281
|
+
Dr({
|
|
1282
|
+
claimTxHex: V.claim_tx.tx_hex,
|
|
1283
|
+
assertTxHex: V.assert_tx.tx_hex,
|
|
1284
|
+
path: `txs[${F}]`
|
|
1285
|
+
});
|
|
1286
|
+
});
|
|
1287
|
+
const P = Lr({
|
|
1219
1288
|
peginTxid: i,
|
|
1220
1289
|
peginTxHex: s.peginTxHex,
|
|
1221
|
-
claimTxHex:
|
|
1222
|
-
assertTxHex:
|
|
1223
|
-
payoutTxHex:
|
|
1224
|
-
challengers:
|
|
1225
|
-
}),
|
|
1226
|
-
|
|
1227
|
-
|
|
1290
|
+
claimTxHex: f.depositor_graph.claim_tx.tx_hex,
|
|
1291
|
+
assertTxHex: f.depositor_graph.assert_tx.tx_hex,
|
|
1292
|
+
payoutTxHex: f.depositor_graph.payout_tx.tx_hex,
|
|
1293
|
+
challengers: f.depositor_graph.challenger_presign_data
|
|
1294
|
+
}), x = I(a);
|
|
1295
|
+
oo(
|
|
1296
|
+
f.txs,
|
|
1228
1297
|
s.vaultProviderBtcPubkey,
|
|
1229
1298
|
s.vaultKeeperBtcPubkeys,
|
|
1230
1299
|
a
|
|
1231
1300
|
);
|
|
1232
|
-
const
|
|
1233
|
-
(
|
|
1234
|
-
),
|
|
1301
|
+
const w = f.txs.filter(
|
|
1302
|
+
(V) => I(V.claimer_pubkey) !== x
|
|
1303
|
+
), _ = to(w);
|
|
1304
|
+
g && y && (typeof g.validateDepositTerms == "function" && await g.validateDepositTerms(y), await g.approveDepositTerms(y)), c == null || c.throwIfAborted();
|
|
1305
|
+
const k = await no(
|
|
1235
1306
|
o,
|
|
1236
1307
|
s,
|
|
1237
|
-
|
|
1308
|
+
_,
|
|
1238
1309
|
h
|
|
1239
1310
|
);
|
|
1240
|
-
|
|
1241
|
-
const
|
|
1242
|
-
depositorGraph:
|
|
1311
|
+
c == null || c.throwIfAborted();
|
|
1312
|
+
const T = await Qr({
|
|
1313
|
+
depositorGraph: f.depositor_graph,
|
|
1243
1314
|
btcWallet: o,
|
|
1244
1315
|
signingContext: {
|
|
1245
1316
|
vaultCoreVersion: s.vaultCoreVersion,
|
|
@@ -1259,23 +1330,23 @@ async function Uo(e) {
|
|
|
1259
1330
|
vpCommissionScriptPubKey: s.vpCommissionScriptPubKey
|
|
1260
1331
|
}
|
|
1261
1332
|
});
|
|
1262
|
-
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1333
|
+
c == null || c.throwIfAborted(), await p(P), c == null || c.throwIfAborted();
|
|
1334
|
+
const v = { ...k };
|
|
1335
|
+
v[b(a)] = T.payout_signatures, await r.submitDepositorPresignatures(
|
|
1265
1336
|
{
|
|
1266
1337
|
pegin_txid: i,
|
|
1267
1338
|
depositor_pk: a,
|
|
1268
|
-
signatures:
|
|
1269
|
-
depositor_claimer_presignatures:
|
|
1339
|
+
signatures: v,
|
|
1340
|
+
depositor_claimer_presignatures: T
|
|
1270
1341
|
},
|
|
1271
|
-
|
|
1342
|
+
c
|
|
1272
1343
|
);
|
|
1273
1344
|
}
|
|
1274
|
-
const
|
|
1345
|
+
const so = 300 * 1e3, ao = /* @__PURE__ */ new Set([
|
|
1275
1346
|
R.PENDING_DEPOSITOR_WOTS_PK,
|
|
1276
|
-
...
|
|
1347
|
+
...qe
|
|
1277
1348
|
]);
|
|
1278
|
-
async function
|
|
1349
|
+
async function Jo(e) {
|
|
1279
1350
|
const {
|
|
1280
1351
|
statusReader: t,
|
|
1281
1352
|
wotsSubmitter: r,
|
|
@@ -1283,19 +1354,19 @@ async function Go(e) {
|
|
|
1283
1354
|
peginTxid: n,
|
|
1284
1355
|
depositorPk: i,
|
|
1285
1356
|
wotsPublicKeys: a,
|
|
1286
|
-
timeoutMs: s =
|
|
1357
|
+
timeoutMs: s = so,
|
|
1287
1358
|
signal: u
|
|
1288
1359
|
} = e;
|
|
1289
1360
|
u == null || u.throwIfAborted();
|
|
1290
|
-
const
|
|
1361
|
+
const l = await st({
|
|
1291
1362
|
statusReader: t,
|
|
1292
1363
|
vaultId: o,
|
|
1293
1364
|
peginTxid: n,
|
|
1294
|
-
targetStatuses:
|
|
1365
|
+
targetStatuses: ao,
|
|
1295
1366
|
timeoutMs: s,
|
|
1296
1367
|
signal: u
|
|
1297
1368
|
});
|
|
1298
|
-
|
|
1369
|
+
qe.has(l) || (u == null || u.throwIfAborted(), await r.submitDepositorWotsKey(
|
|
1299
1370
|
{
|
|
1300
1371
|
pegin_txid: n,
|
|
1301
1372
|
depositor_pk: i,
|
|
@@ -1304,30 +1375,30 @@ async function Go(e) {
|
|
|
1304
1375
|
u
|
|
1305
1376
|
));
|
|
1306
1377
|
}
|
|
1307
|
-
function
|
|
1378
|
+
function ne(e) {
|
|
1308
1379
|
return e.registration || e.operation;
|
|
1309
1380
|
}
|
|
1310
|
-
function
|
|
1381
|
+
function io(e, t, r) {
|
|
1311
1382
|
const o = C(e);
|
|
1312
1383
|
return {
|
|
1313
1384
|
registration: o === C(t),
|
|
1314
1385
|
operation: o === C(r)
|
|
1315
1386
|
};
|
|
1316
1387
|
}
|
|
1317
|
-
function
|
|
1318
|
-
const o =
|
|
1388
|
+
function Ae(e, t, r) {
|
|
1389
|
+
const o = se(e);
|
|
1319
1390
|
return {
|
|
1320
|
-
registration:
|
|
1321
|
-
operation:
|
|
1391
|
+
registration: Se(o, se(t)),
|
|
1392
|
+
operation: Se(o, se(r))
|
|
1322
1393
|
};
|
|
1323
1394
|
}
|
|
1324
|
-
function
|
|
1395
|
+
function se(e) {
|
|
1325
1396
|
return e.map(C).sort();
|
|
1326
1397
|
}
|
|
1327
|
-
function
|
|
1398
|
+
function Se(e, t) {
|
|
1328
1399
|
return e.length === t.length && e.every((r, o) => r === t[o]);
|
|
1329
1400
|
}
|
|
1330
|
-
async function
|
|
1401
|
+
async function Zo(e) {
|
|
1331
1402
|
const {
|
|
1332
1403
|
vaultProviderEthAddress: t,
|
|
1333
1404
|
hintBtcPubkey: r,
|
|
@@ -1346,11 +1417,11 @@ async function Xo(e) {
|
|
|
1346
1417
|
`Vault provider BTC pubkey mismatch for ${t}: indexer hint matches neither the registration key nor the current operation key on-chain.${i ? ` ${i}` : ""}`
|
|
1347
1418
|
);
|
|
1348
1419
|
}
|
|
1349
|
-
function
|
|
1350
|
-
const o = `${e} operation key (admin=${t.ethAddress})`, n =
|
|
1420
|
+
function ae(e, t, r) {
|
|
1421
|
+
const o = `${e} operation key (admin=${t.ethAddress})`, n = me(
|
|
1351
1422
|
t.btcPubKey,
|
|
1352
1423
|
`${e} roster key (admin=${t.ethAddress})`
|
|
1353
|
-
), i =
|
|
1424
|
+
), i = me(r, o);
|
|
1354
1425
|
return {
|
|
1355
1426
|
adminAddress: t.ethAddress,
|
|
1356
1427
|
genesisBtcPubkey: n,
|
|
@@ -1358,7 +1429,7 @@ function re(e, t, r) {
|
|
|
1358
1429
|
rotated: i !== n
|
|
1359
1430
|
};
|
|
1360
1431
|
}
|
|
1361
|
-
function
|
|
1432
|
+
function uo(e) {
|
|
1362
1433
|
const t = /* @__PURE__ */ new Map();
|
|
1363
1434
|
for (const r of e) {
|
|
1364
1435
|
const o = t.get(r.operationBtcPubkey);
|
|
@@ -1369,12 +1440,12 @@ function eo(e) {
|
|
|
1369
1440
|
t.set(r.operationBtcPubkey, r.adminAddress);
|
|
1370
1441
|
}
|
|
1371
1442
|
}
|
|
1372
|
-
function
|
|
1443
|
+
function it(e, t, r) {
|
|
1373
1444
|
if (t.vaultKeepers.length !== e.vaultKeepers.length || t.universalChallengers.length !== e.universalChallengers.length)
|
|
1374
1445
|
throw new Error(
|
|
1375
1446
|
`Operation-key resolution returned ${t.vaultKeepers.length} keeper and ${t.universalChallengers.length} challenger keys for a roster of ${e.vaultKeepers.length} keepers and ${e.universalChallengers.length} challengers`
|
|
1376
1447
|
);
|
|
1377
|
-
const o =
|
|
1448
|
+
const o = ae(
|
|
1378
1449
|
"vault provider",
|
|
1379
1450
|
{
|
|
1380
1451
|
ethAddress: e.vaultProviderEthAddress,
|
|
@@ -1382,11 +1453,11 @@ function rt(e, t, r) {
|
|
|
1382
1453
|
},
|
|
1383
1454
|
t.vaultProvider
|
|
1384
1455
|
), n = e.vaultKeepers.map(
|
|
1385
|
-
(a, s) =>
|
|
1456
|
+
(a, s) => ae("vault keeper", a, t.vaultKeepers[s])
|
|
1386
1457
|
), i = e.universalChallengers.map(
|
|
1387
|
-
(a, s) =>
|
|
1458
|
+
(a, s) => ae("universal challenger", a, t.universalChallengers[s])
|
|
1388
1459
|
);
|
|
1389
|
-
return
|
|
1460
|
+
return uo([
|
|
1390
1461
|
o,
|
|
1391
1462
|
...n,
|
|
1392
1463
|
...i
|
|
@@ -1401,33 +1472,33 @@ function rt(e, t, r) {
|
|
|
1401
1472
|
query: e
|
|
1402
1473
|
};
|
|
1403
1474
|
}
|
|
1404
|
-
async function
|
|
1475
|
+
async function co(e) {
|
|
1405
1476
|
const t = await e.operationKeyReader.getCurrentOperationKeys(
|
|
1406
1477
|
e.query,
|
|
1407
1478
|
e.blockNumber
|
|
1408
1479
|
);
|
|
1409
|
-
return
|
|
1480
|
+
return it(e.query, t, { mode: "current" });
|
|
1410
1481
|
}
|
|
1411
|
-
async function
|
|
1482
|
+
async function lo(e) {
|
|
1412
1483
|
const t = await e.operationKeyReader.getOperationKeysAtEpochs(
|
|
1413
1484
|
e.query,
|
|
1414
1485
|
e.epochs
|
|
1415
1486
|
);
|
|
1416
|
-
return
|
|
1487
|
+
return it(e.query, t, {
|
|
1417
1488
|
mode: "epochs",
|
|
1418
1489
|
epochs: e.epochs
|
|
1419
1490
|
});
|
|
1420
1491
|
}
|
|
1421
|
-
class
|
|
1492
|
+
class ue extends Error {
|
|
1422
1493
|
constructor(t) {
|
|
1423
1494
|
super(t), this.name = "ApplicationEntryPointMismatchError";
|
|
1424
1495
|
}
|
|
1425
1496
|
}
|
|
1426
|
-
function
|
|
1427
|
-
return e instanceof
|
|
1497
|
+
function en(e) {
|
|
1498
|
+
return e instanceof ue || e instanceof Error && e.name === "ApplicationEntryPointMismatchError";
|
|
1428
1499
|
}
|
|
1429
|
-
const
|
|
1430
|
-
async function
|
|
1500
|
+
const Ie = (e) => e.map(C).sort();
|
|
1501
|
+
async function tn(e) {
|
|
1431
1502
|
const {
|
|
1432
1503
|
vaultRegistryReader: t,
|
|
1433
1504
|
vaultKeeperReader: r,
|
|
@@ -1437,15 +1508,15 @@ async function jo(e) {
|
|
|
1437
1508
|
expectedVaultProviderBtcPubkey: a,
|
|
1438
1509
|
expectedVaultKeeperBtcPubkeys: s,
|
|
1439
1510
|
expectedUniversalChallengerBtcPubkeys: u,
|
|
1440
|
-
operationKeyReader:
|
|
1441
|
-
onIndexerServingOperationKeys:
|
|
1511
|
+
operationKeyReader: l,
|
|
1512
|
+
onIndexerServingOperationKeys: c,
|
|
1442
1513
|
onIndexerHintsInconsistent: h,
|
|
1443
1514
|
blockNumber: p
|
|
1444
1515
|
} = e, [
|
|
1445
1516
|
d,
|
|
1446
1517
|
g,
|
|
1447
|
-
|
|
1448
|
-
|
|
1518
|
+
y,
|
|
1519
|
+
f
|
|
1449
1520
|
] = await Promise.all([
|
|
1450
1521
|
t.getVaultProviderApplication(
|
|
1451
1522
|
n,
|
|
@@ -1458,15 +1529,15 @@ async function jo(e) {
|
|
|
1458
1529
|
o.getLatestUniversalChallengersVersion(p),
|
|
1459
1530
|
o.getCurrentUcKeyEpoch(p)
|
|
1460
1531
|
]);
|
|
1461
|
-
if (!
|
|
1462
|
-
throw new
|
|
1532
|
+
if (!Mt(i, { strict: !1 }))
|
|
1533
|
+
throw new ue(
|
|
1463
1534
|
`The application entry point this deposit was prepared for is not a valid address: ${i}`
|
|
1464
1535
|
);
|
|
1465
|
-
if (!
|
|
1466
|
-
throw new
|
|
1536
|
+
if (!Ft(d, i))
|
|
1537
|
+
throw new ue(
|
|
1467
1538
|
`Vault provider ${n} is registered to application ${d}, but this deposit was prepared for ${i}. Refusing to build: the vault keeper roster, its version, and the keeper key epoch would all resolve against a different application than the one selected.`
|
|
1468
1539
|
);
|
|
1469
|
-
const [
|
|
1540
|
+
const [P, x] = await Promise.all(
|
|
1470
1541
|
[
|
|
1471
1542
|
r.getCurrentVaultKeepersVersion(
|
|
1472
1543
|
d,
|
|
@@ -1477,84 +1548,84 @@ async function jo(e) {
|
|
|
1477
1548
|
p
|
|
1478
1549
|
)
|
|
1479
1550
|
]
|
|
1480
|
-
), [
|
|
1551
|
+
), [w, _] = await Promise.all([
|
|
1481
1552
|
r.getVaultKeepersByVersion(
|
|
1482
1553
|
d,
|
|
1483
|
-
|
|
1554
|
+
P,
|
|
1484
1555
|
p
|
|
1485
1556
|
),
|
|
1486
1557
|
o.getUniversalChallengersByVersion(
|
|
1487
|
-
|
|
1558
|
+
y,
|
|
1488
1559
|
p
|
|
1489
1560
|
)
|
|
1490
|
-
]),
|
|
1561
|
+
]), k = {
|
|
1491
1562
|
vaultProvider: C(g),
|
|
1492
|
-
vaultKeepers:
|
|
1493
|
-
universalChallengers:
|
|
1494
|
-
},
|
|
1495
|
-
operationKeyReader:
|
|
1563
|
+
vaultKeepers: Ie(w.map(($) => $.btcPubKey)),
|
|
1564
|
+
universalChallengers: Ie(_.map(($) => $.btcPubKey))
|
|
1565
|
+
}, T = await co({
|
|
1566
|
+
operationKeyReader: l,
|
|
1496
1567
|
query: {
|
|
1497
1568
|
vaultProviderEthAddress: n,
|
|
1498
1569
|
vaultProviderGenesisBtcPubkey: `0x${g}`,
|
|
1499
1570
|
applicationEntryPoint: d,
|
|
1500
|
-
vaultKeepers:
|
|
1501
|
-
universalChallengers:
|
|
1571
|
+
vaultKeepers: w,
|
|
1572
|
+
universalChallengers: _
|
|
1502
1573
|
},
|
|
1503
1574
|
blockNumber: p
|
|
1504
1575
|
}), v = {
|
|
1505
|
-
vaultProvider:
|
|
1506
|
-
vaultKeepers: [
|
|
1576
|
+
vaultProvider: T.vaultProvider.operationBtcPubkey,
|
|
1577
|
+
vaultKeepers: [...T.vaultKeeperOperationKeysSorted],
|
|
1507
1578
|
universalChallengers: [
|
|
1508
|
-
|
|
1579
|
+
...T.universalChallengerOperationKeysSorted
|
|
1509
1580
|
]
|
|
1510
|
-
},
|
|
1581
|
+
}, V = io(
|
|
1511
1582
|
a,
|
|
1512
|
-
|
|
1583
|
+
k.vaultProvider,
|
|
1513
1584
|
v.vaultProvider
|
|
1514
|
-
),
|
|
1585
|
+
), F = Ae(
|
|
1515
1586
|
s,
|
|
1516
|
-
|
|
1587
|
+
k.vaultKeepers,
|
|
1517
1588
|
v.vaultKeepers
|
|
1518
|
-
),
|
|
1589
|
+
), he = Ae(
|
|
1519
1590
|
u,
|
|
1520
|
-
|
|
1591
|
+
k.universalChallengers,
|
|
1521
1592
|
v.universalChallengers
|
|
1522
1593
|
);
|
|
1523
|
-
if (!
|
|
1594
|
+
if (!ne(V))
|
|
1524
1595
|
throw new Error(
|
|
1525
1596
|
`Vault provider BTC pubkey indexer hint does not match BTCVaultRegistry for ${n}. Refresh and try again.`
|
|
1526
1597
|
);
|
|
1527
|
-
if (!
|
|
1598
|
+
if (!ne(F))
|
|
1528
1599
|
throw new Error(
|
|
1529
|
-
`Vault keeper BTC pubkeys (v${
|
|
1600
|
+
`Vault keeper BTC pubkeys (v${P}) indexer set does not match ApplicationRegistry on-chain set. Refresh and try again.`
|
|
1530
1601
|
);
|
|
1531
|
-
if (!
|
|
1602
|
+
if (!ne(he))
|
|
1532
1603
|
throw new Error(
|
|
1533
|
-
`Universal challenger BTC pubkeys (v${
|
|
1604
|
+
`Universal challenger BTC pubkeys (v${y}) indexer set does not match ProtocolParams on-chain set. Refresh and try again.`
|
|
1534
1605
|
);
|
|
1535
|
-
const
|
|
1536
|
-
if (
|
|
1537
|
-
const
|
|
1538
|
-
throw h == null || h(
|
|
1606
|
+
const pe = [V, F, he], pt = pe.some(($) => $.registration && !$.operation), de = pe.some(($) => $.operation && !$.registration);
|
|
1607
|
+
if (pt && de) {
|
|
1608
|
+
const $ = `Indexer participant hints are internally inconsistent for vault provider ${n}: some roles match the registration keys while others match the rotated operation keys.`;
|
|
1609
|
+
throw h == null || h($), new Error(`${$} Refresh and try again.`);
|
|
1539
1610
|
}
|
|
1540
|
-
return
|
|
1611
|
+
return de && (c == null || c(
|
|
1541
1612
|
`Indexer is serving rotated operation keys for vault provider ${n}`
|
|
1542
1613
|
)), {
|
|
1543
1614
|
vaultProviderBtcPubkeyXOnly: v.vaultProvider,
|
|
1544
1615
|
vaultKeeperBtcPubkeysSorted: v.vaultKeepers,
|
|
1545
1616
|
universalChallengerBtcPubkeysSorted: v.universalChallengers,
|
|
1546
|
-
expectedAppVaultKeepersVersion:
|
|
1547
|
-
expectedUniversalChallengersVersion:
|
|
1548
|
-
appKeeperKeyEpoch:
|
|
1549
|
-
ucKeyEpoch:
|
|
1550
|
-
registrationKeys:
|
|
1551
|
-
participantKeys:
|
|
1617
|
+
expectedAppVaultKeepersVersion: P,
|
|
1618
|
+
expectedUniversalChallengersVersion: y,
|
|
1619
|
+
appKeeperKeyEpoch: x,
|
|
1620
|
+
ucKeyEpoch: f,
|
|
1621
|
+
registrationKeys: k,
|
|
1622
|
+
participantKeys: T
|
|
1552
1623
|
};
|
|
1553
1624
|
}
|
|
1554
|
-
function
|
|
1625
|
+
function ho(e) {
|
|
1555
1626
|
return /^[0-9a-fA-F]{64}$/.test(e);
|
|
1556
1627
|
}
|
|
1557
|
-
function
|
|
1628
|
+
function rn(e) {
|
|
1558
1629
|
const {
|
|
1559
1630
|
amountSats: t,
|
|
1560
1631
|
minDeposit: r,
|
|
@@ -1565,29 +1636,29 @@ function zo(e) {
|
|
|
1565
1636
|
} = e;
|
|
1566
1637
|
return !(t <= 0n || t < r || o && o > 0n && t > o || i == null || a == null || t + i + a > n);
|
|
1567
1638
|
}
|
|
1568
|
-
function
|
|
1639
|
+
function on(e, t, r) {
|
|
1569
1640
|
return e <= 0n ? {
|
|
1570
1641
|
valid: !1,
|
|
1571
1642
|
error: "Deposit amount must be greater than zero"
|
|
1572
1643
|
} : e < t ? {
|
|
1573
1644
|
valid: !1,
|
|
1574
|
-
error: `Minimum deposit is ${
|
|
1645
|
+
error: `Minimum deposit is ${H(t)} BTC`
|
|
1575
1646
|
} : r && r > 0n && e > r ? {
|
|
1576
1647
|
valid: !1,
|
|
1577
|
-
error: `Maximum deposit is ${
|
|
1648
|
+
error: `Maximum deposit is ${H(r)} BTC`
|
|
1578
1649
|
} : { valid: !0 };
|
|
1579
1650
|
}
|
|
1580
|
-
function
|
|
1651
|
+
function nn(e) {
|
|
1581
1652
|
const { amount: t, effectiveRemaining: r } = e;
|
|
1582
1653
|
return r === null ? { valid: !0 } : r === 0n ? {
|
|
1583
1654
|
valid: !1,
|
|
1584
1655
|
error: "Supply cap reached — deposits temporarily paused"
|
|
1585
1656
|
} : t > r ? {
|
|
1586
1657
|
valid: !1,
|
|
1587
|
-
error: `Vault size exceeds remaining capacity (${
|
|
1658
|
+
error: `Vault size exceeds remaining capacity (${H(r)} BTC)`
|
|
1588
1659
|
} : { valid: !0 };
|
|
1589
1660
|
}
|
|
1590
|
-
function
|
|
1661
|
+
function sn(e, t) {
|
|
1591
1662
|
if (!e || e.length === 0)
|
|
1592
1663
|
return {
|
|
1593
1664
|
valid: !1,
|
|
@@ -1603,7 +1674,7 @@ function Qo(e, t) {
|
|
|
1603
1674
|
error: "Invalid vault provider selected"
|
|
1604
1675
|
} : { valid: !0 };
|
|
1605
1676
|
}
|
|
1606
|
-
function
|
|
1677
|
+
function po(e, t, r) {
|
|
1607
1678
|
if (!e || e.length === 0)
|
|
1608
1679
|
return {
|
|
1609
1680
|
valid: !1,
|
|
@@ -1619,40 +1690,40 @@ function no(e, t, r) {
|
|
|
1619
1690
|
if (t && n < t)
|
|
1620
1691
|
return {
|
|
1621
1692
|
valid: !1,
|
|
1622
|
-
error: `Vault ${o + 1} amount ${
|
|
1693
|
+
error: `Vault ${o + 1} amount ${H(n)} BTC is below minimum deposit ${H(t)} BTC`
|
|
1623
1694
|
};
|
|
1624
1695
|
if (r && n > r)
|
|
1625
1696
|
return {
|
|
1626
1697
|
valid: !1,
|
|
1627
|
-
error: `Vault ${o + 1} amount ${
|
|
1698
|
+
error: `Vault ${o + 1} amount ${H(n)} BTC exceeds maximum deposit ${H(r)} BTC`
|
|
1628
1699
|
};
|
|
1629
1700
|
}
|
|
1630
1701
|
return { valid: !0 };
|
|
1631
1702
|
}
|
|
1632
|
-
function
|
|
1633
|
-
const t =
|
|
1634
|
-
return
|
|
1703
|
+
function go(e) {
|
|
1704
|
+
const t = b(e);
|
|
1705
|
+
return ho(t) ? { valid: !0 } : {
|
|
1635
1706
|
valid: !1,
|
|
1636
1707
|
error: "Invalid pubkey format: must be 64 hex characters (32-byte x-only public key, no 0x prefix)"
|
|
1637
1708
|
};
|
|
1638
1709
|
}
|
|
1639
|
-
function
|
|
1710
|
+
function fo(e) {
|
|
1640
1711
|
if (!e || e.length === 0)
|
|
1641
1712
|
throw new Error(
|
|
1642
1713
|
"No vault keepers available. The system requires at least one vault keeper to create a deposit."
|
|
1643
1714
|
);
|
|
1644
1715
|
}
|
|
1645
|
-
function
|
|
1716
|
+
function yo(e) {
|
|
1646
1717
|
if (!e || e.length === 0)
|
|
1647
1718
|
throw new Error(
|
|
1648
1719
|
"No universal challengers available. The system requires at least one universal challenger to create a deposit."
|
|
1649
1720
|
);
|
|
1650
1721
|
}
|
|
1651
|
-
function
|
|
1722
|
+
function bo(e) {
|
|
1652
1723
|
if (e.length === 0)
|
|
1653
1724
|
throw new Error("No spendable UTXOs available");
|
|
1654
1725
|
}
|
|
1655
|
-
function
|
|
1726
|
+
function an(e) {
|
|
1656
1727
|
const {
|
|
1657
1728
|
vaultAmounts: t,
|
|
1658
1729
|
confirmedUTXOs: r,
|
|
@@ -1661,78 +1732,78 @@ function Jo(e) {
|
|
|
1661
1732
|
universalChallengerBtcPubkeys: i,
|
|
1662
1733
|
minDeposit: a,
|
|
1663
1734
|
maxDeposit: s
|
|
1664
|
-
} = e, u =
|
|
1735
|
+
} = e, u = po(
|
|
1665
1736
|
t,
|
|
1666
1737
|
a,
|
|
1667
1738
|
s
|
|
1668
1739
|
);
|
|
1669
1740
|
if (!u.valid)
|
|
1670
1741
|
throw new Error(u.error);
|
|
1671
|
-
const
|
|
1672
|
-
if (!
|
|
1673
|
-
throw new Error(
|
|
1674
|
-
|
|
1742
|
+
const l = go(o);
|
|
1743
|
+
if (!l.valid)
|
|
1744
|
+
throw new Error(l.error);
|
|
1745
|
+
fo(n), yo(i), bo(r);
|
|
1675
1746
|
}
|
|
1676
|
-
class
|
|
1747
|
+
class ut extends Error {
|
|
1677
1748
|
constructor(t) {
|
|
1678
1749
|
super(t), this.name = "ParticipantKeyDriftError";
|
|
1679
1750
|
}
|
|
1680
1751
|
}
|
|
1681
|
-
function
|
|
1682
|
-
return e instanceof
|
|
1752
|
+
function un(e) {
|
|
1753
|
+
return e instanceof ut || e instanceof Error && e.name === "ParticipantKeyDriftError";
|
|
1683
1754
|
}
|
|
1684
|
-
function
|
|
1755
|
+
function Re(e, t, r) {
|
|
1685
1756
|
return t.length === r.length && t.every((o, n) => o === r[n]) ? null : `${e} expected [${t.join(", ")}], got [${r.join(", ")}]`;
|
|
1686
1757
|
}
|
|
1687
|
-
async function
|
|
1758
|
+
async function cn(e) {
|
|
1688
1759
|
const { vaultRegistryReader: t, operationKeyReader: r, vaultIds: o, expected: n } = e, i = n.query;
|
|
1689
1760
|
if (o.length === 0) return;
|
|
1690
1761
|
const a = await t.getVaultKeyEpochsBatch(o), s = [];
|
|
1691
|
-
for (const [u,
|
|
1692
|
-
const
|
|
1762
|
+
for (const [u, l] of a.entries()) {
|
|
1763
|
+
const c = o[u];
|
|
1693
1764
|
let h;
|
|
1694
1765
|
try {
|
|
1695
|
-
h = await
|
|
1766
|
+
h = await lo({
|
|
1696
1767
|
operationKeyReader: r,
|
|
1697
1768
|
query: i,
|
|
1698
|
-
epochs:
|
|
1769
|
+
epochs: l
|
|
1699
1770
|
});
|
|
1700
1771
|
} catch (g) {
|
|
1701
1772
|
s.push(
|
|
1702
|
-
`vault ${
|
|
1773
|
+
`vault ${c}: could not resolve participants at frozen epochs (vp=${l.vpKeyEpoch}, keeper=${l.appKeeperKeyEpoch}, uc=${l.ucKeyEpoch}): ${g.message}`
|
|
1703
1774
|
);
|
|
1704
1775
|
continue;
|
|
1705
1776
|
}
|
|
1706
1777
|
h.vaultProvider.operationBtcPubkey !== n.vaultProvider.operationBtcPubkey && s.push(
|
|
1707
|
-
`vault ${
|
|
1778
|
+
`vault ${c}: vault provider key expected ${n.vaultProvider.operationBtcPubkey}, got ${h.vaultProvider.operationBtcPubkey}`
|
|
1708
1779
|
);
|
|
1709
|
-
const p =
|
|
1710
|
-
`vault ${
|
|
1780
|
+
const p = Re(
|
|
1781
|
+
`vault ${c}: vault keeper keys`,
|
|
1711
1782
|
n.vaultKeeperOperationKeysSorted,
|
|
1712
1783
|
h.vaultKeeperOperationKeysSorted
|
|
1713
1784
|
);
|
|
1714
1785
|
p && s.push(p);
|
|
1715
|
-
const d =
|
|
1716
|
-
`vault ${
|
|
1786
|
+
const d = Re(
|
|
1787
|
+
`vault ${c}: universal challenger keys`,
|
|
1717
1788
|
n.universalChallengerOperationKeysSorted,
|
|
1718
1789
|
h.universalChallengerOperationKeysSorted
|
|
1719
1790
|
);
|
|
1720
1791
|
d && s.push(d);
|
|
1721
1792
|
}
|
|
1722
1793
|
if (s.length > 0)
|
|
1723
|
-
throw new
|
|
1794
|
+
throw new ut(
|
|
1724
1795
|
`Aborting BTC broadcast: participant operation keys changed during registration (${s.join("; ")}). The Pre-PegIn was not broadcast; the registered ETH vault will time out per protocol rules.`
|
|
1725
1796
|
);
|
|
1726
1797
|
}
|
|
1727
|
-
class
|
|
1798
|
+
class ct extends Error {
|
|
1728
1799
|
constructor(t) {
|
|
1729
1800
|
super(t), this.name = "RegisteredVaultVersionMismatchError";
|
|
1730
1801
|
}
|
|
1731
1802
|
}
|
|
1732
|
-
function
|
|
1733
|
-
return e instanceof
|
|
1803
|
+
function ln(e) {
|
|
1804
|
+
return e instanceof ct || e instanceof Error && e.name === "RegisteredVaultVersionMismatchError";
|
|
1734
1805
|
}
|
|
1735
|
-
async function
|
|
1806
|
+
async function hn(e) {
|
|
1736
1807
|
const {
|
|
1737
1808
|
vaultRegistryReader: t,
|
|
1738
1809
|
vaultIds: r,
|
|
@@ -1741,55 +1812,55 @@ async function rn(e) {
|
|
|
1741
1812
|
expectedUniversalChallengersVersion: i,
|
|
1742
1813
|
expectedVaultCoreVersion: a
|
|
1743
1814
|
} = e, s = await t.getProtocolInfoBatch(r), u = [];
|
|
1744
|
-
if (s.forEach((
|
|
1745
|
-
const h = r[
|
|
1746
|
-
|
|
1747
|
-
`vault ${h}: offchainParams expected v${o}, got v${
|
|
1748
|
-
),
|
|
1749
|
-
`vault ${h}: appVaultKeepers expected v${n}, got v${
|
|
1750
|
-
),
|
|
1751
|
-
`vault ${h}: universalChallengers expected v${i}, got v${
|
|
1752
|
-
),
|
|
1753
|
-
`vault ${h}: vaultCoreVersion expected v${a} (build-time active), got v${
|
|
1815
|
+
if (s.forEach((l, c) => {
|
|
1816
|
+
const h = r[c];
|
|
1817
|
+
l.offchainParamsVersion !== o && u.push(
|
|
1818
|
+
`vault ${h}: offchainParams expected v${o}, got v${l.offchainParamsVersion}`
|
|
1819
|
+
), l.appVaultKeepersVersion !== n && u.push(
|
|
1820
|
+
`vault ${h}: appVaultKeepers expected v${n}, got v${l.appVaultKeepersVersion}`
|
|
1821
|
+
), l.universalChallengersVersion !== i && u.push(
|
|
1822
|
+
`vault ${h}: universalChallengers expected v${i}, got v${l.universalChallengersVersion}`
|
|
1823
|
+
), l.vaultCoreVersion !== a && u.push(
|
|
1824
|
+
`vault ${h}: vaultCoreVersion expected v${a} (build-time active), got v${l.vaultCoreVersion}`
|
|
1754
1825
|
);
|
|
1755
1826
|
}), u.length > 0)
|
|
1756
|
-
throw new
|
|
1827
|
+
throw new ct(
|
|
1757
1828
|
`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.`
|
|
1758
1829
|
);
|
|
1759
1830
|
}
|
|
1760
|
-
class
|
|
1831
|
+
class mo extends Error {
|
|
1761
1832
|
constructor(r, o) {
|
|
1762
1833
|
super(`Refund not yet mature (BIP68 not final): ${o.message}`);
|
|
1763
|
-
|
|
1764
|
-
|
|
1834
|
+
K(this, "vaultId");
|
|
1835
|
+
K(this, "cause");
|
|
1765
1836
|
this.name = "BIP68NotMatureError", this.vaultId = r, this.cause = o;
|
|
1766
1837
|
}
|
|
1767
1838
|
}
|
|
1768
|
-
const
|
|
1769
|
-
function
|
|
1839
|
+
const vo = /^0x[0-9a-fA-F]{64}$/, Po = /^(?:0x)?(?:[0-9a-fA-F]{2})+$/, lt = /^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/, ht = 160, Be = 2e3, Ve = 10n, He = 100n;
|
|
1840
|
+
function pn(e) {
|
|
1770
1841
|
if (!Number.isFinite(e) || e <= 0)
|
|
1771
1842
|
throw new Error(
|
|
1772
1843
|
`feeRateSatsVb must be a positive finite number, got ${e}`
|
|
1773
1844
|
);
|
|
1774
|
-
return BigInt(Math.ceil(e *
|
|
1845
|
+
return BigInt(Math.ceil(e * ht));
|
|
1775
1846
|
}
|
|
1776
|
-
const
|
|
1777
|
-
function
|
|
1847
|
+
const xo = 1, wo = /non-BIP68-final/i;
|
|
1848
|
+
function ce(e, t) {
|
|
1778
1849
|
if (e.length !== 66)
|
|
1779
1850
|
throw new Error(
|
|
1780
1851
|
`${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
|
|
1781
1852
|
);
|
|
1782
|
-
if (!
|
|
1853
|
+
if (!vo.test(e))
|
|
1783
1854
|
throw new Error(
|
|
1784
1855
|
`${t} must contain only hex characters after the 0x prefix`
|
|
1785
1856
|
);
|
|
1786
1857
|
}
|
|
1787
|
-
function
|
|
1858
|
+
function ie(e, t) {
|
|
1788
1859
|
if (!Number.isInteger(e) || e < 0)
|
|
1789
1860
|
throw new Error(`${t} must be a non-negative integer, got ${e}`);
|
|
1790
1861
|
}
|
|
1791
|
-
function
|
|
1792
|
-
if (
|
|
1862
|
+
function Eo(e) {
|
|
1863
|
+
if (ce(e.hashlock, "hashlock"), !Number.isInteger(e.htlcVout) || e.htlcVout < 0)
|
|
1793
1864
|
throw new Error(
|
|
1794
1865
|
`htlcVout must be a non-negative integer, got ${e.htlcVout}`
|
|
1795
1866
|
);
|
|
@@ -1801,7 +1872,7 @@ function fo(e) {
|
|
|
1801
1872
|
);
|
|
1802
1873
|
for (let r = 0; r < e.batch.length; r++) {
|
|
1803
1874
|
const o = e.batch[r];
|
|
1804
|
-
if (
|
|
1875
|
+
if (ce(o.hashlock, `batch[${r}].hashlock`), !Number.isInteger(o.htlcVout) || o.htlcVout !== r)
|
|
1805
1876
|
throw new Error(
|
|
1806
1877
|
`batch[${r}].htlcVout must equal ${r} (contiguous vout-ordered vector), got ${o.htlcVout}`
|
|
1807
1878
|
);
|
|
@@ -1819,27 +1890,27 @@ function fo(e) {
|
|
|
1819
1890
|
throw new Error(
|
|
1820
1891
|
`batch[${e.htlcVout}].amount (${t.amount}) does not match target amount (${e.amount})`
|
|
1821
1892
|
);
|
|
1822
|
-
if (
|
|
1893
|
+
if (ie(e.offchainParamsVersion, "offchainParamsVersion"), ie(e.appVaultKeepersVersion, "appVaultKeepersVersion"), ie(
|
|
1823
1894
|
e.universalChallengersVersion,
|
|
1824
1895
|
"universalChallengersVersion"
|
|
1825
|
-
),
|
|
1896
|
+
), Zt(
|
|
1826
1897
|
e.vaultCoreVersion,
|
|
1827
1898
|
"VaultRefundData.vaultCoreVersion"
|
|
1828
1899
|
), typeof e.unsignedPrePeginTxHex != "string" || e.unsignedPrePeginTxHex.length === 0)
|
|
1829
1900
|
throw new Error("unsignedPrePeginTxHex must be a non-empty hex string");
|
|
1830
|
-
if (!
|
|
1901
|
+
if (!Po.test(e.unsignedPrePeginTxHex))
|
|
1831
1902
|
throw new Error(
|
|
1832
1903
|
"unsignedPrePeginTxHex must be a hex byte string (optional 0x prefix, even length)"
|
|
1833
1904
|
);
|
|
1834
|
-
if (!e.depositorBtcPubkey || !
|
|
1905
|
+
if (!e.depositorBtcPubkey || !lt.test(e.depositorBtcPubkey))
|
|
1835
1906
|
throw new Error(
|
|
1836
1907
|
"depositorBtcPubkey must be 32 or 33 bytes of hex (optional 0x prefix)"
|
|
1837
1908
|
);
|
|
1838
1909
|
if (typeof e.amount != "bigint" || e.amount <= 0n)
|
|
1839
1910
|
throw new Error(`amount must be a positive bigint, got ${e.amount}`);
|
|
1840
1911
|
}
|
|
1841
|
-
function
|
|
1842
|
-
if (!e.vaultProviderPubkey || !
|
|
1912
|
+
function _o(e) {
|
|
1913
|
+
if (!e.vaultProviderPubkey || !lt.test(e.vaultProviderPubkey))
|
|
1843
1914
|
throw new Error("vaultProviderPubkey must be 32 or 33 bytes of hex");
|
|
1844
1915
|
if (e.vaultKeeperPubkeys.length === 0)
|
|
1845
1916
|
throw new Error("vaultKeeperPubkeys must be non-empty");
|
|
@@ -1864,7 +1935,7 @@ function yo(e) {
|
|
|
1864
1935
|
`councilQuorum (${e.councilQuorum}) must be in [1, councilSize=${e.councilSize}]`
|
|
1865
1936
|
);
|
|
1866
1937
|
}
|
|
1867
|
-
async function
|
|
1938
|
+
async function dn(e) {
|
|
1868
1939
|
const {
|
|
1869
1940
|
vaultId: t,
|
|
1870
1941
|
readVault: r,
|
|
@@ -1874,51 +1945,51 @@ async function nn(e) {
|
|
|
1874
1945
|
broadcastTx: a,
|
|
1875
1946
|
signal: s
|
|
1876
1947
|
} = e;
|
|
1877
|
-
s == null || s.throwIfAborted(),
|
|
1948
|
+
s == null || s.throwIfAborted(), ce(t, "vaultId");
|
|
1878
1949
|
const u = await r();
|
|
1879
|
-
|
|
1880
|
-
const
|
|
1881
|
-
if (
|
|
1950
|
+
Eo(u), s == null || s.throwIfAborted();
|
|
1951
|
+
const l = await o(u);
|
|
1952
|
+
if (_o(l), s == null || s.throwIfAborted(), !Number.isFinite(n) || n <= 0)
|
|
1882
1953
|
throw new Error(`feeRate must be a positive number, got ${n}`);
|
|
1883
|
-
if (n >
|
|
1954
|
+
if (n > Be)
|
|
1884
1955
|
throw new Error(
|
|
1885
|
-
`feeRate ${n} sat/vB exceeds refund safety cap ${
|
|
1956
|
+
`feeRate ${n} sat/vB exceeds refund safety cap ${Be} sat/vB; refusing to sign refund.`
|
|
1886
1957
|
);
|
|
1887
|
-
const
|
|
1888
|
-
if (
|
|
1958
|
+
const c = BigInt(Math.ceil(n * ht)), h = u.amount * Ve / He;
|
|
1959
|
+
if (c > h)
|
|
1889
1960
|
throw new Error(
|
|
1890
|
-
`Refund fee ${
|
|
1961
|
+
`Refund fee ${c} sats exceeds the per-vault safety cap of ${h} sats (${Ve}/${He} of vault.amount=${u.amount}); refusing to sign refund.`
|
|
1891
1962
|
);
|
|
1892
1963
|
s == null || s.throwIfAborted();
|
|
1893
|
-
const p =
|
|
1964
|
+
const p = Q(
|
|
1894
1965
|
u.depositorBtcPubkey
|
|
1895
|
-
), d =
|
|
1966
|
+
), d = b(u.unsignedPrePeginTxHex), g = Pt(d);
|
|
1896
1967
|
if (g !== void 0 && g.vout !== u.batch.length)
|
|
1897
1968
|
throw new Error(
|
|
1898
1969
|
`Auth-anchor OP_RETURN at vout ${g.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.`
|
|
1899
1970
|
);
|
|
1900
|
-
const
|
|
1901
|
-
let
|
|
1971
|
+
const y = g == null ? void 0 : g.hash;
|
|
1972
|
+
let f;
|
|
1902
1973
|
try {
|
|
1903
|
-
|
|
1974
|
+
f = B.fromHex(d);
|
|
1904
1975
|
} catch (v) {
|
|
1905
1976
|
throw new Error(
|
|
1906
1977
|
`Failed to parse funded Pre-PegIn transaction hex: ${v instanceof Error ? v.message : String(v)}`
|
|
1907
1978
|
);
|
|
1908
1979
|
}
|
|
1909
|
-
if (
|
|
1980
|
+
if (f.outs.length < u.batch.length)
|
|
1910
1981
|
throw new Error(
|
|
1911
|
-
`Funded Pre-PegIn tx has ${
|
|
1982
|
+
`Funded Pre-PegIn tx has ${f.outs.length} outputs but batch requires at least ${u.batch.length} HTLC outputs. Refund refused — funded tx shape disagrees with sibling vector.`
|
|
1912
1983
|
);
|
|
1913
|
-
const { psbtHex:
|
|
1984
|
+
const { psbtHex: P } = await Yt({
|
|
1914
1985
|
prePeginParams: {
|
|
1915
1986
|
vaultCoreVersion: u.vaultCoreVersion,
|
|
1916
1987
|
depositorPubkey: p,
|
|
1917
|
-
vaultProviderPubkey:
|
|
1918
|
-
vaultKeeperPubkeys:
|
|
1919
|
-
universalChallengerPubkeys:
|
|
1920
|
-
hashlocks: u.batch.map((v) =>
|
|
1921
|
-
timelockRefund:
|
|
1988
|
+
vaultProviderPubkey: b(l.vaultProviderPubkey),
|
|
1989
|
+
vaultKeeperPubkeys: l.vaultKeeperPubkeys.map(b),
|
|
1990
|
+
universalChallengerPubkeys: l.universalChallengerPubkeys.map(b),
|
|
1991
|
+
hashlocks: u.batch.map((v) => b(v.hashlock)),
|
|
1992
|
+
timelockRefund: l.timelockRefund,
|
|
1922
1993
|
// `batch[i].amount` is the on-chain vault deposit (peg-in) amount, which
|
|
1923
1994
|
// is exactly what WASM's `pegInAmounts` expects — it re-adds the protocol
|
|
1924
1995
|
// reserve (`depositorClaimValue + minPeginFee`) internally when sizing the
|
|
@@ -1926,72 +1997,72 @@ async function nn(e) {
|
|
|
1926
1997
|
// to the funded tx bytes, refusing the refund if the template's HTLC value
|
|
1927
1998
|
// disagrees with the on-chain commitment.
|
|
1928
1999
|
pegInAmounts: u.batch.map((v) => v.amount),
|
|
1929
|
-
feeRate:
|
|
1930
|
-
minPeginFeeRate:
|
|
1931
|
-
numLocalChallengers:
|
|
1932
|
-
councilQuorum:
|
|
1933
|
-
councilSize:
|
|
1934
|
-
network:
|
|
1935
|
-
authAnchorHash:
|
|
2000
|
+
feeRate: l.feeRate,
|
|
2001
|
+
minPeginFeeRate: l.minPeginFeeRate,
|
|
2002
|
+
numLocalChallengers: l.numLocalChallengers,
|
|
2003
|
+
councilQuorum: l.councilQuorum,
|
|
2004
|
+
councilSize: l.councilSize,
|
|
2005
|
+
network: l.network,
|
|
2006
|
+
authAnchorHash: y
|
|
1936
2007
|
},
|
|
1937
2008
|
fundedPrePeginTxHex: d,
|
|
1938
2009
|
htlcVout: u.htlcVout,
|
|
1939
|
-
refundFee:
|
|
2010
|
+
refundFee: c,
|
|
1940
2011
|
// buildRefundPsbt's top-level `hashlock` param is documented as "no 0x
|
|
1941
2012
|
// prefix" and flows into the WASM HTLC connector derivation; a prefixed
|
|
1942
2013
|
// value would derive the wrong refund script leaf and yield an
|
|
1943
2014
|
// unspendable PSBT. Match the `hashlocks` array handling above.
|
|
1944
|
-
hashlock:
|
|
2015
|
+
hashlock: b(u.hashlock)
|
|
1945
2016
|
});
|
|
1946
2017
|
s == null || s.throwIfAborted();
|
|
1947
|
-
const
|
|
2018
|
+
const x = U(
|
|
1948
2019
|
u.depositorBtcPubkey,
|
|
1949
|
-
|
|
1950
|
-
),
|
|
1951
|
-
|
|
1952
|
-
requestedPsbtHex:
|
|
1953
|
-
returnedPsbtHex:
|
|
2020
|
+
xo
|
|
2021
|
+
), w = await i(P, x);
|
|
2022
|
+
X({
|
|
2023
|
+
requestedPsbtHex: P,
|
|
2024
|
+
returnedPsbtHex: w
|
|
1954
2025
|
});
|
|
1955
|
-
const
|
|
1956
|
-
|
|
2026
|
+
const _ = 0, k = q(
|
|
2027
|
+
w,
|
|
1957
2028
|
p,
|
|
1958
|
-
|
|
2029
|
+
_
|
|
1959
2030
|
);
|
|
1960
|
-
|
|
1961
|
-
requestedPsbtHex:
|
|
1962
|
-
signatureHex:
|
|
2031
|
+
j({
|
|
2032
|
+
requestedPsbtHex: P,
|
|
2033
|
+
signatureHex: k,
|
|
1963
2034
|
signerXOnlyPubkeyHex: p,
|
|
1964
|
-
inputIndex:
|
|
2035
|
+
inputIndex: _
|
|
1965
2036
|
});
|
|
1966
|
-
const
|
|
1967
|
-
requestedPsbtHex:
|
|
1968
|
-
signaturesHex: [
|
|
2037
|
+
const T = je({
|
|
2038
|
+
requestedPsbtHex: P,
|
|
2039
|
+
signaturesHex: [k],
|
|
1969
2040
|
signerXOnlyPubkeyHex: p
|
|
1970
2041
|
});
|
|
1971
2042
|
s == null || s.throwIfAborted();
|
|
1972
2043
|
try {
|
|
1973
|
-
return await a(
|
|
2044
|
+
return await a(T);
|
|
1974
2045
|
} catch (v) {
|
|
1975
|
-
throw v instanceof Error &&
|
|
2046
|
+
throw v instanceof Error && wo.test(v.message) ? new mo(t, v) : v;
|
|
1976
2047
|
}
|
|
1977
2048
|
}
|
|
1978
|
-
class
|
|
2049
|
+
class Oe extends Error {
|
|
1979
2050
|
constructor(r, o, n) {
|
|
1980
2051
|
super(r);
|
|
1981
2052
|
/** Fee the reclaim would have paid, in satoshis. */
|
|
1982
|
-
|
|
2053
|
+
K(this, "feeSats");
|
|
1983
2054
|
/** Sum of the reserves the reclaim would have swept, in satoshis. */
|
|
1984
|
-
|
|
2055
|
+
K(this, "sweptTotalSats");
|
|
1985
2056
|
this.name = "ReclaimUneconomicalError", this.feeSats = o, this.sweptTotalSats = n;
|
|
1986
2057
|
}
|
|
1987
2058
|
}
|
|
1988
|
-
const
|
|
1989
|
-
async function
|
|
2059
|
+
const Ne = 2e3, Ke = 25n, De = 100n, gn = 10n;
|
|
2060
|
+
async function ko(e, t, r) {
|
|
1990
2061
|
for (let o = 0; o < e.length; o++) {
|
|
1991
|
-
const n =
|
|
1992
|
-
await
|
|
1993
|
-
|
|
1994
|
-
|
|
2062
|
+
const n = wt(e[o].depositorSignedPeginTxHex), i = Fe(
|
|
2063
|
+
await Ht(
|
|
2064
|
+
b(n),
|
|
2065
|
+
b(r)
|
|
1995
2066
|
)
|
|
1996
2067
|
).toLowerCase();
|
|
1997
2068
|
if (i !== t[o].toLowerCase())
|
|
@@ -2000,7 +2071,7 @@ async function bo(e, t, r) {
|
|
|
2000
2071
|
);
|
|
2001
2072
|
}
|
|
2002
2073
|
}
|
|
2003
|
-
async function
|
|
2074
|
+
async function fn(e) {
|
|
2004
2075
|
const {
|
|
2005
2076
|
vaultIds: t,
|
|
2006
2077
|
depositorEthAddress: r,
|
|
@@ -2015,125 +2086,125 @@ async function an(e) {
|
|
|
2015
2086
|
throw new Error("Reclaim requires at least one vault id; got none.");
|
|
2016
2087
|
if (!Number.isFinite(i) || i <= 0)
|
|
2017
2088
|
throw new Error(`feeRate must be a positive number, got ${i}`);
|
|
2018
|
-
if (i >
|
|
2019
|
-
throw new
|
|
2020
|
-
`Fee rate ${i} sat/vB exceeds the reclaim safety cap of ${
|
|
2089
|
+
if (i > Ne)
|
|
2090
|
+
throw new Oe(
|
|
2091
|
+
`Fee rate ${i} sat/vB exceeds the reclaim safety cap of ${Ne} sat/vB; refusing to sign.`,
|
|
2021
2092
|
0n,
|
|
2022
2093
|
0n
|
|
2023
2094
|
);
|
|
2024
|
-
const
|
|
2025
|
-
if (u == null || u.throwIfAborted(),
|
|
2095
|
+
const l = await n();
|
|
2096
|
+
if (u == null || u.throwIfAborted(), l.length !== t.length)
|
|
2026
2097
|
throw new Error(
|
|
2027
|
-
`readVaults returned ${
|
|
2028
|
-
);
|
|
2029
|
-
await
|
|
2030
|
-
const
|
|
2031
|
-
depositorSignedPeginTxHex:
|
|
2032
|
-
observed:
|
|
2033
|
-
expectedValue:
|
|
2034
|
-
})), p =
|
|
2098
|
+
`readVaults returned ${l.length} reserves for ${t.length} vault id(s); refusing to sweep a set that does not match the request.`
|
|
2099
|
+
);
|
|
2100
|
+
await ko(l, t, r), u == null || u.throwIfAborted();
|
|
2101
|
+
const c = Q(o), h = l.map((_) => ({
|
|
2102
|
+
depositorSignedPeginTxHex: _.depositorSignedPeginTxHex,
|
|
2103
|
+
observed: _.observed,
|
|
2104
|
+
expectedValue: _.expectedClaimValue
|
|
2105
|
+
})), p = Qt(i, h.length), d = h.reduce((_, k) => _ + k.expectedValue, 0n), g = d * Ke / De;
|
|
2035
2106
|
if (p > g)
|
|
2036
|
-
throw new
|
|
2037
|
-
`Reclaim fee ${p} sats exceeds ${
|
|
2107
|
+
throw new Oe(
|
|
2108
|
+
`Reclaim fee ${p} sats exceeds ${Ke}/${De} of the swept total (${d} sats, cap ${g} sats). The reserve is not at risk — it stays where it is until fee rates fall.`,
|
|
2038
2109
|
p,
|
|
2039
2110
|
d
|
|
2040
2111
|
);
|
|
2041
2112
|
u == null || u.throwIfAborted();
|
|
2042
|
-
const { psbtHex:
|
|
2043
|
-
depositorPubkey:
|
|
2113
|
+
const { psbtHex: y } = Jt({
|
|
2114
|
+
depositorPubkey: c,
|
|
2044
2115
|
inputs: h,
|
|
2045
2116
|
feeSats: p
|
|
2046
2117
|
});
|
|
2047
2118
|
u == null || u.throwIfAborted();
|
|
2048
|
-
const
|
|
2119
|
+
const f = U(
|
|
2049
2120
|
o,
|
|
2050
2121
|
h.length
|
|
2051
|
-
),
|
|
2052
|
-
|
|
2053
|
-
requestedPsbtHex:
|
|
2054
|
-
returnedPsbtHex:
|
|
2122
|
+
), P = await a(y, f);
|
|
2123
|
+
X({
|
|
2124
|
+
requestedPsbtHex: y,
|
|
2125
|
+
returnedPsbtHex: P
|
|
2055
2126
|
});
|
|
2056
|
-
const
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
);
|
|
2062
|
-
return
|
|
2063
|
-
requestedPsbtHex:
|
|
2064
|
-
signatureHex:
|
|
2065
|
-
signerXOnlyPubkeyHex:
|
|
2066
|
-
inputIndex:
|
|
2067
|
-
}),
|
|
2068
|
-
}),
|
|
2069
|
-
requestedPsbtHex:
|
|
2070
|
-
signaturesHex:
|
|
2071
|
-
signerXOnlyPubkeyHex:
|
|
2127
|
+
const x = h.map((_, k) => {
|
|
2128
|
+
const T = q(
|
|
2129
|
+
P,
|
|
2130
|
+
c,
|
|
2131
|
+
k
|
|
2132
|
+
);
|
|
2133
|
+
return j({
|
|
2134
|
+
requestedPsbtHex: y,
|
|
2135
|
+
signatureHex: T,
|
|
2136
|
+
signerXOnlyPubkeyHex: c,
|
|
2137
|
+
inputIndex: k
|
|
2138
|
+
}), T;
|
|
2139
|
+
}), w = je({
|
|
2140
|
+
requestedPsbtHex: y,
|
|
2141
|
+
signaturesHex: x,
|
|
2142
|
+
signerXOnlyPubkeyHex: c
|
|
2072
2143
|
});
|
|
2073
|
-
return u == null || u.throwIfAborted(), s(
|
|
2144
|
+
return u == null || u.throwIfAborted(), s(w);
|
|
2074
2145
|
}
|
|
2075
2146
|
export {
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2147
|
+
Ve as $,
|
|
2148
|
+
_r as A,
|
|
2149
|
+
sn as B,
|
|
2150
|
+
sr as C,
|
|
2151
|
+
Er as D,
|
|
2152
|
+
nn as E,
|
|
2153
|
+
po as F,
|
|
2154
|
+
m as G,
|
|
2155
|
+
go as H,
|
|
2156
|
+
ut as I,
|
|
2157
|
+
un as J,
|
|
2158
|
+
cn as K,
|
|
2159
|
+
ln as L,
|
|
2160
|
+
hn as M,
|
|
2161
|
+
st as N,
|
|
2162
|
+
Zo as O,
|
|
2163
|
+
ir as P,
|
|
2164
|
+
ne as Q,
|
|
2165
|
+
ct as R,
|
|
2166
|
+
io as S,
|
|
2167
|
+
Ae as T,
|
|
2168
|
+
co as U,
|
|
2169
|
+
lr as V,
|
|
2170
|
+
lo as W,
|
|
2171
|
+
mo as X,
|
|
2172
|
+
dn as Y,
|
|
2173
|
+
pn as Z,
|
|
2174
|
+
He as _,
|
|
2175
|
+
Uo as a,
|
|
2176
|
+
Be as a0,
|
|
2177
|
+
ht as a1,
|
|
2178
|
+
Oe as a2,
|
|
2179
|
+
fn as a3,
|
|
2180
|
+
De as a4,
|
|
2181
|
+
Ke as a5,
|
|
2182
|
+
Ne as a6,
|
|
2183
|
+
gn as a7,
|
|
2184
|
+
Go as b,
|
|
2185
|
+
Xo as c,
|
|
2186
|
+
qo as d,
|
|
2187
|
+
jo as e,
|
|
2188
|
+
ar as f,
|
|
2189
|
+
ur as g,
|
|
2190
|
+
Qe as h,
|
|
2191
|
+
Cr as i,
|
|
2192
|
+
Ze as j,
|
|
2193
|
+
et as k,
|
|
2194
|
+
Rr as l,
|
|
2195
|
+
zo as m,
|
|
2196
|
+
Yo as n,
|
|
2197
|
+
Ur as o,
|
|
2198
|
+
Qr as p,
|
|
2199
|
+
Jo as q,
|
|
2200
|
+
Qo as r,
|
|
2201
|
+
kr as s,
|
|
2202
|
+
ue as t,
|
|
2203
|
+
en as u,
|
|
2204
|
+
tn as v,
|
|
2205
|
+
Wo as w,
|
|
2206
|
+
rn as x,
|
|
2207
|
+
on as y,
|
|
2208
|
+
an as z
|
|
2138
2209
|
};
|
|
2139
|
-
//# sourceMappingURL=buildAndBroadcastReclaim-
|
|
2210
|
+
//# sourceMappingURL=buildAndBroadcastReclaim-D5520lbL.js.map
|