@babylonlabs-io/ts-sdk 0.20.1 → 0.22.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 +14 -6
- package/dist/{errors-D_PI__IT.js → errors-CkkL1ztr.js} +338 -328
- package/dist/errors-CkkL1ztr.js.map +1 -0
- package/dist/errors-D2H46Yut.cjs +2 -0
- package/dist/errors-D2H46Yut.cjs.map +1 -0
- package/dist/index-BAECy2oz.cjs +2 -0
- package/dist/index-BAECy2oz.cjs.map +1 -0
- package/dist/{index-CFwoGJNQ.js → index-DLtpqdlu.js} +141 -115
- package/dist/index-DLtpqdlu.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +124 -117
- package/dist/index.js.map +1 -1
- package/dist/shared/wallets/index.d.ts +8 -0
- package/dist/shared/wallets/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.d.ts +3 -2
- package/dist/tbv/core/clients/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.js +16 -15
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/index.d.ts +1 -1
- package/dist/tbv/core/clients/vault-provider/index.d.ts.map +1 -1
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +120 -113
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.d.ts +15 -62
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/services/index.d.ts +2 -4
- package/dist/tbv/core/services/index.d.ts.map +1 -1
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.d.ts +2 -7
- package/dist/tbv/core/utils/index.d.ts.map +1 -1
- package/dist/tbv/core/utils/index.js +37 -31
- package/dist/tbv/core/utils/index.js.map +1 -1
- package/dist/tbv/core/utils/validation.d.ts +35 -0
- package/dist/tbv/core/utils/validation.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +120 -113
- package/dist/tbv/index.js.map +1 -1
- package/dist/validation-CxqROCno.js +15 -0
- package/dist/validation-CxqROCno.js.map +1 -0
- package/dist/validation-u8W7Lp2x.cjs +2 -0
- package/dist/validation-u8W7Lp2x.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/errors-D9EtjJoD.cjs +0 -2
- package/dist/errors-D9EtjJoD.cjs.map +0 -1
- package/dist/errors-D_PI__IT.js.map +0 -1
- package/dist/index-BpXpESWu.cjs +0 -2
- package/dist/index-BpXpESWu.cjs.map +0 -1
- package/dist/index-CFwoGJNQ.js.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var N = (n, e, t) => e in n ? O(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var b = (n, e, t) => N(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { B as K, H as D, K as U, T as M } from "./validation-CxqROCno.js";
|
|
5
|
+
import { D as H, J as X, B as m } from "./types-DWjaqVfP.js";
|
|
6
|
+
const L = 21e6 * 1e8, T = 3e4;
|
|
6
7
|
async function g(n, e) {
|
|
7
8
|
const t = new AbortController(), a = setTimeout(
|
|
8
9
|
() => t.abort(),
|
|
9
|
-
|
|
10
|
+
T
|
|
10
11
|
), i = [t.signal, e == null ? void 0 : e.signal].filter(
|
|
11
12
|
Boolean
|
|
12
13
|
);
|
|
@@ -17,21 +18,41 @@ async function g(n, e) {
|
|
|
17
18
|
});
|
|
18
19
|
} catch (s) {
|
|
19
20
|
throw clearTimeout(a), s != null && typeof s == "object" && "name" in s && s.name === "AbortError" ? new Error(
|
|
20
|
-
`Mempool API request timed out after ${
|
|
21
|
+
`Mempool API request timed out after ${T}ms: ${n}`
|
|
21
22
|
) : s;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
return Number.isInteger(n) && n > 0 && n <=
|
|
25
|
+
const I = 1e4;
|
|
26
|
+
function E(n) {
|
|
27
|
+
return Number.isInteger(n) && n > 0 && n <= L;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
return Number.isInteger(n) && n > 0 && n <=
|
|
29
|
+
function q(n) {
|
|
30
|
+
return Number.isInteger(n) && n > 0 && n <= I;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function k(n, e) {
|
|
32
33
|
return !Number.isInteger(n) || n < 0 ? !1 : e === void 0 || n < e;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
function h(n) {
|
|
36
|
+
if (!M.test(n))
|
|
37
|
+
throw new Error(`Invalid transaction ID format: ${n}`);
|
|
38
|
+
}
|
|
39
|
+
function B(n) {
|
|
40
|
+
if (!K.test(n))
|
|
41
|
+
throw new Error(`Invalid Bitcoin address format: ${n}`);
|
|
42
|
+
}
|
|
43
|
+
function F(n, e) {
|
|
44
|
+
if (!D.test(n))
|
|
45
|
+
throw new Error(
|
|
46
|
+
`Invalid scriptPubKey: not valid hex for ${e}`
|
|
47
|
+
);
|
|
48
|
+
if (!U.some(
|
|
49
|
+
(a) => n.toLowerCase().startsWith(a)
|
|
50
|
+
))
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Unrecognized scriptPubKey type for ${e}: prefix ${n.slice(0, 6)} does not match any known Bitcoin script type`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
const W = {
|
|
35
56
|
mainnet: "https://mempool.space/api",
|
|
36
57
|
testnet: "https://mempool.space/testnet/api",
|
|
37
58
|
signet: "https://mempool.space/signet/api"
|
|
@@ -51,7 +72,7 @@ async function d(n, e) {
|
|
|
51
72
|
throw t instanceof Error ? new Error(`Failed to fetch from mempool API: ${t.message}`) : new Error("Failed to fetch from mempool API: Unknown error");
|
|
52
73
|
}
|
|
53
74
|
}
|
|
54
|
-
async function
|
|
75
|
+
async function pe(n, e) {
|
|
55
76
|
try {
|
|
56
77
|
const t = await g(`${e}/tx`, {
|
|
57
78
|
method: "POST",
|
|
@@ -77,10 +98,11 @@ async function ae(n, e) {
|
|
|
77
98
|
throw t instanceof Error ? new Error(`Failed to broadcast BTC transaction: ${t.message}`) : new Error("Failed to broadcast BTC transaction: Unknown error");
|
|
78
99
|
}
|
|
79
100
|
}
|
|
80
|
-
async function
|
|
81
|
-
return d(`${e}/tx/${n}`);
|
|
101
|
+
async function z(n, e) {
|
|
102
|
+
return h(n), d(`${e}/tx/${n}`);
|
|
82
103
|
}
|
|
83
|
-
async function
|
|
104
|
+
async function me(n, e) {
|
|
105
|
+
h(n);
|
|
84
106
|
try {
|
|
85
107
|
const t = await g(`${e}/tx/${n}/hex`);
|
|
86
108
|
if (!t.ok) {
|
|
@@ -94,38 +116,41 @@ async function re(n, e) {
|
|
|
94
116
|
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
117
|
}
|
|
96
118
|
}
|
|
97
|
-
async function
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
async function de(n, e, t) {
|
|
120
|
+
h(n);
|
|
121
|
+
const a = await z(n, t);
|
|
122
|
+
if (!k(e, a.vout.length))
|
|
100
123
|
throw new Error(
|
|
101
124
|
`Invalid vout ${e} for transaction ${n} (has ${a.vout.length} outputs)`
|
|
102
125
|
);
|
|
103
126
|
const i = a.vout[e];
|
|
104
|
-
if (!
|
|
127
|
+
if (!E(i.value))
|
|
105
128
|
throw new Error(`Invalid UTXO value ${i.value} for ${n}:${e}`);
|
|
106
|
-
return {
|
|
129
|
+
return F(i.scriptpubkey, `${n}:${e}`), {
|
|
107
130
|
txid: n,
|
|
108
131
|
vout: e,
|
|
109
132
|
value: i.value,
|
|
110
133
|
scriptPubKey: i.scriptpubkey
|
|
111
134
|
};
|
|
112
135
|
}
|
|
113
|
-
async function
|
|
136
|
+
async function ye(n, e) {
|
|
137
|
+
B(n);
|
|
114
138
|
try {
|
|
115
139
|
const t = await d(`${e}/address/${n}/utxo`), a = await d(`${e}/v1/validate-address/${n}`);
|
|
116
140
|
if (!a.isvalid)
|
|
117
141
|
throw new Error(
|
|
118
142
|
`Invalid Bitcoin address: ${n}. Mempool API validation failed.`
|
|
119
143
|
);
|
|
144
|
+
F(a.scriptPubKey, n);
|
|
120
145
|
for (const s of t) {
|
|
121
|
-
if (!
|
|
146
|
+
if (h(s.txid), !k(s.vout))
|
|
122
147
|
throw new Error(`Invalid vout ${s.vout} for ${s.txid}`);
|
|
123
|
-
if (!
|
|
148
|
+
if (!E(s.value))
|
|
124
149
|
throw new Error(
|
|
125
150
|
`Invalid UTXO value ${s.value} for ${s.txid}:${s.vout}`
|
|
126
151
|
);
|
|
127
152
|
}
|
|
128
|
-
return t.sort((s,
|
|
153
|
+
return t.sort((s, P) => P.value - s.value).map((s) => ({
|
|
129
154
|
txid: s.txid,
|
|
130
155
|
vout: s.vout,
|
|
131
156
|
value: s.value,
|
|
@@ -140,13 +165,13 @@ async function ie(n, e) {
|
|
|
140
165
|
);
|
|
141
166
|
}
|
|
142
167
|
}
|
|
143
|
-
function
|
|
144
|
-
return
|
|
168
|
+
function fe(n) {
|
|
169
|
+
return W[n];
|
|
145
170
|
}
|
|
146
|
-
async function
|
|
147
|
-
return d(`${e}/address/${n}/txs`);
|
|
171
|
+
async function ge(n, e) {
|
|
172
|
+
return B(n), d(`${e}/address/${n}/txs`);
|
|
148
173
|
}
|
|
149
|
-
async function
|
|
174
|
+
async function he(n) {
|
|
150
175
|
const e = await g(`${n}/v1/fees/recommended`);
|
|
151
176
|
if (!e.ok)
|
|
152
177
|
throw new Error(
|
|
@@ -160,9 +185,9 @@ async function ce(n) {
|
|
|
160
185
|
"minimumFee"
|
|
161
186
|
];
|
|
162
187
|
for (const i of a)
|
|
163
|
-
if (!
|
|
188
|
+
if (!q(t[i]))
|
|
164
189
|
throw new Error(
|
|
165
|
-
`Invalid fee rate ${i}=${t[i]} from mempool API: expected a positive number ≤ ${
|
|
190
|
+
`Invalid fee rate ${i}=${t[i]} from mempool API: expected a positive number ≤ ${I}`
|
|
166
191
|
);
|
|
167
192
|
if (t.minimumFee > t.economyFee || t.economyFee > t.hourFee || t.hourFee > t.halfHourFee || t.halfHourFee > t.fastestFee)
|
|
168
193
|
throw new Error(
|
|
@@ -170,7 +195,7 @@ async function ce(n) {
|
|
|
170
195
|
);
|
|
171
196
|
return t;
|
|
172
197
|
}
|
|
173
|
-
const
|
|
198
|
+
const _ = [
|
|
174
199
|
{
|
|
175
200
|
type: "function",
|
|
176
201
|
name: "getVaultKeepersByVersion",
|
|
@@ -546,45 +571,45 @@ const b = [
|
|
|
546
571
|
],
|
|
547
572
|
stateMutability: "view"
|
|
548
573
|
}
|
|
549
|
-
],
|
|
574
|
+
], v = new Set(Object.values(H)), J = 200;
|
|
550
575
|
function o(n) {
|
|
551
576
|
var e;
|
|
552
|
-
return ((e = JSON.stringify(n)) == null ? void 0 : e.slice(0,
|
|
577
|
+
return ((e = JSON.stringify(n)) == null ? void 0 : e.slice(0, J)) ?? "undefined";
|
|
553
578
|
}
|
|
554
|
-
const
|
|
579
|
+
const Q = "The vault provider returned an unexpected response. Please try again or contact support.";
|
|
555
580
|
class r extends Error {
|
|
556
581
|
constructor(t) {
|
|
557
|
-
super(
|
|
558
|
-
|
|
582
|
+
super(Q);
|
|
583
|
+
b(this, "detail");
|
|
559
584
|
this.name = "VpResponseValidationError", this.detail = t;
|
|
560
585
|
}
|
|
561
586
|
}
|
|
562
|
-
const
|
|
587
|
+
const G = /^[0-9a-fA-F]+$/, V = 64, A = 66, y = 64;
|
|
563
588
|
function u(n) {
|
|
564
|
-
return typeof n == "string" && n.length > 0 &&
|
|
589
|
+
return typeof n == "string" && n.length > 0 && G.test(n);
|
|
565
590
|
}
|
|
566
|
-
function
|
|
591
|
+
function R(n) {
|
|
567
592
|
return typeof n == "string" && n.length > 0;
|
|
568
593
|
}
|
|
569
|
-
function
|
|
594
|
+
function j(n, e) {
|
|
570
595
|
if (!u(n))
|
|
571
596
|
throw new r(
|
|
572
597
|
`VP response validation failed: "${e}" must be a non-empty hex string, got ${o(n)}`
|
|
573
598
|
);
|
|
574
599
|
}
|
|
575
600
|
function p(n, e) {
|
|
576
|
-
if (!
|
|
601
|
+
if (!R(n))
|
|
577
602
|
throw new r(
|
|
578
603
|
`VP response validation failed: "${e}" must be a non-empty string, got ${o(n)}`
|
|
579
604
|
);
|
|
580
605
|
}
|
|
581
|
-
function
|
|
582
|
-
if (!u(n) || n.length !==
|
|
606
|
+
function S(n, e) {
|
|
607
|
+
if (!u(n) || n.length !== V && n.length !== A)
|
|
583
608
|
throw new r(
|
|
584
|
-
`VP response validation failed: "${e}" must be a ${
|
|
609
|
+
`VP response validation failed: "${e}" must be a ${V} or ${A}-char hex string (BTC pubkey), got ${o(n)}`
|
|
585
610
|
);
|
|
586
611
|
}
|
|
587
|
-
function
|
|
612
|
+
function Y(n) {
|
|
588
613
|
const e = n.presigning;
|
|
589
614
|
if (e == null) return;
|
|
590
615
|
if (typeof e != "object" || Array.isArray(e))
|
|
@@ -605,7 +630,7 @@ function X(n) {
|
|
|
605
630
|
`VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${o(t.vk_challenger_presigning_total)}`
|
|
606
631
|
);
|
|
607
632
|
}
|
|
608
|
-
function
|
|
633
|
+
function Z(n) {
|
|
609
634
|
if (n === null || typeof n != "object")
|
|
610
635
|
throw new r(
|
|
611
636
|
"VP response validation failed: getPeginStatus response is not an object"
|
|
@@ -619,15 +644,15 @@ function q(n) {
|
|
|
619
644
|
throw new r(
|
|
620
645
|
'VP response validation failed: "status" must be a string'
|
|
621
646
|
);
|
|
622
|
-
if (!
|
|
647
|
+
if (!v.has(e.status))
|
|
623
648
|
throw new r(
|
|
624
|
-
`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...
|
|
649
|
+
`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...v].join(", ")}`
|
|
625
650
|
);
|
|
626
651
|
if (e.progress === null || typeof e.progress != "object" || Array.isArray(e.progress))
|
|
627
652
|
throw new r(
|
|
628
653
|
'VP response validation failed: "progress" must be an object'
|
|
629
654
|
);
|
|
630
|
-
if (
|
|
655
|
+
if (Y(e.progress), typeof e.health_info != "string")
|
|
631
656
|
throw new r(
|
|
632
657
|
'VP response validation failed: "health_info" must be a string'
|
|
633
658
|
);
|
|
@@ -636,7 +661,7 @@ function q(n) {
|
|
|
636
661
|
`VP response validation failed: "last_error" must be a string if present, got ${o(e.last_error)}`
|
|
637
662
|
);
|
|
638
663
|
}
|
|
639
|
-
function
|
|
664
|
+
function ee(n) {
|
|
640
665
|
if (n === null || typeof n != "object")
|
|
641
666
|
throw new r(
|
|
642
667
|
"VP response validation failed: requestDepositorPresignTransactions response is not an object"
|
|
@@ -647,12 +672,12 @@ function J(n) {
|
|
|
647
672
|
'VP response validation failed: "txs" must be an array'
|
|
648
673
|
);
|
|
649
674
|
for (let t = 0; t < e.txs.length; t++)
|
|
650
|
-
|
|
675
|
+
te(e.txs[t], `txs[${t}]`);
|
|
651
676
|
if (e.depositor_graph === null || typeof e.depositor_graph != "object")
|
|
652
677
|
throw new r(
|
|
653
678
|
'VP response validation failed: "depositor_graph" must be an object'
|
|
654
679
|
);
|
|
655
|
-
|
|
680
|
+
ie(
|
|
656
681
|
e.depositor_graph
|
|
657
682
|
);
|
|
658
683
|
}
|
|
@@ -661,17 +686,17 @@ function c(n, e) {
|
|
|
661
686
|
throw new r(
|
|
662
687
|
`VP response validation failed: "${e}" must be an object`
|
|
663
688
|
);
|
|
664
|
-
|
|
689
|
+
j(n.tx_hex, `${e}.tx_hex`);
|
|
665
690
|
}
|
|
666
|
-
function
|
|
691
|
+
function te(n, e) {
|
|
667
692
|
if (n === null || typeof n != "object")
|
|
668
693
|
throw new r(
|
|
669
694
|
`VP response validation failed: "${e}" must be an object`
|
|
670
695
|
);
|
|
671
696
|
const t = n;
|
|
672
|
-
|
|
697
|
+
S(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`);
|
|
673
698
|
}
|
|
674
|
-
function
|
|
699
|
+
function ne(n, e) {
|
|
675
700
|
if (n === null || typeof n != "object")
|
|
676
701
|
throw new r(
|
|
677
702
|
`VP response validation failed: "${e}" must be an object`
|
|
@@ -679,13 +704,13 @@ function Q(n, e) {
|
|
|
679
704
|
const t = n;
|
|
680
705
|
p(t.wots_pks_json, `${e}.wots_pks_json`), p(t.gc_wots_keys_json, `${e}.gc_wots_keys_json`);
|
|
681
706
|
}
|
|
682
|
-
function
|
|
707
|
+
function ae(n, e) {
|
|
683
708
|
if (n === null || typeof n != "object")
|
|
684
709
|
throw new r(
|
|
685
710
|
`VP response validation failed: "${e}" must be an object`
|
|
686
711
|
);
|
|
687
712
|
const t = n;
|
|
688
|
-
if (
|
|
713
|
+
if (S(t.challenger_pubkey, `${e}.challenger_pubkey`), c(
|
|
689
714
|
t.challenge_assert_x_tx,
|
|
690
715
|
`${e}.challenge_assert_x_tx`
|
|
691
716
|
), c(
|
|
@@ -696,7 +721,7 @@ function W(n, e) {
|
|
|
696
721
|
`VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
|
|
697
722
|
);
|
|
698
723
|
for (let a = 0; a < t.challenge_assert_connectors.length; a++)
|
|
699
|
-
|
|
724
|
+
ne(
|
|
700
725
|
t.challenge_assert_connectors[a],
|
|
701
726
|
`${e}.challenge_assert_connectors[${a}]`
|
|
702
727
|
);
|
|
@@ -705,18 +730,18 @@ function W(n, e) {
|
|
|
705
730
|
`VP response validation failed: "${e}.output_label_hashes" must be an array`
|
|
706
731
|
);
|
|
707
732
|
for (let a = 0; a < t.output_label_hashes.length; a++)
|
|
708
|
-
|
|
733
|
+
j(
|
|
709
734
|
t.output_label_hashes[a],
|
|
710
735
|
`${e}.output_label_hashes[${a}]`
|
|
711
736
|
);
|
|
712
737
|
}
|
|
713
|
-
function
|
|
738
|
+
function re(n) {
|
|
714
739
|
if (n === null || typeof n != "object")
|
|
715
740
|
throw new r(
|
|
716
741
|
"VP response validation failed: requestDepositorClaimerArtifacts response is not an object"
|
|
717
742
|
);
|
|
718
743
|
const e = n;
|
|
719
|
-
if (!
|
|
744
|
+
if (!R(e.tx_graph_json))
|
|
720
745
|
throw new r(
|
|
721
746
|
`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${o(e.tx_graph_json)}`
|
|
722
747
|
);
|
|
@@ -742,7 +767,7 @@ function G(n) {
|
|
|
742
767
|
);
|
|
743
768
|
}
|
|
744
769
|
}
|
|
745
|
-
function
|
|
770
|
+
function se(n) {
|
|
746
771
|
if (n === null || typeof n != "object")
|
|
747
772
|
throw new r(
|
|
748
773
|
"VP response validation failed: getPegoutStatus response is not an object"
|
|
@@ -783,13 +808,13 @@ function Y(n) {
|
|
|
783
808
|
);
|
|
784
809
|
}
|
|
785
810
|
}
|
|
786
|
-
function
|
|
811
|
+
function ie(n) {
|
|
787
812
|
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
813
|
throw new r(
|
|
789
814
|
'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
|
|
790
815
|
);
|
|
791
816
|
for (let e = 0; e < n.challenger_presign_data.length; e++)
|
|
792
|
-
|
|
817
|
+
ae(
|
|
793
818
|
n.challenger_presign_data[e],
|
|
794
819
|
`depositor_graph.challenger_presign_data[${e}]`
|
|
795
820
|
);
|
|
@@ -798,19 +823,19 @@ function Z(n) {
|
|
|
798
823
|
'VP response validation failed: "depositor_graph.offchain_params_version" must be a number'
|
|
799
824
|
);
|
|
800
825
|
}
|
|
801
|
-
const
|
|
802
|
-
class
|
|
826
|
+
const oe = 6e4;
|
|
827
|
+
class be {
|
|
803
828
|
constructor(e, t) {
|
|
804
|
-
|
|
829
|
+
b(this, "client");
|
|
805
830
|
const a = {
|
|
806
831
|
baseUrl: e,
|
|
807
|
-
timeout: (t == null ? void 0 : t.timeout) ??
|
|
832
|
+
timeout: (t == null ? void 0 : t.timeout) ?? oe,
|
|
808
833
|
retries: t == null ? void 0 : t.retries,
|
|
809
834
|
retryDelay: t == null ? void 0 : t.retryDelay,
|
|
810
835
|
retryableFor: t == null ? void 0 : t.retryableFor,
|
|
811
836
|
headers: t == null ? void 0 : t.headers
|
|
812
837
|
};
|
|
813
|
-
this.client = new
|
|
838
|
+
this.client = new X(a);
|
|
814
839
|
}
|
|
815
840
|
/**
|
|
816
841
|
* Request the payout/claim/assert transactions that the depositor
|
|
@@ -818,7 +843,7 @@ class ue {
|
|
|
818
843
|
*/
|
|
819
844
|
async requestDepositorPresignTransactions(e, t) {
|
|
820
845
|
const a = await this.client.call("vaultProvider_requestDepositorPresignTransactions", e, t);
|
|
821
|
-
return
|
|
846
|
+
return ee(a), a;
|
|
822
847
|
}
|
|
823
848
|
/**
|
|
824
849
|
* Submit the depositor's pre-signatures for the payout transactions
|
|
@@ -849,7 +874,7 @@ class ue {
|
|
|
849
874
|
*/
|
|
850
875
|
async requestDepositorClaimerArtifacts(e, t) {
|
|
851
876
|
const a = await this.client.call("vaultProvider_requestDepositorClaimerArtifacts", e, t);
|
|
852
|
-
return
|
|
877
|
+
return re(a), a;
|
|
853
878
|
}
|
|
854
879
|
/** Get the current pegin status from the vault provider daemon. */
|
|
855
880
|
async getPeginStatus(e, t) {
|
|
@@ -858,7 +883,7 @@ class ue {
|
|
|
858
883
|
e,
|
|
859
884
|
t
|
|
860
885
|
);
|
|
861
|
-
return
|
|
886
|
+
return Z(a), a;
|
|
862
887
|
}
|
|
863
888
|
/** Get the current pegout status from the vault provider daemon. */
|
|
864
889
|
async getPegoutStatus(e, t) {
|
|
@@ -867,10 +892,10 @@ class ue {
|
|
|
867
892
|
e,
|
|
868
893
|
t
|
|
869
894
|
);
|
|
870
|
-
return
|
|
895
|
+
return se(a), a;
|
|
871
896
|
}
|
|
872
897
|
}
|
|
873
|
-
async function
|
|
898
|
+
async function _e(n, e) {
|
|
874
899
|
const [t, a] = await n.multicall({
|
|
875
900
|
contracts: [
|
|
876
901
|
{
|
|
@@ -891,8 +916,8 @@ async function pe(n, e) {
|
|
|
891
916
|
applicationRegistry: a
|
|
892
917
|
};
|
|
893
918
|
}
|
|
894
|
-
const
|
|
895
|
-
function
|
|
919
|
+
const $ = 65535;
|
|
920
|
+
function w(n) {
|
|
896
921
|
return {
|
|
897
922
|
timelockAssert: n.timelockAssert,
|
|
898
923
|
timelockChallengeAssert: n.timelockChallengeAssert,
|
|
@@ -909,7 +934,7 @@ function _(n) {
|
|
|
909
934
|
minPrepeginDepth: n.minPrepeginDepth
|
|
910
935
|
};
|
|
911
936
|
}
|
|
912
|
-
function
|
|
937
|
+
function x(n) {
|
|
913
938
|
return {
|
|
914
939
|
minimumPegInAmount: n.minimumPegInAmount,
|
|
915
940
|
maxPegInAmount: n.maxPegInAmount,
|
|
@@ -918,14 +943,14 @@ function A(n) {
|
|
|
918
943
|
maxHtlcOutputCount: n.maxHtlcOutputCount
|
|
919
944
|
};
|
|
920
945
|
}
|
|
921
|
-
function
|
|
922
|
-
if (n > BigInt(
|
|
946
|
+
function C(n) {
|
|
947
|
+
if (n > BigInt($))
|
|
923
948
|
throw new Error(
|
|
924
|
-
`timelockAssert value ${n} exceeds uint16 max (${
|
|
949
|
+
`timelockAssert value ${n} exceeds uint16 max (${$})`
|
|
925
950
|
);
|
|
926
951
|
return Number(n);
|
|
927
952
|
}
|
|
928
|
-
class
|
|
953
|
+
class we {
|
|
929
954
|
constructor(e, t) {
|
|
930
955
|
this.publicClient = e, this.contractAddress = t;
|
|
931
956
|
}
|
|
@@ -935,7 +960,7 @@ class me {
|
|
|
935
960
|
abi: l,
|
|
936
961
|
functionName: "getTBVProtocolParams"
|
|
937
962
|
});
|
|
938
|
-
return
|
|
963
|
+
return x(e);
|
|
939
964
|
}
|
|
940
965
|
async getLatestOffchainParams() {
|
|
941
966
|
const e = await this.publicClient.readContract({
|
|
@@ -943,7 +968,7 @@ class me {
|
|
|
943
968
|
abi: l,
|
|
944
969
|
functionName: "getLatestOffchainParams"
|
|
945
970
|
});
|
|
946
|
-
return
|
|
971
|
+
return w(e);
|
|
947
972
|
}
|
|
948
973
|
async getOffchainParamsByVersion(e) {
|
|
949
974
|
const t = await this.publicClient.readContract({
|
|
@@ -952,7 +977,7 @@ class me {
|
|
|
952
977
|
functionName: "getOffchainParamsByVersion",
|
|
953
978
|
args: [e]
|
|
954
979
|
});
|
|
955
|
-
return
|
|
980
|
+
return w(t);
|
|
956
981
|
}
|
|
957
982
|
async getLatestOffchainParamsVersion() {
|
|
958
983
|
return await this.publicClient.readContract({
|
|
@@ -963,7 +988,7 @@ class me {
|
|
|
963
988
|
}
|
|
964
989
|
async getTimelockPeginByVersion(e) {
|
|
965
990
|
const t = await this.getOffchainParamsByVersion(e);
|
|
966
|
-
return
|
|
991
|
+
return C(t.timelockAssert);
|
|
967
992
|
}
|
|
968
993
|
/**
|
|
969
994
|
* Read TBV protocol params and latest offchain params atomically via multicall.
|
|
@@ -984,14 +1009,14 @@ class me {
|
|
|
984
1009
|
}
|
|
985
1010
|
],
|
|
986
1011
|
allowFailure: !1
|
|
987
|
-
}), t =
|
|
1012
|
+
}), t = x(e[0]), a = w(e[1]);
|
|
988
1013
|
return {
|
|
989
1014
|
minimumPegInAmount: t.minimumPegInAmount,
|
|
990
1015
|
maxPegInAmount: t.maxPegInAmount,
|
|
991
1016
|
pegInAckTimeout: t.pegInAckTimeout,
|
|
992
1017
|
pegInActivationTimeout: t.pegInActivationTimeout,
|
|
993
1018
|
maxHtlcOutputCount: t.maxHtlcOutputCount,
|
|
994
|
-
timelockPegin:
|
|
1019
|
+
timelockPegin: C(a.timelockAssert),
|
|
995
1020
|
timelockRefund: a.tRefund,
|
|
996
1021
|
minVpCommissionBps: a.minVpCommissionBps,
|
|
997
1022
|
offchainParams: a
|
|
@@ -1004,14 +1029,14 @@ function f(n) {
|
|
|
1004
1029
|
btcPubKey: e.btcPubKey
|
|
1005
1030
|
}));
|
|
1006
1031
|
}
|
|
1007
|
-
class
|
|
1032
|
+
class Pe {
|
|
1008
1033
|
constructor(e, t) {
|
|
1009
1034
|
this.publicClient = e, this.contractAddress = t;
|
|
1010
1035
|
}
|
|
1011
1036
|
async getVaultKeepersByVersion(e, t) {
|
|
1012
1037
|
const a = await this.publicClient.readContract({
|
|
1013
1038
|
address: this.contractAddress,
|
|
1014
|
-
abi:
|
|
1039
|
+
abi: _,
|
|
1015
1040
|
functionName: "getVaultKeepersByVersion",
|
|
1016
1041
|
args: [e, t]
|
|
1017
1042
|
});
|
|
@@ -1020,7 +1045,7 @@ class de {
|
|
|
1020
1045
|
async getCurrentVaultKeepers(e) {
|
|
1021
1046
|
const t = await this.publicClient.readContract({
|
|
1022
1047
|
address: this.contractAddress,
|
|
1023
|
-
abi:
|
|
1048
|
+
abi: _,
|
|
1024
1049
|
functionName: "getCurrentVaultKeepers",
|
|
1025
1050
|
args: [e]
|
|
1026
1051
|
});
|
|
@@ -1029,13 +1054,13 @@ class de {
|
|
|
1029
1054
|
async getCurrentVaultKeepersVersion(e) {
|
|
1030
1055
|
return await this.publicClient.readContract({
|
|
1031
1056
|
address: this.contractAddress,
|
|
1032
|
-
abi:
|
|
1057
|
+
abi: _,
|
|
1033
1058
|
functionName: "getCurrentVaultKeepersVersion",
|
|
1034
1059
|
args: [e]
|
|
1035
1060
|
});
|
|
1036
1061
|
}
|
|
1037
1062
|
}
|
|
1038
|
-
class
|
|
1063
|
+
class Te {
|
|
1039
1064
|
constructor(e, t) {
|
|
1040
1065
|
this.publicClient = e, this.contractAddress = t;
|
|
1041
1066
|
}
|
|
@@ -1064,7 +1089,7 @@ class ye {
|
|
|
1064
1089
|
});
|
|
1065
1090
|
}
|
|
1066
1091
|
}
|
|
1067
|
-
class
|
|
1092
|
+
class ve {
|
|
1068
1093
|
constructor(e, t) {
|
|
1069
1094
|
this.publicClient = e, this.contractAddress = t;
|
|
1070
1095
|
}
|
|
@@ -1119,23 +1144,24 @@ class fe {
|
|
|
1119
1144
|
}
|
|
1120
1145
|
}
|
|
1121
1146
|
export {
|
|
1122
|
-
|
|
1123
|
-
|
|
1147
|
+
_ as A,
|
|
1148
|
+
W as M,
|
|
1124
1149
|
l as P,
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1150
|
+
be as V,
|
|
1151
|
+
ye as a,
|
|
1152
|
+
fe as b,
|
|
1153
|
+
he as c,
|
|
1154
|
+
me as d,
|
|
1155
|
+
z as e,
|
|
1156
|
+
de as f,
|
|
1157
|
+
ge as g,
|
|
1133
1158
|
r as h,
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1159
|
+
we as i,
|
|
1160
|
+
Te as j,
|
|
1161
|
+
Pe as k,
|
|
1162
|
+
ve as l,
|
|
1163
|
+
pe as p,
|
|
1164
|
+
_e as r,
|
|
1165
|
+
re as v
|
|
1140
1166
|
};
|
|
1141
|
-
//# sourceMappingURL=index-
|
|
1167
|
+
//# sourceMappingURL=index-DLtpqdlu.js.map
|