@babylonlabs-io/ts-sdk 0.19.0 → 0.20.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/README.md +56 -12
- package/dist/bitcoin-CNnPFU6Y.cjs +2 -0
- package/dist/bitcoin-CNnPFU6Y.cjs.map +1 -0
- package/dist/{constants-Q7v2O7Ps.js → bitcoin-nOOgeRyl.js} +64 -76
- package/dist/bitcoin-nOOgeRyl.js.map +1 -0
- package/dist/buildAndBroadcastRefund-DWEQvj9T.cjs +2 -0
- package/dist/buildAndBroadcastRefund-DWEQvj9T.cjs.map +1 -0
- package/dist/buildAndBroadcastRefund-DnTQkCgG.js +1331 -0
- package/dist/buildAndBroadcastRefund-DnTQkCgG.js.map +1 -0
- package/dist/challengeAssert-D1lpvuMv.js +283 -0
- package/dist/challengeAssert-D1lpvuMv.js.map +1 -0
- package/dist/challengeAssert-nYlgeAI8.cjs +2 -0
- package/dist/challengeAssert-nYlgeAI8.cjs.map +1 -0
- package/dist/errors-BZON3Wmn.cjs +2 -0
- package/dist/errors-BZON3Wmn.cjs.map +1 -0
- package/dist/{errors-aMocmFr-.js → errors-CHY4WNi-.js} +98 -97
- package/dist/errors-CHY4WNi-.js.map +1 -0
- package/dist/fundPeginTransaction-BLYXxLBv.js +70 -0
- package/dist/fundPeginTransaction-BLYXxLBv.js.map +1 -0
- package/dist/fundPeginTransaction-DxNOeyNI.cjs +2 -0
- package/dist/fundPeginTransaction-DxNOeyNI.cjs.map +1 -0
- package/dist/index-BpXpESWu.cjs +2 -0
- package/dist/index-BpXpESWu.cjs.map +1 -0
- package/dist/{index-BvFLf3vm.js → index-CFwoGJNQ.js} +146 -518
- package/dist/index-CFwoGJNQ.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +133 -109
- package/dist/payout-DzGsAnhf.js +261 -0
- package/dist/payout-DzGsAnhf.js.map +1 -0
- package/dist/payout-RFIh7GLN.cjs +2 -0
- package/dist/payout-RFIh7GLN.cjs.map +1 -0
- package/dist/psbtInputFields-C-zYR1z7.cjs +2 -0
- package/dist/psbtInputFields-C-zYR1z7.cjs.map +1 -0
- package/dist/psbtInputFields-Dx41_IoI.js +229 -0
- package/dist/psbtInputFields-Dx41_IoI.js.map +1 -0
- package/dist/signing-DeWVBl7m.js +64 -0
- package/dist/signing-DeWVBl7m.js.map +1 -0
- package/dist/signing-cl-lowxV.cjs +2 -0
- package/dist/signing-cl-lowxV.cjs.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.d.ts +3 -1
- package/dist/tbv/core/index.d.ts.map +1 -1
- package/dist/tbv/core/index.js +130 -106
- package/dist/tbv/core/managers/PeginManager.d.ts +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.d.ts +3 -2
- package/dist/tbv/core/primitives/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.js +24 -23
- package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts +1 -1
- package/dist/tbv/core/primitives/psbt/index.d.ts +1 -1
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +2 -3
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts +4 -0
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/utils/index.d.ts +1 -1
- package/dist/tbv/core/primitives/utils/index.d.ts.map +1 -1
- package/dist/tbv/core/services/activation/__tests__/activateVault.test.d.ts +2 -0
- package/dist/tbv/core/services/activation/__tests__/activateVault.test.d.ts.map +1 -0
- package/dist/tbv/core/services/activation/activateVault.d.ts +77 -0
- package/dist/tbv/core/services/activation/activateVault.d.ts.map +1 -0
- package/dist/tbv/core/services/activation/index.d.ts +7 -0
- package/dist/tbv/core/services/activation/index.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/__tests__/peginState.test.d.ts +2 -0
- package/dist/tbv/core/services/deposit/__tests__/peginState.test.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/__tests__/validation.test.d.ts +5 -0
- package/dist/tbv/core/services/deposit/__tests__/validation.test.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/index.d.ts +4 -0
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts +93 -0
- package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/validation.d.ts +114 -0
- package/dist/tbv/core/services/deposit/validation.d.ts.map +1 -0
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.d.ts +3 -0
- package/dist/tbv/core/services/index.d.ts.map +1 -1
- package/dist/tbv/core/services/index.js +25 -7
- package/dist/tbv/core/services/index.js.map +1 -1
- package/dist/tbv/core/services/pegout/__tests__/state.test.d.ts +2 -0
- package/dist/tbv/core/services/pegout/__tests__/state.test.d.ts.map +1 -0
- package/dist/tbv/core/services/pegout/index.d.ts +2 -0
- package/dist/tbv/core/services/pegout/index.d.ts.map +1 -0
- package/dist/tbv/core/services/pegout/state.d.ts +30 -0
- package/dist/tbv/core/services/pegout/state.d.ts.map +1 -0
- package/dist/tbv/core/services/refund/__tests__/buildAndBroadcastRefund.test.d.ts +2 -0
- package/dist/tbv/core/services/refund/__tests__/buildAndBroadcastRefund.test.d.ts.map +1 -0
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +103 -0
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -0
- package/dist/tbv/core/services/refund/errors.d.ts +13 -0
- package/dist/tbv/core/services/refund/errors.d.ts.map +1 -0
- package/dist/tbv/core/services/refund/index.d.ts +8 -0
- package/dist/tbv/core/services/refund/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +30 -24
- package/dist/tbv/core/utils/transaction/fundPeginTransaction.d.ts +1 -1
- package/dist/tbv/core/utils/utxo/__tests__/availability.test.d.ts +3 -0
- package/dist/tbv/core/utils/utxo/__tests__/availability.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/__tests__/reservation.test.d.ts +3 -0
- package/dist/tbv/core/utils/utxo/__tests__/reservation.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/availability.d.ts +62 -0
- package/dist/tbv/core/utils/utxo/availability.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/index.d.ts +2 -0
- package/dist/tbv/core/utils/utxo/index.d.ts.map +1 -1
- package/dist/tbv/core/utils/utxo/reservation.d.ts +65 -0
- package/dist/tbv/core/utils/utxo/reservation.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +130 -106
- package/dist/tbv/integrations/aave/index.cjs +1 -1
- package/dist/tbv/integrations/aave/index.cjs.map +1 -1
- package/dist/tbv/integrations/aave/index.d.ts +3 -3
- package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/index.js +145 -169
- package/dist/tbv/integrations/aave/index.js.map +1 -1
- package/dist/tbv/integrations/aave/utils/healthFactor.d.ts +0 -30
- package/dist/tbv/integrations/aave/utils/healthFactor.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/utils/index.d.ts +2 -2
- package/dist/tbv/integrations/aave/utils/index.d.ts.map +1 -1
- package/dist/types-B-p4dhEH.cjs +2 -0
- package/dist/types-B-p4dhEH.cjs.map +1 -0
- package/dist/types-DWjaqVfP.js +608 -0
- package/dist/types-DWjaqVfP.js.map +1 -0
- package/package.json +5 -1
- package/dist/challengeAssert-D_k_ADgP.cjs +0 -2
- package/dist/challengeAssert-D_k_ADgP.cjs.map +0 -1
- package/dist/challengeAssert-k5_LWUtO.js +0 -362
- package/dist/challengeAssert-k5_LWUtO.js.map +0 -1
- package/dist/constants-EiyZkXce.cjs +0 -2
- package/dist/constants-EiyZkXce.cjs.map +0 -1
- package/dist/constants-Q7v2O7Ps.js.map +0 -1
- package/dist/errors-DVNYib5y.cjs +0 -2
- package/dist/errors-DVNYib5y.cjs.map +0 -1
- package/dist/errors-aMocmFr-.js.map +0 -1
- package/dist/fundPeginTransaction-DpwnDslW.js +0 -50
- package/dist/fundPeginTransaction-DpwnDslW.js.map +0 -1
- package/dist/fundPeginTransaction-EbrZzlrh.cjs +0 -2
- package/dist/fundPeginTransaction-EbrZzlrh.cjs.map +0 -1
- package/dist/index-BX-V3C9t.js +0 -995
- package/dist/index-BX-V3C9t.js.map +0 -1
- package/dist/index-BgnxXV5G.cjs +0 -2
- package/dist/index-BgnxXV5G.cjs.map +0 -1
- package/dist/index-BvFLf3vm.js.map +0 -1
- package/dist/index-DpKhuCta.cjs +0 -2
- package/dist/index-DpKhuCta.cjs.map +0 -1
- package/dist/payout-Ce9vSs9e.js +0 -164
- package/dist/payout-Ce9vSs9e.js.map +0 -1
- package/dist/payout-CfsDnjKI.cjs +0 -2
- package/dist/payout-CfsDnjKI.cjs.map +0 -1
- package/dist/psbtInputFields-C0nKn_GD.cjs +0 -2
- package/dist/psbtInputFields-C0nKn_GD.cjs.map +0 -1
- package/dist/psbtInputFields-DO0ELwiv.js +0 -116
- package/dist/psbtInputFields-DO0ELwiv.js.map +0 -1
- package/dist/signing-Deg5lCoC.cjs +0 -2
- package/dist/signing-Deg5lCoC.cjs.map +0 -1
- package/dist/signing-Drwr3bXB.js +0 -16
- package/dist/signing-Drwr3bXB.js.map +0 -1
- package/dist/types-D1rYwwCu.js +0 -235
- package/dist/types-D1rYwwCu.js.map +0 -1
- package/dist/types-DEWiqXYp.cjs +0 -2
- package/dist/types-DEWiqXYp.cjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var R = (n, e, t) => e in n ?
|
|
3
|
-
var
|
|
4
|
-
import { D as
|
|
5
|
-
const
|
|
6
|
-
async function
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var R = (n, e, t) => e in n ? j(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var h = (n, e, t) => R(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { D as O, J as S, B as m } from "./types-DWjaqVfP.js";
|
|
5
|
+
const N = 21e6 * 1e8, P = 3e4;
|
|
6
|
+
async function g(n, e) {
|
|
7
7
|
const t = new AbortController(), a = setTimeout(
|
|
8
8
|
() => t.abort(),
|
|
9
|
-
|
|
9
|
+
P
|
|
10
10
|
), i = [t.signal, e == null ? void 0 : e.signal].filter(
|
|
11
11
|
Boolean
|
|
12
12
|
);
|
|
@@ -15,15 +15,15 @@ async function f(n, e) {
|
|
|
15
15
|
...e,
|
|
16
16
|
signal: AbortSignal.any(i)
|
|
17
17
|
});
|
|
18
|
-
} catch (
|
|
19
|
-
throw clearTimeout(a),
|
|
20
|
-
`Mempool API request timed out after ${
|
|
21
|
-
) :
|
|
18
|
+
} catch (s) {
|
|
19
|
+
throw clearTimeout(a), s != null && typeof s == "object" && "name" in s && s.name === "AbortError" ? new Error(
|
|
20
|
+
`Mempool API request timed out after ${P}ms: ${n}`
|
|
21
|
+
) : s;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
const C = 1e4;
|
|
25
25
|
function I(n) {
|
|
26
|
-
return Number.isInteger(n) && n > 0 && n <=
|
|
26
|
+
return Number.isInteger(n) && n > 0 && n <= N;
|
|
27
27
|
}
|
|
28
28
|
function K(n) {
|
|
29
29
|
return Number.isInteger(n) && n > 0 && n <= C;
|
|
@@ -31,14 +31,14 @@ function K(n) {
|
|
|
31
31
|
function E(n, e) {
|
|
32
32
|
return !Number.isInteger(n) || n < 0 ? !1 : e === void 0 || n < e;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const U = {
|
|
35
35
|
mainnet: "https://mempool.space/api",
|
|
36
36
|
testnet: "https://mempool.space/testnet/api",
|
|
37
37
|
signet: "https://mempool.space/signet/api"
|
|
38
38
|
};
|
|
39
|
-
async function
|
|
39
|
+
async function d(n, e) {
|
|
40
40
|
try {
|
|
41
|
-
const t = await
|
|
41
|
+
const t = await g(n, e);
|
|
42
42
|
if (!t.ok) {
|
|
43
43
|
const i = await t.text();
|
|
44
44
|
throw new Error(
|
|
@@ -53,7 +53,7 @@ async function y(n, e) {
|
|
|
53
53
|
}
|
|
54
54
|
async function ae(n, e) {
|
|
55
55
|
try {
|
|
56
|
-
const t = await
|
|
56
|
+
const t = await g(`${e}/tx`, {
|
|
57
57
|
method: "POST",
|
|
58
58
|
body: n,
|
|
59
59
|
headers: {
|
|
@@ -62,14 +62,14 @@ async function ae(n, e) {
|
|
|
62
62
|
});
|
|
63
63
|
if (!t.ok) {
|
|
64
64
|
const i = await t.text();
|
|
65
|
-
let
|
|
65
|
+
let s;
|
|
66
66
|
try {
|
|
67
|
-
|
|
67
|
+
s = JSON.parse(i).message;
|
|
68
68
|
} catch {
|
|
69
|
-
|
|
69
|
+
s = i;
|
|
70
70
|
}
|
|
71
71
|
throw new Error(
|
|
72
|
-
|
|
72
|
+
s || `Failed to broadcast transaction: ${t.statusText}`
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
return await t.text();
|
|
@@ -77,12 +77,12 @@ async function ae(n, e) {
|
|
|
77
77
|
throw t instanceof Error ? new Error(`Failed to broadcast BTC transaction: ${t.message}`) : new Error("Failed to broadcast BTC transaction: Unknown error");
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
async function
|
|
81
|
-
return
|
|
80
|
+
async function M(n, e) {
|
|
81
|
+
return d(`${e}/tx/${n}`);
|
|
82
82
|
}
|
|
83
|
-
async function
|
|
83
|
+
async function re(n, e) {
|
|
84
84
|
try {
|
|
85
|
-
const t = await
|
|
85
|
+
const t = await g(`${e}/tx/${n}/hex`);
|
|
86
86
|
if (!t.ok) {
|
|
87
87
|
const a = await t.text();
|
|
88
88
|
throw new Error(
|
|
@@ -94,8 +94,8 @@ async function se(n, e) {
|
|
|
94
94
|
throw t instanceof Error ? new Error(`Failed to get transaction hex for ${n}: ${t.message}`) : new Error(`Failed to get transaction hex for ${n}: Unknown error`);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
async function
|
|
98
|
-
const a = await
|
|
97
|
+
async function se(n, e, t) {
|
|
98
|
+
const a = await M(n, t);
|
|
99
99
|
if (!E(e, a.vout.length))
|
|
100
100
|
throw new Error(
|
|
101
101
|
`Invalid vout ${e} for transaction ${n} (has ${a.vout.length} outputs)`
|
|
@@ -112,25 +112,25 @@ async function re(n, e, t) {
|
|
|
112
112
|
}
|
|
113
113
|
async function ie(n, e) {
|
|
114
114
|
try {
|
|
115
|
-
const t = await
|
|
115
|
+
const t = await d(`${e}/address/${n}/utxo`), a = await d(`${e}/v1/validate-address/${n}`);
|
|
116
116
|
if (!a.isvalid)
|
|
117
117
|
throw new Error(
|
|
118
118
|
`Invalid Bitcoin address: ${n}. Mempool API validation failed.`
|
|
119
119
|
);
|
|
120
|
-
for (const
|
|
121
|
-
if (!E(
|
|
122
|
-
throw new Error(`Invalid vout ${
|
|
123
|
-
if (!I(
|
|
120
|
+
for (const s of t) {
|
|
121
|
+
if (!E(s.vout))
|
|
122
|
+
throw new Error(`Invalid vout ${s.vout} for ${s.txid}`);
|
|
123
|
+
if (!I(s.value))
|
|
124
124
|
throw new Error(
|
|
125
|
-
`Invalid UTXO value ${
|
|
125
|
+
`Invalid UTXO value ${s.value} for ${s.txid}:${s.vout}`
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
|
-
return t.sort((
|
|
129
|
-
txid:
|
|
130
|
-
vout:
|
|
131
|
-
value:
|
|
128
|
+
return t.sort((s, w) => w.value - s.value).map((s) => ({
|
|
129
|
+
txid: s.txid,
|
|
130
|
+
vout: s.vout,
|
|
131
|
+
value: s.value,
|
|
132
132
|
scriptPubKey: a.scriptPubKey,
|
|
133
|
-
confirmed:
|
|
133
|
+
confirmed: s.status.confirmed
|
|
134
134
|
}));
|
|
135
135
|
} catch (t) {
|
|
136
136
|
throw t instanceof Error ? new Error(
|
|
@@ -141,13 +141,13 @@ async function ie(n, e) {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
function oe(n) {
|
|
144
|
-
return
|
|
144
|
+
return U[n];
|
|
145
145
|
}
|
|
146
146
|
async function le(n, e) {
|
|
147
|
-
return
|
|
147
|
+
return d(`${e}/address/${n}/txs`);
|
|
148
148
|
}
|
|
149
|
-
async function
|
|
150
|
-
const e = await
|
|
149
|
+
async function ce(n) {
|
|
150
|
+
const e = await g(`${n}/v1/fees/recommended`);
|
|
151
151
|
if (!e.ok)
|
|
152
152
|
throw new Error(
|
|
153
153
|
`Failed to fetch network fees: ${e.status} ${e.statusText}`
|
|
@@ -170,7 +170,7 @@ async function pe(n) {
|
|
|
170
170
|
);
|
|
171
171
|
return t;
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const b = [
|
|
174
174
|
{
|
|
175
175
|
type: "function",
|
|
176
176
|
name: "getVaultKeepersByVersion",
|
|
@@ -257,377 +257,6 @@ const h = [
|
|
|
257
257
|
],
|
|
258
258
|
stateMutability: "view"
|
|
259
259
|
}
|
|
260
|
-
], m = [
|
|
261
|
-
{
|
|
262
|
-
type: "function",
|
|
263
|
-
name: "submitPeginRequest",
|
|
264
|
-
inputs: [
|
|
265
|
-
{
|
|
266
|
-
name: "depositor",
|
|
267
|
-
type: "address",
|
|
268
|
-
internalType: "address"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: "depositorBtcPubKey",
|
|
272
|
-
type: "bytes32",
|
|
273
|
-
internalType: "bytes32"
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
name: "btcPopSignature",
|
|
277
|
-
type: "bytes",
|
|
278
|
-
internalType: "bytes"
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
name: "unsignedPrePeginTx",
|
|
282
|
-
type: "bytes",
|
|
283
|
-
internalType: "bytes"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: "depositorSignedPeginTx",
|
|
287
|
-
type: "bytes",
|
|
288
|
-
internalType: "bytes"
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
name: "vaultProvider",
|
|
292
|
-
type: "address",
|
|
293
|
-
internalType: "address"
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: "hashlock",
|
|
297
|
-
type: "bytes32",
|
|
298
|
-
internalType: "bytes32"
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
name: "htlcVout",
|
|
302
|
-
type: "uint8",
|
|
303
|
-
internalType: "uint8"
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
name: "depositorPayoutBtcAddress",
|
|
307
|
-
type: "bytes",
|
|
308
|
-
internalType: "bytes"
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
name: "depositorWotsPkHash",
|
|
312
|
-
type: "bytes32",
|
|
313
|
-
internalType: "bytes32"
|
|
314
|
-
}
|
|
315
|
-
],
|
|
316
|
-
outputs: [
|
|
317
|
-
{
|
|
318
|
-
name: "",
|
|
319
|
-
type: "bytes32",
|
|
320
|
-
internalType: "bytes32"
|
|
321
|
-
}
|
|
322
|
-
],
|
|
323
|
-
stateMutability: "payable"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
type: "function",
|
|
327
|
-
name: "submitPeginRequest",
|
|
328
|
-
inputs: [
|
|
329
|
-
{
|
|
330
|
-
name: "depositor",
|
|
331
|
-
type: "address",
|
|
332
|
-
internalType: "address"
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: "depositorBtcPubKey",
|
|
336
|
-
type: "bytes32",
|
|
337
|
-
internalType: "bytes32"
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
name: "btcPopSignature",
|
|
341
|
-
type: "bytes",
|
|
342
|
-
internalType: "bytes"
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
name: "unsignedPrePeginTx",
|
|
346
|
-
type: "bytes",
|
|
347
|
-
internalType: "bytes"
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
name: "depositorSignedPeginTx",
|
|
351
|
-
type: "bytes",
|
|
352
|
-
internalType: "bytes"
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
name: "vaultProvider",
|
|
356
|
-
type: "address",
|
|
357
|
-
internalType: "address"
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
name: "hashlock",
|
|
361
|
-
type: "bytes32",
|
|
362
|
-
internalType: "bytes32"
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
name: "htlcVout",
|
|
366
|
-
type: "uint8",
|
|
367
|
-
internalType: "uint8"
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
name: "referralCode",
|
|
371
|
-
type: "uint32",
|
|
372
|
-
internalType: "uint32"
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
name: "depositorPayoutBtcAddress",
|
|
376
|
-
type: "bytes",
|
|
377
|
-
internalType: "bytes"
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
name: "depositorWotsPkHash",
|
|
381
|
-
type: "bytes32",
|
|
382
|
-
internalType: "bytes32"
|
|
383
|
-
}
|
|
384
|
-
],
|
|
385
|
-
outputs: [
|
|
386
|
-
{
|
|
387
|
-
name: "",
|
|
388
|
-
type: "bytes32",
|
|
389
|
-
internalType: "bytes32"
|
|
390
|
-
}
|
|
391
|
-
],
|
|
392
|
-
stateMutability: "payable"
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
type: "function",
|
|
396
|
-
name: "submitPeginRequestBatch",
|
|
397
|
-
inputs: [
|
|
398
|
-
{ name: "depositor", type: "address", internalType: "address" },
|
|
399
|
-
{ name: "vaultProvider", type: "address", internalType: "address" },
|
|
400
|
-
{
|
|
401
|
-
name: "requests",
|
|
402
|
-
type: "tuple[]",
|
|
403
|
-
internalType: "struct IBTCVaultRegistry.BatchPeginRequest[]",
|
|
404
|
-
components: [
|
|
405
|
-
{ name: "depositorBtcPubKey", type: "bytes32", internalType: "bytes32" },
|
|
406
|
-
{ name: "btcPopSignature", type: "bytes", internalType: "bytes" },
|
|
407
|
-
{ name: "unsignedPrePeginTx", type: "bytes", internalType: "bytes" },
|
|
408
|
-
{ name: "depositorSignedPeginTx", type: "bytes", internalType: "bytes" },
|
|
409
|
-
{ name: "hashlock", type: "bytes32", internalType: "bytes32" },
|
|
410
|
-
{ name: "htlcVout", type: "uint8", internalType: "uint8" },
|
|
411
|
-
{ name: "referralCode", type: "uint32", internalType: "uint32" },
|
|
412
|
-
{ name: "depositorPayoutBtcAddress", type: "bytes", internalType: "bytes" },
|
|
413
|
-
{ name: "depositorWotsPkHash", type: "bytes32", internalType: "bytes32" }
|
|
414
|
-
]
|
|
415
|
-
}
|
|
416
|
-
],
|
|
417
|
-
outputs: [
|
|
418
|
-
{ name: "vaultIds", type: "bytes32[]", internalType: "bytes32[]" }
|
|
419
|
-
],
|
|
420
|
-
stateMutability: "payable"
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
type: "function",
|
|
424
|
-
name: "activateVaultWithSecret",
|
|
425
|
-
inputs: [
|
|
426
|
-
{
|
|
427
|
-
name: "vaultId",
|
|
428
|
-
type: "bytes32",
|
|
429
|
-
internalType: "bytes32"
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
name: "s",
|
|
433
|
-
type: "bytes32",
|
|
434
|
-
internalType: "bytes32"
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
name: "activationMetadata",
|
|
438
|
-
type: "bytes",
|
|
439
|
-
internalType: "bytes"
|
|
440
|
-
}
|
|
441
|
-
],
|
|
442
|
-
outputs: [],
|
|
443
|
-
stateMutability: "nonpayable"
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
type: "function",
|
|
447
|
-
name: "getPegInFee",
|
|
448
|
-
inputs: [
|
|
449
|
-
{
|
|
450
|
-
name: "vaultProvider",
|
|
451
|
-
type: "address",
|
|
452
|
-
internalType: "address"
|
|
453
|
-
}
|
|
454
|
-
],
|
|
455
|
-
outputs: [
|
|
456
|
-
{
|
|
457
|
-
name: "totalFee",
|
|
458
|
-
type: "uint256",
|
|
459
|
-
internalType: "uint256"
|
|
460
|
-
}
|
|
461
|
-
],
|
|
462
|
-
stateMutability: "view"
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
type: "function",
|
|
466
|
-
name: "getBtcVaultBasicInfo",
|
|
467
|
-
inputs: [
|
|
468
|
-
{
|
|
469
|
-
name: "vaultId",
|
|
470
|
-
type: "bytes32",
|
|
471
|
-
internalType: "bytes32"
|
|
472
|
-
}
|
|
473
|
-
],
|
|
474
|
-
outputs: [
|
|
475
|
-
{ name: "depositor", type: "address", internalType: "address" },
|
|
476
|
-
{ name: "depositorBtcPubKey", type: "bytes32", internalType: "bytes32" },
|
|
477
|
-
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
478
|
-
{ name: "vaultProvider", type: "address", internalType: "address" },
|
|
479
|
-
{ name: "status", type: "uint8", internalType: "enum IBTCVaultRegistry.BTCVaultStatus" },
|
|
480
|
-
{ name: "applicationEntryPoint", type: "address", internalType: "address" },
|
|
481
|
-
{ name: "createdAt", type: "uint256", internalType: "uint256" }
|
|
482
|
-
],
|
|
483
|
-
stateMutability: "view"
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
type: "error",
|
|
487
|
-
name: "InvalidPeginFee",
|
|
488
|
-
inputs: [
|
|
489
|
-
{
|
|
490
|
-
name: "provided",
|
|
491
|
-
type: "uint256",
|
|
492
|
-
internalType: "uint256"
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
name: "required",
|
|
496
|
-
type: "uint256",
|
|
497
|
-
internalType: "uint256"
|
|
498
|
-
}
|
|
499
|
-
]
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
type: "error",
|
|
503
|
-
name: "InvalidSecret",
|
|
504
|
-
inputs: []
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
type: "error",
|
|
508
|
-
name: "ActivationDeadlineExpired",
|
|
509
|
-
inputs: []
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
type: "error",
|
|
513
|
-
name: "InvalidHashlock",
|
|
514
|
-
inputs: []
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
type: "error",
|
|
518
|
-
name: "DuplicateHashlock",
|
|
519
|
-
inputs: []
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
type: "error",
|
|
523
|
-
name: "CapExceeded",
|
|
524
|
-
inputs: []
|
|
525
|
-
},
|
|
526
|
-
{
|
|
527
|
-
type: "error",
|
|
528
|
-
name: "InvalidOutputIndex",
|
|
529
|
-
inputs: []
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
type: "error",
|
|
533
|
-
name: "PeginSignaturesIncomplete",
|
|
534
|
-
inputs: []
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
type: "function",
|
|
538
|
-
name: "getBtcVaultProtocolInfo",
|
|
539
|
-
inputs: [
|
|
540
|
-
{
|
|
541
|
-
name: "vaultId",
|
|
542
|
-
type: "bytes32",
|
|
543
|
-
internalType: "bytes32"
|
|
544
|
-
}
|
|
545
|
-
],
|
|
546
|
-
outputs: [
|
|
547
|
-
{
|
|
548
|
-
name: "depositorSignedPeginTx",
|
|
549
|
-
type: "bytes",
|
|
550
|
-
internalType: "bytes"
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
name: "universalChallengersVersion",
|
|
554
|
-
type: "uint32",
|
|
555
|
-
internalType: "uint32"
|
|
556
|
-
},
|
|
557
|
-
{
|
|
558
|
-
name: "appVaultKeepersVersion",
|
|
559
|
-
type: "uint32",
|
|
560
|
-
internalType: "uint32"
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
name: "offchainParamsVersion",
|
|
564
|
-
type: "uint32",
|
|
565
|
-
internalType: "uint32"
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
name: "verifiedAt",
|
|
569
|
-
type: "uint256",
|
|
570
|
-
internalType: "uint256"
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
name: "depositorWotsPkHash",
|
|
574
|
-
type: "bytes32",
|
|
575
|
-
internalType: "bytes32"
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
name: "hashlock",
|
|
579
|
-
type: "bytes32",
|
|
580
|
-
internalType: "bytes32"
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
name: "htlcVout",
|
|
584
|
-
type: "uint8",
|
|
585
|
-
internalType: "uint8"
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
name: "depositorPopSignature",
|
|
589
|
-
type: "bytes",
|
|
590
|
-
internalType: "bytes"
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
name: "prePeginTxHash",
|
|
594
|
-
type: "bytes32",
|
|
595
|
-
internalType: "bytes32"
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
name: "vaultProviderCommissionBps",
|
|
599
|
-
type: "uint16",
|
|
600
|
-
internalType: "uint16"
|
|
601
|
-
}
|
|
602
|
-
],
|
|
603
|
-
stateMutability: "view"
|
|
604
|
-
},
|
|
605
|
-
{
|
|
606
|
-
type: "function",
|
|
607
|
-
name: "protocolParams",
|
|
608
|
-
inputs: [],
|
|
609
|
-
outputs: [
|
|
610
|
-
{
|
|
611
|
-
name: "",
|
|
612
|
-
type: "address",
|
|
613
|
-
internalType: "contract IProtocolParams"
|
|
614
|
-
}
|
|
615
|
-
],
|
|
616
|
-
stateMutability: "view"
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
type: "function",
|
|
620
|
-
name: "applicationRegistry",
|
|
621
|
-
inputs: [],
|
|
622
|
-
outputs: [
|
|
623
|
-
{
|
|
624
|
-
name: "",
|
|
625
|
-
type: "address",
|
|
626
|
-
internalType: "contract IApplicationRegistry"
|
|
627
|
-
}
|
|
628
|
-
],
|
|
629
|
-
stateMutability: "view"
|
|
630
|
-
}
|
|
631
260
|
], l = [
|
|
632
261
|
{
|
|
633
262
|
type: "function",
|
|
@@ -917,41 +546,41 @@ const h = [
|
|
|
917
546
|
],
|
|
918
547
|
stateMutability: "view"
|
|
919
548
|
}
|
|
920
|
-
],
|
|
549
|
+
], T = new Set(Object.values(O)), D = 200;
|
|
921
550
|
function o(n) {
|
|
922
551
|
var e;
|
|
923
552
|
return ((e = JSON.stringify(n)) == null ? void 0 : e.slice(0, D)) ?? "undefined";
|
|
924
553
|
}
|
|
925
554
|
const H = "The vault provider returned an unexpected response. Please try again or contact support.";
|
|
926
|
-
class
|
|
555
|
+
class r extends Error {
|
|
927
556
|
constructor(t) {
|
|
928
557
|
super(H);
|
|
929
|
-
|
|
558
|
+
h(this, "detail");
|
|
930
559
|
this.name = "VpResponseValidationError", this.detail = t;
|
|
931
560
|
}
|
|
932
561
|
}
|
|
933
|
-
const L = /^[0-9a-fA-F]+$/, v = 64, V = 66,
|
|
562
|
+
const L = /^[0-9a-fA-F]+$/, v = 64, V = 66, y = 64;
|
|
934
563
|
function u(n) {
|
|
935
564
|
return typeof n == "string" && n.length > 0 && L.test(n);
|
|
936
565
|
}
|
|
937
|
-
function
|
|
566
|
+
function k(n) {
|
|
938
567
|
return typeof n == "string" && n.length > 0;
|
|
939
568
|
}
|
|
940
|
-
function
|
|
569
|
+
function F(n, e) {
|
|
941
570
|
if (!u(n))
|
|
942
|
-
throw new
|
|
571
|
+
throw new r(
|
|
943
572
|
`VP response validation failed: "${e}" must be a non-empty hex string, got ${o(n)}`
|
|
944
573
|
);
|
|
945
574
|
}
|
|
946
|
-
function
|
|
947
|
-
if (!
|
|
948
|
-
throw new
|
|
575
|
+
function p(n, e) {
|
|
576
|
+
if (!k(n))
|
|
577
|
+
throw new r(
|
|
949
578
|
`VP response validation failed: "${e}" must be a non-empty string, got ${o(n)}`
|
|
950
579
|
);
|
|
951
580
|
}
|
|
952
|
-
function
|
|
581
|
+
function B(n, e) {
|
|
953
582
|
if (!u(n) || n.length !== v && n.length !== V)
|
|
954
|
-
throw new
|
|
583
|
+
throw new r(
|
|
955
584
|
`VP response validation failed: "${e}" must be a ${v} or ${V}-char hex string (BTC pubkey), got ${o(n)}`
|
|
956
585
|
);
|
|
957
586
|
}
|
|
@@ -959,220 +588,220 @@ function X(n) {
|
|
|
959
588
|
const e = n.presigning;
|
|
960
589
|
if (e == null) return;
|
|
961
590
|
if (typeof e != "object" || Array.isArray(e))
|
|
962
|
-
throw new
|
|
591
|
+
throw new r(
|
|
963
592
|
'VP response validation failed: "progress.presigning" must be an object if present'
|
|
964
593
|
);
|
|
965
594
|
const t = e;
|
|
966
595
|
if (t.depositor_graph_created !== void 0 && typeof t.depositor_graph_created != "boolean")
|
|
967
|
-
throw new
|
|
596
|
+
throw new r(
|
|
968
597
|
`VP response validation failed: "progress.presigning.depositor_graph_created" must be a boolean if present, got ${o(t.depositor_graph_created)}`
|
|
969
598
|
);
|
|
970
599
|
if (t.vk_challenger_presigning_completed !== void 0 && typeof t.vk_challenger_presigning_completed != "number")
|
|
971
|
-
throw new
|
|
600
|
+
throw new r(
|
|
972
601
|
`VP response validation failed: "progress.presigning.vk_challenger_presigning_completed" must be a number if present, got ${o(t.vk_challenger_presigning_completed)}`
|
|
973
602
|
);
|
|
974
603
|
if (t.vk_challenger_presigning_total !== void 0 && typeof t.vk_challenger_presigning_total != "number")
|
|
975
|
-
throw new
|
|
604
|
+
throw new r(
|
|
976
605
|
`VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${o(t.vk_challenger_presigning_total)}`
|
|
977
606
|
);
|
|
978
607
|
}
|
|
979
608
|
function q(n) {
|
|
980
609
|
if (n === null || typeof n != "object")
|
|
981
|
-
throw new
|
|
610
|
+
throw new r(
|
|
982
611
|
"VP response validation failed: getPeginStatus response is not an object"
|
|
983
612
|
);
|
|
984
613
|
const e = n;
|
|
985
|
-
if (!u(e.pegin_txid) || e.pegin_txid.length !==
|
|
986
|
-
throw new
|
|
987
|
-
`VP response validation failed: "pegin_txid" must be a ${
|
|
614
|
+
if (!u(e.pegin_txid) || e.pegin_txid.length !== y)
|
|
615
|
+
throw new r(
|
|
616
|
+
`VP response validation failed: "pegin_txid" must be a ${y}-char hex string (txid), got ${o(e.pegin_txid)}`
|
|
988
617
|
);
|
|
989
618
|
if (typeof e.status != "string")
|
|
990
|
-
throw new
|
|
619
|
+
throw new r(
|
|
991
620
|
'VP response validation failed: "status" must be a string'
|
|
992
621
|
);
|
|
993
|
-
if (!
|
|
994
|
-
throw new
|
|
995
|
-
`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...
|
|
622
|
+
if (!T.has(e.status))
|
|
623
|
+
throw new r(
|
|
624
|
+
`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...T].join(", ")}`
|
|
996
625
|
);
|
|
997
626
|
if (e.progress === null || typeof e.progress != "object" || Array.isArray(e.progress))
|
|
998
|
-
throw new
|
|
627
|
+
throw new r(
|
|
999
628
|
'VP response validation failed: "progress" must be an object'
|
|
1000
629
|
);
|
|
1001
630
|
if (X(e.progress), typeof e.health_info != "string")
|
|
1002
|
-
throw new
|
|
631
|
+
throw new r(
|
|
1003
632
|
'VP response validation failed: "health_info" must be a string'
|
|
1004
633
|
);
|
|
1005
634
|
if (e.last_error !== void 0 && typeof e.last_error != "string")
|
|
1006
|
-
throw new
|
|
635
|
+
throw new r(
|
|
1007
636
|
`VP response validation failed: "last_error" must be a string if present, got ${o(e.last_error)}`
|
|
1008
637
|
);
|
|
1009
638
|
}
|
|
1010
|
-
function
|
|
639
|
+
function J(n) {
|
|
1011
640
|
if (n === null || typeof n != "object")
|
|
1012
|
-
throw new
|
|
641
|
+
throw new r(
|
|
1013
642
|
"VP response validation failed: requestDepositorPresignTransactions response is not an object"
|
|
1014
643
|
);
|
|
1015
644
|
const e = n;
|
|
1016
645
|
if (!Array.isArray(e.txs))
|
|
1017
|
-
throw new
|
|
646
|
+
throw new r(
|
|
1018
647
|
'VP response validation failed: "txs" must be an array'
|
|
1019
648
|
);
|
|
1020
649
|
for (let t = 0; t < e.txs.length; t++)
|
|
1021
|
-
|
|
650
|
+
z(e.txs[t], `txs[${t}]`);
|
|
1022
651
|
if (e.depositor_graph === null || typeof e.depositor_graph != "object")
|
|
1023
|
-
throw new
|
|
652
|
+
throw new r(
|
|
1024
653
|
'VP response validation failed: "depositor_graph" must be an object'
|
|
1025
654
|
);
|
|
1026
655
|
Z(
|
|
1027
656
|
e.depositor_graph
|
|
1028
657
|
);
|
|
1029
658
|
}
|
|
1030
|
-
function
|
|
659
|
+
function c(n, e) {
|
|
1031
660
|
if (n === null || typeof n != "object")
|
|
1032
|
-
throw new
|
|
661
|
+
throw new r(
|
|
1033
662
|
`VP response validation failed: "${e}" must be an object`
|
|
1034
663
|
);
|
|
1035
|
-
|
|
664
|
+
F(n.tx_hex, `${e}.tx_hex`);
|
|
1036
665
|
}
|
|
1037
|
-
function
|
|
666
|
+
function z(n, e) {
|
|
1038
667
|
if (n === null || typeof n != "object")
|
|
1039
|
-
throw new
|
|
668
|
+
throw new r(
|
|
1040
669
|
`VP response validation failed: "${e}" must be an object`
|
|
1041
670
|
);
|
|
1042
671
|
const t = n;
|
|
1043
|
-
|
|
672
|
+
B(t.claimer_pubkey, `${e}.claimer_pubkey`), c(t.claim_tx, `${e}.claim_tx`), c(t.assert_tx, `${e}.assert_tx`), c(t.payout_tx, `${e}.payout_tx`), p(t.payout_psbt, `${e}.payout_psbt`);
|
|
1044
673
|
}
|
|
1045
|
-
function
|
|
674
|
+
function Q(n, e) {
|
|
1046
675
|
if (n === null || typeof n != "object")
|
|
1047
|
-
throw new
|
|
676
|
+
throw new r(
|
|
1048
677
|
`VP response validation failed: "${e}" must be an object`
|
|
1049
678
|
);
|
|
1050
679
|
const t = n;
|
|
1051
|
-
|
|
680
|
+
p(t.wots_pks_json, `${e}.wots_pks_json`), p(t.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
|
|
1052
681
|
}
|
|
1053
|
-
function
|
|
682
|
+
function W(n, e) {
|
|
1054
683
|
if (n === null || typeof n != "object")
|
|
1055
|
-
throw new
|
|
684
|
+
throw new r(
|
|
1056
685
|
`VP response validation failed: "${e}" must be an object`
|
|
1057
686
|
);
|
|
1058
687
|
const t = n;
|
|
1059
|
-
if (
|
|
688
|
+
if (B(t.challenger_pubkey, `${e}.challenger_pubkey`), c(
|
|
1060
689
|
t.challenge_assert_x_tx,
|
|
1061
690
|
`${e}.challenge_assert_x_tx`
|
|
1062
|
-
),
|
|
691
|
+
), c(
|
|
1063
692
|
t.challenge_assert_y_tx,
|
|
1064
693
|
`${e}.challenge_assert_y_tx`
|
|
1065
|
-
),
|
|
1066
|
-
throw new
|
|
694
|
+
), c(t.nopayout_tx, `${e}.nopayout_tx`), p(t.nopayout_psbt, `${e}.nopayout_psbt`), !Array.isArray(t.challenge_assert_connectors))
|
|
695
|
+
throw new r(
|
|
1067
696
|
`VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
|
|
1068
697
|
);
|
|
1069
698
|
for (let a = 0; a < t.challenge_assert_connectors.length; a++)
|
|
1070
|
-
|
|
699
|
+
Q(
|
|
1071
700
|
t.challenge_assert_connectors[a],
|
|
1072
701
|
`${e}.challenge_assert_connectors[${a}]`
|
|
1073
702
|
);
|
|
1074
703
|
if (!Array.isArray(t.output_label_hashes))
|
|
1075
|
-
throw new
|
|
704
|
+
throw new r(
|
|
1076
705
|
`VP response validation failed: "${e}.output_label_hashes" must be an array`
|
|
1077
706
|
);
|
|
1078
707
|
for (let a = 0; a < t.output_label_hashes.length; a++)
|
|
1079
|
-
|
|
708
|
+
F(
|
|
1080
709
|
t.output_label_hashes[a],
|
|
1081
710
|
`${e}.output_label_hashes[${a}]`
|
|
1082
711
|
);
|
|
1083
712
|
}
|
|
1084
713
|
function G(n) {
|
|
1085
714
|
if (n === null || typeof n != "object")
|
|
1086
|
-
throw new
|
|
715
|
+
throw new r(
|
|
1087
716
|
"VP response validation failed: requestDepositorClaimerArtifacts response is not an object"
|
|
1088
717
|
);
|
|
1089
718
|
const e = n;
|
|
1090
|
-
if (!
|
|
1091
|
-
throw new
|
|
719
|
+
if (!k(e.tx_graph_json))
|
|
720
|
+
throw new r(
|
|
1092
721
|
`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${o(e.tx_graph_json)}`
|
|
1093
722
|
);
|
|
1094
723
|
if (!u(e.verifying_key_hex))
|
|
1095
|
-
throw new
|
|
724
|
+
throw new r(
|
|
1096
725
|
`VP response validation failed: "verifying_key_hex" must be a non-empty hex string, got ${o(e.verifying_key_hex)}`
|
|
1097
726
|
);
|
|
1098
727
|
if (e.babe_sessions === null || typeof e.babe_sessions != "object")
|
|
1099
|
-
throw new
|
|
728
|
+
throw new r(
|
|
1100
729
|
'VP response validation failed: "babe_sessions" must be an object'
|
|
1101
730
|
);
|
|
1102
731
|
for (const [t, a] of Object.entries(
|
|
1103
732
|
e.babe_sessions
|
|
1104
733
|
)) {
|
|
1105
734
|
if (a === null || typeof a != "object")
|
|
1106
|
-
throw new
|
|
735
|
+
throw new r(
|
|
1107
736
|
`VP response validation failed: "babe_sessions.${t}" must be an object`
|
|
1108
737
|
);
|
|
1109
738
|
const i = a;
|
|
1110
739
|
if (!u(i.decryptor_artifacts_hex))
|
|
1111
|
-
throw new
|
|
740
|
+
throw new r(
|
|
1112
741
|
`VP response validation failed: "babe_sessions.${t}.decryptor_artifacts_hex" must be a non-empty hex string, got ${o(i.decryptor_artifacts_hex)}`
|
|
1113
742
|
);
|
|
1114
743
|
}
|
|
1115
744
|
}
|
|
1116
745
|
function Y(n) {
|
|
1117
746
|
if (n === null || typeof n != "object")
|
|
1118
|
-
throw new
|
|
747
|
+
throw new r(
|
|
1119
748
|
"VP response validation failed: getPegoutStatus response is not an object"
|
|
1120
749
|
);
|
|
1121
750
|
const e = n;
|
|
1122
|
-
if (!u(e.pegin_txid) || e.pegin_txid.length !==
|
|
1123
|
-
throw new
|
|
1124
|
-
`VP response validation failed: "pegin_txid" must be a ${
|
|
751
|
+
if (!u(e.pegin_txid) || e.pegin_txid.length !== y)
|
|
752
|
+
throw new r(
|
|
753
|
+
`VP response validation failed: "pegin_txid" must be a ${y}-char hex string (txid), got ${o(e.pegin_txid)}`
|
|
1125
754
|
);
|
|
1126
755
|
if (typeof e.found != "boolean")
|
|
1127
|
-
throw new
|
|
756
|
+
throw new r(
|
|
1128
757
|
`VP response validation failed: "found" must be a boolean, got ${o(e.found)}`
|
|
1129
758
|
);
|
|
1130
759
|
if (e.claimer !== void 0) {
|
|
1131
760
|
if (e.claimer === null || typeof e.claimer != "object")
|
|
1132
|
-
throw new
|
|
761
|
+
throw new r(
|
|
1133
762
|
'VP response validation failed: "claimer" must be an object if present'
|
|
1134
763
|
);
|
|
1135
764
|
const t = e.claimer;
|
|
1136
765
|
if (typeof t.status != "string")
|
|
1137
|
-
throw new
|
|
766
|
+
throw new r(
|
|
1138
767
|
`VP response validation failed: "claimer.status" must be a string, got ${o(t.status)}`
|
|
1139
768
|
);
|
|
1140
769
|
if (typeof t.failed != "boolean")
|
|
1141
|
-
throw new
|
|
770
|
+
throw new r(
|
|
1142
771
|
`VP response validation failed: "claimer.failed" must be a boolean, got ${o(t.failed)}`
|
|
1143
772
|
);
|
|
1144
773
|
}
|
|
1145
774
|
if (e.challenger !== void 0) {
|
|
1146
775
|
if (e.challenger === null || typeof e.challenger != "object")
|
|
1147
|
-
throw new
|
|
776
|
+
throw new r(
|
|
1148
777
|
'VP response validation failed: "challenger" must be an object if present'
|
|
1149
778
|
);
|
|
1150
779
|
const t = e.challenger;
|
|
1151
780
|
if (typeof t.status != "string")
|
|
1152
|
-
throw new
|
|
781
|
+
throw new r(
|
|
1153
782
|
`VP response validation failed: "challenger.status" must be a string, got ${o(t.status)}`
|
|
1154
783
|
);
|
|
1155
784
|
}
|
|
1156
785
|
}
|
|
1157
786
|
function Z(n) {
|
|
1158
|
-
if (
|
|
1159
|
-
throw new
|
|
787
|
+
if (c(n.claim_tx, "depositor_graph.claim_tx"), c(n.assert_tx, "depositor_graph.assert_tx"), c(n.payout_tx, "depositor_graph.payout_tx"), p(n.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(n.challenger_presign_data))
|
|
788
|
+
throw new r(
|
|
1160
789
|
'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
|
|
1161
790
|
);
|
|
1162
791
|
for (let e = 0; e < n.challenger_presign_data.length; e++)
|
|
1163
|
-
|
|
792
|
+
W(
|
|
1164
793
|
n.challenger_presign_data[e],
|
|
1165
794
|
`depositor_graph.challenger_presign_data[${e}]`
|
|
1166
795
|
);
|
|
1167
796
|
if (typeof n.offchain_params_version != "number")
|
|
1168
|
-
throw new
|
|
797
|
+
throw new r(
|
|
1169
798
|
'VP response validation failed: "depositor_graph.offchain_params_version" must be a number'
|
|
1170
799
|
);
|
|
1171
800
|
}
|
|
1172
801
|
const ee = 6e4;
|
|
1173
802
|
class ue {
|
|
1174
803
|
constructor(e, t) {
|
|
1175
|
-
|
|
804
|
+
h(this, "client");
|
|
1176
805
|
const a = {
|
|
1177
806
|
baseUrl: e,
|
|
1178
807
|
timeout: (t == null ? void 0 : t.timeout) ?? ee,
|
|
@@ -1181,7 +810,7 @@ class ue {
|
|
|
1181
810
|
retryableFor: t == null ? void 0 : t.retryableFor,
|
|
1182
811
|
headers: t == null ? void 0 : t.headers
|
|
1183
812
|
};
|
|
1184
|
-
this.client = new
|
|
813
|
+
this.client = new S(a);
|
|
1185
814
|
}
|
|
1186
815
|
/**
|
|
1187
816
|
* Request the payout/claim/assert transactions that the depositor
|
|
@@ -1189,7 +818,7 @@ class ue {
|
|
|
1189
818
|
*/
|
|
1190
819
|
async requestDepositorPresignTransactions(e, t) {
|
|
1191
820
|
const a = await this.client.call("vaultProvider_requestDepositorPresignTransactions", e, t);
|
|
1192
|
-
return
|
|
821
|
+
return J(a), a;
|
|
1193
822
|
}
|
|
1194
823
|
/**
|
|
1195
824
|
* Submit the depositor's pre-signatures for the payout transactions
|
|
@@ -1241,7 +870,7 @@ class ue {
|
|
|
1241
870
|
return Y(a), a;
|
|
1242
871
|
}
|
|
1243
872
|
}
|
|
1244
|
-
async function
|
|
873
|
+
async function pe(n, e) {
|
|
1245
874
|
const [t, a] = await n.multicall({
|
|
1246
875
|
contracts: [
|
|
1247
876
|
{
|
|
@@ -1263,7 +892,7 @@ async function ce(n, e) {
|
|
|
1263
892
|
};
|
|
1264
893
|
}
|
|
1265
894
|
const x = 65535;
|
|
1266
|
-
function
|
|
895
|
+
function _(n) {
|
|
1267
896
|
return {
|
|
1268
897
|
timelockAssert: n.timelockAssert,
|
|
1269
898
|
timelockChallengeAssert: n.timelockChallengeAssert,
|
|
@@ -1296,7 +925,7 @@ function $(n) {
|
|
|
1296
925
|
);
|
|
1297
926
|
return Number(n);
|
|
1298
927
|
}
|
|
1299
|
-
class
|
|
928
|
+
class me {
|
|
1300
929
|
constructor(e, t) {
|
|
1301
930
|
this.publicClient = e, this.contractAddress = t;
|
|
1302
931
|
}
|
|
@@ -1314,7 +943,7 @@ class ye {
|
|
|
1314
943
|
abi: l,
|
|
1315
944
|
functionName: "getLatestOffchainParams"
|
|
1316
945
|
});
|
|
1317
|
-
return
|
|
946
|
+
return _(e);
|
|
1318
947
|
}
|
|
1319
948
|
async getOffchainParamsByVersion(e) {
|
|
1320
949
|
const t = await this.publicClient.readContract({
|
|
@@ -1323,7 +952,7 @@ class ye {
|
|
|
1323
952
|
functionName: "getOffchainParamsByVersion",
|
|
1324
953
|
args: [e]
|
|
1325
954
|
});
|
|
1326
|
-
return
|
|
955
|
+
return _(t);
|
|
1327
956
|
}
|
|
1328
957
|
async getLatestOffchainParamsVersion() {
|
|
1329
958
|
return await this.publicClient.readContract({
|
|
@@ -1355,7 +984,7 @@ class ye {
|
|
|
1355
984
|
}
|
|
1356
985
|
],
|
|
1357
986
|
allowFailure: !1
|
|
1358
|
-
}), t = A(e[0]), a =
|
|
987
|
+
}), t = A(e[0]), a = _(e[1]);
|
|
1359
988
|
return {
|
|
1360
989
|
minimumPegInAmount: t.minimumPegInAmount,
|
|
1361
990
|
maxPegInAmount: t.maxPegInAmount,
|
|
@@ -1369,44 +998,44 @@ class ye {
|
|
|
1369
998
|
};
|
|
1370
999
|
}
|
|
1371
1000
|
}
|
|
1372
|
-
function
|
|
1001
|
+
function f(n) {
|
|
1373
1002
|
return n.map((e) => ({
|
|
1374
1003
|
ethAddress: e.ethAddress,
|
|
1375
1004
|
btcPubKey: e.btcPubKey
|
|
1376
1005
|
}));
|
|
1377
1006
|
}
|
|
1378
|
-
class
|
|
1007
|
+
class de {
|
|
1379
1008
|
constructor(e, t) {
|
|
1380
1009
|
this.publicClient = e, this.contractAddress = t;
|
|
1381
1010
|
}
|
|
1382
1011
|
async getVaultKeepersByVersion(e, t) {
|
|
1383
1012
|
const a = await this.publicClient.readContract({
|
|
1384
1013
|
address: this.contractAddress,
|
|
1385
|
-
abi:
|
|
1014
|
+
abi: b,
|
|
1386
1015
|
functionName: "getVaultKeepersByVersion",
|
|
1387
1016
|
args: [e, t]
|
|
1388
1017
|
});
|
|
1389
|
-
return
|
|
1018
|
+
return f(a);
|
|
1390
1019
|
}
|
|
1391
1020
|
async getCurrentVaultKeepers(e) {
|
|
1392
1021
|
const t = await this.publicClient.readContract({
|
|
1393
1022
|
address: this.contractAddress,
|
|
1394
|
-
abi:
|
|
1023
|
+
abi: b,
|
|
1395
1024
|
functionName: "getCurrentVaultKeepers",
|
|
1396
1025
|
args: [e]
|
|
1397
1026
|
});
|
|
1398
|
-
return
|
|
1027
|
+
return f(t);
|
|
1399
1028
|
}
|
|
1400
1029
|
async getCurrentVaultKeepersVersion(e) {
|
|
1401
1030
|
return await this.publicClient.readContract({
|
|
1402
1031
|
address: this.contractAddress,
|
|
1403
|
-
abi:
|
|
1032
|
+
abi: b,
|
|
1404
1033
|
functionName: "getCurrentVaultKeepersVersion",
|
|
1405
1034
|
args: [e]
|
|
1406
1035
|
});
|
|
1407
1036
|
}
|
|
1408
1037
|
}
|
|
1409
|
-
class
|
|
1038
|
+
class ye {
|
|
1410
1039
|
constructor(e, t) {
|
|
1411
1040
|
this.publicClient = e, this.contractAddress = t;
|
|
1412
1041
|
}
|
|
@@ -1417,7 +1046,7 @@ class de {
|
|
|
1417
1046
|
functionName: "getUniversalChallengersByVersion",
|
|
1418
1047
|
args: [e]
|
|
1419
1048
|
});
|
|
1420
|
-
return
|
|
1049
|
+
return f(t);
|
|
1421
1050
|
}
|
|
1422
1051
|
async getCurrentUniversalChallengers() {
|
|
1423
1052
|
const e = await this.publicClient.readContract({
|
|
@@ -1425,7 +1054,7 @@ class de {
|
|
|
1425
1054
|
abi: l,
|
|
1426
1055
|
functionName: "getCurrentUniversalChallengers"
|
|
1427
1056
|
});
|
|
1428
|
-
return
|
|
1057
|
+
return f(e);
|
|
1429
1058
|
}
|
|
1430
1059
|
async getLatestUniversalChallengersVersion() {
|
|
1431
1060
|
return await this.publicClient.readContract({
|
|
@@ -1435,7 +1064,7 @@ class de {
|
|
|
1435
1064
|
});
|
|
1436
1065
|
}
|
|
1437
1066
|
}
|
|
1438
|
-
class
|
|
1067
|
+
class fe {
|
|
1439
1068
|
constructor(e, t) {
|
|
1440
1069
|
this.publicClient = e, this.contractAddress = t;
|
|
1441
1070
|
}
|
|
@@ -1490,24 +1119,23 @@ class ge {
|
|
|
1490
1119
|
}
|
|
1491
1120
|
}
|
|
1492
1121
|
export {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
N as M,
|
|
1122
|
+
b as A,
|
|
1123
|
+
U as M,
|
|
1496
1124
|
l as P,
|
|
1497
1125
|
ue as V,
|
|
1498
1126
|
ie as a,
|
|
1499
1127
|
oe as b,
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1128
|
+
ce as c,
|
|
1129
|
+
re as d,
|
|
1130
|
+
M as e,
|
|
1131
|
+
se as f,
|
|
1504
1132
|
le as g,
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1133
|
+
r as h,
|
|
1134
|
+
me as i,
|
|
1135
|
+
ye as j,
|
|
1136
|
+
de as k,
|
|
1137
|
+
fe as l,
|
|
1510
1138
|
ae as p,
|
|
1511
|
-
|
|
1139
|
+
pe as r
|
|
1512
1140
|
};
|
|
1513
|
-
//# sourceMappingURL=index-
|
|
1141
|
+
//# sourceMappingURL=index-CFwoGJNQ.js.map
|