@babylonlabs-io/ts-sdk 0.78.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BTCVaultRegistry.abi-BT3eo60h.js → BTCVaultRegistry.abi-B0x9_Bza.js} +43 -1
- package/dist/BTCVaultRegistry.abi-B0x9_Bza.js.map +1 -0
- package/dist/BTCVaultRegistry.abi-BQ5tFNSu.cjs +2 -0
- package/dist/BTCVaultRegistry.abi-BQ5tFNSu.cjs.map +1 -0
- package/dist/{BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js → BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js} +57 -20
- package/dist/BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js.map +1 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs +2 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs.map +1 -0
- package/dist/{PeginManager-Cz0Ytdwo.js → PeginManager-BXlh3ar0.js} +289 -348
- package/dist/PeginManager-BXlh3ar0.js.map +1 -0
- package/dist/PeginManager-BuVSknB0.cjs +2 -0
- package/dist/PeginManager-BuVSknB0.cjs.map +1 -0
- package/dist/ProtocolParams.abi-Db2USqQm.cjs +2 -0
- package/dist/ProtocolParams.abi-Db2USqQm.cjs.map +1 -0
- package/dist/ProtocolParams.abi-q0AidvYX.js +526 -0
- package/dist/ProtocolParams.abi-q0AidvYX.js.map +1 -0
- package/dist/buildAndBroadcastReclaim-N9dXH9dm.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-N9dXH9dm.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-DD50pVB1.js → buildAndBroadcastReclaim-O6z9kvc4.js} +502 -468
- package/dist/buildAndBroadcastReclaim-O6z9kvc4.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +227 -222
- package/dist/pegin-registration-client-CZgcU2_0.cjs +2 -0
- package/dist/pegin-registration-client-CZgcU2_0.cjs.map +1 -0
- package/dist/{pegin-registration-client-7Vbtdypu.js → pegin-registration-client-pcczkzMg.js} +184 -143
- package/dist/pegin-registration-client-pcczkzMg.js.map +1 -0
- package/dist/tbv/core/clients/eth/index.cjs +1 -1
- package/dist/tbv/core/clients/eth/index.js +2 -2
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts +17 -0
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts +2 -0
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +28 -0
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +12 -0
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/contracts/__tests__/peginFingerprintAbi.test.d.ts +24 -0
- package/dist/tbv/core/contracts/__tests__/peginFingerprintAbi.test.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts +14 -0
- package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +38 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +10 -0
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/errors.d.ts +41 -4
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.cjs.map +1 -1
- package/dist/tbv/core/contracts/index.d.ts +1 -1
- package/dist/tbv/core/contracts/index.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.js +15 -492
- package/dist/tbv/core/contracts/index.js.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +222 -217
- package/dist/tbv/core/managers/PeginManager.d.ts +13 -25
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.d.ts +2 -2
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.js +4 -5
- package/dist/tbv/core/pegin-fingerprint/index.d.ts +1 -1
- package/dist/tbv/core/pegin-fingerprint/index.d.ts.map +1 -1
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts +10 -0
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/index.d.ts +1 -1
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts +50 -3
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +56 -54
- package/dist/tbv/core/services/participants/__tests__/fixtures/rotation.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +222 -217
- package/dist/{toRefundInputs-D708M8MA.js → toRefundInputs-9inv4Ai4.js} +96 -92
- package/dist/toRefundInputs-9inv4Ai4.js.map +1 -0
- package/dist/toRefundInputs-DitGWAnz.cjs +2 -0
- package/dist/toRefundInputs-DitGWAnz.cjs.map +1 -0
- package/dist/{types-BwqkOoJ6.js → types-B9YhlXe8.js} +109 -83
- package/dist/types-B9YhlXe8.js.map +1 -0
- package/dist/types-C1tpDycc.cjs +2 -0
- package/dist/types-C1tpDycc.cjs.map +1 -0
- package/package.json +3 -3
- package/dist/BTCVaultRegistry.abi-BJnjzEWD.cjs +0 -2
- package/dist/BTCVaultRegistry.abi-BJnjzEWD.cjs.map +0 -1
- package/dist/BTCVaultRegistry.abi-BT3eo60h.js.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs +0 -2
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js.map +0 -1
- package/dist/PeginManager-Cz0Ytdwo.js.map +0 -1
- package/dist/PeginManager-DE2lTWMl.cjs +0 -2
- package/dist/PeginManager-DE2lTWMl.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-CB5VPETy.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-CB5VPETy.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-DD50pVB1.js.map +0 -1
- package/dist/pegin-registration-client-7Vbtdypu.js.map +0 -1
- package/dist/pegin-registration-client-CSe1vOum.cjs +0 -2
- package/dist/pegin-registration-client-CSe1vOum.cjs.map +0 -1
- package/dist/toRefundInputs-BH3wkNC4.cjs +0 -2
- package/dist/toRefundInputs-BH3wkNC4.cjs.map +0 -1
- package/dist/toRefundInputs-D708M8MA.js.map +0 -1
- package/dist/types-BN0jOH8K.cjs +0 -2
- package/dist/types-BN0jOH8K.cjs.map +0 -1
- package/dist/types-BwqkOoJ6.js.map +0 -1
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var S = (e, t, r) =>
|
|
4
|
-
import { B as
|
|
5
|
-
import { e as
|
|
6
|
-
import { v as
|
|
7
|
-
import { zeroAddress as
|
|
8
|
-
import { D as
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var _e = (e, t, r) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var S = (e, t, r) => _e(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { B as pe } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
|
|
5
|
+
import { e as he, v as Se, s as y, u as de, p as O, c as C, f as _ } from "./bitcoin-C-TuHb-v.js";
|
|
6
|
+
import { v as $e, d as Be, s as Ie, P as Ve, a as Ke } from "./signPsbtsWithFallback-f7QLp0q8.js";
|
|
7
|
+
import { zeroAddress as Oe, isAddress as Ne, isAddressEqual as He } from "viem";
|
|
8
|
+
import { D as R, c as De, b as Me, R as Fe, d as ge } from "./json-rpc-client-DuUARJvV.js";
|
|
9
9
|
import { Transaction as $ } from "bitcoinjs-lib";
|
|
10
|
-
import { p as
|
|
11
|
-
import { D as
|
|
12
|
-
import { d as
|
|
13
|
-
import { a as K, c as
|
|
14
|
-
import { a as
|
|
15
|
-
import { a as
|
|
16
|
-
import { deriveVaultId as
|
|
17
|
-
const
|
|
10
|
+
import { p as Ue, f as Le, i as B, g as I, j as V } from "./verifyScriptPathSchnorrSignature-D_epga4j.js";
|
|
11
|
+
import { D as W } from "./constants-D5vORbQE.js";
|
|
12
|
+
import { d as Xe, c as qe, b as Ge, f as fe, e as ze, a as je } from "./noPayout-DiGr4eas.js";
|
|
13
|
+
import { a as K, c as Qe } from "./signing-Cm-McVR2.js";
|
|
14
|
+
import { a as Y } from "./onChainBtcPubkey-C-6UWpD8.js";
|
|
15
|
+
import { a as We } from "./secp256k1-D-H9jmd7.js";
|
|
16
|
+
import { deriveVaultId as Ye } from "./tbv/core/wasm/index.js";
|
|
17
|
+
const Je = /^0x[0-9a-fA-F]{64}$/, Ze = /^0x[0-9a-fA-F]{40}$/, et = /^0x([0-9a-fA-F]{2})*$/;
|
|
18
18
|
function N(e, t) {
|
|
19
19
|
if (e.length !== 66)
|
|
20
20
|
throw new Error(
|
|
21
21
|
`${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
|
|
22
22
|
);
|
|
23
|
-
if (!
|
|
23
|
+
if (!Je.test(e))
|
|
24
24
|
throw new Error(
|
|
25
25
|
`${t} must contain only hex characters after the 0x prefix`
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
if (!
|
|
28
|
+
function tt(e, t) {
|
|
29
|
+
if (!Ze.test(e))
|
|
30
30
|
throw new Error(
|
|
31
31
|
`${t} must be a 20-byte 0x-prefixed hex address (42 chars)`
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (!
|
|
34
|
+
function rt(e, t) {
|
|
35
|
+
if (!et.test(e))
|
|
36
36
|
throw new Error(
|
|
37
37
|
`${t} must be a 0x-prefixed hex string with an even number of hex chars`
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
const t =
|
|
43
|
-
if (N(t, "secret"), e.hashlock !== void 0 && (N(e.hashlock, "hashlock"),
|
|
40
|
+
function me(e) {
|
|
41
|
+
tt(e.btcVaultRegistryAddress, "btcVaultRegistryAddress"), N(e.vaultId, "vaultId");
|
|
42
|
+
const t = he(e.secret);
|
|
43
|
+
if (N(t, "secret"), e.hashlock !== void 0 && (N(e.hashlock, "hashlock"), !$e(t, e.hashlock)))
|
|
44
44
|
throw new Error(
|
|
45
45
|
"Invalid secret: SHA256(secret) does not match the provided hashlock"
|
|
46
46
|
);
|
|
47
47
|
return t;
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function or(e) {
|
|
50
50
|
const {
|
|
51
51
|
btcVaultRegistryAddress: t,
|
|
52
52
|
vaultId: r,
|
|
@@ -56,23 +56,23 @@ async function Yt(e) {
|
|
|
56
56
|
signal: s
|
|
57
57
|
} = e;
|
|
58
58
|
s == null || s.throwIfAborted();
|
|
59
|
-
const i =
|
|
59
|
+
const i = me({
|
|
60
60
|
btcVaultRegistryAddress: t,
|
|
61
61
|
vaultId: r,
|
|
62
62
|
secret: e.secret,
|
|
63
63
|
hashlock: o
|
|
64
64
|
});
|
|
65
|
-
return
|
|
65
|
+
return rt(a, "activationMetadata"), l({
|
|
66
66
|
address: t,
|
|
67
|
-
abi:
|
|
67
|
+
abi: pe,
|
|
68
68
|
functionName: "activateVaultWithSecret",
|
|
69
69
|
args: [r, i, a]
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
async function
|
|
72
|
+
async function nr(e) {
|
|
73
73
|
const { btcVaultRegistryAddress: t, vaultId: r, hashlock: o, writeContract: a, signal: l } = e;
|
|
74
74
|
l == null || l.throwIfAborted();
|
|
75
|
-
const s =
|
|
75
|
+
const s = me({
|
|
76
76
|
btcVaultRegistryAddress: t,
|
|
77
77
|
vaultId: r,
|
|
78
78
|
secret: e.secret,
|
|
@@ -80,40 +80,40 @@ async function Jt(e) {
|
|
|
80
80
|
});
|
|
81
81
|
return a({
|
|
82
82
|
address: t,
|
|
83
|
-
abi:
|
|
83
|
+
abi: pe,
|
|
84
84
|
functionName: "activateVaultWithSecretAndRedeem",
|
|
85
85
|
args: [r, s]
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
class
|
|
88
|
+
const ot = 8, nt = 6e3, st = 10 * 6e4, at = 10;
|
|
89
|
+
class Pe extends Error {
|
|
90
90
|
constructor(t) {
|
|
91
91
|
super(t), this.name = "PeginRegistrationMissingError";
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class ve extends Error {
|
|
95
95
|
constructor(t) {
|
|
96
96
|
super(t), this.name = "PeginRegistrationNotFinalError";
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return e instanceof
|
|
99
|
+
function it(e) {
|
|
100
|
+
return e instanceof Pe || e instanceof Error && e.name === "PeginRegistrationMissingError";
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return e instanceof
|
|
102
|
+
function sr(e) {
|
|
103
|
+
return e instanceof ve || e instanceof Error && e.name === "PeginRegistrationNotFinalError";
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function J(e) {
|
|
106
106
|
const { currentBlock: t, createdAtBlock: r } = e, o = t - r + 1n;
|
|
107
107
|
return o < 0n ? 0 : Number(o);
|
|
108
108
|
}
|
|
109
|
-
async function
|
|
109
|
+
async function ar(e) {
|
|
110
110
|
const {
|
|
111
111
|
vaultRegistryReader: t,
|
|
112
112
|
getBlockNumber: r,
|
|
113
113
|
vaultIds: o,
|
|
114
|
-
required: a =
|
|
115
|
-
pollIntervalMs: l =
|
|
116
|
-
timeoutMs: s =
|
|
114
|
+
required: a = ot,
|
|
115
|
+
pollIntervalMs: l = nt,
|
|
116
|
+
timeoutMs: s = st,
|
|
117
117
|
signal: i,
|
|
118
118
|
onProgress: n
|
|
119
119
|
} = e;
|
|
@@ -122,92 +122,92 @@ async function er(e) {
|
|
|
122
122
|
"waitForPeginRegistrationDepth requires at least one vault ID"
|
|
123
123
|
);
|
|
124
124
|
const u = Date.now();
|
|
125
|
-
let
|
|
125
|
+
let p = !1, c = 0, h;
|
|
126
126
|
for (; ; ) {
|
|
127
127
|
if (i != null && i.aborted)
|
|
128
128
|
throw new Error(
|
|
129
129
|
`Aborted while waiting for peg-in registration depth (${o.length} vault(s))`
|
|
130
130
|
);
|
|
131
131
|
if (Date.now() - u >= s)
|
|
132
|
-
throw new
|
|
133
|
-
`Peg-in registration did not reach ${a} Ethereum confirmations within ${s}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.` + (
|
|
132
|
+
throw new ve(
|
|
133
|
+
`Peg-in registration did not reach ${a} Ethereum confirmations within ${s}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.` + (h instanceof Error ? ` Last read error: ${h.message}` : "")
|
|
134
134
|
);
|
|
135
135
|
try {
|
|
136
|
-
const
|
|
137
|
-
o.map((
|
|
136
|
+
const d = await r(), g = await Promise.all(
|
|
137
|
+
o.map((P) => t.getVaultBasicInfo(P))
|
|
138
138
|
), m = g.findIndex(
|
|
139
|
-
(
|
|
139
|
+
(P) => P.depositor === Oe || P.createdAt === 0n
|
|
140
140
|
);
|
|
141
141
|
if (m !== -1) {
|
|
142
|
-
if (c += 1, !
|
|
143
|
-
throw new
|
|
142
|
+
if (c += 1, !p && c > at)
|
|
143
|
+
throw new Pe(
|
|
144
144
|
`Vault ${o[m]} is still not visible on-chain after ${c} reads — the registration does not exist.`
|
|
145
145
|
);
|
|
146
146
|
console.warn(
|
|
147
|
-
`Peg-in registration for vault ${o[m]} is not visible in chain state at block ${
|
|
147
|
+
`Peg-in registration for vault ${o[m]} is not visible in chain state at block ${d} — a lagging RPC backend or an Ethereum reorg. Still polling.`
|
|
148
148
|
), n == null || n({ confirmations: 0, required: a });
|
|
149
149
|
} else {
|
|
150
|
-
|
|
151
|
-
let
|
|
152
|
-
currentBlock:
|
|
150
|
+
p = !0, c = 0, h = void 0;
|
|
151
|
+
let P = g[0], f = J({
|
|
152
|
+
currentBlock: d,
|
|
153
153
|
createdAtBlock: g[0].createdAt
|
|
154
154
|
});
|
|
155
|
-
for (const
|
|
156
|
-
const
|
|
157
|
-
currentBlock:
|
|
158
|
-
createdAtBlock:
|
|
155
|
+
for (const x of g.slice(1)) {
|
|
156
|
+
const b = J({
|
|
157
|
+
currentBlock: d,
|
|
158
|
+
createdAtBlock: x.createdAt
|
|
159
159
|
});
|
|
160
|
-
|
|
160
|
+
b < f && (f = b, P = x);
|
|
161
161
|
}
|
|
162
|
-
if (n == null || n({ confirmations:
|
|
163
|
-
return { confirmations:
|
|
162
|
+
if (n == null || n({ confirmations: f, required: a }), f >= a)
|
|
163
|
+
return { confirmations: f, basicInfo: P };
|
|
164
164
|
}
|
|
165
|
-
} catch (
|
|
166
|
-
if (
|
|
167
|
-
throw
|
|
165
|
+
} catch (d) {
|
|
166
|
+
if (it(d))
|
|
167
|
+
throw d;
|
|
168
168
|
console.warn(
|
|
169
|
-
`Registration-depth read failed (retrying in ${l}ms): ` + (
|
|
170
|
-
),
|
|
169
|
+
`Registration-depth read failed (retrying in ${l}ms): ` + (d instanceof Error ? d.message : String(d))
|
|
170
|
+
), h = d;
|
|
171
171
|
}
|
|
172
|
-
await new Promise((
|
|
172
|
+
await new Promise((d, g) => {
|
|
173
173
|
const m = () => {
|
|
174
|
-
clearTimeout(
|
|
174
|
+
clearTimeout(P), g(
|
|
175
175
|
new Error(
|
|
176
176
|
`Aborted while waiting for peg-in registration depth (${o.length} vault(s))`
|
|
177
177
|
)
|
|
178
178
|
);
|
|
179
|
-
},
|
|
180
|
-
i == null || i.removeEventListener("abort", m),
|
|
179
|
+
}, P = setTimeout(() => {
|
|
180
|
+
i == null || i.removeEventListener("abort", m), d();
|
|
181
181
|
}, l);
|
|
182
182
|
i == null || i.addEventListener("abort", m, { once: !0 });
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
const
|
|
187
|
-
function
|
|
186
|
+
const ut = 1;
|
|
187
|
+
function lt(e, t, r) {
|
|
188
188
|
const o = r.map(
|
|
189
|
-
(c) =>
|
|
189
|
+
(c) => y(c).toLowerCase()
|
|
190
190
|
), a = t.filter((c) => o.includes(c));
|
|
191
191
|
if (a.length > 0)
|
|
192
192
|
throw new Error(
|
|
193
193
|
`Cannot validate challenger set: vault keepers and universal challengers overlap (${a.join(", ")})`
|
|
194
194
|
);
|
|
195
195
|
const l = [...t, ...o], s = e.map(
|
|
196
|
-
(c) =>
|
|
196
|
+
(c) => y(c.challenger_pubkey).toLowerCase()
|
|
197
197
|
), i = new Set(s);
|
|
198
198
|
if (i.size !== s.length)
|
|
199
199
|
throw new Error(
|
|
200
200
|
"Depositor graph contains duplicate challenger entries in challenger_presign_data"
|
|
201
201
|
);
|
|
202
|
-
const n = new Set(l), u = l.filter((c) => !i.has(c)),
|
|
203
|
-
if (u.length > 0 ||
|
|
202
|
+
const n = new Set(l), u = l.filter((c) => !i.has(c)), p = s.filter((c) => !n.has(c));
|
|
203
|
+
if (u.length > 0 || p.length > 0)
|
|
204
204
|
throw new Error(
|
|
205
|
-
"Depositor graph challenger set does not match expected (local ∪ universal)" + (u.length > 0 ? ` (missing: ${u.join(", ")})` : "") + (
|
|
205
|
+
"Depositor graph challenger set does not match expected (local ∪ universal)" + (u.length > 0 ? ` (missing: ${u.join(", ")})` : "") + (p.length > 0 ? ` (unexpected: ${p.join(", ")})` : "")
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function ct(e, t) {
|
|
209
209
|
const r = e.ins[t];
|
|
210
|
-
return
|
|
210
|
+
return de(new Uint8Array(r.hash).slice().reverse());
|
|
211
211
|
}
|
|
212
212
|
function H(e, t, r, o, a) {
|
|
213
213
|
const l = e.ins[t];
|
|
@@ -215,25 +215,25 @@ function H(e, t, r, o, a) {
|
|
|
215
215
|
throw new Error(
|
|
216
216
|
`NoPayout (challenger ${a}) input ${t} expected to spend ${o} vout 0, got vout ${l.index}`
|
|
217
217
|
);
|
|
218
|
-
const s = r.getId(), i =
|
|
218
|
+
const s = r.getId(), i = ct(e, t);
|
|
219
219
|
if (i !== s)
|
|
220
220
|
throw new Error(
|
|
221
221
|
`NoPayout (challenger ${a}) input ${t} does not reference ${o} (expected txid ${s}, got ${i})`
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
|
-
async function
|
|
225
|
-
const o = [], a = [], l = [], s =
|
|
224
|
+
async function pt(e, t, r) {
|
|
225
|
+
const o = [], a = [], l = [], s = Ue({
|
|
226
226
|
claimerBtcPubkey: r.depositorBtcPubkey,
|
|
227
227
|
depositorBtcPubkey: r.depositorBtcPubkey,
|
|
228
228
|
vaultProviderBtcPubkey: r.vaultProviderBtcPubkey,
|
|
229
229
|
vaultKeeperBtcPubkeys: r.vaultKeeperBtcPubkeys
|
|
230
230
|
});
|
|
231
|
-
|
|
231
|
+
lt(
|
|
232
232
|
e.challenger_presign_data,
|
|
233
233
|
s,
|
|
234
234
|
r.universalChallengerBtcPubkeys
|
|
235
235
|
);
|
|
236
|
-
const i = await
|
|
236
|
+
const i = await Le({
|
|
237
237
|
vaultCoreVersion: r.vaultCoreVersion,
|
|
238
238
|
vkClaimerPayoutScriptPubKeys: r.vkClaimerPayoutScriptPubKeys,
|
|
239
239
|
vpCommissionScriptPubKey: r.vpCommissionScriptPubKey,
|
|
@@ -249,7 +249,7 @@ async function st(e, t, r) {
|
|
|
249
249
|
network: r.network,
|
|
250
250
|
claimerBtcPubkey: r.depositorBtcPubkey,
|
|
251
251
|
registeredPayoutScriptPubKey: r.registeredPayoutScriptPubKey,
|
|
252
|
-
commissionBps:
|
|
252
|
+
commissionBps: ut,
|
|
253
253
|
protocolFeeRate: r.protocolFeeRate,
|
|
254
254
|
councilMembers: r.councilMembers,
|
|
255
255
|
councilQuorum: r.councilQuorum
|
|
@@ -257,34 +257,34 @@ async function st(e, t, r) {
|
|
|
257
257
|
o.push(i.psbtHex), a.push(
|
|
258
258
|
K(
|
|
259
259
|
t,
|
|
260
|
-
|
|
260
|
+
W
|
|
261
261
|
)
|
|
262
262
|
);
|
|
263
|
-
const n =
|
|
264
|
-
|
|
263
|
+
const n = y(r.depositorBtcPubkey), u = $.fromHex(
|
|
264
|
+
y(e.assert_tx.tx_hex)
|
|
265
265
|
);
|
|
266
|
-
for (const
|
|
267
|
-
const c =
|
|
268
|
-
challenger:
|
|
266
|
+
for (const p of e.challenger_presign_data) {
|
|
267
|
+
const c = y(p.challenger_pubkey), h = o.length, d = await ht({
|
|
268
|
+
challenger: p,
|
|
269
269
|
challengerPubkey: c,
|
|
270
270
|
claimerPubkey: n,
|
|
271
271
|
localChallengers: s,
|
|
272
272
|
assertTxParsed: u,
|
|
273
273
|
ctx: r
|
|
274
274
|
});
|
|
275
|
-
o.push(
|
|
275
|
+
o.push(d), a.push(
|
|
276
276
|
K(
|
|
277
277
|
t,
|
|
278
|
-
|
|
278
|
+
W
|
|
279
279
|
)
|
|
280
280
|
), l.push({
|
|
281
281
|
challengerPubkey: c,
|
|
282
|
-
noPayoutIdx:
|
|
282
|
+
noPayoutIdx: h
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
return { psbtHexes: o, signOptions: a, challengerEntries: l };
|
|
286
286
|
}
|
|
287
|
-
async function
|
|
287
|
+
async function ht(e) {
|
|
288
288
|
const {
|
|
289
289
|
challenger: t,
|
|
290
290
|
challengerPubkey: r,
|
|
@@ -293,17 +293,17 @@ async function at(e) {
|
|
|
293
293
|
assertTxParsed: l,
|
|
294
294
|
ctx: s
|
|
295
295
|
} = e;
|
|
296
|
-
|
|
296
|
+
Xe(
|
|
297
297
|
t.nopayout_tx.tx_hex,
|
|
298
298
|
r,
|
|
299
299
|
s.network
|
|
300
300
|
);
|
|
301
301
|
const i = $.fromHex(
|
|
302
|
-
|
|
302
|
+
y(t.nopayout_tx.tx_hex)
|
|
303
303
|
), n = $.fromHex(
|
|
304
|
-
|
|
304
|
+
y(t.challenge_assert_x_tx.tx_hex)
|
|
305
305
|
), u = $.fromHex(
|
|
306
|
-
|
|
306
|
+
y(t.challenge_assert_y_tx.tx_hex)
|
|
307
307
|
);
|
|
308
308
|
if (i.ins.length !== 3)
|
|
309
309
|
throw new Error(
|
|
@@ -328,18 +328,18 @@ async function at(e) {
|
|
|
328
328
|
"ChallengeAssertY",
|
|
329
329
|
r
|
|
330
330
|
);
|
|
331
|
-
const
|
|
331
|
+
const p = [
|
|
332
332
|
l.outs[0],
|
|
333
333
|
n.outs[0],
|
|
334
334
|
u.outs[0]
|
|
335
335
|
].map((c) => ({
|
|
336
|
-
script_pubkey:
|
|
336
|
+
script_pubkey: de(new Uint8Array(c.script)),
|
|
337
337
|
value: c.value
|
|
338
338
|
}));
|
|
339
|
-
return
|
|
339
|
+
return qe({
|
|
340
340
|
noPayoutTxHex: t.nopayout_tx.tx_hex,
|
|
341
341
|
challengerPubkey: r,
|
|
342
|
-
prevouts:
|
|
342
|
+
prevouts: p,
|
|
343
343
|
connectorParams: {
|
|
344
344
|
txGraphVersion: s.vaultCoreVersion,
|
|
345
345
|
claimer: o,
|
|
@@ -351,7 +351,7 @@ async function at(e) {
|
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function dt(e, t, r) {
|
|
355
355
|
B(e[0]);
|
|
356
356
|
const a = I(
|
|
357
357
|
e[0].returnedPsbtHex,
|
|
@@ -386,36 +386,36 @@ function it(e, t, r) {
|
|
|
386
386
|
per_challenger: l
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
|
-
async function
|
|
390
|
-
const { depositorGraph: t, btcWallet: r, signingContext: o } = e, a = await r.getPublicKeyHex(), { depositorPubkey: l } =
|
|
389
|
+
async function gt(e) {
|
|
390
|
+
const { depositorGraph: t, btcWallet: r, signingContext: o } = e, a = await r.getPublicKeyHex(), { depositorPubkey: l } = Se(
|
|
391
391
|
a,
|
|
392
|
-
|
|
393
|
-
), { psbtHexes: s, signOptions: i, challengerEntries: n } = await
|
|
392
|
+
y(o.depositorBtcPubkey)
|
|
393
|
+
), { psbtHexes: s, signOptions: i, challengerEntries: n } = await pt(
|
|
394
394
|
t,
|
|
395
395
|
a,
|
|
396
396
|
o
|
|
397
|
-
), u = await
|
|
397
|
+
), u = await Be(
|
|
398
398
|
r,
|
|
399
399
|
s,
|
|
400
400
|
i
|
|
401
|
-
),
|
|
401
|
+
), p = s.map((c, h) => ({
|
|
402
402
|
requestedPsbtHex: c,
|
|
403
|
-
returnedPsbtHex: u[
|
|
403
|
+
returnedPsbtHex: u[h]
|
|
404
404
|
}));
|
|
405
|
-
return
|
|
406
|
-
|
|
405
|
+
return dt(
|
|
406
|
+
p,
|
|
407
407
|
n,
|
|
408
408
|
l
|
|
409
409
|
);
|
|
410
410
|
}
|
|
411
|
-
const
|
|
412
|
-
async function
|
|
411
|
+
const ft = 1e4;
|
|
412
|
+
async function ye(e) {
|
|
413
413
|
const {
|
|
414
414
|
statusReader: t,
|
|
415
415
|
peginTxid: r,
|
|
416
416
|
targetStatuses: o,
|
|
417
417
|
timeoutMs: a,
|
|
418
|
-
pollIntervalMs: l =
|
|
418
|
+
pollIntervalMs: l = ft,
|
|
419
419
|
signal: s
|
|
420
420
|
} = e, i = Date.now();
|
|
421
421
|
for (; ; ) {
|
|
@@ -437,53 +437,53 @@ async function fe(e) {
|
|
|
437
437
|
`getPeginStatus returned status for pegin ${n.pegin_txid.slice(0, 8)}…, requested ${r.slice(0, 8)}…`
|
|
438
438
|
);
|
|
439
439
|
const u = n.status;
|
|
440
|
-
if (o.has(u) || u ===
|
|
440
|
+
if (o.has(u) || u === R.ACTIVATED)
|
|
441
441
|
return u;
|
|
442
|
-
if (u ===
|
|
442
|
+
if (u === R.EXPIRED || De.has(u))
|
|
443
443
|
throw new Error(
|
|
444
444
|
`Pegin ${r.slice(0, 8)}… reached terminal status "${u}" while waiting for ${[...o].join(", ")}`
|
|
445
445
|
);
|
|
446
446
|
} catch (n) {
|
|
447
|
-
if (!(n instanceof
|
|
447
|
+
if (!(n instanceof Me && n.code === Fe.PEGIN_NOT_FOUND))
|
|
448
448
|
throw n;
|
|
449
449
|
}
|
|
450
450
|
await new Promise((n, u) => {
|
|
451
|
-
const
|
|
451
|
+
const p = () => {
|
|
452
452
|
clearTimeout(c), u(
|
|
453
453
|
new Error(
|
|
454
454
|
`Polling aborted for pegin ${r.slice(0, 8)}… (target: ${[...o].join(", ")})`
|
|
455
455
|
)
|
|
456
456
|
);
|
|
457
457
|
}, c = setTimeout(() => {
|
|
458
|
-
s == null || s.removeEventListener("abort",
|
|
458
|
+
s == null || s.removeEventListener("abort", p), n();
|
|
459
459
|
}, l);
|
|
460
|
-
s == null || s.addEventListener("abort",
|
|
460
|
+
s == null || s.addEventListener("abort", p, { once: !0 });
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
]),
|
|
470
|
-
|
|
471
|
-
...
|
|
464
|
+
const mt = 1200 * 1e3, be = /* @__PURE__ */ new Set([
|
|
465
|
+
R.PENDING_ACKS,
|
|
466
|
+
R.PENDING_ACTIVATION,
|
|
467
|
+
R.ACTIVATED_PENDING_BROADCAST,
|
|
468
|
+
R.ACTIVATED
|
|
469
|
+
]), Pt = /* @__PURE__ */ new Set([
|
|
470
|
+
R.PENDING_DEPOSITOR_SIGNATURES,
|
|
471
|
+
...be
|
|
472
472
|
]);
|
|
473
|
-
function
|
|
473
|
+
function vt(e) {
|
|
474
474
|
return e.map((t) => ({
|
|
475
475
|
claimerPubkeyXOnly: O(t.claimer_pubkey),
|
|
476
476
|
payoutTxHex: t.payout_tx.tx_hex,
|
|
477
477
|
assertTxHex: t.assert_tx.tx_hex
|
|
478
478
|
}));
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function A(e) {
|
|
481
481
|
return O(e).toLowerCase();
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
const r = (n, u,
|
|
483
|
+
function yt(e, t) {
|
|
484
|
+
const r = (n, u, p) => {
|
|
485
485
|
throw new Error(
|
|
486
|
-
`Deposit terms ${n} (${String(u)}) does not match the vault's version-locked signing context (${String(
|
|
486
|
+
`Deposit terms ${n} (${String(u)}) does not match the vault's version-locked signing context (${String(p)}); refusing to sign payouts against terms that describe a different graph.`
|
|
487
487
|
);
|
|
488
488
|
}, o = [
|
|
489
489
|
["protocolFeeRate", e.protocolFeeRate, t.protocolFeeRate],
|
|
@@ -491,11 +491,11 @@ function pt(e, t) {
|
|
|
491
491
|
["timelockPegin", e.timelockPegin, t.timelockPegin],
|
|
492
492
|
["timelockAssert", e.timelockAssert, t.timelockAssert]
|
|
493
493
|
];
|
|
494
|
-
for (const [n, u,
|
|
495
|
-
u !==
|
|
496
|
-
const a = (n) => n.map(
|
|
497
|
-
const
|
|
498
|
-
return
|
|
494
|
+
for (const [n, u, p] of o)
|
|
495
|
+
u !== p && r(n, u, p);
|
|
496
|
+
const a = (n) => n.map(A).sort(), l = (n, u) => {
|
|
497
|
+
const p = a(n), c = a(u);
|
|
498
|
+
return p.length === c.length && p.every((h, d) => h === c[d]);
|
|
499
499
|
};
|
|
500
500
|
l(e.vaultKeeperBtcPubkeys, t.vaultKeeperBtcPubkeys) || r(
|
|
501
501
|
"vaultKeeperBtcPubkeys",
|
|
@@ -509,8 +509,8 @@ function pt(e, t) {
|
|
|
509
509
|
e.universalChallengerBtcPubkeys.join(","),
|
|
510
510
|
t.universalChallengerBtcPubkeys.join(",")
|
|
511
511
|
);
|
|
512
|
-
const s =
|
|
513
|
-
(n) =>
|
|
512
|
+
const s = A(t.vaultProviderBtcPubkey), i = e.vaults.map(
|
|
513
|
+
(n) => A(n.vaultProviderBtcPubkey)
|
|
514
514
|
);
|
|
515
515
|
i.includes(s) || r(
|
|
516
516
|
"vaults[].vaultProviderBtcPubkey",
|
|
@@ -518,10 +518,10 @@ function pt(e, t) {
|
|
|
518
518
|
t.vaultProviderBtcPubkey
|
|
519
519
|
);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
522
|
-
const a =
|
|
523
|
-
|
|
524
|
-
...r.map(
|
|
521
|
+
function bt(e, t, r, o) {
|
|
522
|
+
const a = A(o), l = [
|
|
523
|
+
A(t),
|
|
524
|
+
...r.map(A)
|
|
525
525
|
], s = new Set(l);
|
|
526
526
|
if (s.size !== l.length)
|
|
527
527
|
throw new Error(
|
|
@@ -532,17 +532,17 @@ function gt(e, t, r, o) {
|
|
|
532
532
|
"Cannot validate claimer set: depositor key overlaps with vault provider or vault keeper set"
|
|
533
533
|
);
|
|
534
534
|
const i = e.map(
|
|
535
|
-
(
|
|
535
|
+
(h) => A(h.claimer_pubkey)
|
|
536
536
|
);
|
|
537
537
|
if (new Set(i).size !== i.length)
|
|
538
538
|
throw new Error("Presign response contains duplicate claimer entries");
|
|
539
|
-
const n = i.filter((
|
|
540
|
-
if (
|
|
539
|
+
const n = i.filter((h) => h !== a), u = new Set(n), p = l.filter((h) => !u.has(h)), c = n.filter((h) => !s.has(h));
|
|
540
|
+
if (p.length > 0 || c.length > 0)
|
|
541
541
|
throw new Error(
|
|
542
|
-
"Presign response claimer set does not match expected (vault provider ∪ vault keepers)" + (
|
|
542
|
+
"Presign response claimer set does not match expected (vault provider ∪ vault keepers)" + (p.length > 0 ? ` (missing: ${p.join(", ")})` : "") + (c.length > 0 ? ` (unexpected: ${c.join(", ")})` : "")
|
|
543
543
|
);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function Z(e, t) {
|
|
546
546
|
return {
|
|
547
547
|
vaultCoreVersion: t.vaultCoreVersion,
|
|
548
548
|
payoutTxHex: e.payoutTxHex,
|
|
@@ -564,8 +564,8 @@ function Q(e, t) {
|
|
|
564
564
|
vpCommissionScriptPubKey: t.vpCommissionScriptPubKey
|
|
565
565
|
};
|
|
566
566
|
}
|
|
567
|
-
async function
|
|
568
|
-
const a = new
|
|
567
|
+
async function wt(e, t, r, o) {
|
|
568
|
+
const a = new Ve({
|
|
569
569
|
network: t.network,
|
|
570
570
|
btcWallet: e
|
|
571
571
|
}), l = r.length;
|
|
@@ -573,14 +573,14 @@ async function ft(e, t, r, o) {
|
|
|
573
573
|
let s;
|
|
574
574
|
if (a.supportsBatchSigning())
|
|
575
575
|
s = (await a.signPayoutTransactionsBatch(
|
|
576
|
-
r.map((u) =>
|
|
576
|
+
r.map((u) => Z(u, t))
|
|
577
577
|
)).map((u) => u.payoutSignature);
|
|
578
578
|
else {
|
|
579
579
|
s = [];
|
|
580
580
|
for (let n = 0; n < r.length; n++) {
|
|
581
581
|
o == null || o(n, l);
|
|
582
582
|
const u = await a.signPayoutTransaction(
|
|
583
|
-
|
|
583
|
+
Z(r[n], t)
|
|
584
584
|
);
|
|
585
585
|
s.push(u.signature);
|
|
586
586
|
}
|
|
@@ -592,7 +592,7 @@ async function ft(e, t, r, o) {
|
|
|
592
592
|
};
|
|
593
593
|
return o == null || o(l, l), i;
|
|
594
594
|
}
|
|
595
|
-
async function
|
|
595
|
+
async function ir(e) {
|
|
596
596
|
const {
|
|
597
597
|
statusReader: t,
|
|
598
598
|
presignClient: r,
|
|
@@ -601,26 +601,26 @@ async function tr(e) {
|
|
|
601
601
|
depositorPk: l,
|
|
602
602
|
signingContext: s,
|
|
603
603
|
depositTerms: i,
|
|
604
|
-
timeoutMs: n =
|
|
604
|
+
timeoutMs: n = mt,
|
|
605
605
|
signal: u,
|
|
606
|
-
onProgress:
|
|
607
|
-
} = e, c = await
|
|
606
|
+
onProgress: p
|
|
607
|
+
} = e, c = await ye({
|
|
608
608
|
statusReader: t,
|
|
609
609
|
peginTxid: a,
|
|
610
|
-
targetStatuses:
|
|
610
|
+
targetStatuses: Pt,
|
|
611
611
|
timeoutMs: n,
|
|
612
612
|
signal: u
|
|
613
613
|
});
|
|
614
|
-
if (
|
|
614
|
+
if (be.has(c))
|
|
615
615
|
return;
|
|
616
|
-
if (u == null || u.throwIfAborted(), i !== void 0 &&
|
|
616
|
+
if (u == null || u.throwIfAborted(), i !== void 0 && yt(i, s), Ie(o)) {
|
|
617
617
|
if (!i)
|
|
618
618
|
throw new Error(
|
|
619
619
|
"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)."
|
|
620
620
|
);
|
|
621
621
|
typeof o.validateDepositTerms == "function" && await o.validateDepositTerms(i), await o.approveDepositTerms(i);
|
|
622
622
|
}
|
|
623
|
-
const
|
|
623
|
+
const h = await r.requestDepositorPresignTransactions(
|
|
624
624
|
{
|
|
625
625
|
pegin_txid: a,
|
|
626
626
|
depositor_pk: l
|
|
@@ -628,24 +628,24 @@ async function tr(e) {
|
|
|
628
628
|
u
|
|
629
629
|
);
|
|
630
630
|
u == null || u.throwIfAborted();
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
|
|
631
|
+
const d = A(l);
|
|
632
|
+
bt(
|
|
633
|
+
h.txs,
|
|
634
634
|
s.vaultProviderBtcPubkey,
|
|
635
635
|
s.vaultKeeperBtcPubkeys,
|
|
636
636
|
l
|
|
637
637
|
);
|
|
638
|
-
const g =
|
|
639
|
-
(
|
|
640
|
-
), m =
|
|
638
|
+
const g = h.txs.filter(
|
|
639
|
+
(b) => A(b.claimer_pubkey) !== d
|
|
640
|
+
), m = vt(g), P = await wt(
|
|
641
641
|
o,
|
|
642
642
|
s,
|
|
643
643
|
m,
|
|
644
|
-
|
|
644
|
+
p
|
|
645
645
|
);
|
|
646
646
|
u == null || u.throwIfAborted();
|
|
647
|
-
const
|
|
648
|
-
depositorGraph:
|
|
647
|
+
const f = await gt({
|
|
648
|
+
depositorGraph: h.depositor_graph,
|
|
649
649
|
btcWallet: o,
|
|
650
650
|
signingContext: {
|
|
651
651
|
vaultCoreVersion: s.vaultCoreVersion,
|
|
@@ -666,40 +666,40 @@ async function tr(e) {
|
|
|
666
666
|
}
|
|
667
667
|
});
|
|
668
668
|
u == null || u.throwIfAborted();
|
|
669
|
-
const
|
|
670
|
-
|
|
669
|
+
const x = { ...P };
|
|
670
|
+
x[y(l)] = f.payout_signatures, await r.submitDepositorPresignatures(
|
|
671
671
|
{
|
|
672
672
|
pegin_txid: a,
|
|
673
673
|
depositor_pk: l,
|
|
674
|
-
signatures:
|
|
675
|
-
depositor_claimer_presignatures:
|
|
674
|
+
signatures: x,
|
|
675
|
+
depositor_claimer_presignatures: f
|
|
676
676
|
},
|
|
677
677
|
u
|
|
678
678
|
);
|
|
679
679
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
...
|
|
680
|
+
const Et = 300 * 1e3, kt = /* @__PURE__ */ new Set([
|
|
681
|
+
R.PENDING_DEPOSITOR_WOTS_PK,
|
|
682
|
+
...ge
|
|
683
683
|
]);
|
|
684
|
-
async function
|
|
684
|
+
async function ur(e) {
|
|
685
685
|
const {
|
|
686
686
|
statusReader: t,
|
|
687
687
|
wotsSubmitter: r,
|
|
688
688
|
peginTxid: o,
|
|
689
689
|
depositorPk: a,
|
|
690
690
|
wotsPublicKeys: l,
|
|
691
|
-
timeoutMs: s =
|
|
691
|
+
timeoutMs: s = Et,
|
|
692
692
|
signal: i
|
|
693
693
|
} = e;
|
|
694
694
|
i == null || i.throwIfAborted();
|
|
695
|
-
const n = await
|
|
695
|
+
const n = await ye({
|
|
696
696
|
statusReader: t,
|
|
697
697
|
peginTxid: o,
|
|
698
|
-
targetStatuses:
|
|
698
|
+
targetStatuses: kt,
|
|
699
699
|
timeoutMs: s,
|
|
700
700
|
signal: i
|
|
701
701
|
});
|
|
702
|
-
|
|
702
|
+
ge.has(n) || (i == null || i.throwIfAborted(), await r.submitDepositorWotsKey(
|
|
703
703
|
{
|
|
704
704
|
pegin_txid: o,
|
|
705
705
|
depositor_pk: a,
|
|
@@ -711,27 +711,27 @@ async function rr(e) {
|
|
|
711
711
|
function D(e) {
|
|
712
712
|
return e.registration || e.operation;
|
|
713
713
|
}
|
|
714
|
-
function
|
|
715
|
-
const o =
|
|
714
|
+
function xt(e, t, r) {
|
|
715
|
+
const o = C(e);
|
|
716
716
|
return {
|
|
717
|
-
registration: o ===
|
|
718
|
-
operation: o ===
|
|
717
|
+
registration: o === C(t),
|
|
718
|
+
operation: o === C(r)
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
|
-
function
|
|
722
|
-
const o =
|
|
721
|
+
function ee(e, t, r) {
|
|
722
|
+
const o = M(e);
|
|
723
723
|
return {
|
|
724
|
-
registration:
|
|
725
|
-
operation:
|
|
724
|
+
registration: te(o, M(t)),
|
|
725
|
+
operation: te(o, M(r))
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
|
-
function
|
|
729
|
-
return e.map(
|
|
728
|
+
function M(e) {
|
|
729
|
+
return e.map(C).sort();
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function te(e, t) {
|
|
732
732
|
return e.length === t.length && e.every((r, o) => r === t[o]);
|
|
733
733
|
}
|
|
734
|
-
async function
|
|
734
|
+
async function lr(e) {
|
|
735
735
|
const {
|
|
736
736
|
vaultProviderEthAddress: t,
|
|
737
737
|
hintBtcPubkey: r,
|
|
@@ -740,9 +740,9 @@ async function or(e) {
|
|
|
740
740
|
context: l
|
|
741
741
|
} = e;
|
|
742
742
|
if (!r) return;
|
|
743
|
-
const s =
|
|
744
|
-
if (s ===
|
|
745
|
-
const i =
|
|
743
|
+
const s = C(r);
|
|
744
|
+
if (s === C(o)) return;
|
|
745
|
+
const i = C(
|
|
746
746
|
await a()
|
|
747
747
|
);
|
|
748
748
|
if (s !== i)
|
|
@@ -750,11 +750,11 @@ async function or(e) {
|
|
|
750
750
|
`Vault provider BTC pubkey mismatch for ${t}: indexer hint matches neither the registration key nor the current operation key on-chain.${l ? ` ${l}` : ""}`
|
|
751
751
|
);
|
|
752
752
|
}
|
|
753
|
-
function
|
|
754
|
-
const o = `${e} operation key (admin=${t.ethAddress})`, a =
|
|
753
|
+
function F(e, t, r) {
|
|
754
|
+
const o = `${e} operation key (admin=${t.ethAddress})`, a = Y(
|
|
755
755
|
t.btcPubKey,
|
|
756
756
|
`${e} roster key (admin=${t.ethAddress})`
|
|
757
|
-
), l =
|
|
757
|
+
), l = Y(r, o);
|
|
758
758
|
return {
|
|
759
759
|
adminAddress: t.ethAddress,
|
|
760
760
|
genesisBtcPubkey: a,
|
|
@@ -762,7 +762,7 @@ function M(e, t, r) {
|
|
|
762
762
|
rotated: l !== a
|
|
763
763
|
};
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Tt(e) {
|
|
766
766
|
const t = /* @__PURE__ */ new Map();
|
|
767
767
|
for (const r of e) {
|
|
768
768
|
const o = t.get(r.operationBtcPubkey);
|
|
@@ -773,12 +773,12 @@ function bt(e) {
|
|
|
773
773
|
t.set(r.operationBtcPubkey, r.adminAddress);
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function we(e, t, r) {
|
|
777
777
|
if (t.vaultKeepers.length !== e.vaultKeepers.length || t.universalChallengers.length !== e.universalChallengers.length)
|
|
778
778
|
throw new Error(
|
|
779
779
|
`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`
|
|
780
780
|
);
|
|
781
|
-
const o =
|
|
781
|
+
const o = F(
|
|
782
782
|
"vault provider",
|
|
783
783
|
{
|
|
784
784
|
ethAddress: e.vaultProviderEthAddress,
|
|
@@ -786,11 +786,11 @@ function ve(e, t, r) {
|
|
|
786
786
|
},
|
|
787
787
|
t.vaultProvider
|
|
788
788
|
), a = e.vaultKeepers.map(
|
|
789
|
-
(s, i) =>
|
|
789
|
+
(s, i) => F("vault keeper", s, t.vaultKeepers[i])
|
|
790
790
|
), l = e.universalChallengers.map(
|
|
791
|
-
(s, i) =>
|
|
791
|
+
(s, i) => F("universal challenger", s, t.universalChallengers[i])
|
|
792
792
|
);
|
|
793
|
-
return
|
|
793
|
+
return Tt([
|
|
794
794
|
o,
|
|
795
795
|
...a,
|
|
796
796
|
...l
|
|
@@ -805,25 +805,33 @@ function ve(e, t, r) {
|
|
|
805
805
|
query: e
|
|
806
806
|
};
|
|
807
807
|
}
|
|
808
|
-
async function
|
|
808
|
+
async function At(e) {
|
|
809
809
|
const t = await e.operationKeyReader.getCurrentOperationKeys(
|
|
810
810
|
e.query,
|
|
811
811
|
e.blockNumber
|
|
812
812
|
);
|
|
813
|
-
return
|
|
813
|
+
return we(e.query, t, { mode: "current" });
|
|
814
814
|
}
|
|
815
|
-
async function
|
|
815
|
+
async function Ct(e) {
|
|
816
816
|
const t = await e.operationKeyReader.getOperationKeysAtEpochs(
|
|
817
817
|
e.query,
|
|
818
818
|
e.epochs
|
|
819
819
|
);
|
|
820
|
-
return
|
|
820
|
+
return we(e.query, t, {
|
|
821
821
|
mode: "epochs",
|
|
822
822
|
epochs: e.epochs
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
|
-
|
|
826
|
-
|
|
825
|
+
class L extends Error {
|
|
826
|
+
constructor(t) {
|
|
827
|
+
super(t), this.name = "ApplicationEntryPointMismatchError";
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
function cr(e) {
|
|
831
|
+
return e instanceof L || e instanceof Error && e.name === "ApplicationEntryPointMismatchError";
|
|
832
|
+
}
|
|
833
|
+
const re = (e) => e.map(C).sort();
|
|
834
|
+
async function pr(e) {
|
|
827
835
|
const {
|
|
828
836
|
vaultRegistryReader: t,
|
|
829
837
|
vaultKeeperReader: r,
|
|
@@ -834,99 +842,123 @@ async function nr(e) {
|
|
|
834
842
|
expectedVaultKeeperBtcPubkeys: i,
|
|
835
843
|
expectedUniversalChallengerBtcPubkeys: n,
|
|
836
844
|
operationKeyReader: u,
|
|
837
|
-
onIndexerServingOperationKeys:
|
|
845
|
+
onIndexerServingOperationKeys: p,
|
|
838
846
|
onIndexerHintsInconsistent: c,
|
|
839
|
-
blockNumber:
|
|
847
|
+
blockNumber: h
|
|
840
848
|
} = e, [
|
|
841
|
-
|
|
849
|
+
d,
|
|
842
850
|
g,
|
|
843
|
-
m
|
|
851
|
+
m,
|
|
852
|
+
P
|
|
844
853
|
] = await Promise.all([
|
|
845
|
-
t.
|
|
854
|
+
t.getVaultProviderApplication(
|
|
846
855
|
a,
|
|
847
|
-
|
|
856
|
+
h
|
|
848
857
|
),
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
858
|
+
t.getVaultProviderGenesisBtcPubKey(
|
|
859
|
+
a,
|
|
860
|
+
h
|
|
852
861
|
),
|
|
853
|
-
o.getLatestUniversalChallengersVersion(
|
|
854
|
-
|
|
862
|
+
o.getLatestUniversalChallengersVersion(h),
|
|
863
|
+
o.getCurrentUcKeyEpoch(h)
|
|
864
|
+
]);
|
|
865
|
+
if (!Ne(l, { strict: !1 }))
|
|
866
|
+
throw new L(
|
|
867
|
+
`The application entry point this deposit was prepared for is not a valid address: ${l}`
|
|
868
|
+
);
|
|
869
|
+
if (!He(d, l))
|
|
870
|
+
throw new L(
|
|
871
|
+
`Vault provider ${a} is registered to application ${d}, but this deposit was prepared for ${l}. 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.`
|
|
872
|
+
);
|
|
873
|
+
const [f, x] = await Promise.all(
|
|
874
|
+
[
|
|
875
|
+
r.getCurrentVaultKeepersVersion(
|
|
876
|
+
d,
|
|
877
|
+
h
|
|
878
|
+
),
|
|
879
|
+
r.getCurrentAppKeeperKeyEpoch(
|
|
880
|
+
d,
|
|
881
|
+
h
|
|
882
|
+
)
|
|
883
|
+
]
|
|
884
|
+
), [b, w] = await Promise.all([
|
|
855
885
|
r.getVaultKeepersByVersion(
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
886
|
+
d,
|
|
887
|
+
f,
|
|
888
|
+
h
|
|
859
889
|
),
|
|
860
890
|
o.getUniversalChallengersByVersion(
|
|
861
891
|
m,
|
|
862
|
-
|
|
892
|
+
h
|
|
863
893
|
)
|
|
864
|
-
]),
|
|
865
|
-
vaultProvider:
|
|
866
|
-
vaultKeepers:
|
|
867
|
-
universalChallengers:
|
|
868
|
-
},
|
|
894
|
+
]), E = {
|
|
895
|
+
vaultProvider: C(g),
|
|
896
|
+
vaultKeepers: re(b.map((k) => k.btcPubKey)),
|
|
897
|
+
universalChallengers: re(w.map((k) => k.btcPubKey))
|
|
898
|
+
}, T = await At({
|
|
869
899
|
operationKeyReader: u,
|
|
870
900
|
query: {
|
|
871
901
|
vaultProviderEthAddress: a,
|
|
872
|
-
vaultProviderGenesisBtcPubkey: `0x${
|
|
873
|
-
applicationEntryPoint:
|
|
874
|
-
vaultKeepers:
|
|
875
|
-
universalChallengers:
|
|
902
|
+
vaultProviderGenesisBtcPubkey: `0x${g}`,
|
|
903
|
+
applicationEntryPoint: d,
|
|
904
|
+
vaultKeepers: b,
|
|
905
|
+
universalChallengers: w
|
|
876
906
|
},
|
|
877
|
-
blockNumber:
|
|
878
|
-
}),
|
|
879
|
-
vaultProvider:
|
|
880
|
-
vaultKeepers: [...
|
|
907
|
+
blockNumber: h
|
|
908
|
+
}), v = {
|
|
909
|
+
vaultProvider: T.vaultProvider.operationBtcPubkey,
|
|
910
|
+
vaultKeepers: [...T.vaultKeeperOperationKeysSorted],
|
|
881
911
|
universalChallengers: [
|
|
882
|
-
...
|
|
912
|
+
...T.universalChallengerOperationKeysSorted
|
|
883
913
|
]
|
|
884
|
-
},
|
|
914
|
+
}, q = xt(
|
|
885
915
|
s,
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
),
|
|
916
|
+
E.vaultProvider,
|
|
917
|
+
v.vaultProvider
|
|
918
|
+
), G = ee(
|
|
889
919
|
i,
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
),
|
|
920
|
+
E.vaultKeepers,
|
|
921
|
+
v.vaultKeepers
|
|
922
|
+
), z = ee(
|
|
893
923
|
n,
|
|
894
|
-
|
|
895
|
-
|
|
924
|
+
E.universalChallengers,
|
|
925
|
+
v.universalChallengers
|
|
896
926
|
);
|
|
897
|
-
if (!D(
|
|
927
|
+
if (!D(q))
|
|
898
928
|
throw new Error(
|
|
899
929
|
`Vault provider BTC pubkey indexer hint does not match BTCVaultRegistry for ${a}. Refresh and try again.`
|
|
900
930
|
);
|
|
901
|
-
if (!D(
|
|
931
|
+
if (!D(G))
|
|
902
932
|
throw new Error(
|
|
903
|
-
`Vault keeper BTC pubkeys (v${
|
|
933
|
+
`Vault keeper BTC pubkeys (v${f}) indexer set does not match ApplicationRegistry on-chain set. Refresh and try again.`
|
|
904
934
|
);
|
|
905
|
-
if (!D(
|
|
935
|
+
if (!D(z))
|
|
906
936
|
throw new Error(
|
|
907
937
|
`Universal challenger BTC pubkeys (v${m}) indexer set does not match ProtocolParams on-chain set. Refresh and try again.`
|
|
908
938
|
);
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
const
|
|
912
|
-
throw c == null || c(
|
|
939
|
+
const j = [q, G, z], Ce = j.some((k) => k.registration && !k.operation), Q = j.some((k) => k.operation && !k.registration);
|
|
940
|
+
if (Ce && Q) {
|
|
941
|
+
const k = `Indexer participant hints are internally inconsistent for vault provider ${a}: some roles match the registration keys while others match the rotated operation keys.`;
|
|
942
|
+
throw c == null || c(k), new Error(`${k} Refresh and try again.`);
|
|
913
943
|
}
|
|
914
|
-
return
|
|
944
|
+
return Q && (p == null || p(
|
|
915
945
|
`Indexer is serving rotated operation keys for vault provider ${a}`
|
|
916
946
|
)), {
|
|
917
|
-
vaultProviderBtcPubkeyXOnly:
|
|
918
|
-
vaultKeeperBtcPubkeysSorted:
|
|
919
|
-
universalChallengerBtcPubkeysSorted:
|
|
920
|
-
expectedAppVaultKeepersVersion:
|
|
947
|
+
vaultProviderBtcPubkeyXOnly: v.vaultProvider,
|
|
948
|
+
vaultKeeperBtcPubkeysSorted: v.vaultKeepers,
|
|
949
|
+
universalChallengerBtcPubkeysSorted: v.universalChallengers,
|
|
950
|
+
expectedAppVaultKeepersVersion: f,
|
|
921
951
|
expectedUniversalChallengersVersion: m,
|
|
922
|
-
|
|
923
|
-
|
|
952
|
+
appKeeperKeyEpoch: x,
|
|
953
|
+
ucKeyEpoch: P,
|
|
954
|
+
registrationKeys: E,
|
|
955
|
+
participantKeys: T
|
|
924
956
|
};
|
|
925
957
|
}
|
|
926
|
-
function
|
|
958
|
+
function Rt(e) {
|
|
927
959
|
return /^[0-9a-fA-F]{64}$/.test(e);
|
|
928
960
|
}
|
|
929
|
-
function
|
|
961
|
+
function hr(e) {
|
|
930
962
|
const {
|
|
931
963
|
amountSats: t,
|
|
932
964
|
minDeposit: r,
|
|
@@ -937,7 +969,7 @@ function sr(e) {
|
|
|
937
969
|
} = e;
|
|
938
970
|
return !(t <= 0n || t < r || o && o > 0n && t > o || l == null || s == null || t + l + s > a);
|
|
939
971
|
}
|
|
940
|
-
function
|
|
972
|
+
function dr(e, t, r) {
|
|
941
973
|
return e <= 0n ? {
|
|
942
974
|
valid: !1,
|
|
943
975
|
error: "Deposit amount must be greater than zero"
|
|
@@ -949,7 +981,7 @@ function ar(e, t, r) {
|
|
|
949
981
|
error: `Maximum deposit is ${_(r)} BTC`
|
|
950
982
|
} : { valid: !0 };
|
|
951
983
|
}
|
|
952
|
-
function
|
|
984
|
+
function gr(e) {
|
|
953
985
|
const { amount: t, effectiveRemaining: r } = e;
|
|
954
986
|
return r === null ? { valid: !0 } : r === 0n ? {
|
|
955
987
|
valid: !1,
|
|
@@ -959,7 +991,7 @@ function ir(e) {
|
|
|
959
991
|
error: `Vault size exceeds remaining capacity (${_(r)} BTC)`
|
|
960
992
|
} : { valid: !0 };
|
|
961
993
|
}
|
|
962
|
-
function
|
|
994
|
+
function fr(e, t) {
|
|
963
995
|
if (!e || e.length === 0)
|
|
964
996
|
return {
|
|
965
997
|
valid: !1,
|
|
@@ -975,7 +1007,7 @@ function ur(e, t) {
|
|
|
975
1007
|
error: "Invalid vault provider selected"
|
|
976
1008
|
} : { valid: !0 };
|
|
977
1009
|
}
|
|
978
|
-
function
|
|
1010
|
+
function _t(e, t, r) {
|
|
979
1011
|
if (!e || e.length === 0)
|
|
980
1012
|
return {
|
|
981
1013
|
valid: !1,
|
|
@@ -1001,30 +1033,30 @@ function Et(e, t, r) {
|
|
|
1001
1033
|
}
|
|
1002
1034
|
return { valid: !0 };
|
|
1003
1035
|
}
|
|
1004
|
-
function
|
|
1005
|
-
const t =
|
|
1006
|
-
return
|
|
1036
|
+
function St(e) {
|
|
1037
|
+
const t = y(e);
|
|
1038
|
+
return Rt(t) ? { valid: !0 } : {
|
|
1007
1039
|
valid: !1,
|
|
1008
1040
|
error: "Invalid pubkey format: must be 64 hex characters (32-byte x-only public key, no 0x prefix)"
|
|
1009
1041
|
};
|
|
1010
1042
|
}
|
|
1011
|
-
function
|
|
1043
|
+
function $t(e) {
|
|
1012
1044
|
if (!e || e.length === 0)
|
|
1013
1045
|
throw new Error(
|
|
1014
1046
|
"No vault keepers available. The system requires at least one vault keeper to create a deposit."
|
|
1015
1047
|
);
|
|
1016
1048
|
}
|
|
1017
|
-
function
|
|
1049
|
+
function Bt(e) {
|
|
1018
1050
|
if (!e || e.length === 0)
|
|
1019
1051
|
throw new Error(
|
|
1020
1052
|
"No universal challengers available. The system requires at least one universal challenger to create a deposit."
|
|
1021
1053
|
);
|
|
1022
1054
|
}
|
|
1023
|
-
function
|
|
1055
|
+
function It(e) {
|
|
1024
1056
|
if (e.length === 0)
|
|
1025
1057
|
throw new Error("No spendable UTXOs available");
|
|
1026
1058
|
}
|
|
1027
|
-
function
|
|
1059
|
+
function mr(e) {
|
|
1028
1060
|
const {
|
|
1029
1061
|
vaultAmounts: t,
|
|
1030
1062
|
confirmedUTXOs: r,
|
|
@@ -1033,78 +1065,78 @@ function lr(e) {
|
|
|
1033
1065
|
universalChallengerBtcPubkeys: l,
|
|
1034
1066
|
minDeposit: s,
|
|
1035
1067
|
maxDeposit: i
|
|
1036
|
-
} = e, n =
|
|
1068
|
+
} = e, n = _t(
|
|
1037
1069
|
t,
|
|
1038
1070
|
s,
|
|
1039
1071
|
i
|
|
1040
1072
|
);
|
|
1041
1073
|
if (!n.valid)
|
|
1042
1074
|
throw new Error(n.error);
|
|
1043
|
-
const u =
|
|
1075
|
+
const u = St(o);
|
|
1044
1076
|
if (!u.valid)
|
|
1045
1077
|
throw new Error(u.error);
|
|
1046
|
-
|
|
1078
|
+
$t(a), Bt(l), It(r);
|
|
1047
1079
|
}
|
|
1048
|
-
class
|
|
1080
|
+
class Ee extends Error {
|
|
1049
1081
|
constructor(t) {
|
|
1050
1082
|
super(t), this.name = "ParticipantKeyDriftError";
|
|
1051
1083
|
}
|
|
1052
1084
|
}
|
|
1053
|
-
function
|
|
1054
|
-
return e instanceof
|
|
1085
|
+
function Pr(e) {
|
|
1086
|
+
return e instanceof Ee || e instanceof Error && e.name === "ParticipantKeyDriftError";
|
|
1055
1087
|
}
|
|
1056
|
-
function
|
|
1088
|
+
function oe(e, t, r) {
|
|
1057
1089
|
return t.length === r.length && t.every((o, a) => o === r[a]) ? null : `${e} expected [${t.join(", ")}], got [${r.join(", ")}]`;
|
|
1058
1090
|
}
|
|
1059
|
-
async function
|
|
1091
|
+
async function vr(e) {
|
|
1060
1092
|
const { vaultRegistryReader: t, operationKeyReader: r, vaultIds: o, expected: a } = e, l = a.query;
|
|
1061
1093
|
if (o.length === 0) return;
|
|
1062
1094
|
const s = await t.getVaultKeyEpochsBatch(o), i = [];
|
|
1063
1095
|
for (const [n, u] of s.entries()) {
|
|
1064
|
-
const
|
|
1096
|
+
const p = o[n];
|
|
1065
1097
|
let c;
|
|
1066
1098
|
try {
|
|
1067
|
-
c = await
|
|
1099
|
+
c = await Ct({
|
|
1068
1100
|
operationKeyReader: r,
|
|
1069
1101
|
query: l,
|
|
1070
1102
|
epochs: u
|
|
1071
1103
|
});
|
|
1072
1104
|
} catch (g) {
|
|
1073
1105
|
i.push(
|
|
1074
|
-
`vault ${
|
|
1106
|
+
`vault ${p}: could not resolve participants at frozen epochs (vp=${u.vpKeyEpoch}, keeper=${u.appKeeperKeyEpoch}, uc=${u.ucKeyEpoch}): ${g.message}`
|
|
1075
1107
|
);
|
|
1076
1108
|
continue;
|
|
1077
1109
|
}
|
|
1078
1110
|
c.vaultProvider.operationBtcPubkey !== a.vaultProvider.operationBtcPubkey && i.push(
|
|
1079
|
-
`vault ${
|
|
1111
|
+
`vault ${p}: vault provider key expected ${a.vaultProvider.operationBtcPubkey}, got ${c.vaultProvider.operationBtcPubkey}`
|
|
1080
1112
|
);
|
|
1081
|
-
const
|
|
1082
|
-
`vault ${
|
|
1113
|
+
const h = oe(
|
|
1114
|
+
`vault ${p}: vault keeper keys`,
|
|
1083
1115
|
a.vaultKeeperOperationKeysSorted,
|
|
1084
1116
|
c.vaultKeeperOperationKeysSorted
|
|
1085
1117
|
);
|
|
1086
|
-
|
|
1087
|
-
const
|
|
1088
|
-
`vault ${
|
|
1118
|
+
h && i.push(h);
|
|
1119
|
+
const d = oe(
|
|
1120
|
+
`vault ${p}: universal challenger keys`,
|
|
1089
1121
|
a.universalChallengerOperationKeysSorted,
|
|
1090
1122
|
c.universalChallengerOperationKeysSorted
|
|
1091
1123
|
);
|
|
1092
|
-
|
|
1124
|
+
d && i.push(d);
|
|
1093
1125
|
}
|
|
1094
1126
|
if (i.length > 0)
|
|
1095
|
-
throw new
|
|
1127
|
+
throw new Ee(
|
|
1096
1128
|
`Aborting BTC broadcast: participant operation keys changed during registration (${i.join("; ")}). The Pre-PegIn was not broadcast; the registered ETH vault will time out per protocol rules.`
|
|
1097
1129
|
);
|
|
1098
1130
|
}
|
|
1099
|
-
class
|
|
1131
|
+
class ke extends Error {
|
|
1100
1132
|
constructor(t) {
|
|
1101
1133
|
super(t), this.name = "RegisteredVaultVersionMismatchError";
|
|
1102
1134
|
}
|
|
1103
1135
|
}
|
|
1104
|
-
function
|
|
1105
|
-
return e instanceof
|
|
1136
|
+
function yr(e) {
|
|
1137
|
+
return e instanceof ke || e instanceof Error && e.name === "RegisteredVaultVersionMismatchError";
|
|
1106
1138
|
}
|
|
1107
|
-
async function
|
|
1139
|
+
async function br(e) {
|
|
1108
1140
|
const {
|
|
1109
1141
|
vaultRegistryReader: t,
|
|
1110
1142
|
vaultIds: r,
|
|
@@ -1113,8 +1145,8 @@ async function pr(e) {
|
|
|
1113
1145
|
expectedUniversalChallengersVersion: l,
|
|
1114
1146
|
expectedVaultCoreVersion: s
|
|
1115
1147
|
} = e, i = await t.getProtocolInfoBatch(r), n = [];
|
|
1116
|
-
if (i.forEach((u,
|
|
1117
|
-
const c = r[
|
|
1148
|
+
if (i.forEach((u, p) => {
|
|
1149
|
+
const c = r[p];
|
|
1118
1150
|
u.offchainParamsVersion !== o && n.push(
|
|
1119
1151
|
`vault ${c}: offchainParams expected v${o}, got v${u.offchainParamsVersion}`
|
|
1120
1152
|
), u.appVaultKeepersVersion !== a && n.push(
|
|
@@ -1125,25 +1157,25 @@ async function pr(e) {
|
|
|
1125
1157
|
`vault ${c}: vaultCoreVersion expected v${s} (build-time active), got v${u.vaultCoreVersion}`
|
|
1126
1158
|
);
|
|
1127
1159
|
}), n.length > 0)
|
|
1128
|
-
throw new
|
|
1160
|
+
throw new ke(
|
|
1129
1161
|
`Aborting BTC broadcast: signer-set or offchain-params versions changed during registration (${n.join("; ")}). The Pre-PegIn was not broadcast; the registered ETH vault will time out per protocol rules.`
|
|
1130
1162
|
);
|
|
1131
1163
|
}
|
|
1132
|
-
var
|
|
1133
|
-
const
|
|
1164
|
+
var xe = /* @__PURE__ */ ((e) => (e.CLAIM_EVENT_RECEIVED = "ClaimEventReceived", e.CLAIM_BROADCAST = "ClaimBroadcast", e.ASSERT_BROADCAST = "AssertBroadcast", e.PAYOUT_BROADCAST = "PayoutBroadcast", e.PAYOUT_BLOCKED = "PayoutBlocked", e))(xe || {});
|
|
1165
|
+
const Vt = /* @__PURE__ */ new Set([
|
|
1134
1166
|
"PayoutBroadcast",
|
|
1135
1167
|
"PayoutBlocked"
|
|
1136
1168
|
/* PAYOUT_BLOCKED */
|
|
1137
1169
|
]);
|
|
1138
|
-
function
|
|
1139
|
-
return Object.values(
|
|
1170
|
+
function wr(e) {
|
|
1171
|
+
return Object.values(xe).includes(
|
|
1140
1172
|
e
|
|
1141
1173
|
);
|
|
1142
1174
|
}
|
|
1143
|
-
function
|
|
1144
|
-
return !!e &&
|
|
1175
|
+
function Er(e) {
|
|
1176
|
+
return !!e && Vt.has(e);
|
|
1145
1177
|
}
|
|
1146
|
-
class
|
|
1178
|
+
class Kt extends Error {
|
|
1147
1179
|
constructor(r, o) {
|
|
1148
1180
|
super(`Refund not yet mature (BIP68 not final): ${o.message}`);
|
|
1149
1181
|
S(this, "vaultId");
|
|
@@ -1151,31 +1183,31 @@ class _t extends Error {
|
|
|
1151
1183
|
this.name = "BIP68NotMatureError", this.vaultId = r, this.cause = o;
|
|
1152
1184
|
}
|
|
1153
1185
|
}
|
|
1154
|
-
const
|
|
1155
|
-
function
|
|
1186
|
+
const Ot = /^0x[0-9a-fA-F]{64}$/, Nt = /^(?:0x)?(?:[0-9a-fA-F]{2})+$/, Te = /^(?:0x)?(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{66})$/, Ae = 160, ne = 2e3, se = 10n, ae = 100n;
|
|
1187
|
+
function kr(e) {
|
|
1156
1188
|
if (!Number.isFinite(e) || e <= 0)
|
|
1157
1189
|
throw new Error(
|
|
1158
1190
|
`feeRateSatsVb must be a positive finite number, got ${e}`
|
|
1159
1191
|
);
|
|
1160
|
-
return BigInt(Math.ceil(e *
|
|
1192
|
+
return BigInt(Math.ceil(e * Ae));
|
|
1161
1193
|
}
|
|
1162
|
-
const
|
|
1163
|
-
function
|
|
1194
|
+
const Ht = 1, Dt = /non-BIP68-final/i;
|
|
1195
|
+
function X(e, t) {
|
|
1164
1196
|
if (e.length !== 66)
|
|
1165
1197
|
throw new Error(
|
|
1166
1198
|
`${t} must be 32 bytes (66 hex chars with 0x prefix), got length ${e.length}`
|
|
1167
1199
|
);
|
|
1168
|
-
if (!
|
|
1200
|
+
if (!Ot.test(e))
|
|
1169
1201
|
throw new Error(
|
|
1170
1202
|
`${t} must contain only hex characters after the 0x prefix`
|
|
1171
1203
|
);
|
|
1172
1204
|
}
|
|
1173
|
-
function
|
|
1205
|
+
function U(e, t) {
|
|
1174
1206
|
if (!Number.isInteger(e) || e < 0)
|
|
1175
1207
|
throw new Error(`${t} must be a non-negative integer, got ${e}`);
|
|
1176
1208
|
}
|
|
1177
|
-
function
|
|
1178
|
-
if (
|
|
1209
|
+
function Mt(e) {
|
|
1210
|
+
if (X(e.hashlock, "hashlock"), !Number.isInteger(e.htlcVout) || e.htlcVout < 0)
|
|
1179
1211
|
throw new Error(
|
|
1180
1212
|
`htlcVout must be a non-negative integer, got ${e.htlcVout}`
|
|
1181
1213
|
);
|
|
@@ -1187,7 +1219,7 @@ function Vt(e) {
|
|
|
1187
1219
|
);
|
|
1188
1220
|
for (let r = 0; r < e.batch.length; r++) {
|
|
1189
1221
|
const o = e.batch[r];
|
|
1190
|
-
if (
|
|
1222
|
+
if (X(o.hashlock, `batch[${r}].hashlock`), !Number.isInteger(o.htlcVout) || o.htlcVout !== r)
|
|
1191
1223
|
throw new Error(
|
|
1192
1224
|
`batch[${r}].htlcVout must equal ${r} (contiguous vout-ordered vector), got ${o.htlcVout}`
|
|
1193
1225
|
);
|
|
@@ -1205,27 +1237,27 @@ function Vt(e) {
|
|
|
1205
1237
|
throw new Error(
|
|
1206
1238
|
`batch[${e.htlcVout}].amount (${t.amount}) does not match target amount (${e.amount})`
|
|
1207
1239
|
);
|
|
1208
|
-
if (
|
|
1240
|
+
if (U(e.offchainParamsVersion, "offchainParamsVersion"), U(e.appVaultKeepersVersion, "appVaultKeepersVersion"), U(
|
|
1209
1241
|
e.universalChallengersVersion,
|
|
1210
1242
|
"universalChallengersVersion"
|
|
1211
|
-
),
|
|
1243
|
+
), We(
|
|
1212
1244
|
e.vaultCoreVersion,
|
|
1213
1245
|
"VaultRefundData.vaultCoreVersion"
|
|
1214
1246
|
), typeof e.unsignedPrePeginTxHex != "string" || e.unsignedPrePeginTxHex.length === 0)
|
|
1215
1247
|
throw new Error("unsignedPrePeginTxHex must be a non-empty hex string");
|
|
1216
|
-
if (
|
|
1248
|
+
if (!Nt.test(e.unsignedPrePeginTxHex))
|
|
1217
1249
|
throw new Error(
|
|
1218
1250
|
"unsignedPrePeginTxHex must be a hex byte string (optional 0x prefix, even length)"
|
|
1219
1251
|
);
|
|
1220
|
-
if (!e.depositorBtcPubkey || !
|
|
1252
|
+
if (!e.depositorBtcPubkey || !Te.test(e.depositorBtcPubkey))
|
|
1221
1253
|
throw new Error(
|
|
1222
1254
|
"depositorBtcPubkey must be 32 or 33 bytes of hex (optional 0x prefix)"
|
|
1223
1255
|
);
|
|
1224
1256
|
if (typeof e.amount != "bigint" || e.amount <= 0n)
|
|
1225
1257
|
throw new Error(`amount must be a positive bigint, got ${e.amount}`);
|
|
1226
1258
|
}
|
|
1227
|
-
function
|
|
1228
|
-
if (!e.vaultProviderPubkey || !
|
|
1259
|
+
function Ft(e) {
|
|
1260
|
+
if (!e.vaultProviderPubkey || !Te.test(e.vaultProviderPubkey))
|
|
1229
1261
|
throw new Error("vaultProviderPubkey must be 32 or 33 bytes of hex");
|
|
1230
1262
|
if (e.vaultKeeperPubkeys.length === 0)
|
|
1231
1263
|
throw new Error("vaultKeeperPubkeys must be non-empty");
|
|
@@ -1250,7 +1282,7 @@ function Kt(e) {
|
|
|
1250
1282
|
`councilQuorum (${e.councilQuorum}) must be in [1, councilSize=${e.councilSize}]`
|
|
1251
1283
|
);
|
|
1252
1284
|
}
|
|
1253
|
-
async function
|
|
1285
|
+
async function xr(e) {
|
|
1254
1286
|
const {
|
|
1255
1287
|
vaultId: t,
|
|
1256
1288
|
readVault: r,
|
|
@@ -1260,50 +1292,50 @@ async function vr(e) {
|
|
|
1260
1292
|
broadcastTx: s,
|
|
1261
1293
|
signal: i
|
|
1262
1294
|
} = e;
|
|
1263
|
-
i == null || i.throwIfAborted(),
|
|
1295
|
+
i == null || i.throwIfAborted(), X(t, "vaultId");
|
|
1264
1296
|
const n = await r();
|
|
1265
|
-
|
|
1297
|
+
Mt(n), i == null || i.throwIfAborted();
|
|
1266
1298
|
const u = await o(n);
|
|
1267
|
-
if (
|
|
1299
|
+
if (Ft(u), i == null || i.throwIfAborted(), !Number.isFinite(a) || a <= 0)
|
|
1268
1300
|
throw new Error(`feeRate must be a positive number, got ${a}`);
|
|
1269
|
-
if (a >
|
|
1301
|
+
if (a > ne)
|
|
1270
1302
|
throw new Error(
|
|
1271
|
-
`feeRate ${a} sat/vB exceeds refund safety cap ${
|
|
1303
|
+
`feeRate ${a} sat/vB exceeds refund safety cap ${ne} sat/vB; refusing to sign refund.`
|
|
1272
1304
|
);
|
|
1273
|
-
const
|
|
1274
|
-
if (
|
|
1305
|
+
const p = BigInt(Math.ceil(a * Ae)), c = n.amount * se / ae;
|
|
1306
|
+
if (p > c)
|
|
1275
1307
|
throw new Error(
|
|
1276
|
-
`Refund fee ${
|
|
1308
|
+
`Refund fee ${p} sats exceeds the per-vault safety cap of ${c} sats (${se}/${ae} of vault.amount=${n.amount}); refusing to sign refund.`
|
|
1277
1309
|
);
|
|
1278
1310
|
i == null || i.throwIfAborted();
|
|
1279
|
-
const
|
|
1311
|
+
const h = O(
|
|
1280
1312
|
n.depositorBtcPubkey
|
|
1281
|
-
),
|
|
1313
|
+
), d = y(n.unsignedPrePeginTxHex), g = Ke(d);
|
|
1282
1314
|
if (g !== void 0 && g.vout !== n.batch.length)
|
|
1283
1315
|
throw new Error(
|
|
1284
1316
|
`Auth-anchor OP_RETURN at vout ${g.vout} does not match batch size (${n.batch.length} HTLC outputs expect the anchor at vout ${n.batch.length}). Refund refused — sibling HTLC vector is incomplete.`
|
|
1285
1317
|
);
|
|
1286
1318
|
const m = g == null ? void 0 : g.hash;
|
|
1287
|
-
let
|
|
1319
|
+
let P;
|
|
1288
1320
|
try {
|
|
1289
|
-
|
|
1290
|
-
} catch (
|
|
1321
|
+
P = $.fromHex(d);
|
|
1322
|
+
} catch (v) {
|
|
1291
1323
|
throw new Error(
|
|
1292
|
-
`Failed to parse funded Pre-PegIn transaction hex: ${
|
|
1324
|
+
`Failed to parse funded Pre-PegIn transaction hex: ${v instanceof Error ? v.message : String(v)}`
|
|
1293
1325
|
);
|
|
1294
1326
|
}
|
|
1295
|
-
if (
|
|
1327
|
+
if (P.outs.length < n.batch.length)
|
|
1296
1328
|
throw new Error(
|
|
1297
|
-
`Funded Pre-PegIn tx has ${
|
|
1329
|
+
`Funded Pre-PegIn tx has ${P.outs.length} outputs but batch requires at least ${n.batch.length} HTLC outputs. Refund refused — funded tx shape disagrees with sibling vector.`
|
|
1298
1330
|
);
|
|
1299
|
-
const { psbtHex:
|
|
1331
|
+
const { psbtHex: f } = await Ge({
|
|
1300
1332
|
prePeginParams: {
|
|
1301
1333
|
vaultCoreVersion: n.vaultCoreVersion,
|
|
1302
|
-
depositorPubkey:
|
|
1303
|
-
vaultProviderPubkey:
|
|
1304
|
-
vaultKeeperPubkeys: u.vaultKeeperPubkeys.map(
|
|
1305
|
-
universalChallengerPubkeys: u.universalChallengerPubkeys.map(
|
|
1306
|
-
hashlocks: n.batch.map((
|
|
1334
|
+
depositorPubkey: h,
|
|
1335
|
+
vaultProviderPubkey: y(u.vaultProviderPubkey),
|
|
1336
|
+
vaultKeeperPubkeys: u.vaultKeeperPubkeys.map(y),
|
|
1337
|
+
universalChallengerPubkeys: u.universalChallengerPubkeys.map(y),
|
|
1338
|
+
hashlocks: n.batch.map((v) => y(v.hashlock)),
|
|
1307
1339
|
timelockRefund: u.timelockRefund,
|
|
1308
1340
|
// `batch[i].amount` is the on-chain vault deposit (peg-in) amount, which
|
|
1309
1341
|
// is exactly what WASM's `pegInAmounts` expects — it re-adds the protocol
|
|
@@ -1311,7 +1343,7 @@ async function vr(e) {
|
|
|
1311
1343
|
// HTLC output. `buildRefundPsbt`'s value cross-check then binds the result
|
|
1312
1344
|
// to the funded tx bytes, refusing the refund if the template's HTLC value
|
|
1313
1345
|
// disagrees with the on-chain commitment.
|
|
1314
|
-
pegInAmounts: n.batch.map((
|
|
1346
|
+
pegInAmounts: n.batch.map((v) => v.amount),
|
|
1315
1347
|
feeRate: u.feeRate,
|
|
1316
1348
|
minPeginFeeRate: u.minPeginFeeRate,
|
|
1317
1349
|
numLocalChallengers: u.numLocalChallengers,
|
|
@@ -1320,48 +1352,48 @@ async function vr(e) {
|
|
|
1320
1352
|
network: u.network,
|
|
1321
1353
|
authAnchorHash: m
|
|
1322
1354
|
},
|
|
1323
|
-
fundedPrePeginTxHex:
|
|
1355
|
+
fundedPrePeginTxHex: d,
|
|
1324
1356
|
htlcVout: n.htlcVout,
|
|
1325
|
-
refundFee:
|
|
1357
|
+
refundFee: p,
|
|
1326
1358
|
// buildRefundPsbt's top-level `hashlock` param is documented as "no 0x
|
|
1327
1359
|
// prefix" and flows into the WASM HTLC connector derivation; a prefixed
|
|
1328
1360
|
// value would derive the wrong refund script leaf and yield an
|
|
1329
1361
|
// unspendable PSBT. Match the `hashlocks` array handling above.
|
|
1330
|
-
hashlock:
|
|
1362
|
+
hashlock: y(n.hashlock)
|
|
1331
1363
|
});
|
|
1332
1364
|
i == null || i.throwIfAborted();
|
|
1333
|
-
const
|
|
1365
|
+
const x = K(
|
|
1334
1366
|
n.depositorBtcPubkey,
|
|
1335
|
-
|
|
1336
|
-
),
|
|
1367
|
+
Ht
|
|
1368
|
+
), b = await l(f, x);
|
|
1337
1369
|
B({
|
|
1338
|
-
requestedPsbtHex:
|
|
1339
|
-
returnedPsbtHex:
|
|
1370
|
+
requestedPsbtHex: f,
|
|
1371
|
+
returnedPsbtHex: b
|
|
1340
1372
|
});
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1373
|
+
const w = 0, E = I(
|
|
1374
|
+
b,
|
|
1375
|
+
h,
|
|
1376
|
+
w
|
|
1345
1377
|
);
|
|
1346
1378
|
V({
|
|
1347
|
-
requestedPsbtHex:
|
|
1348
|
-
signatureHex:
|
|
1349
|
-
signerXOnlyPubkeyHex:
|
|
1350
|
-
inputIndex:
|
|
1379
|
+
requestedPsbtHex: f,
|
|
1380
|
+
signatureHex: E,
|
|
1381
|
+
signerXOnlyPubkeyHex: h,
|
|
1382
|
+
inputIndex: w
|
|
1351
1383
|
});
|
|
1352
|
-
const
|
|
1353
|
-
requestedPsbtHex:
|
|
1354
|
-
signaturesHex: [
|
|
1355
|
-
signerXOnlyPubkeyHex:
|
|
1384
|
+
const T = fe({
|
|
1385
|
+
requestedPsbtHex: f,
|
|
1386
|
+
signaturesHex: [E],
|
|
1387
|
+
signerXOnlyPubkeyHex: h
|
|
1356
1388
|
});
|
|
1357
1389
|
i == null || i.throwIfAborted();
|
|
1358
1390
|
try {
|
|
1359
|
-
return await s(
|
|
1360
|
-
} catch (
|
|
1361
|
-
throw
|
|
1391
|
+
return await s(T);
|
|
1392
|
+
} catch (v) {
|
|
1393
|
+
throw v instanceof Error && Dt.test(v.message) ? new Kt(t, v) : v;
|
|
1362
1394
|
}
|
|
1363
1395
|
}
|
|
1364
|
-
class
|
|
1396
|
+
class ie extends Error {
|
|
1365
1397
|
constructor(r, o, a) {
|
|
1366
1398
|
super(r);
|
|
1367
1399
|
/** Fee the reclaim would have paid, in satoshis. */
|
|
@@ -1371,13 +1403,13 @@ class oe extends Error {
|
|
|
1371
1403
|
this.name = "ReclaimUneconomicalError", this.feeSats = o, this.sweptTotalSats = a;
|
|
1372
1404
|
}
|
|
1373
1405
|
}
|
|
1374
|
-
const
|
|
1375
|
-
async function
|
|
1406
|
+
const ue = 2e3, le = 25n, ce = 100n, Tr = 10n;
|
|
1407
|
+
async function Ut(e, t, r) {
|
|
1376
1408
|
for (let o = 0; o < e.length; o++) {
|
|
1377
|
-
const a =
|
|
1378
|
-
await
|
|
1379
|
-
|
|
1380
|
-
|
|
1409
|
+
const a = Qe(e[o].depositorSignedPeginTxHex), l = he(
|
|
1410
|
+
await Ye(
|
|
1411
|
+
y(a),
|
|
1412
|
+
y(r)
|
|
1381
1413
|
)
|
|
1382
1414
|
).toLowerCase();
|
|
1383
1415
|
if (l !== t[o].toLowerCase())
|
|
@@ -1386,7 +1418,7 @@ async function Ot(e, t, r) {
|
|
|
1386
1418
|
);
|
|
1387
1419
|
}
|
|
1388
1420
|
}
|
|
1389
|
-
async function
|
|
1421
|
+
async function Ar(e) {
|
|
1390
1422
|
const {
|
|
1391
1423
|
vaultIds: t,
|
|
1392
1424
|
depositorEthAddress: r,
|
|
@@ -1401,9 +1433,9 @@ async function br(e) {
|
|
|
1401
1433
|
throw new Error("Reclaim requires at least one vault id; got none.");
|
|
1402
1434
|
if (!Number.isFinite(l) || l <= 0)
|
|
1403
1435
|
throw new Error(`feeRate must be a positive number, got ${l}`);
|
|
1404
|
-
if (l >
|
|
1405
|
-
throw new
|
|
1406
|
-
`Fee rate ${l} sat/vB exceeds the reclaim safety cap of ${
|
|
1436
|
+
if (l > ue)
|
|
1437
|
+
throw new ie(
|
|
1438
|
+
`Fee rate ${l} sat/vB exceeds the reclaim safety cap of ${ue} sat/vB; refusing to sign.`,
|
|
1407
1439
|
0n,
|
|
1408
1440
|
0n
|
|
1409
1441
|
);
|
|
@@ -1412,100 +1444,102 @@ async function br(e) {
|
|
|
1412
1444
|
throw new Error(
|
|
1413
1445
|
`readVaults returned ${u.length} reserves for ${t.length} vault id(s); refusing to sweep a set that does not match the request.`
|
|
1414
1446
|
);
|
|
1415
|
-
await
|
|
1416
|
-
const
|
|
1417
|
-
depositorSignedPeginTxHex:
|
|
1418
|
-
observed:
|
|
1419
|
-
expectedValue:
|
|
1420
|
-
})),
|
|
1421
|
-
if (
|
|
1422
|
-
throw new
|
|
1423
|
-
`Reclaim fee ${
|
|
1424
|
-
|
|
1425
|
-
|
|
1447
|
+
await Ut(u, t, r), n == null || n.throwIfAborted();
|
|
1448
|
+
const p = O(o), c = u.map((w) => ({
|
|
1449
|
+
depositorSignedPeginTxHex: w.depositorSignedPeginTxHex,
|
|
1450
|
+
observed: w.observed,
|
|
1451
|
+
expectedValue: w.expectedClaimValue
|
|
1452
|
+
})), h = ze(l, c.length), d = c.reduce((w, E) => w + E.expectedValue, 0n), g = d * le / ce;
|
|
1453
|
+
if (h > g)
|
|
1454
|
+
throw new ie(
|
|
1455
|
+
`Reclaim fee ${h} sats exceeds ${le}/${ce} of the swept total (${d} sats, cap ${g} sats). The reserve is not at risk — it stays where it is until fee rates fall.`,
|
|
1456
|
+
h,
|
|
1457
|
+
d
|
|
1426
1458
|
);
|
|
1427
1459
|
n == null || n.throwIfAborted();
|
|
1428
|
-
const { psbtHex: m } =
|
|
1429
|
-
depositorPubkey:
|
|
1460
|
+
const { psbtHex: m } = je({
|
|
1461
|
+
depositorPubkey: p,
|
|
1430
1462
|
inputs: c,
|
|
1431
|
-
feeSats:
|
|
1463
|
+
feeSats: h
|
|
1432
1464
|
});
|
|
1433
1465
|
n == null || n.throwIfAborted();
|
|
1434
|
-
const
|
|
1466
|
+
const P = K(
|
|
1435
1467
|
o,
|
|
1436
1468
|
c.length
|
|
1437
|
-
),
|
|
1469
|
+
), f = await s(m, P);
|
|
1438
1470
|
B({
|
|
1439
1471
|
requestedPsbtHex: m,
|
|
1440
|
-
returnedPsbtHex:
|
|
1472
|
+
returnedPsbtHex: f
|
|
1441
1473
|
});
|
|
1442
|
-
const
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1474
|
+
const x = c.map((w, E) => {
|
|
1475
|
+
const T = I(
|
|
1476
|
+
f,
|
|
1477
|
+
p,
|
|
1478
|
+
E
|
|
1447
1479
|
);
|
|
1448
1480
|
return V({
|
|
1449
1481
|
requestedPsbtHex: m,
|
|
1450
|
-
signatureHex:
|
|
1451
|
-
signerXOnlyPubkeyHex:
|
|
1452
|
-
inputIndex:
|
|
1453
|
-
}),
|
|
1454
|
-
}),
|
|
1482
|
+
signatureHex: T,
|
|
1483
|
+
signerXOnlyPubkeyHex: p,
|
|
1484
|
+
inputIndex: E
|
|
1485
|
+
}), T;
|
|
1486
|
+
}), b = fe({
|
|
1455
1487
|
requestedPsbtHex: m,
|
|
1456
|
-
signaturesHex:
|
|
1457
|
-
signerXOnlyPubkeyHex:
|
|
1488
|
+
signaturesHex: x,
|
|
1489
|
+
signerXOnlyPubkeyHex: p
|
|
1458
1490
|
});
|
|
1459
|
-
return n == null || n.throwIfAborted(), i(
|
|
1491
|
+
return n == null || n.throwIfAborted(), i(b);
|
|
1460
1492
|
}
|
|
1461
1493
|
export {
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
sr as
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1494
|
+
L as A,
|
|
1495
|
+
D as B,
|
|
1496
|
+
xt as C,
|
|
1497
|
+
ee as D,
|
|
1498
|
+
At as E,
|
|
1499
|
+
Ct as F,
|
|
1500
|
+
xe as G,
|
|
1501
|
+
wr as H,
|
|
1502
|
+
Er as I,
|
|
1503
|
+
Kt as J,
|
|
1504
|
+
xr as K,
|
|
1505
|
+
kr as L,
|
|
1506
|
+
ae as M,
|
|
1507
|
+
se as N,
|
|
1508
|
+
ne as O,
|
|
1509
|
+
ot as P,
|
|
1510
|
+
Ae as Q,
|
|
1511
|
+
ke as R,
|
|
1512
|
+
ie as S,
|
|
1513
|
+
Ar as T,
|
|
1514
|
+
ce as U,
|
|
1515
|
+
le as V,
|
|
1516
|
+
ue as W,
|
|
1517
|
+
Tr as X,
|
|
1518
|
+
or as a,
|
|
1519
|
+
nr as b,
|
|
1520
|
+
Pe as c,
|
|
1521
|
+
ve as d,
|
|
1522
|
+
sr as e,
|
|
1523
|
+
ur as f,
|
|
1524
|
+
cr as g,
|
|
1525
|
+
hr as h,
|
|
1526
|
+
it as i,
|
|
1527
|
+
dr as j,
|
|
1528
|
+
mr as k,
|
|
1529
|
+
fr as l,
|
|
1530
|
+
gr as m,
|
|
1531
|
+
_t as n,
|
|
1532
|
+
St as o,
|
|
1533
|
+
Ee as p,
|
|
1534
|
+
Pr as q,
|
|
1535
|
+
ir as r,
|
|
1536
|
+
gt as s,
|
|
1537
|
+
vr as t,
|
|
1538
|
+
yr as u,
|
|
1539
|
+
pr as v,
|
|
1540
|
+
ar as w,
|
|
1541
|
+
br as x,
|
|
1542
|
+
ye as y,
|
|
1543
|
+
lr as z
|
|
1510
1544
|
};
|
|
1511
|
-
//# sourceMappingURL=buildAndBroadcastReclaim-
|
|
1545
|
+
//# sourceMappingURL=buildAndBroadcastReclaim-O6z9kvc4.js.map
|