@babylonlabs-io/ts-sdk 0.33.0 → 0.33.2
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/{PeginManager-BMrWtTji.js → PeginManager-BtXhdqkm.js} +5 -5
- package/dist/{PeginManager-BMrWtTji.js.map → PeginManager-BtXhdqkm.js.map} +1 -1
- package/dist/{PeginManager-DUMF84XK.cjs → PeginManager-ztgWQqza.cjs} +2 -2
- package/dist/{PeginManager-DUMF84XK.cjs.map → PeginManager-ztgWQqza.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-Ba56IKL7.js → buildAndBroadcastRefund-Ci_pVTNu.js} +3 -3
- package/dist/{buildAndBroadcastRefund-Ba56IKL7.js.map → buildAndBroadcastRefund-Ci_pVTNu.js.map} +1 -1
- package/dist/{buildAndBroadcastRefund-6pR681fI.cjs → buildAndBroadcastRefund-DKr9hbDn.cjs} +2 -2
- package/dist/{buildAndBroadcastRefund-6pR681fI.cjs.map → buildAndBroadcastRefund-DKr9hbDn.cjs.map} +1 -1
- package/dist/challengeAssert-06GLZtV8.cjs +2 -0
- package/dist/challengeAssert-06GLZtV8.cjs.map +1 -0
- package/dist/{challengeAssert-DSlCIBoT.js → challengeAssert-KGVKQh0J.js} +64 -70
- package/dist/challengeAssert-KGVKQh0J.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/{noPayout-DohtepqZ.js → noPayout-BmMd4NNH.js} +44 -50
- package/dist/{noPayout-DohtepqZ.js.map → noPayout-BmMd4NNH.js.map} +1 -1
- package/dist/noPayout-Bp2TYA_X.cjs +2 -0
- package/dist/{noPayout-CDhbGn_B.cjs.map → noPayout-Bp2TYA_X.cjs.map} +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/clients/vault-provider/api.d.ts +2 -0
- package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +9 -0
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +6 -6
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +2 -2
- package/dist/tbv/core/primitives/psbt/__tests__/peginInput.test.d.ts +3 -3
- package/dist/tbv/core/primitives/psbt/payout.d.ts +3 -2
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts +11 -5
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +6 -6
- package/dist/types-PthVHz5q.cjs +2 -0
- package/dist/types-PthVHz5q.cjs.map +1 -0
- package/dist/{types-D1o_3Q__.js → types-SYvSQWnc.js} +128 -87
- package/dist/types-SYvSQWnc.js.map +1 -0
- package/dist/{vault-registry-reader-DdUgC5IF.cjs → vault-registry-reader-CmDdymw4.cjs} +2 -2
- package/dist/vault-registry-reader-CmDdymw4.cjs.map +1 -0
- package/dist/{vault-registry-reader-BeIEh62N.js → vault-registry-reader-eiBfG4uQ.js} +117 -116
- package/dist/vault-registry-reader-eiBfG4uQ.js.map +1 -0
- package/package.json +1 -1
- package/dist/challengeAssert-DSlCIBoT.js.map +0 -1
- package/dist/challengeAssert-DuhkzZG-.cjs +0 -2
- package/dist/challengeAssert-DuhkzZG-.cjs.map +0 -1
- package/dist/noPayout-CDhbGn_B.cjs +0 -2
- package/dist/types-C2IUB0Jd.cjs +0 -2
- package/dist/types-C2IUB0Jd.cjs.map +0 -1
- package/dist/types-D1o_3Q__.js.map +0 -1
- package/dist/vault-registry-reader-BeIEh62N.js.map +0 -1
- package/dist/vault-registry-reader-DdUgC5IF.cjs.map +0 -1
|
@@ -2,8 +2,8 @@ var oe = Object.defineProperty;
|
|
|
2
2
|
var ce = (n, e, t) => e in n ? oe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var l = (n, e, t) => ce(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { B as le, H as f, K as ue, T as pe } from "./validation-CxqROCno.js";
|
|
5
|
-
import { D as de, J as G, B as b } from "./types-
|
|
6
|
-
import { X as v, C as
|
|
5
|
+
import { D as de, J as G, B as b } from "./types-SYvSQWnc.js";
|
|
6
|
+
import { X as v, C as F, s as _, S as he, h as me } from "./bitcoin-0_T6KJON.js";
|
|
7
7
|
import * as $ from "@bitcoin-js/tiny-secp256k1-asmjs";
|
|
8
8
|
import { payments as ye, Transaction as I } from "bitcoinjs-lib";
|
|
9
9
|
import { Buffer as y } from "buffer";
|
|
@@ -13,13 +13,13 @@ async function k(n, e) {
|
|
|
13
13
|
const t = new AbortController(), r = setTimeout(
|
|
14
14
|
() => t.abort(),
|
|
15
15
|
U
|
|
16
|
-
),
|
|
16
|
+
), a = [t.signal, e == null ? void 0 : e.signal].filter(
|
|
17
17
|
Boolean
|
|
18
18
|
);
|
|
19
19
|
try {
|
|
20
20
|
return await fetch(n, {
|
|
21
21
|
...e,
|
|
22
|
-
signal: AbortSignal.any(
|
|
22
|
+
signal: AbortSignal.any(a)
|
|
23
23
|
});
|
|
24
24
|
} catch (s) {
|
|
25
25
|
throw clearTimeout(r), s != null && typeof s == "object" && "name" in s && s.name === "AbortError" ? new Error(
|
|
@@ -66,9 +66,9 @@ async function T(n, e) {
|
|
|
66
66
|
try {
|
|
67
67
|
const t = await k(n, e);
|
|
68
68
|
if (!t.ok) {
|
|
69
|
-
const
|
|
69
|
+
const a = await t.text();
|
|
70
70
|
throw new Error(
|
|
71
|
-
`Mempool API error (${t.status}): ${
|
|
71
|
+
`Mempool API error (${t.status}): ${a || t.statusText}`
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
const r = t.headers.get("content-type");
|
|
@@ -87,12 +87,12 @@ async function Ze(n, e) {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
if (!t.ok) {
|
|
90
|
-
const
|
|
90
|
+
const a = await t.text();
|
|
91
91
|
let s;
|
|
92
92
|
try {
|
|
93
|
-
s = JSON.parse(
|
|
93
|
+
s = JSON.parse(a).message;
|
|
94
94
|
} catch {
|
|
95
|
-
s =
|
|
95
|
+
s = a;
|
|
96
96
|
}
|
|
97
97
|
throw new Error(
|
|
98
98
|
s || `Failed to broadcast transaction: ${t.statusText}`
|
|
@@ -128,14 +128,14 @@ async function tt(n, e, t) {
|
|
|
128
128
|
throw new Error(
|
|
129
129
|
`Invalid vout ${e} for transaction ${n} (has ${r.vout.length} outputs)`
|
|
130
130
|
);
|
|
131
|
-
const
|
|
132
|
-
if (!J(
|
|
133
|
-
throw new Error(`Invalid UTXO value ${
|
|
134
|
-
return Q(
|
|
131
|
+
const a = r.vout[e];
|
|
132
|
+
if (!J(a.value))
|
|
133
|
+
throw new Error(`Invalid UTXO value ${a.value} for ${n}:${e}`);
|
|
134
|
+
return Q(a.scriptpubkey, `${n}:${e}`), {
|
|
135
135
|
txid: n,
|
|
136
136
|
vout: e,
|
|
137
|
-
value:
|
|
138
|
-
scriptPubKey:
|
|
137
|
+
value: a.value,
|
|
138
|
+
scriptPubKey: a.scriptpubkey
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
async function nt(n, e) {
|
|
@@ -176,7 +176,7 @@ function rt(n) {
|
|
|
176
176
|
async function st(n, e) {
|
|
177
177
|
return Y(n), T(`${e}/address/${n}/txs`);
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
179
|
+
async function at(n) {
|
|
180
180
|
const e = await k(`${n}/v1/fees/recommended`);
|
|
181
181
|
if (!e.ok)
|
|
182
182
|
throw new Error(
|
|
@@ -189,10 +189,10 @@ async function it(n) {
|
|
|
189
189
|
"economyFee",
|
|
190
190
|
"minimumFee"
|
|
191
191
|
];
|
|
192
|
-
for (const
|
|
193
|
-
if (!ge(t[
|
|
192
|
+
for (const a of r)
|
|
193
|
+
if (!ge(t[a]))
|
|
194
194
|
throw new Error(
|
|
195
|
-
`Invalid fee rate ${
|
|
195
|
+
`Invalid fee rate ${a}=${t[a]} from mempool API: expected a positive number ≤ ${W}`
|
|
196
196
|
);
|
|
197
197
|
if (t.minimumFee > t.economyFee || t.economyFee > t.hourFee || t.hourFee > t.halfHourFee || t.halfHourFee > t.fastestFee)
|
|
198
198
|
throw new Error(
|
|
@@ -582,7 +582,7 @@ function o(n) {
|
|
|
582
582
|
return ((e = JSON.stringify(n)) == null ? void 0 : e.slice(0, _e)) ?? "undefined";
|
|
583
583
|
}
|
|
584
584
|
const Pe = "The vault provider returned an unexpected response. Please try again or contact support.";
|
|
585
|
-
class
|
|
585
|
+
class i extends Error {
|
|
586
586
|
constructor(t) {
|
|
587
587
|
super(Pe);
|
|
588
588
|
l(this, "detail");
|
|
@@ -598,88 +598,88 @@ function Z(n) {
|
|
|
598
598
|
}
|
|
599
599
|
function ee(n, e) {
|
|
600
600
|
if (!g(n))
|
|
601
|
-
throw new
|
|
601
|
+
throw new i(
|
|
602
602
|
`VP response validation failed: "${e}" must be a non-empty hex string, got ${o(n)}`
|
|
603
603
|
);
|
|
604
604
|
}
|
|
605
605
|
function w(n, e) {
|
|
606
606
|
if (!Z(n))
|
|
607
|
-
throw new
|
|
607
|
+
throw new i(
|
|
608
608
|
`VP response validation failed: "${e}" must be a non-empty string, got ${o(n)}`
|
|
609
609
|
);
|
|
610
610
|
}
|
|
611
611
|
function te(n, e) {
|
|
612
|
-
if (!g(n) || n.length !== v && n.length !==
|
|
613
|
-
throw new
|
|
614
|
-
`VP response validation failed: "${e}" must be a ${v} or ${
|
|
612
|
+
if (!g(n) || n.length !== v && n.length !== F)
|
|
613
|
+
throw new i(
|
|
614
|
+
`VP response validation failed: "${e}" must be a ${v} or ${F}-char hex string (BTC pubkey), got ${o(n)}`
|
|
615
615
|
);
|
|
616
616
|
}
|
|
617
617
|
function ve(n) {
|
|
618
618
|
const e = n.presigning;
|
|
619
619
|
if (e == null) return;
|
|
620
620
|
if (typeof e != "object" || Array.isArray(e))
|
|
621
|
-
throw new
|
|
621
|
+
throw new i(
|
|
622
622
|
'VP response validation failed: "progress.presigning" must be an object if present'
|
|
623
623
|
);
|
|
624
624
|
const t = e;
|
|
625
625
|
if (t.depositor_graph_created !== void 0 && typeof t.depositor_graph_created != "boolean")
|
|
626
|
-
throw new
|
|
626
|
+
throw new i(
|
|
627
627
|
`VP response validation failed: "progress.presigning.depositor_graph_created" must be a boolean if present, got ${o(t.depositor_graph_created)}`
|
|
628
628
|
);
|
|
629
629
|
if (t.vk_challenger_presigning_completed !== void 0 && typeof t.vk_challenger_presigning_completed != "number")
|
|
630
|
-
throw new
|
|
630
|
+
throw new i(
|
|
631
631
|
`VP response validation failed: "progress.presigning.vk_challenger_presigning_completed" must be a number if present, got ${o(t.vk_challenger_presigning_completed)}`
|
|
632
632
|
);
|
|
633
633
|
if (t.vk_challenger_presigning_total !== void 0 && typeof t.vk_challenger_presigning_total != "number")
|
|
634
|
-
throw new
|
|
634
|
+
throw new i(
|
|
635
635
|
`VP response validation failed: "progress.presigning.vk_challenger_presigning_total" must be a number if present, got ${o(t.vk_challenger_presigning_total)}`
|
|
636
636
|
);
|
|
637
637
|
}
|
|
638
638
|
function Te(n) {
|
|
639
639
|
if (n === null || typeof n != "object")
|
|
640
|
-
throw new
|
|
640
|
+
throw new i(
|
|
641
641
|
"VP response validation failed: getPeginStatus response is not an object"
|
|
642
642
|
);
|
|
643
643
|
const e = n;
|
|
644
644
|
if (!g(e.pegin_txid) || e.pegin_txid.length !== x)
|
|
645
|
-
throw new
|
|
645
|
+
throw new i(
|
|
646
646
|
`VP response validation failed: "pegin_txid" must be a ${x}-char hex string (txid), got ${o(e.pegin_txid)}`
|
|
647
647
|
);
|
|
648
648
|
if (typeof e.status != "string")
|
|
649
|
-
throw new
|
|
649
|
+
throw new i(
|
|
650
650
|
'VP response validation failed: "status" must be a string'
|
|
651
651
|
);
|
|
652
652
|
if (!D.has(e.status))
|
|
653
|
-
throw new
|
|
653
|
+
throw new i(
|
|
654
654
|
`VP response validation failed: unrecognized status "${e.status}". Expected one of: ${[...D].join(", ")}`
|
|
655
655
|
);
|
|
656
656
|
if (e.progress === null || typeof e.progress != "object" || Array.isArray(e.progress))
|
|
657
|
-
throw new
|
|
657
|
+
throw new i(
|
|
658
658
|
'VP response validation failed: "progress" must be an object'
|
|
659
659
|
);
|
|
660
660
|
if (ve(e.progress), typeof e.health_info != "string")
|
|
661
|
-
throw new
|
|
661
|
+
throw new i(
|
|
662
662
|
'VP response validation failed: "health_info" must be a string'
|
|
663
663
|
);
|
|
664
664
|
if (e.last_error !== void 0 && typeof e.last_error != "string")
|
|
665
|
-
throw new
|
|
665
|
+
throw new i(
|
|
666
666
|
`VP response validation failed: "last_error" must be a string if present, got ${o(e.last_error)}`
|
|
667
667
|
);
|
|
668
668
|
}
|
|
669
669
|
function xe(n) {
|
|
670
670
|
if (n === null || typeof n != "object")
|
|
671
|
-
throw new
|
|
671
|
+
throw new i(
|
|
672
672
|
"VP response validation failed: requestDepositorPresignTransactions response is not an object"
|
|
673
673
|
);
|
|
674
674
|
const e = n;
|
|
675
675
|
if (!Array.isArray(e.txs))
|
|
676
|
-
throw new
|
|
676
|
+
throw new i(
|
|
677
677
|
'VP response validation failed: "txs" must be an array'
|
|
678
678
|
);
|
|
679
679
|
for (let t = 0; t < e.txs.length; t++)
|
|
680
680
|
Ae(e.txs[t], `txs[${t}]`);
|
|
681
681
|
if (e.depositor_graph === null || typeof e.depositor_graph != "object")
|
|
682
|
-
throw new
|
|
682
|
+
throw new i(
|
|
683
683
|
'VP response validation failed: "depositor_graph" must be an object'
|
|
684
684
|
);
|
|
685
685
|
Se(
|
|
@@ -688,14 +688,14 @@ function xe(n) {
|
|
|
688
688
|
}
|
|
689
689
|
function m(n, e) {
|
|
690
690
|
if (n === null || typeof n != "object")
|
|
691
|
-
throw new
|
|
691
|
+
throw new i(
|
|
692
692
|
`VP response validation failed: "${e}" must be an object`
|
|
693
693
|
);
|
|
694
694
|
ee(n.tx_hex, `${e}.tx_hex`);
|
|
695
695
|
}
|
|
696
696
|
function Ae(n, e) {
|
|
697
697
|
if (n === null || typeof n != "object")
|
|
698
|
-
throw new
|
|
698
|
+
throw new i(
|
|
699
699
|
`VP response validation failed: "${e}" must be an object`
|
|
700
700
|
);
|
|
701
701
|
const t = n;
|
|
@@ -703,7 +703,7 @@ function Ae(n, e) {
|
|
|
703
703
|
}
|
|
704
704
|
function Ve(n, e) {
|
|
705
705
|
if (n === null || typeof n != "object")
|
|
706
|
-
throw new
|
|
706
|
+
throw new i(
|
|
707
707
|
`VP response validation failed: "${e}" must be an object`
|
|
708
708
|
);
|
|
709
709
|
const t = n;
|
|
@@ -711,7 +711,7 @@ function Ve(n, e) {
|
|
|
711
711
|
}
|
|
712
712
|
function $e(n, e) {
|
|
713
713
|
if (n === null || typeof n != "object")
|
|
714
|
-
throw new
|
|
714
|
+
throw new i(
|
|
715
715
|
`VP response validation failed: "${e}" must be an object`
|
|
716
716
|
);
|
|
717
717
|
const t = n;
|
|
@@ -722,7 +722,7 @@ function $e(n, e) {
|
|
|
722
722
|
t.challenge_assert_y_tx,
|
|
723
723
|
`${e}.challenge_assert_y_tx`
|
|
724
724
|
), m(t.nopayout_tx, `${e}.nopayout_tx`), w(t.nopayout_psbt, `${e}.nopayout_psbt`), !Array.isArray(t.challenge_assert_connectors))
|
|
725
|
-
throw new
|
|
725
|
+
throw new i(
|
|
726
726
|
`VP response validation failed: "${e}.challenge_assert_connectors" must be an array`
|
|
727
727
|
);
|
|
728
728
|
for (let r = 0; r < t.challenge_assert_connectors.length; r++)
|
|
@@ -731,7 +731,7 @@ function $e(n, e) {
|
|
|
731
731
|
`${e}.challenge_assert_connectors[${r}]`
|
|
732
732
|
);
|
|
733
733
|
if (!Array.isArray(t.output_label_hashes))
|
|
734
|
-
throw new
|
|
734
|
+
throw new i(
|
|
735
735
|
`VP response validation failed: "${e}.output_label_hashes" must be an array`
|
|
736
736
|
);
|
|
737
737
|
for (let r = 0; r < t.output_label_hashes.length; r++)
|
|
@@ -742,80 +742,80 @@ function $e(n, e) {
|
|
|
742
742
|
}
|
|
743
743
|
function ke(n) {
|
|
744
744
|
if (n === null || typeof n != "object")
|
|
745
|
-
throw new
|
|
745
|
+
throw new i(
|
|
746
746
|
"VP response validation failed: requestDepositorClaimerArtifacts response is not an object"
|
|
747
747
|
);
|
|
748
748
|
const e = n;
|
|
749
749
|
if (!Z(e.tx_graph_json))
|
|
750
|
-
throw new
|
|
750
|
+
throw new i(
|
|
751
751
|
`VP response validation failed: "tx_graph_json" must be a non-empty string, got ${o(e.tx_graph_json)}`
|
|
752
752
|
);
|
|
753
753
|
if (!g(e.verifying_key_hex))
|
|
754
|
-
throw new
|
|
754
|
+
throw new i(
|
|
755
755
|
`VP response validation failed: "verifying_key_hex" must be a non-empty hex string, got ${o(e.verifying_key_hex)}`
|
|
756
756
|
);
|
|
757
757
|
if (e.babe_sessions === null || typeof e.babe_sessions != "object")
|
|
758
|
-
throw new
|
|
758
|
+
throw new i(
|
|
759
759
|
'VP response validation failed: "babe_sessions" must be an object'
|
|
760
760
|
);
|
|
761
761
|
for (const [t, r] of Object.entries(
|
|
762
762
|
e.babe_sessions
|
|
763
763
|
)) {
|
|
764
764
|
if (r === null || typeof r != "object")
|
|
765
|
-
throw new
|
|
765
|
+
throw new i(
|
|
766
766
|
`VP response validation failed: "babe_sessions.${t}" must be an object`
|
|
767
767
|
);
|
|
768
|
-
const
|
|
769
|
-
if (!g(
|
|
770
|
-
throw new
|
|
771
|
-
`VP response validation failed: "babe_sessions.${t}.decryptor_artifacts_hex" must be a non-empty hex string, got ${o(
|
|
768
|
+
const a = r;
|
|
769
|
+
if (!g(a.decryptor_artifacts_hex))
|
|
770
|
+
throw new i(
|
|
771
|
+
`VP response validation failed: "babe_sessions.${t}.decryptor_artifacts_hex" must be a non-empty hex string, got ${o(a.decryptor_artifacts_hex)}`
|
|
772
772
|
);
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
function Ce(n) {
|
|
776
776
|
if (n === null || typeof n != "object")
|
|
777
|
-
throw new
|
|
777
|
+
throw new i(
|
|
778
778
|
"VP response validation failed: getPegoutStatus response is not an object"
|
|
779
779
|
);
|
|
780
780
|
const e = n;
|
|
781
781
|
if (!g(e.pegin_txid) || e.pegin_txid.length !== x)
|
|
782
|
-
throw new
|
|
782
|
+
throw new i(
|
|
783
783
|
`VP response validation failed: "pegin_txid" must be a ${x}-char hex string (txid), got ${o(e.pegin_txid)}`
|
|
784
784
|
);
|
|
785
785
|
if (typeof e.found != "boolean")
|
|
786
|
-
throw new
|
|
786
|
+
throw new i(
|
|
787
787
|
`VP response validation failed: "found" must be a boolean, got ${o(e.found)}`
|
|
788
788
|
);
|
|
789
789
|
if (e.claimer !== void 0) {
|
|
790
790
|
if (e.claimer === null || typeof e.claimer != "object")
|
|
791
|
-
throw new
|
|
791
|
+
throw new i(
|
|
792
792
|
'VP response validation failed: "claimer" must be an object if present'
|
|
793
793
|
);
|
|
794
794
|
const t = e.claimer;
|
|
795
795
|
if (typeof t.status != "string")
|
|
796
|
-
throw new
|
|
796
|
+
throw new i(
|
|
797
797
|
`VP response validation failed: "claimer.status" must be a string, got ${o(t.status)}`
|
|
798
798
|
);
|
|
799
799
|
if (typeof t.failed != "boolean")
|
|
800
|
-
throw new
|
|
800
|
+
throw new i(
|
|
801
801
|
`VP response validation failed: "claimer.failed" must be a boolean, got ${o(t.failed)}`
|
|
802
802
|
);
|
|
803
803
|
}
|
|
804
804
|
if (e.challenger !== void 0) {
|
|
805
805
|
if (e.challenger === null || typeof e.challenger != "object")
|
|
806
|
-
throw new
|
|
806
|
+
throw new i(
|
|
807
807
|
'VP response validation failed: "challenger" must be an object if present'
|
|
808
808
|
);
|
|
809
809
|
const t = e.challenger;
|
|
810
810
|
if (typeof t.status != "string")
|
|
811
|
-
throw new
|
|
811
|
+
throw new i(
|
|
812
812
|
`VP response validation failed: "challenger.status" must be a string, got ${o(t.status)}`
|
|
813
813
|
);
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
function Se(n) {
|
|
817
817
|
if (m(n.claim_tx, "depositor_graph.claim_tx"), m(n.assert_tx, "depositor_graph.assert_tx"), m(n.payout_tx, "depositor_graph.payout_tx"), w(n.payout_psbt, "depositor_graph.payout_psbt"), !Array.isArray(n.challenger_presign_data))
|
|
818
|
-
throw new
|
|
818
|
+
throw new i(
|
|
819
819
|
'VP response validation failed: "depositor_graph.challenger_presign_data" must be an array'
|
|
820
820
|
);
|
|
821
821
|
for (let e = 0; e < n.challenger_presign_data.length; e++)
|
|
@@ -824,7 +824,7 @@ function Se(n) {
|
|
|
824
824
|
`depositor_graph.challenger_presign_data[${e}]`
|
|
825
825
|
);
|
|
826
826
|
if (typeof n.offchain_params_version != "number")
|
|
827
|
-
throw new
|
|
827
|
+
throw new i(
|
|
828
828
|
'VP response validation failed: "depositor_graph.offchain_params_version" must be a number'
|
|
829
829
|
);
|
|
830
830
|
}
|
|
@@ -839,7 +839,8 @@ class Ie {
|
|
|
839
839
|
retryDelay: t == null ? void 0 : t.retryDelay,
|
|
840
840
|
retryableFor: t == null ? void 0 : t.retryableFor,
|
|
841
841
|
headers: t == null ? void 0 : t.headers,
|
|
842
|
-
tokenProvider: t == null ? void 0 : t.tokenProvider
|
|
842
|
+
tokenProvider: t == null ? void 0 : t.tokenProvider,
|
|
843
|
+
maxResponseBytes: t == null ? void 0 : t.maxResponseBytes
|
|
843
844
|
};
|
|
844
845
|
this.client = new G(r);
|
|
845
846
|
}
|
|
@@ -901,24 +902,24 @@ class Ie {
|
|
|
901
902
|
return Ce(r), r;
|
|
902
903
|
}
|
|
903
904
|
}
|
|
904
|
-
const Be = "BIP0322-signed-message",
|
|
905
|
+
const Be = "BIP0322-signed-message", Re = "TapTweak", ne = 32, Fe = 64;
|
|
905
906
|
function re(n, e) {
|
|
906
|
-
const t = new TextEncoder().encode(n), r = K(t),
|
|
907
|
-
return
|
|
907
|
+
const t = new TextEncoder().encode(n), r = K(t), a = new Uint8Array(r.length * 2 + e.length);
|
|
908
|
+
return a.set(r, 0), a.set(r, r.length), a.set(e, r.length * 2), K(a);
|
|
908
909
|
}
|
|
909
|
-
function
|
|
910
|
+
function Oe(n) {
|
|
910
911
|
if (n.length !== ne) return null;
|
|
911
|
-
const e = re(
|
|
912
|
+
const e = re(Re, n), t = $.xOnlyPointAddTweak(n, e);
|
|
912
913
|
return t ? t.xOnlyPubkey : null;
|
|
913
914
|
}
|
|
914
915
|
function Ne(n, e, t) {
|
|
915
|
-
if (e.length !== ne || t.length !==
|
|
916
|
+
if (e.length !== ne || t.length !== Fe) return !1;
|
|
916
917
|
try {
|
|
917
|
-
const r = re(Be, n),
|
|
918
|
+
const r = re(Be, n), a = ye.p2tr({
|
|
918
919
|
internalPubkey: y.from(e)
|
|
919
920
|
});
|
|
920
|
-
if (!
|
|
921
|
-
const s =
|
|
921
|
+
if (!a.output) return !1;
|
|
922
|
+
const s = a.output, c = 0, d = new I();
|
|
922
923
|
d.version = 0, d.locktime = 0;
|
|
923
924
|
const S = y.concat([
|
|
924
925
|
y.from([0, 32]),
|
|
@@ -942,7 +943,7 @@ function Ne(n, e, t) {
|
|
|
942
943
|
[s],
|
|
943
944
|
[c],
|
|
944
945
|
I.SIGHASH_DEFAULT
|
|
945
|
-
), H =
|
|
946
|
+
), H = Oe(e);
|
|
946
947
|
return H ? $.verifySchnorr(N, H, t) : !1;
|
|
947
948
|
} catch {
|
|
948
949
|
return !1;
|
|
@@ -967,17 +968,17 @@ function A(n, e) {
|
|
|
967
968
|
s & 255
|
|
968
969
|
]);
|
|
969
970
|
}
|
|
970
|
-
const
|
|
971
|
-
|
|
971
|
+
const a = new Uint8Array(9);
|
|
972
|
+
a[0] = t | 27;
|
|
972
973
|
for (let s = 7; s >= 0; s--)
|
|
973
|
-
|
|
974
|
-
return
|
|
974
|
+
a[1 + s] = Number(r >> BigInt((7 - s) * 8)) & 255;
|
|
975
|
+
return a;
|
|
975
976
|
}
|
|
976
977
|
function se(...n) {
|
|
977
|
-
const e = n.reduce((
|
|
978
|
+
const e = n.reduce((a, s) => a + s.length, 0), t = new Uint8Array(e);
|
|
978
979
|
let r = 0;
|
|
979
|
-
for (const
|
|
980
|
-
t.set(
|
|
980
|
+
for (const a of n)
|
|
981
|
+
t.set(a, r), r += a.length;
|
|
981
982
|
return t;
|
|
982
983
|
}
|
|
983
984
|
function j(n) {
|
|
@@ -991,8 +992,8 @@ function He(n, e, t) {
|
|
|
991
992
|
throw new Error(
|
|
992
993
|
`encodeServerIdentityPayload: expires_at must be a non-negative safe integer, got ${t}`
|
|
993
994
|
);
|
|
994
|
-
const r = A(4, 3),
|
|
995
|
-
return se(r,
|
|
995
|
+
const r = A(4, 3), a = j(n), s = j(e), c = A(0, t);
|
|
996
|
+
return se(r, a, s, c);
|
|
996
997
|
}
|
|
997
998
|
const Ke = new TextEncoder().encode(
|
|
998
999
|
"btc-auth.server-identity.v1"
|
|
@@ -1009,10 +1010,10 @@ function P(n) {
|
|
|
1009
1010
|
return e;
|
|
1010
1011
|
}
|
|
1011
1012
|
function Ue(n) {
|
|
1012
|
-
const { proof: e, pinnedServerPubkey: t, now: r } = n,
|
|
1013
|
-
if (
|
|
1013
|
+
const { proof: e, pinnedServerPubkey: t, now: r } = n, a = _(t).toLowerCase();
|
|
1014
|
+
if (a.length !== v || !f.test(a))
|
|
1014
1015
|
throw new u(
|
|
1015
|
-
`pinnedServerPubkey must be 32-byte hex; got ${
|
|
1016
|
+
`pinnedServerPubkey must be 32-byte hex; got ${a.length} chars`,
|
|
1016
1017
|
"invalid_pubkey_encoding"
|
|
1017
1018
|
);
|
|
1018
1019
|
const s = _(e.server_pubkey).toLowerCase();
|
|
@@ -1021,9 +1022,9 @@ function Ue(n) {
|
|
|
1021
1022
|
`server_pubkey must be 32-byte hex; got ${s.length} chars`,
|
|
1022
1023
|
"invalid_pubkey_encoding"
|
|
1023
1024
|
);
|
|
1024
|
-
if (s !==
|
|
1025
|
+
if (s !== a)
|
|
1025
1026
|
throw new u(
|
|
1026
|
-
`server_pubkey does not match pinned value: expected ${
|
|
1027
|
+
`server_pubkey does not match pinned value: expected ${a}, got ${s}`,
|
|
1027
1028
|
"pinned_pubkey_mismatch"
|
|
1028
1029
|
);
|
|
1029
1030
|
if (!Number.isSafeInteger(e.expires_at))
|
|
@@ -1042,7 +1043,7 @@ function Ue(n) {
|
|
|
1042
1043
|
"expired"
|
|
1043
1044
|
);
|
|
1044
1045
|
const c = _(e.ephemeral_pubkey).toLowerCase();
|
|
1045
|
-
if (c.length !==
|
|
1046
|
+
if (c.length !== F || !f.test(c))
|
|
1046
1047
|
throw new u(
|
|
1047
1048
|
`ephemeral_pubkey must be 33-byte compressed hex; got ${c.length} chars`,
|
|
1048
1049
|
"invalid_ephemeral_pubkey"
|
|
@@ -1080,13 +1081,13 @@ const De = /* @__PURE__ */ new Set([
|
|
|
1080
1081
|
"vaultProvider_submitDepositorWotsKey",
|
|
1081
1082
|
"vaultProvider_submitDepositorPresignatures",
|
|
1082
1083
|
"vaultProvider_requestDepositorPresignTransactions"
|
|
1083
|
-
]), je = 6e4,
|
|
1084
|
-
function
|
|
1084
|
+
]), je = 6e4, O = "auth_createDepositorToken";
|
|
1085
|
+
function ae(n, e) {
|
|
1085
1086
|
return new G({
|
|
1086
1087
|
baseUrl: n,
|
|
1087
1088
|
timeout: je,
|
|
1088
1089
|
headers: e,
|
|
1089
|
-
retryableFor: (t) => t ===
|
|
1090
|
+
retryableFor: (t) => t === O
|
|
1090
1091
|
});
|
|
1091
1092
|
}
|
|
1092
1093
|
const M = 4102444800, Me = 30;
|
|
@@ -1120,7 +1121,7 @@ class Le {
|
|
|
1120
1121
|
* guard. Returning `null` here breaks that recursion deterministically.
|
|
1121
1122
|
*/
|
|
1122
1123
|
async getToken(e) {
|
|
1123
|
-
if (e ===
|
|
1124
|
+
if (e === O || !this.authGatedMethods.has(e)) return null;
|
|
1124
1125
|
const t = this.cached;
|
|
1125
1126
|
return t && this.now() + this.refreshSkewSecs < t.expiresAt ? t.token : (await this.acquireSingleFlight()).token;
|
|
1126
1127
|
}
|
|
@@ -1147,7 +1148,7 @@ class Le {
|
|
|
1147
1148
|
if (e) return e;
|
|
1148
1149
|
const t = (async () => {
|
|
1149
1150
|
try {
|
|
1150
|
-
const r = await this.client.call(
|
|
1151
|
+
const r = await this.client.call(O, {
|
|
1151
1152
|
pegin_txid: this.peginTxid,
|
|
1152
1153
|
auth_anchor: this.authAnchorHex
|
|
1153
1154
|
});
|
|
@@ -1159,10 +1160,10 @@ class Le {
|
|
|
1159
1160
|
throw new Error(
|
|
1160
1161
|
`VpTokenProvider: invalid token in acquire response (expected non-empty string, got ${typeof r.token})`
|
|
1161
1162
|
);
|
|
1162
|
-
const
|
|
1163
|
-
if (!Number.isSafeInteger(r.expires_at) || r.expires_at <=
|
|
1163
|
+
const a = this.now();
|
|
1164
|
+
if (!Number.isSafeInteger(r.expires_at) || r.expires_at <= a || r.expires_at > M)
|
|
1164
1165
|
throw new Error(
|
|
1165
|
-
`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(r.expires_at)}; must be a safe integer in (${
|
|
1166
|
+
`VpTokenProvider: invalid expires_at in acquire response (got ${JSON.stringify(r.expires_at)}; must be a safe integer in (${a}, ${M}])`
|
|
1166
1167
|
);
|
|
1167
1168
|
const s = {
|
|
1168
1169
|
token: r.token,
|
|
@@ -1239,13 +1240,13 @@ class Xe {
|
|
|
1239
1240
|
return this.entries.size;
|
|
1240
1241
|
}
|
|
1241
1242
|
}
|
|
1242
|
-
const
|
|
1243
|
-
function
|
|
1243
|
+
const ie = new Xe();
|
|
1244
|
+
function it(n) {
|
|
1244
1245
|
var r;
|
|
1245
|
-
const e =
|
|
1246
|
+
const e = ae(
|
|
1246
1247
|
n.baseUrl,
|
|
1247
1248
|
(r = n.options) == null ? void 0 : r.headers
|
|
1248
|
-
), t =
|
|
1249
|
+
), t = ie.getOrCreate({
|
|
1249
1250
|
client: e,
|
|
1250
1251
|
peginTxid: n.peginTxid,
|
|
1251
1252
|
authAnchorHex: n.authAnchorHex,
|
|
@@ -1257,8 +1258,8 @@ function at(n) {
|
|
|
1257
1258
|
});
|
|
1258
1259
|
}
|
|
1259
1260
|
function ot(n) {
|
|
1260
|
-
|
|
1261
|
-
client:
|
|
1261
|
+
ie.getOrCreate({
|
|
1262
|
+
client: ae(n.baseUrl, n.headers),
|
|
1262
1263
|
peginTxid: n.peginTxid,
|
|
1263
1264
|
authAnchorHex: n.authAnchorHex,
|
|
1264
1265
|
pinnedServerPubkey: n.pinnedServerPubkey
|
|
@@ -1286,7 +1287,7 @@ async function ct(n, e) {
|
|
|
1286
1287
|
};
|
|
1287
1288
|
}
|
|
1288
1289
|
const L = 65535;
|
|
1289
|
-
function
|
|
1290
|
+
function R(n) {
|
|
1290
1291
|
return {
|
|
1291
1292
|
timelockAssert: n.timelockAssert,
|
|
1292
1293
|
timelockChallengeAssert: n.timelockChallengeAssert,
|
|
@@ -1337,7 +1338,7 @@ class lt {
|
|
|
1337
1338
|
abi: h,
|
|
1338
1339
|
functionName: "getLatestOffchainParams"
|
|
1339
1340
|
});
|
|
1340
|
-
return
|
|
1341
|
+
return R(e);
|
|
1341
1342
|
}
|
|
1342
1343
|
async getOffchainParamsByVersion(e) {
|
|
1343
1344
|
const t = await this.publicClient.readContract({
|
|
@@ -1346,7 +1347,7 @@ class lt {
|
|
|
1346
1347
|
functionName: "getOffchainParamsByVersion",
|
|
1347
1348
|
args: [e]
|
|
1348
1349
|
});
|
|
1349
|
-
return
|
|
1350
|
+
return R(t);
|
|
1350
1351
|
}
|
|
1351
1352
|
async getLatestOffchainParamsVersion() {
|
|
1352
1353
|
return await this.publicClient.readContract({
|
|
@@ -1378,7 +1379,7 @@ class lt {
|
|
|
1378
1379
|
}
|
|
1379
1380
|
],
|
|
1380
1381
|
allowFailure: !1
|
|
1381
|
-
}), t = X(e[0]), r =
|
|
1382
|
+
}), t = X(e[0]), r = R(e[1]);
|
|
1382
1383
|
return {
|
|
1383
1384
|
minimumPegInAmount: t.minimumPegInAmount,
|
|
1384
1385
|
maxPegInAmount: t.maxPegInAmount,
|
|
@@ -1479,12 +1480,12 @@ class dt {
|
|
|
1479
1480
|
throw new Error(
|
|
1480
1481
|
`getVaultProviderBTCKey returned an unexpected value (vp=${e}, length ${r.length}, prefix "${r.slice(0, 2)}")`
|
|
1481
1482
|
);
|
|
1482
|
-
const
|
|
1483
|
-
if (!$.isXOnlyPoint(me(
|
|
1483
|
+
const a = r.slice(2);
|
|
1484
|
+
if (!$.isXOnlyPoint(me(a)))
|
|
1484
1485
|
throw new Error(
|
|
1485
1486
|
`getVaultProviderBTCKey returned a value that is not on the secp256k1 curve (vp=${e})`
|
|
1486
1487
|
);
|
|
1487
|
-
return
|
|
1488
|
+
return a;
|
|
1488
1489
|
}
|
|
1489
1490
|
async getVaultBasicInfo(e) {
|
|
1490
1491
|
const t = await this.publicClient.readContract({
|
|
@@ -1544,16 +1545,16 @@ export {
|
|
|
1544
1545
|
Ie as V,
|
|
1545
1546
|
nt as a,
|
|
1546
1547
|
rt as b,
|
|
1547
|
-
|
|
1548
|
+
at as c,
|
|
1548
1549
|
et as d,
|
|
1549
1550
|
we as e,
|
|
1550
1551
|
tt as f,
|
|
1551
1552
|
st as g,
|
|
1552
|
-
|
|
1553
|
+
i as h,
|
|
1553
1554
|
Ue as i,
|
|
1554
1555
|
Xe as j,
|
|
1555
|
-
|
|
1556
|
-
|
|
1556
|
+
ie as k,
|
|
1557
|
+
it as l,
|
|
1557
1558
|
ot as m,
|
|
1558
1559
|
lt as n,
|
|
1559
1560
|
pt as o,
|
|
@@ -1563,4 +1564,4 @@ export {
|
|
|
1563
1564
|
dt as s,
|
|
1564
1565
|
ke as v
|
|
1565
1566
|
};
|
|
1566
|
-
//# sourceMappingURL=vault-registry-reader-
|
|
1567
|
+
//# sourceMappingURL=vault-registry-reader-eiBfG4uQ.js.map
|