@babylonlabs-io/ts-sdk 0.58.1 → 0.59.1
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/BTCVaultRegistry.abi-3VLWva2x.cjs +2 -0
- package/dist/BTCVaultRegistry.abi-3VLWva2x.cjs.map +1 -0
- package/dist/{BTCVaultRegistry.abi-CixOlp3B.js → BTCVaultRegistry.abi-B3BLhpJ4.js} +30 -13
- package/dist/BTCVaultRegistry.abi-B3BLhpJ4.js.map +1 -0
- package/dist/{PeginManager-C8ixWlUM.js → PeginManager-1R9dMB1G.js} +3 -3
- package/dist/{PeginManager-C8ixWlUM.js.map → PeginManager-1R9dMB1G.js.map} +1 -1
- package/dist/{PeginManager-CogqZaa2.cjs → PeginManager-OXUOsgz2.cjs} +2 -2
- package/dist/{PeginManager-CogqZaa2.cjs.map → PeginManager-OXUOsgz2.cjs.map} +1 -1
- package/dist/{batchPoll-D5IDDOa8.cjs → batchPoll-C4hwVFa8.cjs} +2 -2
- package/dist/batchPoll-C4hwVFa8.cjs.map +1 -0
- package/dist/{batchPoll-B0VxT62K.js → batchPoll-L9LzMl1E.js} +3 -3
- package/dist/batchPoll-L9LzMl1E.js.map +1 -0
- package/dist/{buildAndBroadcastRefund-DBA-Mp4I.js → buildAndBroadcastRefund-DpF_b3d9.js} +457 -428
- package/dist/buildAndBroadcastRefund-DpF_b3d9.js.map +1 -0
- package/dist/buildAndBroadcastRefund-rSxXMwFd.cjs +2 -0
- package/dist/buildAndBroadcastRefund-rSxXMwFd.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +52 -51
- package/dist/{mempoolApi-CMHEz4ez.js → mempoolApi-BQKF5MTr.js} +96 -79
- package/dist/mempoolApi-BQKF5MTr.js.map +1 -0
- package/dist/mempoolApi-BxhMqJ4f.cjs +2 -0
- package/dist/mempoolApi-BxhMqJ4f.cjs.map +1 -0
- package/dist/onChainBtcPubkey-C_a2L3kL.cjs.map +1 -1
- package/dist/onChainBtcPubkey-DeF4cKoO.js.map +1 -1
- package/dist/{peginState-BB81JI6I.js → peginState-CxDiaKuk.js} +26 -19
- package/dist/peginState-CxDiaKuk.js.map +1 -0
- package/dist/peginState-eaQ4IO_R.cjs +2 -0
- package/dist/peginState-eaQ4IO_R.cjs.map +1 -0
- package/dist/{reservation-CbAXa7VG.js → reservation-B4i_PQhY.js} +2 -2
- package/dist/{reservation-CbAXa7VG.js.map → reservation-B4i_PQhY.js.map} +1 -1
- package/dist/{reservation-RGKvg2x6.cjs → reservation-CDbInVw0.cjs} +2 -2
- package/dist/{reservation-RGKvg2x6.cjs.map → reservation-CDbInVw0.cjs.map} +1 -1
- package/dist/tbv/core/clients/eth/onChainBtcPubkey.d.ts +2 -2
- package/dist/tbv/core/clients/eth/types.d.ts +15 -3
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +24 -7
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +14 -14
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +58 -57
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +1 -1
- package/dist/tbv/core/services/activation/activateVault.d.ts +45 -0
- package/dist/tbv/core/services/activation/activateVault.d.ts.map +1 -1
- package/dist/tbv/core/services/activation/index.d.ts +1 -1
- package/dist/tbv/core/services/activation/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts +24 -0
- package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +34 -33
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +58 -57
- package/package.json +1 -1
- package/dist/BTCVaultRegistry.abi-AUAyCHal.cjs +0 -2
- package/dist/BTCVaultRegistry.abi-AUAyCHal.cjs.map +0 -1
- package/dist/BTCVaultRegistry.abi-CixOlp3B.js.map +0 -1
- package/dist/batchPoll-B0VxT62K.js.map +0 -1
- package/dist/batchPoll-D5IDDOa8.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-BL8u-Ti4.cjs +0 -2
- package/dist/buildAndBroadcastRefund-BL8u-Ti4.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-DBA-Mp4I.js.map +0 -1
- package/dist/mempoolApi-CMHEz4ez.js.map +0 -1
- package/dist/mempoolApi-DfD3_Y6v.cjs +0 -2
- package/dist/mempoolApi-DfD3_Y6v.cjs.map +0 -1
- package/dist/peginState-BB81JI6I.js.map +0 -1
- package/dist/peginState-CBBJw4Za.cjs +0 -2
- package/dist/peginState-CBBJw4Za.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -2,30 +2,30 @@ import { b as s, c as t } from "./challengeAssert-C7PzyJ7g.js";
|
|
|
2
2
|
import { a as o } from "./constants-GjWXdaqV.js";
|
|
3
3
|
import { computeMinClaimValue as n, computeMinPeginFee as p, deriveVaultId as u, expandAuthAnchor as c, expandHashlockSecret as l, expandWotsSeed as d, peginP2aAnchorOutput as P, supportedTxGraphVersions as E, validatePeginP2aAnchor as T } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
4
4
|
import { P as R, d as S, f as g, c as m, b as _, a as f, g as x, e as b } from "./verifyScriptPathSchnorrSignature-Bav08_7R.js";
|
|
5
|
-
import { b as
|
|
5
|
+
import { b as V, e as v, f as C } from "./peginInput-HQPWZfly.js";
|
|
6
6
|
import { a as y, b as I } from "./noPayout-DuE-UyhQ.js";
|
|
7
7
|
import { c as F, d as B, a as U, b as N, e as M, f as H, k, g as K, h as L, i as X, j as w, p as W, s as G, t as j, u as J, v as Y } from "./bitcoin-d9eaaZB_.js";
|
|
8
8
|
import { B as z, H as q, K as Q, M as $, T as aa, c as ea } from "./validation-Dj3dqYtl.js";
|
|
9
9
|
import { c as ta } from "./signing-DaLvGwQe.js";
|
|
10
|
-
import { P as oa, b as ia, c as na, d as pa, e as ua } from "./PeginManager-
|
|
10
|
+
import { P as oa, b as ia, c as na, d as pa, e as ua } from "./PeginManager-1R9dMB1G.js";
|
|
11
11
|
import { P as la, c as da, f as Pa, s as Ea, v as Ta } from "./signPsbtsWithFallback-eY1YgV13.js";
|
|
12
12
|
import { A as Ra, P as Sa } from "./ProtocolParams.abi-CV938AYZ.js";
|
|
13
|
-
import { B as ma } from "./BTCVaultRegistry.abi-
|
|
13
|
+
import { B as ma } from "./BTCVaultRegistry.abi-B3BLhpJ4.js";
|
|
14
14
|
import { B as fa } from "./BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js";
|
|
15
|
-
import { C as ba, e as Oa, g as
|
|
15
|
+
import { C as ba, e as Oa, g as Va, h as va, i as Ca } from "./errors-Blc-JWnI.js";
|
|
16
16
|
import { V as ya, b as Ia, a as Da, d as Fa } from "./deriveVaultRoot-D0RY5GJc.js";
|
|
17
17
|
import { p as Ua } from "./parseFundingOutpoints-GSM-IaaK.js";
|
|
18
18
|
import { BitcoinNetworks as Ma } from "./shared/index.js";
|
|
19
19
|
import { B as ka, a as Ka, f as La, c as Xa, b as wa, d as Wa, g as Ga, i as ja, h as Ja, s as Ya, e as Za, w as za } from "./waitForTransactionReceiptSmartAware-lobLm0q0.js";
|
|
20
20
|
import { B as Qa, D as $a, L as ae, M as ee, c as se, P as te, b as re, a as oe, S as ie, T as ne, W as pe, f as ue, d as ce, p as le, r as de } from "./fundPeginTransaction-B2wyjqp0.js";
|
|
21
|
-
import { U as Ee, a as Te, e as Ae, f as Re, v as Se } from "./reservation-
|
|
22
|
-
import { M as me, V as _e, g as fe, a as xe, b as be, c as Oe, d as
|
|
23
|
-
import { O as Ne, S as Me, V as He, g as ke, h as Ke, i as Le, j as Xe, a as we, d as We, b as Ge, f as je, p as Je, r as Ye, v as Ze, c as ze, e as qe } from "./batchPoll-
|
|
21
|
+
import { U as Ee, a as Te, e as Ae, f as Re, v as Se } from "./reservation-B4i_PQhY.js";
|
|
22
|
+
import { M as me, V as _e, g as fe, a as xe, b as be, c as Oe, d as Ve, e as ve, f as Ce, h as he, i as ye, p as Ie, v as De, j as Fe, k as Be } from "./mempoolApi-BQKF5MTr.js";
|
|
23
|
+
import { O as Ne, S as Me, V as He, g as ke, h as Ke, i as Le, j as Xe, a as we, d as We, b as Ge, f as je, p as Je, r as Ye, v as Ze, c as ze, e as qe } from "./batchPoll-L9LzMl1E.js";
|
|
24
24
|
import { A as $e, D as as, J as es, a as ss, b as ts, d as rs, P as os, R as is, e as ns, c as ps, V as us, i as cs } from "./json-rpc-client-DuUARJvV.js";
|
|
25
25
|
import { a as ds } from "./onChainBtcPubkey-DeF4cKoO.js";
|
|
26
26
|
import { D as Es, a as Ts, b as As, i as Rs } from "./errors-kXGQXKxZ.js";
|
|
27
|
-
import { B as gs, C as ms, P as _s,
|
|
28
|
-
import { C as
|
|
27
|
+
import { B as gs, C as ms, P as _s, E as fs, F as xs, G as bs, H as Os, R as Vs, a as vs, b as Cs, o as hs, A as ys, D as Is, i as Ds, p as Fs, k as Bs, z as Us, y as Ns, m as Ms, q as Hs, t as ks, u as Ks, x as Ls, r as Xs, s as ws, c as Ws, d as Gs, e as js, v as Js, f as Ys, g as Zs, h as zs, j as qs, l as Qs, n as $s, w as at } from "./buildAndBroadcastRefund-DpF_b3d9.js";
|
|
28
|
+
import { C as st, P as tt, c as rt, g as ot, i as it } from "./peginState-CxDiaKuk.js";
|
|
29
29
|
export {
|
|
30
30
|
$e as AUTH_REJECTED_RPC_CODE,
|
|
31
31
|
Ra as ApplicationRegistryABI,
|
|
@@ -38,7 +38,7 @@ export {
|
|
|
38
38
|
ka as BitcoinScriptType,
|
|
39
39
|
ba as CONTRACT_ERRORS,
|
|
40
40
|
ms as ClaimerPegoutStatusValue,
|
|
41
|
-
|
|
41
|
+
st as ContractStatus,
|
|
42
42
|
Es as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
|
|
43
43
|
$a as DUST_THRESHOLD,
|
|
44
44
|
as as DaemonStatus,
|
|
@@ -61,7 +61,7 @@ export {
|
|
|
61
61
|
os as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
62
62
|
_s as ParticipantKeyDriftError,
|
|
63
63
|
la as PayoutManager,
|
|
64
|
-
|
|
64
|
+
tt as PeginAction,
|
|
65
65
|
oa as PeginManager,
|
|
66
66
|
Sa as ProtocolParamsABI,
|
|
67
67
|
R as PsbtSubstitutionError,
|
|
@@ -69,7 +69,7 @@ export {
|
|
|
69
69
|
xs as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
70
70
|
bs as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
71
71
|
Os as REFUND_VSIZE,
|
|
72
|
-
|
|
72
|
+
Vs as RegisteredVaultVersionMismatchError,
|
|
73
73
|
is as RpcErrorCode,
|
|
74
74
|
ie as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
75
75
|
Me as ServerIdentityError,
|
|
@@ -89,7 +89,8 @@ export {
|
|
|
89
89
|
we as VpResponseValidationError,
|
|
90
90
|
We as VpTokenRegistry,
|
|
91
91
|
pe as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
92
|
-
|
|
92
|
+
vs as activateVault,
|
|
93
|
+
Cs as activateVaultAndRedeem,
|
|
93
94
|
Ka as applyChangeOutputPolicy,
|
|
94
95
|
ds as assertOnChainBtcPubkey,
|
|
95
96
|
S as assertPsbtUnsignedTxMatches,
|
|
@@ -98,19 +99,19 @@ export {
|
|
|
98
99
|
o as assertValidVaultCoreVersion,
|
|
99
100
|
hs as assertVaultProviderHintAccepted,
|
|
100
101
|
Ge as batchPollByProvider,
|
|
101
|
-
|
|
102
|
+
ys as buildAndBroadcastRefund,
|
|
102
103
|
s as buildChallengeAssertPsbt,
|
|
103
104
|
ia as buildDepositTerms,
|
|
104
105
|
Ia as buildFundingOutpointsCommitment,
|
|
105
106
|
y as buildNoPayoutPsbt,
|
|
106
107
|
m as buildPayoutPsbt,
|
|
107
|
-
|
|
108
|
+
V as buildPeginInputPsbt,
|
|
108
109
|
_ as buildPeginTxFromFundedPrePegin,
|
|
109
110
|
f as buildPrePeginPsbt,
|
|
110
111
|
I as buildRefundPsbt,
|
|
111
112
|
Da as buildVaultContext,
|
|
112
113
|
La as calculateBtcTxHash,
|
|
113
|
-
|
|
114
|
+
rt as canPerformAction,
|
|
114
115
|
F as canonicalizeBtcPubkey,
|
|
115
116
|
ea as combineAbortSignals,
|
|
116
117
|
Xa as computeChangeOutputFeeSats,
|
|
@@ -131,7 +132,7 @@ export {
|
|
|
131
132
|
Fa as deriveVaultRoot,
|
|
132
133
|
pa as deriveWotsBlocksFromSeed,
|
|
133
134
|
M as ensureHexPrefix,
|
|
134
|
-
|
|
135
|
+
Is as estimateRefundFeeSats,
|
|
135
136
|
ua as estimateSubmitPeginRequestBatchGas,
|
|
136
137
|
c as expandAuthAnchor,
|
|
137
138
|
l as expandHashlockSecret,
|
|
@@ -139,45 +140,45 @@ export {
|
|
|
139
140
|
Oa as extractErrorData,
|
|
140
141
|
Ae as extractInputsFromTransaction,
|
|
141
142
|
b as extractPayoutSignature,
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
v as extractPeginInputSignature,
|
|
144
|
+
C as finalizePeginInputPsbt,
|
|
144
145
|
Re as findOverlappingPendingVaults,
|
|
145
146
|
H as formatSatoshisToBtc,
|
|
146
147
|
Pa as forwardDepositApproval,
|
|
147
148
|
ue as fundPeginTransaction,
|
|
148
149
|
fe as getAddressTxs,
|
|
149
150
|
xe as getAddressUtxos,
|
|
150
|
-
|
|
151
|
+
Va as getContractErrorMessage,
|
|
151
152
|
Ga as getDustThreshold,
|
|
152
153
|
be as getMempoolApiUrl,
|
|
153
154
|
k as getNetwork,
|
|
154
155
|
Oe as getNetworkFees,
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
Ve as getOutspend,
|
|
157
|
+
ot as getPeginProtocolState,
|
|
157
158
|
ja as getPsbtInputFields,
|
|
158
159
|
Ja as getScriptType,
|
|
159
160
|
K as getSortedXOnlyPubkeys,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
ve as getTipHeight,
|
|
162
|
+
Ce as getTxHex,
|
|
163
|
+
he as getTxInfo,
|
|
163
164
|
ye as getUtxoInfo,
|
|
164
|
-
|
|
165
|
+
va as handleContractError,
|
|
165
166
|
L as hexToUint8Array,
|
|
166
|
-
|
|
167
|
+
it as isActivationDeadlinePassedOnChain,
|
|
167
168
|
X as isAddressFromPublicKey,
|
|
168
169
|
cs as isAuthRejectedError,
|
|
169
|
-
|
|
170
|
+
Ds as isDepositAmountValid,
|
|
170
171
|
As as isDepositTermsRejectedError,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
Fs as isHintAccepted,
|
|
173
|
+
Ca as isKnownContractError,
|
|
174
|
+
Bs as isParticipantKeyDriftError,
|
|
175
|
+
Us as isPegoutTerminalStatus,
|
|
176
|
+
Ns as isRecognizedPegoutStatus,
|
|
177
|
+
Ms as isRegisteredVaultVersionMismatchError,
|
|
177
178
|
w as isValidHex,
|
|
178
179
|
Rs as isWotsMismatchError,
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
Hs as matchKeyHint,
|
|
181
|
+
ks as matchKeySetHint,
|
|
181
182
|
Ua as parseFundingOutpointsFromTx,
|
|
182
183
|
ce as parseUnfundedWasmTransaction,
|
|
183
184
|
le as peginOutputCount,
|
|
@@ -186,39 +187,39 @@ export {
|
|
|
186
187
|
W as processPublicKeyToXOnly,
|
|
187
188
|
Ie as pushTx,
|
|
188
189
|
de as rateBasedTxBufferFee,
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
Ks as resolveCurrentParticipantKeys,
|
|
191
|
+
Ls as resolveParticipantKeysAtEpochs,
|
|
191
192
|
Ye as resolveProtocolAddresses,
|
|
192
|
-
|
|
193
|
+
Xs as runDepositorPresignFlow,
|
|
193
194
|
Ya as selectUtxosForPegin,
|
|
194
195
|
Za as shouldAddChangeOutput,
|
|
195
|
-
|
|
196
|
+
ws as signDepositorGraph,
|
|
196
197
|
G as stripHexPrefix,
|
|
197
|
-
|
|
198
|
+
Ws as submitWotsPublicKey,
|
|
198
199
|
E as supportedTxGraphVersions,
|
|
199
200
|
Ea as supportsDepositApproval,
|
|
200
201
|
j as toXOnly,
|
|
201
202
|
J as uint8ArrayToHex,
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
Gs as validateDepositAmount,
|
|
204
|
+
js as validateMultiVaultDepositInputs,
|
|
204
205
|
De as validateOffchainParams,
|
|
205
|
-
|
|
206
|
+
Js as validateOnChainParticipantKeys,
|
|
206
207
|
Fe as validatePegInConfiguration,
|
|
207
208
|
T as validatePeginP2aAnchor,
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
Ys as validateProviderSelection,
|
|
210
|
+
Zs as validateRemainingCapacity,
|
|
210
211
|
Ze as validateRequestDepositorClaimerArtifactsResponse,
|
|
211
212
|
Ta as validateSecretAgainstHashlock,
|
|
212
213
|
Be as validateTBVProtocolParams,
|
|
213
214
|
Se as validateUtxosAvailable,
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
zs as validateVaultAmounts,
|
|
216
|
+
qs as validateVaultProviderPubkey,
|
|
216
217
|
Y as validateWalletPubkey,
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
Qs as verifyRegisteredParticipantKeys,
|
|
219
|
+
$s as verifyRegisteredVaultVersions,
|
|
219
220
|
ze as verifyServerIdentity,
|
|
220
221
|
qe as vpTokenRegistry,
|
|
221
|
-
|
|
222
|
+
at as waitForPeginStatus,
|
|
222
223
|
za as waitForTransactionReceiptSmartAware
|
|
223
224
|
};
|
|
224
225
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { B as a } from "./BTCVaultRegistry.abi-
|
|
2
|
-
import { B as
|
|
1
|
+
import { B as a } from "./BTCVaultRegistry.abi-B3BLhpJ4.js";
|
|
2
|
+
import { B as d } from "./BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js";
|
|
3
3
|
import { a as w } from "./onChainBtcPubkey-DeF4cKoO.js";
|
|
4
|
-
import { a as
|
|
5
|
-
import { B, H as
|
|
6
|
-
const h = 65535, b = 1e4, l = 4294967295,
|
|
7
|
-
function
|
|
4
|
+
import { a as B } from "./constants-GjWXdaqV.js";
|
|
5
|
+
import { B as F, H as K, K as k, T as N, c as S } from "./validation-Dj3dqYtl.js";
|
|
6
|
+
const h = 65535, b = 1e4, l = 4294967295, $ = 255;
|
|
7
|
+
function T(t) {
|
|
8
8
|
if (!Number.isInteger(t) || t < 0 || t > l)
|
|
9
9
|
throw new Error(
|
|
10
10
|
`Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function O(t) {
|
|
14
14
|
const e = [];
|
|
15
15
|
if (t.timelockAssert <= 0n && e.push(
|
|
16
16
|
`timelockAssert must be positive, got ${t.timelockAssert}`
|
|
@@ -39,7 +39,7 @@ function S(t) {
|
|
|
39
39
|
`Invalid offchain protocol parameters: ${e.join("; ")}`
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function R(t) {
|
|
43
43
|
const e = [];
|
|
44
44
|
if (t.minimumPegInAmount <= 0n && e.push(
|
|
45
45
|
`minimumPegInAmount must be positive, got ${t.minimumPegInAmount}`
|
|
@@ -49,24 +49,24 @@ function O(t) {
|
|
|
49
49
|
`pegInAckTimeout must be positive, got ${t.pegInAckTimeout}`
|
|
50
50
|
), t.pegInActivationTimeout <= 0n && e.push(
|
|
51
51
|
`pegInActivationTimeout must be positive, got ${t.pegInActivationTimeout}`
|
|
52
|
-
), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount >
|
|
53
|
-
`maxHtlcOutputCount must be an integer in [1, ${
|
|
52
|
+
), (!Number.isInteger(t.maxHtlcOutputCount) || t.maxHtlcOutputCount <= 0 || t.maxHtlcOutputCount > $) && e.push(
|
|
53
|
+
`maxHtlcOutputCount must be an integer in [1, ${$}], got ${t.maxHtlcOutputCount}`
|
|
54
54
|
), (typeof t.expiredPegInGraceBlocks != "bigint" || t.expiredPegInGraceBlocks <= 0n) && e.push(
|
|
55
55
|
`expiredPegInGraceBlocks must be a positive bigint, got ${t.expiredPegInGraceBlocks}`
|
|
56
56
|
), e.length > 0)
|
|
57
57
|
throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`);
|
|
58
58
|
}
|
|
59
59
|
function L(t) {
|
|
60
|
-
if (
|
|
60
|
+
if (R(t), O(t.offchainParams), !Number.isInteger(t.offchainParamsVersion) || t.offchainParamsVersion < 0 || t.offchainParamsVersion > l)
|
|
61
61
|
throw new Error(
|
|
62
62
|
`Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`
|
|
63
63
|
);
|
|
64
|
-
|
|
64
|
+
B(
|
|
65
65
|
t.activeVaultCoreVersion,
|
|
66
66
|
"ProtocolParams.activeVaultCoreVersion()"
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const P = 9999;
|
|
70
70
|
function I(t) {
|
|
71
71
|
return {
|
|
72
72
|
depositor: t.depositor,
|
|
@@ -80,7 +80,7 @@ function I(t) {
|
|
|
80
80
|
}
|
|
81
81
|
function m(t) {
|
|
82
82
|
const e = Number(t.offchainParamsVersion);
|
|
83
|
-
return
|
|
83
|
+
return T(e), {
|
|
84
84
|
depositorSignedPeginTx: t.depositorSignedPeginTx,
|
|
85
85
|
universalChallengersVersion: t.universalChallengersVersion,
|
|
86
86
|
appVaultKeepersVersion: t.appVaultKeepersVersion,
|
|
@@ -96,15 +96,15 @@ function m(t) {
|
|
|
96
96
|
vaultCoreVersion: t.vaultCoreVersion
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const _ = 1n << 64n, y = 0n;
|
|
100
100
|
function p(t, e, o) {
|
|
101
|
-
if (t < 0n || t >=
|
|
101
|
+
if (t < 0n || t >= _)
|
|
102
102
|
throw new Error(
|
|
103
103
|
`getBtcVaultProtocolInfo returned ${e}=${t} for vault ${o}, outside the uint64 range — the registry may predate RFC-006`
|
|
104
104
|
);
|
|
105
105
|
return t;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function E(t, e) {
|
|
108
108
|
return {
|
|
109
109
|
vpKeyEpoch: p(t.vpKeyEpoch, "vpKeyEpoch", e),
|
|
110
110
|
appKeeperKeyEpoch: p(
|
|
@@ -120,29 +120,46 @@ class W {
|
|
|
120
120
|
this.publicClient = e, this.contractAddress = o;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
|
-
* Read the VP's
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
123
|
+
* Read the VP's **genesis** (registration) x-only BTC pubkey — the key bonded
|
|
124
|
+
* at version 0, which never moves when the operator rotates.
|
|
125
|
+
*
|
|
126
|
+
* Resolved as "the operation key at epoch 0" rather than through the
|
|
127
|
+
* dedicated `getVaultProviderBTCKey` getter, which
|
|
128
|
+
* https://github.com/babylonlabs-io/vault-contracts-aave-v4/pull/539 removes.
|
|
129
|
+
* Epoch 0 predates any rotation — appended versions are stamped at epoch 1 or
|
|
130
|
+
* later — so it resolves to the registration key, and the contracts team has
|
|
131
|
+
* confirmed that is a property we can rely on rather than an implementation
|
|
132
|
+
* detail. The devnet comparison behind that claim — both getters returning the
|
|
133
|
+
* identical key for a provider that *has* rotated, while
|
|
134
|
+
* `getCurrentOperationBtcKey` differed — is recorded in
|
|
135
|
+
* https://github.com/babylonlabs-io/babylon-toolkit/issues/2188.
|
|
136
|
+
*
|
|
137
|
+
* This makes the read RFC-006-only, where the removed getter also existed on a
|
|
138
|
+
* legacy registry. That costs nothing: every caller of this method already
|
|
139
|
+
* resolves participant keys through `OperationKeyReader`, so all of them
|
|
140
|
+
* require an RFC-006 registry regardless.
|
|
141
|
+
*
|
|
142
|
+
* Validates length, hex form, and secp256k1 curve membership before minting
|
|
143
|
+
* the brand. Returns 64-char lowercase hex without the `0x` prefix.
|
|
127
144
|
*/
|
|
128
|
-
async
|
|
145
|
+
async getVaultProviderGenesisBtcPubKey(e) {
|
|
129
146
|
const o = await this.publicClient.readContract({
|
|
130
147
|
address: this.contractAddress,
|
|
131
148
|
abi: a,
|
|
132
|
-
functionName: "
|
|
133
|
-
args: [e]
|
|
149
|
+
functionName: "getOperationBtcKeyAtEpoch",
|
|
150
|
+
args: [e, y]
|
|
134
151
|
});
|
|
135
152
|
return w(
|
|
136
153
|
o,
|
|
137
|
-
`
|
|
154
|
+
`getOperationBtcKeyAtEpoch (vp=${e}, epoch=${y})`
|
|
138
155
|
);
|
|
139
156
|
}
|
|
140
157
|
/**
|
|
141
158
|
* Read a vault provider's *current* RFC-006 operation BTC key.
|
|
142
159
|
*
|
|
143
160
|
* Falls back on-chain to the registration key when the provider has never
|
|
144
|
-
* rotated, so this returns the same value as
|
|
145
|
-
* until the first rotation.
|
|
161
|
+
* rotated, so this returns the same value as
|
|
162
|
+
* `getVaultProviderGenesisBtcPubKey` until the first rotation.
|
|
146
163
|
*
|
|
147
164
|
* This is the key the VP's server signs its BIP-322 auth tokens with — a
|
|
148
165
|
* live per-operator identity, not a per-vault binding, so the auth pin uses
|
|
@@ -173,23 +190,23 @@ class W {
|
|
|
173
190
|
async getVaultKeyEpochs(e) {
|
|
174
191
|
const o = await this.publicClient.readContract({
|
|
175
192
|
address: this.contractAddress,
|
|
176
|
-
abi:
|
|
193
|
+
abi: d,
|
|
177
194
|
functionName: "getBtcVaultProtocolInfo",
|
|
178
195
|
args: [e]
|
|
179
196
|
});
|
|
180
|
-
return
|
|
197
|
+
return E(o, e);
|
|
181
198
|
}
|
|
182
199
|
async getVaultKeyEpochsBatch(e) {
|
|
183
200
|
return e.length === 0 ? [] : (await this.publicClient.multicall({
|
|
184
201
|
contracts: e.map((n) => ({
|
|
185
202
|
address: this.contractAddress,
|
|
186
|
-
abi:
|
|
203
|
+
abi: d,
|
|
187
204
|
functionName: "getBtcVaultProtocolInfo",
|
|
188
205
|
args: [n]
|
|
189
206
|
})),
|
|
190
207
|
allowFailure: !1
|
|
191
208
|
})).map(
|
|
192
|
-
(n, i) =>
|
|
209
|
+
(n, i) => E(n, e[i])
|
|
193
210
|
);
|
|
194
211
|
}
|
|
195
212
|
async getVaultBasicInfo(e) {
|
|
@@ -254,9 +271,9 @@ class W {
|
|
|
254
271
|
functionName: "getVaultProviderCommission",
|
|
255
272
|
args: [e]
|
|
256
273
|
});
|
|
257
|
-
if (!Number.isInteger(o) || o < 0 || o >
|
|
274
|
+
if (!Number.isInteger(o) || o < 0 || o > P)
|
|
258
275
|
throw new Error(
|
|
259
|
-
`getVaultProviderCommission returned ${o} bps for ${e}, outside the protocol range [0, ${
|
|
276
|
+
`getVaultProviderCommission returned ${o} bps for ${e}, outside the protocol range [0, ${P}]`
|
|
260
277
|
);
|
|
261
278
|
return o;
|
|
262
279
|
}
|
|
@@ -305,7 +322,7 @@ class W {
|
|
|
305
322
|
"Vault not found on-chain or has no pegin transaction while reading offchain params version"
|
|
306
323
|
);
|
|
307
324
|
const r = Number(i.offchainParamsVersion);
|
|
308
|
-
return
|
|
325
|
+
return T(r), r;
|
|
309
326
|
});
|
|
310
327
|
}
|
|
311
328
|
}
|
|
@@ -316,7 +333,7 @@ async function f(t, e) {
|
|
|
316
333
|
V
|
|
317
334
|
), i = [o.signal, e == null ? void 0 : e.signal].filter(
|
|
318
335
|
Boolean
|
|
319
|
-
), r =
|
|
336
|
+
), r = S(i);
|
|
320
337
|
try {
|
|
321
338
|
return await fetch(t, {
|
|
322
339
|
...e,
|
|
@@ -328,37 +345,37 @@ async function f(t, e) {
|
|
|
328
345
|
) : s;
|
|
329
346
|
}
|
|
330
347
|
}
|
|
331
|
-
const
|
|
348
|
+
const A = 1e4;
|
|
332
349
|
function C(t) {
|
|
333
350
|
return Number.isInteger(t) && t > 0 && t <= U;
|
|
334
351
|
}
|
|
335
|
-
function
|
|
336
|
-
return Number.isInteger(t) && t > 0 && t <=
|
|
352
|
+
function M(t) {
|
|
353
|
+
return Number.isInteger(t) && t > 0 && t <= A;
|
|
337
354
|
}
|
|
338
|
-
function
|
|
355
|
+
function g(t, e) {
|
|
339
356
|
return !Number.isInteger(t) || t < 0 ? !1 : e === void 0 || t < e;
|
|
340
357
|
}
|
|
341
358
|
function u(t) {
|
|
342
|
-
if (!
|
|
359
|
+
if (!N.test(t))
|
|
343
360
|
throw new Error(`Invalid transaction ID format: ${t}`);
|
|
344
361
|
}
|
|
345
362
|
function v(t) {
|
|
346
|
-
if (!
|
|
363
|
+
if (!F.test(t))
|
|
347
364
|
throw new Error(`Invalid Bitcoin address format: ${t}`);
|
|
348
365
|
}
|
|
349
|
-
function
|
|
350
|
-
if (!
|
|
366
|
+
function x(t, e) {
|
|
367
|
+
if (!K.test(t))
|
|
351
368
|
throw new Error(
|
|
352
369
|
`Invalid scriptPubKey: not valid hex for ${e}`
|
|
353
370
|
);
|
|
354
|
-
if (!
|
|
371
|
+
if (!k.some(
|
|
355
372
|
(n) => t.toLowerCase().startsWith(n)
|
|
356
373
|
))
|
|
357
374
|
throw new Error(
|
|
358
375
|
`Unrecognized scriptPubKey type for ${e}: prefix ${t.slice(0, 6)} does not match any known Bitcoin script type`
|
|
359
376
|
);
|
|
360
377
|
}
|
|
361
|
-
const
|
|
378
|
+
const H = {
|
|
362
379
|
mainnet: "https://mempool.space/api",
|
|
363
380
|
testnet: "https://mempool.space/testnet/api",
|
|
364
381
|
signet: "https://mempool.space/signet/api"
|
|
@@ -378,7 +395,7 @@ async function c(t, e) {
|
|
|
378
395
|
throw o instanceof Error ? new Error(`Failed to fetch from mempool API: ${o.message}`) : new Error("Failed to fetch from mempool API: Unknown error");
|
|
379
396
|
}
|
|
380
397
|
}
|
|
381
|
-
async function
|
|
398
|
+
async function J(t, e) {
|
|
382
399
|
try {
|
|
383
400
|
const o = await f(`${e}/tx`, {
|
|
384
401
|
method: "POST",
|
|
@@ -405,10 +422,10 @@ async function G(t, e) {
|
|
|
405
422
|
throw o instanceof Error ? new Error(`Failed to broadcast BTC transaction: ${o.message}`) : new Error("Failed to broadcast BTC transaction: Unknown error");
|
|
406
423
|
}
|
|
407
424
|
}
|
|
408
|
-
async function
|
|
425
|
+
async function X(t, e) {
|
|
409
426
|
return u(t), c(`${e}/tx/${t}`);
|
|
410
427
|
}
|
|
411
|
-
async function
|
|
428
|
+
async function q(t) {
|
|
412
429
|
const e = await c(`${t}/blocks/tip/height`), o = e.trim();
|
|
413
430
|
if (!/^\d+$/.test(o))
|
|
414
431
|
throw new Error(
|
|
@@ -416,12 +433,12 @@ async function J(t) {
|
|
|
416
433
|
);
|
|
417
434
|
return Number.parseInt(o, 10);
|
|
418
435
|
}
|
|
419
|
-
async function
|
|
420
|
-
if (u(t), !
|
|
436
|
+
async function Y(t, e, o) {
|
|
437
|
+
if (u(t), !g(e))
|
|
421
438
|
throw new Error(`Invalid vout ${e} for transaction ${t}`);
|
|
422
439
|
return c(`${o}/tx/${t}/outspend/${e}`);
|
|
423
440
|
}
|
|
424
|
-
async function
|
|
441
|
+
async function Z(t, e) {
|
|
425
442
|
u(t);
|
|
426
443
|
try {
|
|
427
444
|
const o = await f(`${e}/tx/${t}/hex`);
|
|
@@ -436,24 +453,24 @@ async function Y(t, e) {
|
|
|
436
453
|
throw o instanceof Error ? new Error(`Failed to get transaction hex for ${t}: ${o.message}`) : new Error(`Failed to get transaction hex for ${t}: Unknown error`);
|
|
437
454
|
}
|
|
438
455
|
}
|
|
439
|
-
async function
|
|
456
|
+
async function tt(t, e, o) {
|
|
440
457
|
u(t);
|
|
441
|
-
const n = await
|
|
442
|
-
if (!
|
|
458
|
+
const n = await X(t, o);
|
|
459
|
+
if (!g(e, n.vout.length))
|
|
443
460
|
throw new Error(
|
|
444
461
|
`Invalid vout ${e} for transaction ${t} (has ${n.vout.length} outputs)`
|
|
445
462
|
);
|
|
446
463
|
const i = n.vout[e];
|
|
447
464
|
if (!C(i.value))
|
|
448
465
|
throw new Error(`Invalid UTXO value ${i.value} for ${t}:${e}`);
|
|
449
|
-
return
|
|
466
|
+
return x(i.scriptpubkey, `${t}:${e}`), {
|
|
450
467
|
txid: t,
|
|
451
468
|
vout: e,
|
|
452
469
|
value: i.value,
|
|
453
470
|
scriptPubKey: i.scriptpubkey
|
|
454
471
|
};
|
|
455
472
|
}
|
|
456
|
-
async function
|
|
473
|
+
async function et(t, e) {
|
|
457
474
|
v(t);
|
|
458
475
|
try {
|
|
459
476
|
const o = await c(`${e}/address/${t}/utxo`), n = await c(`${e}/v1/validate-address/${t}`);
|
|
@@ -461,9 +478,9 @@ async function tt(t, e) {
|
|
|
461
478
|
throw new Error(
|
|
462
479
|
`Invalid Bitcoin address: ${t}. Mempool API validation failed.`
|
|
463
480
|
);
|
|
464
|
-
|
|
481
|
+
x(n.scriptPubKey, t);
|
|
465
482
|
for (const r of o) {
|
|
466
|
-
if (u(r.txid), !
|
|
483
|
+
if (u(r.txid), !g(r.vout))
|
|
467
484
|
throw new Error(`Invalid vout ${r.vout} for ${r.txid}`);
|
|
468
485
|
if (!C(r.value))
|
|
469
486
|
throw new Error(
|
|
@@ -485,13 +502,13 @@ async function tt(t, e) {
|
|
|
485
502
|
);
|
|
486
503
|
}
|
|
487
504
|
}
|
|
488
|
-
function
|
|
489
|
-
return
|
|
505
|
+
function ot(t) {
|
|
506
|
+
return H[t];
|
|
490
507
|
}
|
|
491
|
-
async function
|
|
508
|
+
async function nt(t, e) {
|
|
492
509
|
return v(t), c(`${e}/address/${t}/txs`);
|
|
493
510
|
}
|
|
494
|
-
async function
|
|
511
|
+
async function rt(t) {
|
|
495
512
|
const e = await f(`${t}/v1/fees/recommended`);
|
|
496
513
|
if (!e.ok)
|
|
497
514
|
throw new Error(
|
|
@@ -505,9 +522,9 @@ async function nt(t) {
|
|
|
505
522
|
"minimumFee"
|
|
506
523
|
];
|
|
507
524
|
for (const i of n)
|
|
508
|
-
if (!
|
|
525
|
+
if (!M(o[i]))
|
|
509
526
|
throw new Error(
|
|
510
|
-
`Invalid fee rate ${i}=${o[i]} from mempool API: expected a positive number ≤ ${
|
|
527
|
+
`Invalid fee rate ${i}=${o[i]} from mempool API: expected a positive number ≤ ${A}`
|
|
511
528
|
);
|
|
512
529
|
if (o.minimumFee > o.economyFee || o.economyFee > o.hourFee || o.hourFee > o.halfHourFee || o.halfHourFee > o.fastestFee)
|
|
513
530
|
throw new Error(
|
|
@@ -516,21 +533,21 @@ async function nt(t) {
|
|
|
516
533
|
return o;
|
|
517
534
|
}
|
|
518
535
|
export {
|
|
519
|
-
M,
|
|
536
|
+
H as M,
|
|
520
537
|
W as V,
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
538
|
+
et as a,
|
|
539
|
+
ot as b,
|
|
540
|
+
rt as c,
|
|
541
|
+
Y as d,
|
|
542
|
+
q as e,
|
|
543
|
+
Z as f,
|
|
544
|
+
nt as g,
|
|
545
|
+
X as h,
|
|
546
|
+
tt as i,
|
|
530
547
|
L as j,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
548
|
+
R as k,
|
|
549
|
+
T as l,
|
|
550
|
+
J as p,
|
|
551
|
+
O as v
|
|
535
552
|
};
|
|
536
|
-
//# sourceMappingURL=mempoolApi-
|
|
553
|
+
//# sourceMappingURL=mempoolApi-BQKF5MTr.js.map
|