@babylonlabs-io/ts-sdk 0.51.1 → 0.53.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/ApplicationRegistry.abi-CLaa6E99.cjs +2 -0
- package/dist/ApplicationRegistry.abi-CLaa6E99.cjs.map +1 -0
- package/dist/{ApplicationRegistry.abi-Dn2qk6JG.js → ApplicationRegistry.abi-w5prf7Ig.js} +14 -1
- package/dist/ApplicationRegistry.abi-w5prf7Ig.js.map +1 -0
- package/dist/PayoutManager-1GWmbvI9.cjs +2 -0
- package/dist/PayoutManager-1GWmbvI9.cjs.map +1 -0
- package/dist/{PayoutManager-D26nGR-e.js → PayoutManager-Ddo9_Ozc.js} +34 -32
- package/dist/PayoutManager-Ddo9_Ozc.js.map +1 -0
- package/dist/{PeginManager-COxRVrxa.js → PeginManager-CTU0wgkJ.js} +37 -34
- package/dist/PeginManager-CTU0wgkJ.js.map +1 -0
- package/dist/PeginManager-De-eHl3v.cjs +2 -0
- package/dist/PeginManager-De-eHl3v.cjs.map +1 -0
- package/dist/buildAndBroadcastRefund-BnD2qUDW.cjs +2 -0
- package/dist/buildAndBroadcastRefund-BnD2qUDW.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-Bmz9WJuN.js → buildAndBroadcastRefund-DjS9nf87.js} +221 -209
- package/dist/buildAndBroadcastRefund-DjS9nf87.js.map +1 -0
- package/dist/{challengeAssert-HNbugpqL.cjs → challengeAssert-DLQfNcfU.cjs} +2 -2
- package/dist/{challengeAssert-HNbugpqL.cjs.map → challengeAssert-DLQfNcfU.cjs.map} +1 -1
- package/dist/{challengeAssert-csvYXBJB.js → challengeAssert-DvdbpEDY.js} +2 -2
- package/dist/{challengeAssert-csvYXBJB.js.map → challengeAssert-DvdbpEDY.js.map} +1 -1
- package/dist/constants-BhclpREj.js +19 -0
- package/dist/constants-BhclpREj.js.map +1 -0
- package/dist/constants-CvbARMl-.cjs +2 -0
- package/dist/constants-CvbARMl-.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +193 -190
- package/dist/index.js.map +1 -1
- package/dist/{mempoolApi-Dc1KSVNI.js → mempoolApi-CB7bHuwi.js} +106 -101
- package/dist/mempoolApi-CB7bHuwi.js.map +1 -0
- package/dist/mempoolApi-DqJByvqR.cjs +2 -0
- package/dist/mempoolApi-DqJByvqR.cjs.map +1 -0
- package/dist/noPayout-8dDKwi6n.cjs +2 -0
- package/dist/noPayout-8dDKwi6n.cjs.map +1 -0
- package/dist/{noPayout-C1WCsqfd.js → noPayout-tZFoNun3.js} +12 -10
- package/dist/noPayout-tZFoNun3.js.map +1 -0
- package/dist/{peginInput-BPRB9tUi.js → peginInput-BKD_b3gq.js} +8 -7
- package/dist/peginInput-BKD_b3gq.js.map +1 -0
- package/dist/peginInput-CAiiDZeO.cjs +2 -0
- package/dist/peginInput-CAiiDZeO.cjs.map +1 -0
- package/dist/primeVpAuth-CF4cH5_e.cjs +2 -0
- package/dist/primeVpAuth-CF4cH5_e.cjs.map +1 -0
- package/dist/{primeVpAuth-DxMuWQCi.js → primeVpAuth-l-5x_2UV.js} +91 -85
- package/dist/{primeVpAuth-yTddDmGy.cjs.map → primeVpAuth-l-5x_2UV.js.map} +1 -1
- package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/protocol-params-validation.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +8 -0
- package/dist/tbv/core/clients/eth/types.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/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/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +191 -188
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/PayoutManager.d.ts +6 -0
- package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/PeginManager.d.ts +7 -0
- 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.js +2 -2
- package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts +8 -0
- package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.d.ts +2 -1
- package/dist/tbv/core/primitives/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.js +39 -36
- package/dist/tbv/core/primitives/index.js.map +1 -1
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/payout.d.ts +6 -0
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +7 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts +6 -0
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
- package/dist/tbv/core/primitives/scripts/payout.d.ts +6 -0
- package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/vaultCoreVersion.d.ts +26 -0
- package/dist/tbv/core/primitives/vaultCoreVersion.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +7 -0
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts +6 -0
- package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/verifyRegisteredVaultVersions.d.ts +8 -0
- package/dist/tbv/core/services/deposit/verifyRegisteredVaultVersions.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +6 -0
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts +5 -2
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +191 -188
- package/dist/tbv/index.js.map +1 -1
- package/dist/{verifyScriptPathSchnorrSignature-CeZp6tMw.js → verifyScriptPathSchnorrSignature-DpWZx5J0.js} +67 -61
- package/dist/verifyScriptPathSchnorrSignature-DpWZx5J0.js.map +1 -0
- package/dist/verifyScriptPathSchnorrSignature-a4Us7D3e.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-a4Us7D3e.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/ApplicationRegistry.abi-BAPhJch3.cjs +0 -2
- package/dist/ApplicationRegistry.abi-BAPhJch3.cjs.map +0 -1
- package/dist/ApplicationRegistry.abi-Dn2qk6JG.js.map +0 -1
- package/dist/PayoutManager-BZVEyi10.cjs +0 -2
- package/dist/PayoutManager-BZVEyi10.cjs.map +0 -1
- package/dist/PayoutManager-D26nGR-e.js.map +0 -1
- package/dist/PeginManager-BvxfSwsr.cjs +0 -2
- package/dist/PeginManager-BvxfSwsr.cjs.map +0 -1
- package/dist/PeginManager-COxRVrxa.js.map +0 -1
- package/dist/buildAndBroadcastRefund-Bmz9WJuN.js.map +0 -1
- package/dist/buildAndBroadcastRefund-ob1n2iB3.cjs +0 -2
- package/dist/buildAndBroadcastRefund-ob1n2iB3.cjs.map +0 -1
- package/dist/constants-CSG2XeD8.cjs +0 -2
- package/dist/constants-CSG2XeD8.cjs.map +0 -1
- package/dist/constants-Cd_fN8VT.js +0 -12
- package/dist/constants-Cd_fN8VT.js.map +0 -1
- package/dist/mempoolApi-Dc1KSVNI.js.map +0 -1
- package/dist/mempoolApi-NMiYQAXI.cjs +0 -2
- package/dist/mempoolApi-NMiYQAXI.cjs.map +0 -1
- package/dist/noPayout-C1WCsqfd.js.map +0 -1
- package/dist/noPayout-lyIRiUyG.cjs +0 -2
- package/dist/noPayout-lyIRiUyG.cjs.map +0 -1
- package/dist/peginInput-BPRB9tUi.js.map +0 -1
- package/dist/peginInput-DH6X4ITS.cjs +0 -2
- package/dist/peginInput-DH6X4ITS.cjs.map +0 -1
- package/dist/primeVpAuth-DxMuWQCi.js.map +0 -1
- package/dist/primeVpAuth-yTddDmGy.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-CeZp6tMw.js.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Se = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var f = (r, e, t) =>
|
|
2
|
+
var Ce = (r, e, t) => e in r ? Se(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var f = (r, e, t) => Ce(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { B as Q } from "./BTCVaultRegistry.abi-Chs4AFBj.js";
|
|
5
|
-
import { P as
|
|
6
|
-
import { k as
|
|
7
|
-
import { D as
|
|
8
|
-
import { X as R, C as G, s as
|
|
9
|
-
import { C as ee } from "./constants-
|
|
5
|
+
import { P as b, A as L } from "./ApplicationRegistry.abi-w5prf7Ig.js";
|
|
6
|
+
import { k as Te, v as U, l as $e, j as Ve } from "./mempoolApi-CB7bHuwi.js";
|
|
7
|
+
import { D as Ie, J as ge, e as Re } from "./types-CQDRQvV-.js";
|
|
8
|
+
import { X as R, C as G, s as I, S as Oe, h as Ne, p as fe } from "./bitcoin-B5aNKtsk.js";
|
|
9
|
+
import { C as ee } from "./constants-BhclpREj.js";
|
|
10
10
|
import { H as S } from "./validation-CxqROCno.js";
|
|
11
11
|
import * as H from "@bitcoin-js/tiny-secp256k1-asmjs";
|
|
12
|
-
import { payments as
|
|
13
|
-
import { Buffer as
|
|
12
|
+
import { payments as Be, Transaction as X } from "bitcoinjs-lib";
|
|
13
|
+
import { Buffer as V } from "buffer";
|
|
14
14
|
import { s as q } from "./sha2-BYVxyZzX.js";
|
|
15
15
|
async function or(r, e) {
|
|
16
16
|
const [t, n] = await r.multicall({
|
|
@@ -34,7 +34,7 @@ async function or(r, e) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
const te = 65535;
|
|
37
|
-
function
|
|
37
|
+
function N(r) {
|
|
38
38
|
return {
|
|
39
39
|
timelockAssert: r.timelockAssert,
|
|
40
40
|
timelockChallengeAssert: r.timelockChallengeAssert,
|
|
@@ -75,32 +75,32 @@ class ar {
|
|
|
75
75
|
async getTBVProtocolParams() {
|
|
76
76
|
const e = await this.publicClient.readContract({
|
|
77
77
|
address: this.contractAddress,
|
|
78
|
-
abi:
|
|
78
|
+
abi: b,
|
|
79
79
|
functionName: "getTBVProtocolParams"
|
|
80
80
|
}), t = re(e);
|
|
81
|
-
return
|
|
81
|
+
return Te(t), t;
|
|
82
82
|
}
|
|
83
83
|
async getLatestOffchainParams() {
|
|
84
84
|
const e = await this.publicClient.readContract({
|
|
85
85
|
address: this.contractAddress,
|
|
86
|
-
abi:
|
|
86
|
+
abi: b,
|
|
87
87
|
functionName: "getLatestOffchainParams"
|
|
88
|
-
}), t =
|
|
88
|
+
}), t = N(e);
|
|
89
89
|
return U(t), t;
|
|
90
90
|
}
|
|
91
91
|
async getOffchainParamsByVersion(e) {
|
|
92
92
|
const t = await this.publicClient.readContract({
|
|
93
93
|
address: this.contractAddress,
|
|
94
|
-
abi:
|
|
94
|
+
abi: b,
|
|
95
95
|
functionName: "getOffchainParamsByVersion",
|
|
96
96
|
args: [e]
|
|
97
|
-
}), n =
|
|
97
|
+
}), n = N(t);
|
|
98
98
|
return U(n), n;
|
|
99
99
|
}
|
|
100
100
|
async getLatestOffchainParamsVersion() {
|
|
101
101
|
const e = await this.publicClient.readContract({
|
|
102
102
|
address: this.contractAddress,
|
|
103
|
-
abi:
|
|
103
|
+
abi: b,
|
|
104
104
|
functionName: "latestOffchainParamsVersion"
|
|
105
105
|
}), t = Number(e);
|
|
106
106
|
return $e(t), t;
|
|
@@ -121,22 +121,27 @@ class ar {
|
|
|
121
121
|
contracts: [
|
|
122
122
|
{
|
|
123
123
|
address: this.contractAddress,
|
|
124
|
-
abi:
|
|
124
|
+
abi: b,
|
|
125
125
|
functionName: "getTBVProtocolParams"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
address: this.contractAddress,
|
|
129
|
-
abi:
|
|
129
|
+
abi: b,
|
|
130
130
|
functionName: "getLatestOffchainParams"
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
address: this.contractAddress,
|
|
134
|
-
abi:
|
|
134
|
+
abi: b,
|
|
135
135
|
functionName: "latestOffchainParamsVersion"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
address: this.contractAddress,
|
|
139
|
+
abi: b,
|
|
140
|
+
functionName: "activeVaultCoreVersion"
|
|
136
141
|
}
|
|
137
142
|
],
|
|
138
143
|
allowFailure: !1
|
|
139
|
-
}), t = re(e[0]), n =
|
|
144
|
+
}), t = re(e[0]), n = N(e[1]), i = Number(e[2]), s = Number(e[3]), o = {
|
|
140
145
|
minimumPegInAmount: t.minimumPegInAmount,
|
|
141
146
|
maxPegInAmount: t.maxPegInAmount,
|
|
142
147
|
pegInAckTimeout: t.pegInAckTimeout,
|
|
@@ -147,9 +152,10 @@ class ar {
|
|
|
147
152
|
timelockRefund: n.tRefund,
|
|
148
153
|
minVpCommissionBps: n.minVpCommissionBps,
|
|
149
154
|
offchainParams: n,
|
|
150
|
-
offchainParamsVersion: i
|
|
155
|
+
offchainParamsVersion: i,
|
|
156
|
+
activeVaultCoreVersion: s
|
|
151
157
|
};
|
|
152
|
-
return
|
|
158
|
+
return Ve(o), o;
|
|
153
159
|
}
|
|
154
160
|
/**
|
|
155
161
|
* Fetch every historical offchain params version in a single multicall.
|
|
@@ -167,7 +173,7 @@ class ar {
|
|
|
167
173
|
return { byVersion: /* @__PURE__ */ new Map(), latestVersion: 0 };
|
|
168
174
|
const n = Array.from({ length: t }, (c, d) => d + 1), i = n.map((c) => ({
|
|
169
175
|
address: this.contractAddress,
|
|
170
|
-
abi:
|
|
176
|
+
abi: b,
|
|
171
177
|
functionName: "getOffchainParamsByVersion",
|
|
172
178
|
args: [c]
|
|
173
179
|
})), s = await this.publicClient.multicall({
|
|
@@ -175,7 +181,7 @@ class ar {
|
|
|
175
181
|
allowFailure: !1
|
|
176
182
|
}), o = /* @__PURE__ */ new Map();
|
|
177
183
|
for (let c = 0; c < n.length; c++) {
|
|
178
|
-
const d =
|
|
184
|
+
const d = N(s[c]);
|
|
179
185
|
try {
|
|
180
186
|
U(d), o.set(n[c], d);
|
|
181
187
|
} catch (l) {
|
|
@@ -232,7 +238,7 @@ class lr {
|
|
|
232
238
|
async getUniversalChallengersByVersion(e) {
|
|
233
239
|
const t = await this.publicClient.readContract({
|
|
234
240
|
address: this.contractAddress,
|
|
235
|
-
abi:
|
|
241
|
+
abi: b,
|
|
236
242
|
functionName: "getUniversalChallengersByVersion",
|
|
237
243
|
args: [e]
|
|
238
244
|
});
|
|
@@ -241,7 +247,7 @@ class lr {
|
|
|
241
247
|
async getCurrentUniversalChallengers() {
|
|
242
248
|
const e = await this.publicClient.readContract({
|
|
243
249
|
address: this.contractAddress,
|
|
244
|
-
abi:
|
|
250
|
+
abi: b,
|
|
245
251
|
functionName: "getCurrentUniversalChallengers"
|
|
246
252
|
});
|
|
247
253
|
return M(e);
|
|
@@ -249,13 +255,13 @@ class lr {
|
|
|
249
255
|
async getLatestUniversalChallengersVersion() {
|
|
250
256
|
return await this.publicClient.readContract({
|
|
251
257
|
address: this.contractAddress,
|
|
252
|
-
abi:
|
|
258
|
+
abi: b,
|
|
253
259
|
functionName: "latestUniversalChallengersVersion"
|
|
254
260
|
});
|
|
255
261
|
}
|
|
256
262
|
}
|
|
257
263
|
var De = /* @__PURE__ */ ((r) => (r[r.PENDING = 0] = "PENDING", r[r.VERIFIED = 1] = "VERIFIED", r[r.ACTIVE = 2] = "ACTIVE", r[r.REDEEMED = 3] = "REDEEMED", r[r.EXPIRED = 4] = "EXPIRED", r))(De || {});
|
|
258
|
-
const se = new Set(Object.values(
|
|
264
|
+
const se = new Set(Object.values(Ie)), Ge = 200;
|
|
259
265
|
function p(r) {
|
|
260
266
|
var e;
|
|
261
267
|
return ((e = JSON.stringify(r)) == null ? void 0 : e.slice(0, Ge)) ?? "undefined";
|
|
@@ -269,26 +275,26 @@ class a extends Error {
|
|
|
269
275
|
}
|
|
270
276
|
}
|
|
271
277
|
const O = 64;
|
|
272
|
-
function
|
|
278
|
+
function T(r) {
|
|
273
279
|
return typeof r == "string" && r.length > 0 && S.test(r);
|
|
274
280
|
}
|
|
275
281
|
function _e(r) {
|
|
276
282
|
return typeof r == "string" && r.length > 0;
|
|
277
283
|
}
|
|
278
284
|
function me(r, e) {
|
|
279
|
-
if (!
|
|
285
|
+
if (!T(r))
|
|
280
286
|
throw new a(
|
|
281
287
|
`VP response validation failed: "${e}" must be a non-empty hex string, got ${p(r)}`
|
|
282
288
|
);
|
|
283
289
|
}
|
|
284
|
-
function
|
|
290
|
+
function w(r, e) {
|
|
285
291
|
if (!_e(r))
|
|
286
292
|
throw new a(
|
|
287
293
|
`VP response validation failed: "${e}" must be a non-empty string, got ${p(r)}`
|
|
288
294
|
);
|
|
289
295
|
}
|
|
290
296
|
function Z(r, e) {
|
|
291
|
-
if (!
|
|
297
|
+
if (!T(r) || r.length !== R && r.length !== G)
|
|
292
298
|
throw new a(
|
|
293
299
|
`VP response validation failed: "${e}" must be a ${R} or ${G}-char hex string (BTC pubkey), got ${p(r)}`
|
|
294
300
|
);
|
|
@@ -320,7 +326,7 @@ function ye(r) {
|
|
|
320
326
|
"VP response validation failed: getPeginStatus response is not an object"
|
|
321
327
|
);
|
|
322
328
|
const e = r;
|
|
323
|
-
if (!
|
|
329
|
+
if (!T(e.pegin_txid) || e.pegin_txid.length !== O)
|
|
324
330
|
throw new a(
|
|
325
331
|
`VP response validation failed: "pegin_txid" must be a ${O}-char hex string (txid), got ${p(e.pegin_txid)}`
|
|
326
332
|
);
|
|
@@ -378,7 +384,7 @@ function Le(r, e) {
|
|
|
378
384
|
`VP response validation failed: "${e}" must be an object`
|
|
379
385
|
);
|
|
380
386
|
const t = r;
|
|
381
|
-
Z(t.claimer_pubkey, `${e}.claimer_pubkey`), A(t.claim_tx, `${e}.claim_tx`), A(t.assert_tx, `${e}.assert_tx`), A(t.payout_tx, `${e}.payout_tx`),
|
|
387
|
+
Z(t.claimer_pubkey, `${e}.claimer_pubkey`), A(t.claim_tx, `${e}.claim_tx`), A(t.assert_tx, `${e}.assert_tx`), A(t.payout_tx, `${e}.payout_tx`), w(t.payout_psbt, `${e}.payout_psbt`);
|
|
382
388
|
}
|
|
383
389
|
function Ue(r, e) {
|
|
384
390
|
if (r === null || typeof r != "object")
|
|
@@ -386,7 +392,7 @@ function Ue(r, e) {
|
|
|
386
392
|
`VP response validation failed: "${e}" must be an object`
|
|
387
393
|
);
|
|
388
394
|
const t = r;
|
|
389
|
-
|
|
395
|
+
w(t.wots_pks_json, `${e}.wots_pks_json`), w(t.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
|
|
390
396
|
}
|
|
391
397
|
function Xe(r, e) {
|
|
392
398
|
if (r === null || typeof r != "object")
|
|
@@ -400,7 +406,7 @@ function Xe(r, e) {
|
|
|
400
406
|
), A(
|
|
401
407
|
t.challenge_assert_y_tx,
|
|
402
408
|
`${e}.challenge_assert_y_tx`
|
|
403
|
-
), A(t.nopayout_tx, `${e}.nopayout_tx`),
|
|
409
|
+
), A(t.nopayout_tx, `${e}.nopayout_tx`), w(t.nopayout_psbt, `${e}.nopayout_psbt`), !Array.isArray(t.challenge_assert_connectors))
|
|
404
410
|
throw new a(
|
|
405
411
|
`VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
|
|
406
412
|
);
|
|
@@ -433,7 +439,7 @@ function Fe(r) {
|
|
|
433
439
|
throw new a(
|
|
434
440
|
`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${p(e.tx_graph_json)}`
|
|
435
441
|
);
|
|
436
|
-
if (!
|
|
442
|
+
if (!T(e.verifying_key_hex))
|
|
437
443
|
throw new a(
|
|
438
444
|
`VP response validation failed: "verifying_key_hex" must be a non-empty hex string, got ${p(e.verifying_key_hex)}`
|
|
439
445
|
);
|
|
@@ -454,7 +460,7 @@ function Fe(r) {
|
|
|
454
460
|
`VP response validation failed: "babe_sessions.${n}" must be an object`
|
|
455
461
|
);
|
|
456
462
|
const s = i;
|
|
457
|
-
if (!
|
|
463
|
+
if (!T(s.decryptor_artifacts_hex))
|
|
458
464
|
throw new a(
|
|
459
465
|
`VP response validation failed: "babe_sessions.${n}.decryptor_artifacts_hex" must be a non-empty hex string, got ${p(s.decryptor_artifacts_hex)}`
|
|
460
466
|
);
|
|
@@ -466,7 +472,7 @@ function Ke(r) {
|
|
|
466
472
|
"VP response validation failed: pegout status payload is not an object"
|
|
467
473
|
);
|
|
468
474
|
const e = r;
|
|
469
|
-
if (!
|
|
475
|
+
if (!T(e.pegin_txid) || e.pegin_txid.length !== O)
|
|
470
476
|
throw new a(
|
|
471
477
|
`VP response validation failed: "pegin_txid" must be a ${O}-char hex string (txid), got ${p(e.pegin_txid)}`
|
|
472
478
|
);
|
|
@@ -489,11 +495,11 @@ function Ke(r) {
|
|
|
489
495
|
qe(e.challengers[t], t);
|
|
490
496
|
}
|
|
491
497
|
function Je(r) {
|
|
492
|
-
if (
|
|
498
|
+
if (w(r.status, "claimer.status"), typeof r.failed != "boolean")
|
|
493
499
|
throw new a(
|
|
494
500
|
`VP response validation failed: "claimer.failed" must be a boolean, got ${p(r.failed)}`
|
|
495
501
|
);
|
|
496
|
-
if (
|
|
502
|
+
if (w(r.claim_txid, "claimer.claim_txid"), w(r.claimer_pubkey, "claimer.claimer_pubkey"), w(r.assert_txid, "claimer.assert_txid"), typeof r.created_at != "number")
|
|
497
503
|
throw new a(
|
|
498
504
|
`VP response validation failed: "claimer.created_at" must be a number, got ${p(r.created_at)}`
|
|
499
505
|
);
|
|
@@ -508,13 +514,13 @@ function qe(r, e) {
|
|
|
508
514
|
`VP response validation failed: "challengers[${e}]" must be an object, got ${p(r)}`
|
|
509
515
|
);
|
|
510
516
|
const t = r;
|
|
511
|
-
if (
|
|
517
|
+
if (w(t.status, `challengers[${e}].status`), w(t.claim_txid, `challengers[${e}].claim_txid`), w(t.claimer_pubkey, `challengers[${e}].claimer_pubkey`), B(t.assert_txid, `challengers[${e}].assert_txid`), B(
|
|
512
518
|
t.challenge_assert_x_txid,
|
|
513
519
|
`challengers[${e}].challenge_assert_x_txid`
|
|
514
|
-
),
|
|
520
|
+
), B(
|
|
515
521
|
t.challenge_assert_y_txid,
|
|
516
522
|
`challengers[${e}].challenge_assert_y_txid`
|
|
517
|
-
),
|
|
523
|
+
), B(t.nopayout_txid, `challengers[${e}].nopayout_txid`), typeof t.created_at != "number")
|
|
518
524
|
throw new a(
|
|
519
525
|
`VP response validation failed: "challengers[${e}].created_at" must be a number, got ${p(t.created_at)}`
|
|
520
526
|
);
|
|
@@ -523,7 +529,7 @@ function qe(r, e) {
|
|
|
523
529
|
`VP response validation failed: "challengers[${e}].updated_at" must be a number, got ${p(t.updated_at)}`
|
|
524
530
|
);
|
|
525
531
|
}
|
|
526
|
-
function
|
|
532
|
+
function B(r, e) {
|
|
527
533
|
if (r !== null && typeof r != "string")
|
|
528
534
|
throw new a(
|
|
529
535
|
`VP response validation failed: "${e}" must be a string or null, got ${p(r)}`
|
|
@@ -556,7 +562,7 @@ function be(r, e, t) {
|
|
|
556
562
|
`VP response validation failed: "${e}.results[${i}]" must be an object, got ${p(s)}`
|
|
557
563
|
);
|
|
558
564
|
const o = s;
|
|
559
|
-
if (!
|
|
565
|
+
if (!T(o.pegin_txid) || o.pegin_txid.length !== O)
|
|
560
566
|
throw new a(
|
|
561
567
|
`VP response validation failed: "${e}.results[${i}].pegin_txid" must be a ${O}-char hex string, got ${p(o.pegin_txid)}`
|
|
562
568
|
);
|
|
@@ -576,7 +582,7 @@ function be(r, e, t) {
|
|
|
576
582
|
}
|
|
577
583
|
}
|
|
578
584
|
function ze(r) {
|
|
579
|
-
if (A(r.claim_tx, "depositor_graph.claim_tx"), A(r.assert_tx, "depositor_graph.assert_tx"), A(r.payout_tx, "depositor_graph.payout_tx"),
|
|
585
|
+
if (A(r.claim_tx, "depositor_graph.claim_tx"), A(r.assert_tx, "depositor_graph.assert_tx"), A(r.payout_tx, "depositor_graph.payout_tx"), w(r.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(r.challenger_presign_data))
|
|
580
586
|
throw new a(
|
|
581
587
|
'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
|
|
582
588
|
);
|
|
@@ -712,17 +718,17 @@ async function ur(r) {
|
|
|
712
718
|
`batchPollByProvider: batchSize must be a positive integer, got ${g}`
|
|
713
719
|
);
|
|
714
720
|
for (let m = 0; m < e.length; m += g) {
|
|
715
|
-
const
|
|
716
|
-
for (const _ of
|
|
721
|
+
const x = e.slice(m, m + g), k = /* @__PURE__ */ new Map(), C = [];
|
|
722
|
+
for (const _ of x) {
|
|
717
723
|
const u = t(_).toLowerCase();
|
|
718
|
-
k.set(u, _),
|
|
724
|
+
k.set(u, _), C.push(u);
|
|
719
725
|
}
|
|
720
726
|
let P;
|
|
721
727
|
try {
|
|
722
|
-
const _ = await n(
|
|
723
|
-
P = et(
|
|
728
|
+
const _ = await n(C);
|
|
729
|
+
P = et(C, _.results);
|
|
724
730
|
} catch (_) {
|
|
725
|
-
d(
|
|
731
|
+
d(x, _);
|
|
726
732
|
continue;
|
|
727
733
|
}
|
|
728
734
|
l && P.unexpected.length > 0 && l(P.unexpected);
|
|
@@ -760,18 +766,18 @@ function st(r) {
|
|
|
760
766
|
function it(r, e, t) {
|
|
761
767
|
if (e.length !== we || t.length !== nt) return !1;
|
|
762
768
|
try {
|
|
763
|
-
const n = xe(tt, r), i =
|
|
764
|
-
internalPubkey:
|
|
769
|
+
const n = xe(tt, r), i = Be.p2tr({
|
|
770
|
+
internalPubkey: V.from(e)
|
|
765
771
|
});
|
|
766
772
|
if (!i.output) return !1;
|
|
767
773
|
const s = i.output, o = 0, c = new X();
|
|
768
774
|
c.version = 0, c.locktime = 0;
|
|
769
|
-
const d =
|
|
770
|
-
|
|
771
|
-
|
|
775
|
+
const d = V.concat([
|
|
776
|
+
V.from([0, 32]),
|
|
777
|
+
V.from(n)
|
|
772
778
|
]);
|
|
773
779
|
c.addInput(
|
|
774
|
-
|
|
780
|
+
V.alloc(32, 0),
|
|
775
781
|
// prev_txid = 0x0000...0000
|
|
776
782
|
4294967295,
|
|
777
783
|
// prev_vout = 0xFFFFFFFF
|
|
@@ -782,14 +788,14 @@ function it(r, e, t) {
|
|
|
782
788
|
const l = new X();
|
|
783
789
|
l.version = 0, l.locktime = 0;
|
|
784
790
|
const g = c.getHash();
|
|
785
|
-
l.addInput(g, 0, 0), l.addOutput(
|
|
791
|
+
l.addInput(g, 0, 0), l.addOutput(V.from([106]), o);
|
|
786
792
|
const m = l.hashForWitnessV1(
|
|
787
793
|
0,
|
|
788
794
|
[s],
|
|
789
795
|
[o],
|
|
790
796
|
X.SIGHASH_DEFAULT
|
|
791
|
-
),
|
|
792
|
-
return
|
|
797
|
+
), x = st(e);
|
|
798
|
+
return x ? H.verifySchnorr(m, x, t) : !1;
|
|
793
799
|
} catch {
|
|
794
800
|
return !1;
|
|
795
801
|
}
|
|
@@ -855,13 +861,13 @@ function D(r) {
|
|
|
855
861
|
return e;
|
|
856
862
|
}
|
|
857
863
|
function lt(r) {
|
|
858
|
-
const { proof: e, pinnedServerPubkey: t, now: n } = r, i = r.maxLifetimeSecs ?? ct, s =
|
|
864
|
+
const { proof: e, pinnedServerPubkey: t, now: n } = r, i = r.maxLifetimeSecs ?? ct, s = I(t).toLowerCase();
|
|
859
865
|
if (s.length !== R || !S.test(s))
|
|
860
866
|
throw new y(
|
|
861
867
|
`pinnedServerPubkey must be 32-byte hex; got ${s.length} chars`,
|
|
862
868
|
"invalid_pubkey_encoding"
|
|
863
869
|
);
|
|
864
|
-
const o =
|
|
870
|
+
const o = I(e.server_pubkey).toLowerCase();
|
|
865
871
|
if (o.length !== R || !S.test(o))
|
|
866
872
|
throw new y(
|
|
867
873
|
`server_pubkey must be 32-byte hex; got ${o.length} chars`,
|
|
@@ -897,7 +903,7 @@ function lt(r) {
|
|
|
897
903
|
`server identity proof expires too far in the future: expires_at=${e.expires_at}, now=${n}, max lifetime=${i}s`,
|
|
898
904
|
"expires_too_far"
|
|
899
905
|
);
|
|
900
|
-
const c =
|
|
906
|
+
const c = I(e.ephemeral_pubkey).toLowerCase();
|
|
901
907
|
if (c.length !== G || !S.test(c))
|
|
902
908
|
throw new y(
|
|
903
909
|
`ephemeral_pubkey must be 33-byte compressed hex; got ${c.length} chars`,
|
|
@@ -915,7 +921,7 @@ function lt(r) {
|
|
|
915
921
|
"ephemeral_pubkey is not a valid secp256k1 point",
|
|
916
922
|
"invalid_ephemeral_pubkey"
|
|
917
923
|
);
|
|
918
|
-
const g =
|
|
924
|
+
const g = I(e.signature).toLowerCase();
|
|
919
925
|
if (g.length !== Oe || !S.test(g))
|
|
920
926
|
throw new y(
|
|
921
927
|
`signature must be 64-byte Schnorr hex; got ${g.length} chars`,
|
|
@@ -1064,7 +1070,7 @@ function ke(r) {
|
|
|
1064
1070
|
throw new v("trailing bytes after top-level item");
|
|
1065
1071
|
return t;
|
|
1066
1072
|
}
|
|
1067
|
-
const At = "vaultd-jsonrpc", kt = "vaultd-grpc", ce = 18, z = 4, le = -47, Et = 1, ue = 64, St = 128,
|
|
1073
|
+
const At = "vaultd-jsonrpc", kt = "vaultd-grpc", ce = 18, z = 4, le = -47, Et = 1, ue = 64, St = 128, Ct = 96, Tt = 64, $t = 1, Vt = 2, It = 3, Rt = 4, Ot = 5, Nt = 6, Bt = 7, de = new TextEncoder().encode("Signature1");
|
|
1068
1074
|
class h extends Error {
|
|
1069
1075
|
constructor(e, t) {
|
|
1070
1076
|
super(e), this.reason = t, this.name = "CwtVerificationError";
|
|
@@ -1091,10 +1097,10 @@ function Dt(r) {
|
|
|
1091
1097
|
);
|
|
1092
1098
|
const d = s.pos, l = s.readByteString(), g = i.subarray(d, s.pos);
|
|
1093
1099
|
s.readValue();
|
|
1094
|
-
const m = s.pos,
|
|
1095
|
-
if (
|
|
1100
|
+
const m = s.pos, x = s.readByteString(), k = i.subarray(m, s.pos), C = s.readByteString();
|
|
1101
|
+
if (C.length !== ue)
|
|
1096
1102
|
throw new h(
|
|
1097
|
-
`COSE signature must be ${ue} bytes, got ${
|
|
1103
|
+
`COSE signature must be ${ue} bytes, got ${C.length}`,
|
|
1098
1104
|
"invalid_token_structure"
|
|
1099
1105
|
);
|
|
1100
1106
|
if (s.pos !== i.length)
|
|
@@ -1109,12 +1115,12 @@ function Dt(r) {
|
|
|
1109
1115
|
"unexpected_algorithm"
|
|
1110
1116
|
);
|
|
1111
1117
|
const $ = Mt(g, k), _ = q($);
|
|
1112
|
-
if (!H.verify(_, n,
|
|
1118
|
+
if (!H.verify(_, n, C, !0))
|
|
1113
1119
|
throw new h(
|
|
1114
1120
|
"COSE signature does not verify against the server's ephemeral key",
|
|
1115
1121
|
"signature_verification_failed"
|
|
1116
1122
|
);
|
|
1117
|
-
const u = jt(
|
|
1123
|
+
const u = jt(x), E = u.audience.toLowerCase();
|
|
1118
1124
|
if (E.length !== R || !S.test(E))
|
|
1119
1125
|
throw new h(
|
|
1120
1126
|
"token `aud` is not a 32-byte x-only pubkey hex",
|
|
@@ -1187,10 +1193,10 @@ function Gt(r) {
|
|
|
1187
1193
|
function Mt(r, e) {
|
|
1188
1194
|
return Ft(
|
|
1189
1195
|
Uint8Array.of(St | z),
|
|
1190
|
-
Uint8Array.of(
|
|
1196
|
+
Uint8Array.of(Ct | de.length),
|
|
1191
1197
|
de,
|
|
1192
1198
|
r,
|
|
1193
|
-
Uint8Array.of(
|
|
1199
|
+
Uint8Array.of(Tt),
|
|
1194
1200
|
e
|
|
1195
1201
|
);
|
|
1196
1202
|
}
|
|
@@ -1201,15 +1207,15 @@ function jt(r) {
|
|
|
1201
1207
|
"CWT claims root is not a map",
|
|
1202
1208
|
"invalid_claims"
|
|
1203
1209
|
);
|
|
1204
|
-
if (Ht(e,
|
|
1210
|
+
if (Ht(e, Bt, "cti").length === 0)
|
|
1205
1211
|
throw new h("token cti is empty", "invalid_claims");
|
|
1206
1212
|
return {
|
|
1207
1213
|
issuer: K(e, $t, "iss"),
|
|
1208
|
-
subject: K(e,
|
|
1209
|
-
audience: K(e,
|
|
1214
|
+
subject: K(e, Vt, "sub"),
|
|
1215
|
+
audience: K(e, It, "aud"),
|
|
1210
1216
|
expiresAt: J(e, Rt, "exp"),
|
|
1211
1217
|
notBefore: J(e, Ot, "nbf"),
|
|
1212
|
-
issuedAt: J(e,
|
|
1218
|
+
issuedAt: J(e, Nt, "iat")
|
|
1213
1219
|
};
|
|
1214
1220
|
}
|
|
1215
1221
|
function K(r, e, t) {
|
|
@@ -1240,7 +1246,7 @@ function J(r, e, t) {
|
|
|
1240
1246
|
return n;
|
|
1241
1247
|
}
|
|
1242
1248
|
function he(r, e) {
|
|
1243
|
-
const t =
|
|
1249
|
+
const t = I(r).toLowerCase();
|
|
1244
1250
|
if (t.length !== R || !S.test(t))
|
|
1245
1251
|
throw new h(
|
|
1246
1252
|
`${e} must be 32-byte x-only hex; got ${t.length} chars`,
|
|
@@ -1249,13 +1255,13 @@ function he(r, e) {
|
|
|
1249
1255
|
return t;
|
|
1250
1256
|
}
|
|
1251
1257
|
function Lt(r) {
|
|
1252
|
-
const e =
|
|
1258
|
+
const e = I(r).toLowerCase(), t = e.slice(0, 2);
|
|
1253
1259
|
if (e.length !== G || !S.test(e) || t !== "02" && t !== "03")
|
|
1254
1260
|
throw new h(
|
|
1255
1261
|
"ephemeralPubkeyHex must be 33-byte compressed pubkey hex (prefix 02/03)",
|
|
1256
1262
|
"invalid_input"
|
|
1257
1263
|
);
|
|
1258
|
-
return
|
|
1264
|
+
return Ne(e);
|
|
1259
1265
|
}
|
|
1260
1266
|
const Ut = (() => {
|
|
1261
1267
|
const r = new Int16Array(128).fill(-1), e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
@@ -1281,8 +1287,8 @@ function Xt(r) {
|
|
|
1281
1287
|
};
|
|
1282
1288
|
let c = 0, d = 0;
|
|
1283
1289
|
for (let l = 0; l < t; l++) {
|
|
1284
|
-
const g = o(r.charCodeAt(c++)), m = o(r.charCodeAt(c++)),
|
|
1285
|
-
s[d++] = g << 2 | m >> 4, s[d++] = (m & 15) << 4 |
|
|
1290
|
+
const g = o(r.charCodeAt(c++)), m = o(r.charCodeAt(c++)), x = o(r.charCodeAt(c++)), k = o(r.charCodeAt(c++));
|
|
1291
|
+
s[d++] = g << 2 | m >> 4, s[d++] = (m & 15) << 4 | x >> 2, s[d++] = (x & 3) << 6 | k;
|
|
1286
1292
|
}
|
|
1287
1293
|
if (n === 2) {
|
|
1288
1294
|
const l = o(r.charCodeAt(c++)), g = o(r.charCodeAt(c++));
|
|
@@ -1533,4 +1539,4 @@ export {
|
|
|
1533
1539
|
or as r,
|
|
1534
1540
|
Fe as v
|
|
1535
1541
|
};
|
|
1536
|
-
//# sourceMappingURL=primeVpAuth-
|
|
1542
|
+
//# sourceMappingURL=primeVpAuth-l-5x_2UV.js.map
|