@babylonlabs-io/ts-sdk 0.48.2 → 0.48.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PayoutManager-DD1audlx.cjs → PayoutManager-BZVEyi10.cjs} +2 -2
- package/dist/{PayoutManager-DD1audlx.cjs.map → PayoutManager-BZVEyi10.cjs.map} +1 -1
- package/dist/{PayoutManager-D02AePm4.js → PayoutManager-D26nGR-e.js} +2 -2
- package/dist/{PayoutManager-D02AePm4.js.map → PayoutManager-D26nGR-e.js.map} +1 -1
- package/dist/{PeginManager-6seoi9mV.js → PeginManager-CNhDl1eC.js} +3 -3
- package/dist/{PeginManager-6seoi9mV.js.map → PeginManager-CNhDl1eC.js.map} +1 -1
- package/dist/{PeginManager-CHZieoEQ.cjs → PeginManager-NfDjKQGV.cjs} +2 -2
- package/dist/{PeginManager-CHZieoEQ.cjs.map → PeginManager-NfDjKQGV.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-Bi07LxuY.cjs → buildAndBroadcastRefund-BOtxUi05.cjs} +2 -2
- package/dist/{buildAndBroadcastRefund-Bi07LxuY.cjs.map → buildAndBroadcastRefund-BOtxUi05.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-DXHs6unL.js → buildAndBroadcastRefund-o9Byvkut.js} +4 -4
- package/dist/{buildAndBroadcastRefund-DXHs6unL.js.map → buildAndBroadcastRefund-o9Byvkut.js.map} +1 -1
- package/dist/challengeAssert-HNbugpqL.cjs +2 -0
- package/dist/challengeAssert-HNbugpqL.cjs.map +1 -0
- package/dist/{challengeAssert-ChvLypwc.js → challengeAssert-csvYXBJB.js} +7 -7
- package/dist/challengeAssert-csvYXBJB.js.map +1 -0
- package/dist/constants-CSG2XeD8.cjs +2 -0
- package/dist/constants-CSG2XeD8.cjs.map +1 -0
- package/dist/constants-Cd_fN8VT.js +12 -0
- package/dist/constants-Cd_fN8VT.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/{noPayout-CA4-x5vZ.js → noPayout-C1WCsqfd.js} +46 -44
- package/dist/noPayout-C1WCsqfd.js.map +1 -0
- package/dist/noPayout-lyIRiUyG.cjs +2 -0
- package/dist/noPayout-lyIRiUyG.cjs.map +1 -0
- package/dist/{primeVpAuth-rbejoBPu.js → primeVpAuth-Dzxxy0-F.js} +174 -169
- package/dist/primeVpAuth-Dzxxy0-F.js.map +1 -0
- package/dist/primeVpAuth-wKbRw0m4.cjs +2 -0
- package/dist/primeVpAuth-wKbRw0m4.cjs.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +1 -1
- package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +7 -7
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +3 -3
- package/dist/tbv/core/primitives/psbt/__tests__/peginAmountsGuard.test.d.ts +8 -0
- package/dist/tbv/core/primitives/psbt/__tests__/peginAmountsGuard.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts +4 -4
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/constants.d.ts +8 -0
- package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/refund.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/index.cjs +1 -1
- package/dist/tbv/index.js +7 -7
- package/dist/{verifyScriptPathSchnorrSignature-DFJAEleY.js → verifyScriptPathSchnorrSignature-CeZp6tMw.js} +77 -79
- package/dist/verifyScriptPathSchnorrSignature-CeZp6tMw.js.map +1 -0
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-Cl7tu77P.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/challengeAssert-ChvLypwc.js.map +0 -1
- package/dist/challengeAssert-Culc7DoS.cjs +0 -2
- package/dist/challengeAssert-Culc7DoS.cjs.map +0 -1
- package/dist/noPayout-CA4-x5vZ.js.map +0 -1
- package/dist/noPayout-CJ_Acpl_.cjs +0 -2
- package/dist/noPayout-CJ_Acpl_.cjs.map +0 -1
- package/dist/primeVpAuth-Br6RwE3r.cjs +0 -2
- package/dist/primeVpAuth-Br6RwE3r.cjs.map +0 -1
- package/dist/primeVpAuth-rbejoBPu.js.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-D43cncKJ.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-D43cncKJ.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-DFJAEleY.js.map +0 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (r, e, t) =>
|
|
1
|
+
var he = Object.defineProperty;
|
|
2
|
+
var ge = (r, e, t) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var p = (r, e, t) => ge(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { B as X } from "./BTCVaultRegistry.abi-Chs4AFBj.js";
|
|
5
|
-
import { P as b, A as
|
|
6
|
-
import { j as
|
|
7
|
-
import { D as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { P as b, A as H } from "./ApplicationRegistry.abi-Dn2qk6JG.js";
|
|
6
|
+
import { j as fe, v as B, k as _e, i as me } from "./mempoolApi-BxT89SAq.js";
|
|
7
|
+
import { D as be, J as ne, e as ye } from "./types-CQDRQvV-.js";
|
|
8
|
+
import { C as q } from "./constants-Cd_fN8VT.js";
|
|
9
|
+
import { X as R, C as j, s as E, S as we } from "./bitcoin-B5aNKtsk.js";
|
|
10
|
+
import { H as S } from "./validation-CxqROCno.js";
|
|
10
11
|
import * as F from "@bitcoin-js/tiny-secp256k1-asmjs";
|
|
11
|
-
import { payments as
|
|
12
|
+
import { payments as Pe, Transaction as O } from "bitcoinjs-lib";
|
|
12
13
|
import { Buffer as A } from "buffer";
|
|
13
|
-
import { s as
|
|
14
|
-
async function
|
|
14
|
+
import { s as J } from "./sha2-BYVxyZzX.js";
|
|
15
|
+
async function ut(r, e) {
|
|
15
16
|
const [t, n] = await r.multicall({
|
|
16
17
|
contracts: [
|
|
17
18
|
{
|
|
@@ -32,8 +33,8 @@ async function ct(r, e) {
|
|
|
32
33
|
applicationRegistry: n
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
-
function
|
|
36
|
+
const z = 65535;
|
|
37
|
+
function V(r) {
|
|
37
38
|
return {
|
|
38
39
|
timelockAssert: r.timelockAssert,
|
|
39
40
|
timelockChallengeAssert: r.timelockChallengeAssert,
|
|
@@ -50,7 +51,7 @@ function E(r) {
|
|
|
50
51
|
minPrepeginDepth: r.minPrepeginDepth
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function W(r) {
|
|
54
55
|
return {
|
|
55
56
|
minimumPegInAmount: r.minimumPegInAmount,
|
|
56
57
|
maxPegInAmount: r.maxPegInAmount,
|
|
@@ -60,14 +61,14 @@ function z(r) {
|
|
|
60
61
|
expiredPegInGraceBlocks: r.expiredPegInGraceBlocks
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
if (r > BigInt(
|
|
64
|
+
function Y(r) {
|
|
65
|
+
if (r > BigInt(z))
|
|
65
66
|
throw new Error(
|
|
66
|
-
`timelockAssert value ${r} exceeds uint16 max (${
|
|
67
|
+
`timelockAssert value ${r} exceeds uint16 max (${z})`
|
|
67
68
|
);
|
|
68
69
|
return Number(r);
|
|
69
70
|
}
|
|
70
|
-
class
|
|
71
|
+
class dt {
|
|
71
72
|
constructor(e, t) {
|
|
72
73
|
this.publicClient = e, this.contractAddress = t;
|
|
73
74
|
}
|
|
@@ -76,16 +77,16 @@ class lt {
|
|
|
76
77
|
address: this.contractAddress,
|
|
77
78
|
abi: b,
|
|
78
79
|
functionName: "getTBVProtocolParams"
|
|
79
|
-
}), t =
|
|
80
|
-
return
|
|
80
|
+
}), t = W(e);
|
|
81
|
+
return fe(t), t;
|
|
81
82
|
}
|
|
82
83
|
async getLatestOffchainParams() {
|
|
83
84
|
const e = await this.publicClient.readContract({
|
|
84
85
|
address: this.contractAddress,
|
|
85
86
|
abi: b,
|
|
86
87
|
functionName: "getLatestOffchainParams"
|
|
87
|
-
}), t =
|
|
88
|
-
return
|
|
88
|
+
}), t = V(e);
|
|
89
|
+
return B(t), t;
|
|
89
90
|
}
|
|
90
91
|
async getOffchainParamsByVersion(e) {
|
|
91
92
|
const t = await this.publicClient.readContract({
|
|
@@ -93,8 +94,8 @@ class lt {
|
|
|
93
94
|
abi: b,
|
|
94
95
|
functionName: "getOffchainParamsByVersion",
|
|
95
96
|
args: [e]
|
|
96
|
-
}), n =
|
|
97
|
-
return
|
|
97
|
+
}), n = V(t);
|
|
98
|
+
return B(n), n;
|
|
98
99
|
}
|
|
99
100
|
async getLatestOffchainParamsVersion() {
|
|
100
101
|
const e = await this.publicClient.readContract({
|
|
@@ -102,11 +103,11 @@ class lt {
|
|
|
102
103
|
abi: b,
|
|
103
104
|
functionName: "latestOffchainParamsVersion"
|
|
104
105
|
}), t = Number(e);
|
|
105
|
-
return
|
|
106
|
+
return _e(t), t;
|
|
106
107
|
}
|
|
107
108
|
async getTimelockPeginByVersion(e) {
|
|
108
109
|
const t = await this.getOffchainParamsByVersion(e);
|
|
109
|
-
return
|
|
110
|
+
return Y(t.timelockAssert);
|
|
110
111
|
}
|
|
111
112
|
/**
|
|
112
113
|
* Read TBV protocol params, latest offchain params, and the latest version
|
|
@@ -135,20 +136,20 @@ class lt {
|
|
|
135
136
|
}
|
|
136
137
|
],
|
|
137
138
|
allowFailure: !1
|
|
138
|
-
}), t =
|
|
139
|
+
}), t = W(e[0]), n = V(e[1]), s = Number(e[2]), i = {
|
|
139
140
|
minimumPegInAmount: t.minimumPegInAmount,
|
|
140
141
|
maxPegInAmount: t.maxPegInAmount,
|
|
141
142
|
pegInAckTimeout: t.pegInAckTimeout,
|
|
142
143
|
pegInActivationTimeout: t.pegInActivationTimeout,
|
|
143
144
|
maxHtlcOutputCount: t.maxHtlcOutputCount,
|
|
144
145
|
expiredPegInGraceBlocks: t.expiredPegInGraceBlocks,
|
|
145
|
-
timelockPegin:
|
|
146
|
+
timelockPegin: Y(n.timelockAssert),
|
|
146
147
|
timelockRefund: n.tRefund,
|
|
147
148
|
minVpCommissionBps: n.minVpCommissionBps,
|
|
148
149
|
offchainParams: n,
|
|
149
150
|
offchainParamsVersion: s
|
|
150
151
|
};
|
|
151
|
-
return
|
|
152
|
+
return me(i), i;
|
|
152
153
|
}
|
|
153
154
|
/**
|
|
154
155
|
* Fetch every historical offchain params version in a single multicall.
|
|
@@ -174,9 +175,9 @@ class lt {
|
|
|
174
175
|
allowFailure: !1
|
|
175
176
|
}), o = /* @__PURE__ */ new Map();
|
|
176
177
|
for (let c = 0; c < n.length; c++) {
|
|
177
|
-
const u =
|
|
178
|
+
const u = V(i[c]);
|
|
178
179
|
try {
|
|
179
|
-
|
|
180
|
+
B(u), o.set(n[c], u);
|
|
180
181
|
} catch (d) {
|
|
181
182
|
e == null || e(
|
|
182
183
|
n[c],
|
|
@@ -187,44 +188,44 @@ class lt {
|
|
|
187
188
|
return { byVersion: o, latestVersion: t };
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
+
function N(r) {
|
|
191
192
|
return r.map((e) => ({
|
|
192
193
|
ethAddress: e.ethAddress,
|
|
193
194
|
btcPubKey: e.btcPubKey
|
|
194
195
|
}));
|
|
195
196
|
}
|
|
196
|
-
class
|
|
197
|
+
class pt {
|
|
197
198
|
constructor(e, t) {
|
|
198
199
|
this.publicClient = e, this.contractAddress = t;
|
|
199
200
|
}
|
|
200
201
|
async getVaultKeepersByVersion(e, t) {
|
|
201
202
|
const n = await this.publicClient.readContract({
|
|
202
203
|
address: this.contractAddress,
|
|
203
|
-
abi:
|
|
204
|
+
abi: H,
|
|
204
205
|
functionName: "getVaultKeepersByVersion",
|
|
205
206
|
args: [e, t]
|
|
206
207
|
});
|
|
207
|
-
return
|
|
208
|
+
return N(n);
|
|
208
209
|
}
|
|
209
210
|
async getCurrentVaultKeepers(e) {
|
|
210
211
|
const t = await this.publicClient.readContract({
|
|
211
212
|
address: this.contractAddress,
|
|
212
|
-
abi:
|
|
213
|
+
abi: H,
|
|
213
214
|
functionName: "getCurrentVaultKeepers",
|
|
214
215
|
args: [e]
|
|
215
216
|
});
|
|
216
|
-
return
|
|
217
|
+
return N(t);
|
|
217
218
|
}
|
|
218
219
|
async getCurrentVaultKeepersVersion(e) {
|
|
219
220
|
return await this.publicClient.readContract({
|
|
220
221
|
address: this.contractAddress,
|
|
221
|
-
abi:
|
|
222
|
+
abi: H,
|
|
222
223
|
functionName: "getCurrentVaultKeepersVersion",
|
|
223
224
|
args: [e]
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
|
-
class
|
|
228
|
+
class ht {
|
|
228
229
|
constructor(e, t) {
|
|
229
230
|
this.publicClient = e, this.contractAddress = t;
|
|
230
231
|
}
|
|
@@ -235,7 +236,7 @@ class dt {
|
|
|
235
236
|
functionName: "getUniversalChallengersByVersion",
|
|
236
237
|
args: [e]
|
|
237
238
|
});
|
|
238
|
-
return
|
|
239
|
+
return N(t);
|
|
239
240
|
}
|
|
240
241
|
async getCurrentUniversalChallengers() {
|
|
241
242
|
const e = await this.publicClient.readContract({
|
|
@@ -243,7 +244,7 @@ class dt {
|
|
|
243
244
|
abi: b,
|
|
244
245
|
functionName: "getCurrentUniversalChallengers"
|
|
245
246
|
});
|
|
246
|
-
return
|
|
247
|
+
return N(e);
|
|
247
248
|
}
|
|
248
249
|
async getLatestUniversalChallengersVersion() {
|
|
249
250
|
return await this.publicClient.readContract({
|
|
@@ -253,35 +254,35 @@ class dt {
|
|
|
253
254
|
});
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
var
|
|
257
|
-
const
|
|
257
|
+
var xe = /* @__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))(xe || {});
|
|
258
|
+
const Z = new Set(Object.values(be)), ve = 200;
|
|
258
259
|
function l(r) {
|
|
259
260
|
var e;
|
|
260
|
-
return ((e = JSON.stringify(r)) == null ? void 0 : e.slice(0,
|
|
261
|
+
return ((e = JSON.stringify(r)) == null ? void 0 : e.slice(0, ve)) ?? "undefined";
|
|
261
262
|
}
|
|
262
|
-
const
|
|
263
|
+
const Ae = "The vault provider returned an unexpected response. Please try again or contact support.";
|
|
263
264
|
class a extends Error {
|
|
264
265
|
constructor(t) {
|
|
265
|
-
super(
|
|
266
|
+
super(Ae);
|
|
266
267
|
p(this, "detail");
|
|
267
268
|
this.name = "VpResponseValidationError", this.detail = t;
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
|
-
const
|
|
271
|
+
const $ = 64;
|
|
271
272
|
function P(r) {
|
|
272
|
-
return typeof r == "string" && r.length > 0 &&
|
|
273
|
+
return typeof r == "string" && r.length > 0 && S.test(r);
|
|
273
274
|
}
|
|
274
|
-
function
|
|
275
|
+
function se(r) {
|
|
275
276
|
return typeof r == "string" && r.length > 0;
|
|
276
277
|
}
|
|
277
|
-
function
|
|
278
|
+
function ie(r, e) {
|
|
278
279
|
if (!P(r))
|
|
279
280
|
throw new a(
|
|
280
281
|
`VP response validation failed: "${e}" must be a non-empty hex string, got ${l(r)}`
|
|
281
282
|
);
|
|
282
283
|
}
|
|
283
284
|
function _(r, e) {
|
|
284
|
-
if (!
|
|
285
|
+
if (!se(r))
|
|
285
286
|
throw new a(
|
|
286
287
|
`VP response validation failed: "${e}" must be a non-empty string, got ${l(r)}`
|
|
287
288
|
);
|
|
@@ -292,7 +293,7 @@ function L(r, e) {
|
|
|
292
293
|
`VP response validation failed: "${e}" must be a ${R} or ${j}-char hex string (BTC pubkey), got ${l(r)}`
|
|
293
294
|
);
|
|
294
295
|
}
|
|
295
|
-
function
|
|
296
|
+
function $e(r) {
|
|
296
297
|
const e = r.presigning;
|
|
297
298
|
if (e == null) return;
|
|
298
299
|
if (typeof e != "object" || Array.isArray(e))
|
|
@@ -313,29 +314,29 @@ function Ae(r) {
|
|
|
313
314
|
`VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${l(t.vk_challenger_presigning_total)}`
|
|
314
315
|
);
|
|
315
316
|
}
|
|
316
|
-
function
|
|
317
|
+
function ae(r) {
|
|
317
318
|
if (r === null || typeof r != "object")
|
|
318
319
|
throw new a(
|
|
319
320
|
"VP response validation failed: getPeginStatus response is not an object"
|
|
320
321
|
);
|
|
321
322
|
const e = r;
|
|
322
|
-
if (!P(e.pegin_txid) || e.pegin_txid.length !==
|
|
323
|
+
if (!P(e.pegin_txid) || e.pegin_txid.length !== $)
|
|
323
324
|
throw new a(
|
|
324
|
-
`VP response validation failed: "pegin_txid" must be a ${
|
|
325
|
+
`VP response validation failed: "pegin_txid" must be a ${$}-char hex string (txid), got ${l(e.pegin_txid)}`
|
|
325
326
|
);
|
|
326
327
|
if (typeof e.status != "string")
|
|
327
328
|
throw new a(
|
|
328
329
|
'VP response validation failed: "status" must be a string'
|
|
329
330
|
);
|
|
330
|
-
if (!
|
|
331
|
+
if (!Z.has(e.status))
|
|
331
332
|
throw new a(
|
|
332
|
-
`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...
|
|
333
|
+
`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...Z].join(", ")}`
|
|
333
334
|
);
|
|
334
335
|
if (e.progress === null || typeof e.progress != "object" || Array.isArray(e.progress))
|
|
335
336
|
throw new a(
|
|
336
337
|
'VP response validation failed: "progress" must be an object'
|
|
337
338
|
);
|
|
338
|
-
if (
|
|
339
|
+
if ($e(e.progress), typeof e.health_info != "string")
|
|
339
340
|
throw new a(
|
|
340
341
|
'VP response validation failed: "health_info" must be a string'
|
|
341
342
|
);
|
|
@@ -344,7 +345,7 @@ function ie(r) {
|
|
|
344
345
|
`VP response validation failed: "last_error" must be a string if present, got ${l(e.last_error)}`
|
|
345
346
|
);
|
|
346
347
|
}
|
|
347
|
-
function
|
|
348
|
+
function Se(r) {
|
|
348
349
|
if (r === null || typeof r != "object")
|
|
349
350
|
throw new a(
|
|
350
351
|
"VP response validation failed: requestDepositorPresignTransactions response is not an object"
|
|
@@ -355,12 +356,12 @@ function ke(r) {
|
|
|
355
356
|
'VP response validation failed: "txs" must be an array'
|
|
356
357
|
);
|
|
357
358
|
for (let t = 0; t < e.txs.length; t++)
|
|
358
|
-
|
|
359
|
+
ke(e.txs[t], `txs[${t}]`);
|
|
359
360
|
if (e.depositor_graph === null || typeof e.depositor_graph != "object")
|
|
360
361
|
throw new a(
|
|
361
362
|
'VP response validation failed: "depositor_graph" must be an object'
|
|
362
363
|
);
|
|
363
|
-
|
|
364
|
+
De(
|
|
364
365
|
e.depositor_graph
|
|
365
366
|
);
|
|
366
367
|
}
|
|
@@ -369,9 +370,9 @@ function y(r, e) {
|
|
|
369
370
|
throw new a(
|
|
370
371
|
`VP response validation failed: "${e}" must be an object`
|
|
371
372
|
);
|
|
372
|
-
|
|
373
|
+
ie(r.tx_hex, `${e}.tx_hex`);
|
|
373
374
|
}
|
|
374
|
-
function
|
|
375
|
+
function ke(r, e) {
|
|
375
376
|
if (r === null || typeof r != "object")
|
|
376
377
|
throw new a(
|
|
377
378
|
`VP response validation failed: "${e}" must be an object`
|
|
@@ -379,7 +380,7 @@ function $e(r, e) {
|
|
|
379
380
|
const t = r;
|
|
380
381
|
L(t.claimer_pubkey, `${e}.claimer_pubkey`), y(t.claim_tx, `${e}.claim_tx`), y(t.assert_tx, `${e}.assert_tx`), y(t.payout_tx, `${e}.payout_tx`), _(t.payout_psbt, `${e}.payout_psbt`);
|
|
381
382
|
}
|
|
382
|
-
function
|
|
383
|
+
function Te(r, e) {
|
|
383
384
|
if (r === null || typeof r != "object")
|
|
384
385
|
throw new a(
|
|
385
386
|
`VP response validation failed: "${e}" must be an object`
|
|
@@ -387,7 +388,7 @@ function Se(r, e) {
|
|
|
387
388
|
const t = r;
|
|
388
389
|
_(t.wots_pks_json, `${e}.wots_pks_json`), _(t.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
|
|
389
390
|
}
|
|
390
|
-
function
|
|
391
|
+
function Ee(r, e) {
|
|
391
392
|
if (r === null || typeof r != "object")
|
|
392
393
|
throw new a(
|
|
393
394
|
`VP response validation failed: "${e}" must be an object`
|
|
@@ -403,8 +404,12 @@ function Te(r, e) {
|
|
|
403
404
|
throw new a(
|
|
404
405
|
`VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
|
|
405
406
|
);
|
|
407
|
+
if (t.challenge_assert_connectors.length !== q)
|
|
408
|
+
throw new a(
|
|
409
|
+
`VP response validation failed: "${e}.challenge_assert_connectors" must have exactly ${q} entries, got ${t.challenge_assert_connectors.length}`
|
|
410
|
+
);
|
|
406
411
|
for (let n = 0; n < t.challenge_assert_connectors.length; n++)
|
|
407
|
-
|
|
412
|
+
Te(
|
|
408
413
|
t.challenge_assert_connectors[n],
|
|
409
414
|
`${e}.challenge_assert_connectors[${n}]`
|
|
410
415
|
);
|
|
@@ -413,7 +418,7 @@ function Te(r, e) {
|
|
|
413
418
|
`VP response validation failed: "${e}.output_label_hashes" must be an array`
|
|
414
419
|
);
|
|
415
420
|
for (let n = 0; n < t.output_label_hashes.length; n++)
|
|
416
|
-
|
|
421
|
+
ie(
|
|
417
422
|
t.output_label_hashes[n],
|
|
418
423
|
`${e}.output_label_hashes[${n}]`
|
|
419
424
|
);
|
|
@@ -424,7 +429,7 @@ function Ve(r) {
|
|
|
424
429
|
"VP response validation failed: requestDepositorClaimerArtifacts response is not an object"
|
|
425
430
|
);
|
|
426
431
|
const e = r;
|
|
427
|
-
if (!
|
|
432
|
+
if (!se(e.tx_graph_json))
|
|
428
433
|
throw new a(
|
|
429
434
|
`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${l(e.tx_graph_json)}`
|
|
430
435
|
);
|
|
@@ -455,15 +460,15 @@ function Ve(r) {
|
|
|
455
460
|
);
|
|
456
461
|
}
|
|
457
462
|
}
|
|
458
|
-
function
|
|
463
|
+
function Ce(r) {
|
|
459
464
|
if (r === null || typeof r != "object")
|
|
460
465
|
throw new a(
|
|
461
466
|
"VP response validation failed: pegout status payload is not an object"
|
|
462
467
|
);
|
|
463
468
|
const e = r;
|
|
464
|
-
if (!P(e.pegin_txid) || e.pegin_txid.length !==
|
|
469
|
+
if (!P(e.pegin_txid) || e.pegin_txid.length !== $)
|
|
465
470
|
throw new a(
|
|
466
|
-
`VP response validation failed: "pegin_txid" must be a ${
|
|
471
|
+
`VP response validation failed: "pegin_txid" must be a ${$}-char hex string (txid), got ${l(e.pegin_txid)}`
|
|
467
472
|
);
|
|
468
473
|
if (typeof e.found != "boolean")
|
|
469
474
|
throw new a(
|
|
@@ -474,16 +479,16 @@ function Ee(r) {
|
|
|
474
479
|
throw new a(
|
|
475
480
|
`VP response validation failed: "claimer" must be an object or null, got ${l(e.claimer)}`
|
|
476
481
|
);
|
|
477
|
-
|
|
482
|
+
Ie(e.claimer);
|
|
478
483
|
}
|
|
479
484
|
if (!Array.isArray(e.challengers))
|
|
480
485
|
throw new a(
|
|
481
486
|
`VP response validation failed: "challengers" must be an array, got ${l(e.challengers)}`
|
|
482
487
|
);
|
|
483
488
|
for (let t = 0; t < e.challengers.length; t++)
|
|
484
|
-
|
|
489
|
+
Re(e.challengers[t], t);
|
|
485
490
|
}
|
|
486
|
-
function
|
|
491
|
+
function Ie(r) {
|
|
487
492
|
if (_(r.status, "claimer.status"), typeof r.failed != "boolean")
|
|
488
493
|
throw new a(
|
|
489
494
|
`VP response validation failed: "claimer.failed" must be a boolean, got ${l(r.failed)}`
|
|
@@ -497,7 +502,7 @@ function Ce(r) {
|
|
|
497
502
|
`VP response validation failed: "claimer.updated_at" must be a number, got ${l(r.updated_at)}`
|
|
498
503
|
);
|
|
499
504
|
}
|
|
500
|
-
function
|
|
505
|
+
function Re(r, e) {
|
|
501
506
|
if (r === null || typeof r != "object")
|
|
502
507
|
throw new a(
|
|
503
508
|
`VP response validation failed: "challengers[${e}]" must be an object, got ${l(r)}`
|
|
@@ -524,17 +529,17 @@ function C(r, e) {
|
|
|
524
529
|
`VP response validation failed: "${e}" must be a string or null, got ${l(r)}`
|
|
525
530
|
);
|
|
526
531
|
}
|
|
527
|
-
function
|
|
528
|
-
|
|
529
|
-
e.result !== null &&
|
|
532
|
+
function Ne(r) {
|
|
533
|
+
oe(r, "batchGetPeginStatus", (e) => {
|
|
534
|
+
e.result !== null && ae(e.result);
|
|
530
535
|
});
|
|
531
536
|
}
|
|
532
|
-
function
|
|
533
|
-
|
|
534
|
-
e.result !== null &&
|
|
537
|
+
function Ge(r) {
|
|
538
|
+
oe(r, "batchGetPegoutStatus", (e) => {
|
|
539
|
+
e.result !== null && Ce(e.result);
|
|
535
540
|
});
|
|
536
541
|
}
|
|
537
|
-
function
|
|
542
|
+
function oe(r, e, t) {
|
|
538
543
|
if (r === null || typeof r != "object")
|
|
539
544
|
throw new a(
|
|
540
545
|
`VP response validation failed: ${e} response is not an object`
|
|
@@ -551,9 +556,9 @@ function ae(r, e, t) {
|
|
|
551
556
|
`VP response validation failed: "${e}.results[${s}]" must be an object, got ${l(i)}`
|
|
552
557
|
);
|
|
553
558
|
const o = i;
|
|
554
|
-
if (!P(o.pegin_txid) || o.pegin_txid.length !==
|
|
559
|
+
if (!P(o.pegin_txid) || o.pegin_txid.length !== $)
|
|
555
560
|
throw new a(
|
|
556
|
-
`VP response validation failed: "${e}.results[${s}].pegin_txid" must be a ${
|
|
561
|
+
`VP response validation failed: "${e}.results[${s}].pegin_txid" must be a ${$}-char hex string, got ${l(o.pegin_txid)}`
|
|
557
562
|
);
|
|
558
563
|
if (o.error !== null && typeof o.error != "string")
|
|
559
564
|
throw new a(
|
|
@@ -570,13 +575,13 @@ function ae(r, e, t) {
|
|
|
570
575
|
t(o, s);
|
|
571
576
|
}
|
|
572
577
|
}
|
|
573
|
-
function
|
|
578
|
+
function De(r) {
|
|
574
579
|
if (y(r.claim_tx, "depositor_graph.claim_tx"), y(r.assert_tx, "depositor_graph.assert_tx"), y(r.payout_tx, "depositor_graph.payout_tx"), _(r.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(r.challenger_presign_data))
|
|
575
580
|
throw new a(
|
|
576
581
|
'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
|
|
577
582
|
);
|
|
578
583
|
for (let e = 0; e < r.challenger_presign_data.length; e++)
|
|
579
|
-
|
|
584
|
+
Ee(
|
|
580
585
|
r.challenger_presign_data[e],
|
|
581
586
|
`depositor_graph.challenger_presign_data[${e}]`
|
|
582
587
|
);
|
|
@@ -585,13 +590,13 @@ function Ge(r) {
|
|
|
585
590
|
'VP response validation failed: "depositor_graph.offchain_params_version" must be a number'
|
|
586
591
|
);
|
|
587
592
|
}
|
|
588
|
-
const
|
|
593
|
+
const He = 6e4;
|
|
589
594
|
class Be {
|
|
590
595
|
constructor(e, t) {
|
|
591
596
|
p(this, "client");
|
|
592
597
|
const n = {
|
|
593
598
|
baseUrl: e,
|
|
594
|
-
timeout: (t == null ? void 0 : t.timeout) ??
|
|
599
|
+
timeout: (t == null ? void 0 : t.timeout) ?? He,
|
|
595
600
|
retries: t == null ? void 0 : t.retries,
|
|
596
601
|
retryDelay: t == null ? void 0 : t.retryDelay,
|
|
597
602
|
retryableFor: t == null ? void 0 : t.retryableFor,
|
|
@@ -599,7 +604,7 @@ class Be {
|
|
|
599
604
|
tokenProvider: t == null ? void 0 : t.tokenProvider,
|
|
600
605
|
maxResponseBytes: t == null ? void 0 : t.maxResponseBytes
|
|
601
606
|
};
|
|
602
|
-
this.client = new
|
|
607
|
+
this.client = new ne(n);
|
|
603
608
|
}
|
|
604
609
|
/**
|
|
605
610
|
* Request the payout/claim/assert transactions that the depositor
|
|
@@ -607,7 +612,7 @@ class Be {
|
|
|
607
612
|
*/
|
|
608
613
|
async requestDepositorPresignTransactions(e, t) {
|
|
609
614
|
const n = await this.client.call("vaultProvider_requestDepositorPresignTransactions", e, t);
|
|
610
|
-
return
|
|
615
|
+
return Se(n), n;
|
|
611
616
|
}
|
|
612
617
|
/**
|
|
613
618
|
* Submit the depositor's pre-signatures for the payout transactions
|
|
@@ -647,7 +652,7 @@ class Be {
|
|
|
647
652
|
e,
|
|
648
653
|
t
|
|
649
654
|
);
|
|
650
|
-
return
|
|
655
|
+
return ae(n), n;
|
|
651
656
|
}
|
|
652
657
|
/**
|
|
653
658
|
* Get pegin status for many txids in one round trip. Per-result envelope
|
|
@@ -656,7 +661,7 @@ class Be {
|
|
|
656
661
|
*/
|
|
657
662
|
async batchGetPeginStatus(e, t) {
|
|
658
663
|
const n = await this.client.call("vaultProvider_batchGetPeginStatus", e, t);
|
|
659
|
-
return
|
|
664
|
+
return Ne(n), n;
|
|
660
665
|
}
|
|
661
666
|
/**
|
|
662
667
|
* Get pegout status for many txids in one round trip. Same per-result
|
|
@@ -664,10 +669,10 @@ class Be {
|
|
|
664
669
|
*/
|
|
665
670
|
async batchGetPegoutStatus(e, t) {
|
|
666
671
|
const n = await this.client.call("vaultProvider_batchGetPegoutStatus", e, t);
|
|
667
|
-
return
|
|
672
|
+
return Ge(n), n;
|
|
668
673
|
}
|
|
669
674
|
}
|
|
670
|
-
function
|
|
675
|
+
function Oe(r, e) {
|
|
671
676
|
const t = /* @__PURE__ */ new Set();
|
|
672
677
|
for (const u of r)
|
|
673
678
|
t.add(u.toLowerCase());
|
|
@@ -689,7 +694,7 @@ function He(r, e) {
|
|
|
689
694
|
s.has(u) || c.push(u);
|
|
690
695
|
return { byTxid: n, missing: c, unexpected: o, duplicate: i };
|
|
691
696
|
}
|
|
692
|
-
async function
|
|
697
|
+
async function gt(r) {
|
|
693
698
|
const {
|
|
694
699
|
items: e,
|
|
695
700
|
getTxid: t,
|
|
@@ -700,22 +705,22 @@ async function pt(r) {
|
|
|
700
705
|
onDuplicateBatch: c,
|
|
701
706
|
onWholeBatchError: u,
|
|
702
707
|
onUnexpected: d,
|
|
703
|
-
batchSize: f =
|
|
708
|
+
batchSize: f = ye
|
|
704
709
|
} = r;
|
|
705
710
|
if (!Number.isInteger(f) || f <= 0)
|
|
706
711
|
throw new Error(
|
|
707
712
|
`batchPollByProvider: batchSize must be a positive integer, got ${f}`
|
|
708
713
|
);
|
|
709
714
|
for (let w = 0; w < e.length; w += f) {
|
|
710
|
-
const x = e.slice(w, w + f),
|
|
715
|
+
const x = e.slice(w, w + f), k = /* @__PURE__ */ new Map(), D = [];
|
|
711
716
|
for (const h of x) {
|
|
712
717
|
const m = t(h).toLowerCase();
|
|
713
|
-
|
|
718
|
+
k.set(m, h), D.push(m);
|
|
714
719
|
}
|
|
715
720
|
let v;
|
|
716
721
|
try {
|
|
717
|
-
const h = await n(
|
|
718
|
-
v =
|
|
722
|
+
const h = await n(D);
|
|
723
|
+
v = Oe(D, h.results);
|
|
719
724
|
} catch (h) {
|
|
720
725
|
u(x, h);
|
|
721
726
|
continue;
|
|
@@ -723,17 +728,17 @@ async function pt(r) {
|
|
|
723
728
|
d && v.unexpected.length > 0 && d(v.unexpected);
|
|
724
729
|
const T = new Set(v.duplicate);
|
|
725
730
|
for (const h of T) {
|
|
726
|
-
const m =
|
|
731
|
+
const m = k.get(h);
|
|
727
732
|
m && o(m);
|
|
728
733
|
}
|
|
729
734
|
c && T.size > 0 && c(T.size);
|
|
730
735
|
for (const h of v.missing) {
|
|
731
|
-
const m =
|
|
736
|
+
const m = k.get(h);
|
|
732
737
|
m && i(m);
|
|
733
738
|
}
|
|
734
739
|
for (const [h, m] of v.byTxid) {
|
|
735
740
|
if (T.has(h)) continue;
|
|
736
|
-
const K =
|
|
741
|
+
const K = k.get(h);
|
|
737
742
|
K && s(K, {
|
|
738
743
|
pegin_txid: h,
|
|
739
744
|
result: m.result,
|
|
@@ -742,20 +747,20 @@ async function pt(r) {
|
|
|
742
747
|
}
|
|
743
748
|
}
|
|
744
749
|
}
|
|
745
|
-
const
|
|
746
|
-
function
|
|
747
|
-
const t = new TextEncoder().encode(r), n =
|
|
748
|
-
return s.set(n, 0), s.set(n, n.length), s.set(e, n.length * 2),
|
|
750
|
+
const je = "BIP0322-signed-message", Me = "TapTweak", ce = 32, Ue = 64;
|
|
751
|
+
function le(r, e) {
|
|
752
|
+
const t = new TextEncoder().encode(r), n = J(t), s = new Uint8Array(n.length * 2 + e.length);
|
|
753
|
+
return s.set(n, 0), s.set(n, n.length), s.set(e, n.length * 2), J(s);
|
|
749
754
|
}
|
|
750
|
-
function
|
|
751
|
-
if (r.length !==
|
|
752
|
-
const e =
|
|
755
|
+
function Fe(r) {
|
|
756
|
+
if (r.length !== ce) return null;
|
|
757
|
+
const e = le(Me, r), t = F.xOnlyPointAddTweak(r, e);
|
|
753
758
|
return t ? t.xOnlyPubkey : null;
|
|
754
759
|
}
|
|
755
|
-
function
|
|
756
|
-
if (e.length !==
|
|
760
|
+
function Le(r, e, t) {
|
|
761
|
+
if (e.length !== ce || t.length !== Ue) return !1;
|
|
757
762
|
try {
|
|
758
|
-
const n =
|
|
763
|
+
const n = le(je, r), s = Pe.p2tr({
|
|
759
764
|
internalPubkey: A.from(e)
|
|
760
765
|
});
|
|
761
766
|
if (!s.output) return !1;
|
|
@@ -783,7 +788,7 @@ function Fe(r, e, t) {
|
|
|
783
788
|
[i],
|
|
784
789
|
[o],
|
|
785
790
|
O.SIGHASH_DEFAULT
|
|
786
|
-
), x =
|
|
791
|
+
), x = Fe(e);
|
|
787
792
|
return x ? F.verifySchnorr(w, x, t) : !1;
|
|
788
793
|
} catch {
|
|
789
794
|
return !1;
|
|
@@ -814,30 +819,30 @@ function G(r, e) {
|
|
|
814
819
|
s[1 + i] = Number(n >> BigInt((7 - i) * 8)) & 255;
|
|
815
820
|
return s;
|
|
816
821
|
}
|
|
817
|
-
function
|
|
822
|
+
function ue(...r) {
|
|
818
823
|
const e = r.reduce((s, i) => s + i.length, 0), t = new Uint8Array(e);
|
|
819
824
|
let n = 0;
|
|
820
825
|
for (const s of r)
|
|
821
826
|
t.set(s, n), n += s.length;
|
|
822
827
|
return t;
|
|
823
828
|
}
|
|
824
|
-
function
|
|
829
|
+
function Q(r) {
|
|
825
830
|
const t = [G(4, r.length)];
|
|
826
831
|
for (const n of r)
|
|
827
832
|
t.push(G(0, n));
|
|
828
|
-
return
|
|
833
|
+
return ue(...t);
|
|
829
834
|
}
|
|
830
|
-
function
|
|
835
|
+
function Ke(r, e, t) {
|
|
831
836
|
if (!Number.isSafeInteger(t) || t < 0)
|
|
832
837
|
throw new Error(
|
|
833
838
|
`encodeServerIdentityPayload: expires_at must be a non-negative safe integer, got ${t}`
|
|
834
839
|
);
|
|
835
|
-
const n = G(4, 3), s =
|
|
836
|
-
return
|
|
840
|
+
const n = G(4, 3), s = Q(r), i = Q(e), o = G(0, t);
|
|
841
|
+
return ue(n, s, i, o);
|
|
837
842
|
}
|
|
838
|
-
const
|
|
843
|
+
const Xe = new TextEncoder().encode(
|
|
839
844
|
"btc-auth.server-identity.v1"
|
|
840
|
-
),
|
|
845
|
+
), qe = 2 * 3600;
|
|
841
846
|
class g extends Error {
|
|
842
847
|
constructor(e, t) {
|
|
843
848
|
super(e), this.reason = t, this.name = "ServerIdentityError";
|
|
@@ -849,15 +854,15 @@ function I(r) {
|
|
|
849
854
|
e[t] = parseInt(r.slice(t * 2, t * 2 + 2), 16);
|
|
850
855
|
return e;
|
|
851
856
|
}
|
|
852
|
-
function
|
|
853
|
-
const { proof: e, pinnedServerPubkey: t, now: n } = r, s = r.maxLifetimeSecs ??
|
|
854
|
-
if (i.length !== R ||
|
|
857
|
+
function Je(r) {
|
|
858
|
+
const { proof: e, pinnedServerPubkey: t, now: n } = r, s = r.maxLifetimeSecs ?? qe, i = E(t).toLowerCase();
|
|
859
|
+
if (i.length !== R || !S.test(i))
|
|
855
860
|
throw new g(
|
|
856
861
|
`pinnedServerPubkey must be 32-byte hex; got ${i.length} chars`,
|
|
857
862
|
"invalid_pubkey_encoding"
|
|
858
863
|
);
|
|
859
|
-
const o =
|
|
860
|
-
if (o.length !== R ||
|
|
864
|
+
const o = E(e.server_pubkey).toLowerCase();
|
|
865
|
+
if (o.length !== R || !S.test(o))
|
|
861
866
|
throw new g(
|
|
862
867
|
`server_pubkey must be 32-byte hex; got ${o.length} chars`,
|
|
863
868
|
"invalid_pubkey_encoding"
|
|
@@ -892,8 +897,8 @@ function qe(r) {
|
|
|
892
897
|
`server identity proof expires too far in the future: expires_at=${e.expires_at}, now=${n}, max lifetime=${s}s`,
|
|
893
898
|
"expires_too_far"
|
|
894
899
|
);
|
|
895
|
-
const c =
|
|
896
|
-
if (c.length !== j ||
|
|
900
|
+
const c = E(e.ephemeral_pubkey).toLowerCase();
|
|
901
|
+
if (c.length !== j || !S.test(c))
|
|
897
902
|
throw new g(
|
|
898
903
|
`ephemeral_pubkey must be 33-byte compressed hex; got ${c.length} chars`,
|
|
899
904
|
"invalid_ephemeral_pubkey"
|
|
@@ -910,40 +915,40 @@ function qe(r) {
|
|
|
910
915
|
"ephemeral_pubkey is not a valid secp256k1 point",
|
|
911
916
|
"invalid_ephemeral_pubkey"
|
|
912
917
|
);
|
|
913
|
-
const f =
|
|
914
|
-
if (f.length !==
|
|
918
|
+
const f = E(e.signature).toLowerCase();
|
|
919
|
+
if (f.length !== we || !S.test(f))
|
|
915
920
|
throw new g(
|
|
916
921
|
`signature must be 64-byte Schnorr hex; got ${f.length} chars`,
|
|
917
922
|
"invalid_signature_encoding"
|
|
918
923
|
);
|
|
919
|
-
const w =
|
|
920
|
-
|
|
924
|
+
const w = Ke(
|
|
925
|
+
Xe,
|
|
921
926
|
I(c),
|
|
922
927
|
e.expires_at
|
|
923
928
|
);
|
|
924
|
-
if (!
|
|
929
|
+
if (!Le(w, I(o), I(f)))
|
|
925
930
|
throw new g(
|
|
926
931
|
"BIP-322 signature verification failed — ephemeral key is not attested by pinned server pubkey",
|
|
927
932
|
"signature_verification_failed"
|
|
928
933
|
);
|
|
929
934
|
}
|
|
930
|
-
const
|
|
935
|
+
const ee = /* @__PURE__ */ new Set([
|
|
931
936
|
"vaultProvider_submitDepositorWotsKey",
|
|
932
937
|
"vaultProvider_submitDepositorPresignatures",
|
|
933
938
|
"vaultProvider_requestDepositorPresignTransactions"
|
|
934
|
-
]),
|
|
939
|
+
]), te = /* @__PURE__ */ new Set([
|
|
935
940
|
"vaultProvider_requestDepositorClaimerArtifacts"
|
|
936
|
-
]),
|
|
937
|
-
function
|
|
938
|
-
return new
|
|
941
|
+
]), ze = 6e4, M = "auth_createDepositorToken", U = "auth_createDepositorTokenGrpc";
|
|
942
|
+
function de(r, e) {
|
|
943
|
+
return new ne({
|
|
939
944
|
baseUrl: r,
|
|
940
|
-
timeout:
|
|
945
|
+
timeout: ze,
|
|
941
946
|
headers: e,
|
|
942
947
|
retryableFor: (t) => t === M || t === U
|
|
943
948
|
});
|
|
944
949
|
}
|
|
945
|
-
const
|
|
946
|
-
class
|
|
950
|
+
const re = 4102444800, We = 30;
|
|
951
|
+
class Ye {
|
|
947
952
|
constructor(e) {
|
|
948
953
|
// `client` is the only mutable field — see `setClient`. The
|
|
949
954
|
// identity-bearing fields (peginTxid/authAnchorHex/pinnedServerPubkey)
|
|
@@ -963,7 +968,7 @@ class We {
|
|
|
963
968
|
/** Cached gRPC-subject bearer (auth_createDepositorTokenGrpc). */
|
|
964
969
|
p(this, "cachedGrpc", null);
|
|
965
970
|
p(this, "inFlightGrpc", null);
|
|
966
|
-
this.client = e.client, this.peginTxid = e.peginTxid, this.authAnchorHex = e.authAnchorHex, this.pinnedServerPubkey = e.pinnedServerPubkey, this.authGatedMethods = e.authGatedMethods, this.grpcGatedMethods = e.grpcGatedMethods, this.refreshSkewSecs = e.refreshSkewSecs ??
|
|
971
|
+
this.client = e.client, this.peginTxid = e.peginTxid, this.authAnchorHex = e.authAnchorHex, this.pinnedServerPubkey = e.pinnedServerPubkey, this.authGatedMethods = e.authGatedMethods, this.grpcGatedMethods = e.grpcGatedMethods, this.refreshSkewSecs = e.refreshSkewSecs ?? We, this.now = e.now ?? (() => Math.floor(Date.now() / 1e3));
|
|
967
972
|
}
|
|
968
973
|
/**
|
|
969
974
|
* Return a bearer token for `method`, or `null` if `method` is not
|
|
@@ -1022,7 +1027,7 @@ class We {
|
|
|
1022
1027
|
pegin_txid: this.peginTxid,
|
|
1023
1028
|
auth_anchor: this.authAnchorHex
|
|
1024
1029
|
});
|
|
1025
|
-
if (
|
|
1030
|
+
if (Je({
|
|
1026
1031
|
proof: i.server_identity,
|
|
1027
1032
|
pinnedServerPubkey: this.pinnedServerPubkey,
|
|
1028
1033
|
now: this.now()
|
|
@@ -1031,9 +1036,9 @@ class We {
|
|
|
1031
1036
|
`VpTokenProvider: invalid token in acquire response (expected non-empty string, got ${typeof i.token})`
|
|
1032
1037
|
);
|
|
1033
1038
|
const o = this.now();
|
|
1034
|
-
if (!Number.isSafeInteger(i.expires_at) || i.expires_at <= o || i.expires_at >
|
|
1039
|
+
if (!Number.isSafeInteger(i.expires_at) || i.expires_at <= o || i.expires_at > re)
|
|
1035
1040
|
throw new Error(
|
|
1036
|
-
`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(i.expires_at)}; must be a safe integer in (${o}, ${
|
|
1041
|
+
`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(i.expires_at)}; must be a safe integer in (${o}, ${re}])`
|
|
1037
1042
|
);
|
|
1038
1043
|
const c = {
|
|
1039
1044
|
token: i.token,
|
|
@@ -1047,7 +1052,7 @@ class We {
|
|
|
1047
1052
|
return e === "grpc" ? this.inFlightGrpc = s : this.inFlightJsonRpc = s, s;
|
|
1048
1053
|
}
|
|
1049
1054
|
}
|
|
1050
|
-
class
|
|
1055
|
+
class Ze {
|
|
1051
1056
|
constructor() {
|
|
1052
1057
|
p(this, "entries", /* @__PURE__ */ new Map());
|
|
1053
1058
|
}
|
|
@@ -1076,13 +1081,13 @@ class Ye {
|
|
|
1076
1081
|
);
|
|
1077
1082
|
return n.provider.setClient(e.client), n.provider;
|
|
1078
1083
|
}
|
|
1079
|
-
const s = new
|
|
1084
|
+
const s = new Ye({
|
|
1080
1085
|
client: e.client,
|
|
1081
1086
|
peginTxid: e.peginTxid,
|
|
1082
1087
|
authAnchorHex: e.authAnchorHex,
|
|
1083
1088
|
pinnedServerPubkey: e.pinnedServerPubkey,
|
|
1084
|
-
authGatedMethods: t ?
|
|
1085
|
-
grpcGatedMethods: t ?
|
|
1089
|
+
authGatedMethods: t ? ee : /* @__PURE__ */ new Set([...ee, ...te]),
|
|
1090
|
+
grpcGatedMethods: t ? te : /* @__PURE__ */ new Set()
|
|
1086
1091
|
});
|
|
1087
1092
|
return this.entries.set(e.peginTxid, {
|
|
1088
1093
|
provider: s,
|
|
@@ -1117,13 +1122,13 @@ class Ye {
|
|
|
1117
1122
|
return this.entries.size;
|
|
1118
1123
|
}
|
|
1119
1124
|
}
|
|
1120
|
-
const
|
|
1121
|
-
function
|
|
1125
|
+
const pe = new Ze();
|
|
1126
|
+
function ft(r) {
|
|
1122
1127
|
var n;
|
|
1123
|
-
const e =
|
|
1128
|
+
const e = de(
|
|
1124
1129
|
r.baseUrl,
|
|
1125
1130
|
(n = r.options) == null ? void 0 : n.headers
|
|
1126
|
-
), t =
|
|
1131
|
+
), t = pe.getOrCreate({
|
|
1127
1132
|
client: e,
|
|
1128
1133
|
peginTxid: r.peginTxid,
|
|
1129
1134
|
authAnchorHex: r.authAnchorHex,
|
|
@@ -1135,9 +1140,9 @@ function ht(r) {
|
|
|
1135
1140
|
tokenProvider: t
|
|
1136
1141
|
});
|
|
1137
1142
|
}
|
|
1138
|
-
function
|
|
1139
|
-
|
|
1140
|
-
client:
|
|
1143
|
+
function _t(r) {
|
|
1144
|
+
pe.getOrCreate({
|
|
1145
|
+
client: de(r.baseUrl, r.headers),
|
|
1141
1146
|
peginTxid: r.peginTxid,
|
|
1142
1147
|
authAnchorHex: r.authAnchorHex,
|
|
1143
1148
|
pinnedServerPubkey: r.pinnedServerPubkey,
|
|
@@ -1145,20 +1150,20 @@ function gt(r) {
|
|
|
1145
1150
|
});
|
|
1146
1151
|
}
|
|
1147
1152
|
export {
|
|
1148
|
-
|
|
1153
|
+
xe as O,
|
|
1149
1154
|
g as S,
|
|
1150
1155
|
Be as V,
|
|
1151
1156
|
a,
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1157
|
+
gt as b,
|
|
1158
|
+
Je as c,
|
|
1159
|
+
Ze as d,
|
|
1160
|
+
pe as e,
|
|
1161
|
+
ft as f,
|
|
1162
|
+
dt as g,
|
|
1163
|
+
ht as h,
|
|
1164
|
+
pt as i,
|
|
1165
|
+
_t as p,
|
|
1166
|
+
ut as r,
|
|
1162
1167
|
Ve as v
|
|
1163
1168
|
};
|
|
1164
|
-
//# sourceMappingURL=primeVpAuth-
|
|
1169
|
+
//# sourceMappingURL=primeVpAuth-Dzxxy0-F.js.map
|