@babylonlabs-io/ts-sdk 0.77.0 → 0.79.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/dist/{BTCVaultRegistry.abi-CJwWI2EO.js → BTCVaultRegistry.abi-B0x9_Bza.js} +321 -2
- package/dist/BTCVaultRegistry.abi-B0x9_Bza.js.map +1 -0
- package/dist/BTCVaultRegistry.abi-BQ5tFNSu.cjs +2 -0
- package/dist/BTCVaultRegistry.abi-BQ5tFNSu.cjs.map +1 -0
- package/dist/{BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js → BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js} +57 -20
- package/dist/BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js.map +1 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs +2 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs.map +1 -0
- package/dist/{PeginManager-DNimKlmw.js → PeginManager-BXlh3ar0.js} +289 -348
- package/dist/PeginManager-BXlh3ar0.js.map +1 -0
- package/dist/PeginManager-BuVSknB0.cjs +2 -0
- package/dist/PeginManager-BuVSknB0.cjs.map +1 -0
- package/dist/ProtocolParams.abi-Db2USqQm.cjs +2 -0
- package/dist/ProtocolParams.abi-Db2USqQm.cjs.map +1 -0
- package/dist/ProtocolParams.abi-q0AidvYX.js +526 -0
- package/dist/ProtocolParams.abi-q0AidvYX.js.map +1 -0
- package/dist/buildAndBroadcastReclaim-N9dXH9dm.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-N9dXH9dm.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-DCGcupg7.js → buildAndBroadcastReclaim-O6z9kvc4.js} +502 -468
- package/dist/buildAndBroadcastReclaim-O6z9kvc4.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +229 -222
- package/dist/pegin-registration-client-CZgcU2_0.cjs +2 -0
- package/dist/pegin-registration-client-CZgcU2_0.cjs.map +1 -0
- package/dist/{pegin-registration-client-CXK3B_D1.js → pegin-registration-client-pcczkzMg.js} +344 -240
- package/dist/pegin-registration-client-pcczkzMg.js.map +1 -0
- package/dist/tbv/core/clients/eth/index.cjs +1 -1
- package/dist/tbv/core/clients/eth/index.d.ts +1 -0
- package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/index.js +14 -12
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts +17 -0
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/registration-logs-error.d.ts +20 -0
- package/dist/tbv/core/clients/eth/registration-logs-error.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts +2 -0
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +40 -0
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +31 -0
- 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 +41 -39
- package/dist/tbv/core/contracts/__tests__/peginFingerprintAbi.test.d.ts +24 -0
- package/dist/tbv/core/contracts/__tests__/peginFingerprintAbi.test.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts +14 -0
- package/dist/tbv/core/contracts/abis/ApplicationRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +265 -1
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +10 -0
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/errors.d.ts +41 -4
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.cjs.map +1 -1
- package/dist/tbv/core/contracts/index.d.ts +1 -1
- package/dist/tbv/core/contracts/index.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.js +15 -492
- package/dist/tbv/core/contracts/index.js.map +1 -1
- package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts +3 -2
- package/dist/tbv/core/deposit-terms/commissionCeiling.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +224 -217
- package/dist/tbv/core/managers/PeginManager.d.ts +13 -25
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.d.ts +2 -2
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.js +4 -5
- package/dist/tbv/core/pegin-fingerprint/index.d.ts +1 -1
- package/dist/tbv/core/pegin-fingerprint/index.d.ts.map +1 -1
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts +10 -0
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/index.d.ts +1 -1
- package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts +50 -3
- 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 +56 -54
- package/dist/tbv/core/services/participants/__tests__/fixtures/rotation.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +224 -217
- package/dist/{toRefundInputs-BNSXIymn.js → toRefundInputs-9inv4Ai4.js} +96 -92
- package/dist/toRefundInputs-9inv4Ai4.js.map +1 -0
- package/dist/toRefundInputs-DitGWAnz.cjs +2 -0
- package/dist/toRefundInputs-DitGWAnz.cjs.map +1 -0
- package/dist/{types-C5DyrC8F.js → types-B9YhlXe8.js} +109 -83
- package/dist/types-B9YhlXe8.js.map +1 -0
- package/dist/types-C1tpDycc.cjs +2 -0
- package/dist/types-C1tpDycc.cjs.map +1 -0
- package/package.json +3 -3
- package/dist/BTCVaultRegistry.abi-CJwWI2EO.js.map +0 -1
- package/dist/BTCVaultRegistry.abi-z7d_eP22.cjs +0 -2
- package/dist/BTCVaultRegistry.abi-z7d_eP22.cjs.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs +0 -2
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js.map +0 -1
- package/dist/PeginManager-DEByBX5R.cjs +0 -2
- package/dist/PeginManager-DEByBX5R.cjs.map +0 -1
- package/dist/PeginManager-DNimKlmw.js.map +0 -1
- package/dist/buildAndBroadcastReclaim-Cqc6Jiqk.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-Cqc6Jiqk.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-DCGcupg7.js.map +0 -1
- package/dist/pegin-registration-client-CXK3B_D1.js.map +0 -1
- package/dist/pegin-registration-client-DLsMNm8Z.cjs +0 -2
- package/dist/pegin-registration-client-DLsMNm8Z.cjs.map +0 -1
- package/dist/toRefundInputs-BNSXIymn.js.map +0 -1
- package/dist/toRefundInputs-meTyor7r.cjs +0 -2
- package/dist/toRefundInputs-meTyor7r.cjs.map +0 -1
- package/dist/types-BzSOthHH.cjs +0 -2
- package/dist/types-BzSOthHH.cjs.map +0 -1
- package/dist/types-C5DyrC8F.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,277 +1,284 @@
|
|
|
1
|
-
import { P as s, h as
|
|
2
|
-
import { a as
|
|
3
|
-
import { computeMinClaimValue as
|
|
4
|
-
import { a as
|
|
5
|
-
import { c as
|
|
1
|
+
import { P as s, h as r, i as t, j as i, f as o, b as n, a as P, c as p, k as E, d as c, e as l, g as d } from "./verifyScriptPathSchnorrSignature-D_epga4j.js";
|
|
2
|
+
import { a as g } from "./secp256k1-D-H9jmd7.js";
|
|
3
|
+
import { computeMinClaimValue as A, computeMinPeginFee as _, deriveVaultId as T, expandAuthAnchor as m, expandHashlockSecret as S, expandWotsSeed as I, peginP2aAnchorOutput as C, supportedTxGraphVersions as O, validatePeginP2aAnchor as N } from "./tbv/core/wasm/index.js";
|
|
4
|
+
import { a as x, c as b, b as h, e as V, f as F } from "./verifyKeyPathSchnorrSignature-BVtNwgK6.js";
|
|
5
|
+
import { c as M, a as y, b as D, e as U, f as B, r as H } from "./noPayout-DiGr4eas.js";
|
|
6
6
|
import { b as K } from "./challengeAssert-Cp_GeRg8.js";
|
|
7
|
-
import { c as k, d as G, a as W, b as w, e as Y, f as j, k as z, g as J, h as Z, i as q, j as Q, p as $, s as aa, t as ea, u as sa, v as
|
|
7
|
+
import { c as k, d as G, a as W, b as w, e as Y, f as j, k as z, g as J, h as Z, i as q, j as Q, p as $, s as aa, t as ea, u as sa, v as ra } from "./bitcoin-C-TuHb-v.js";
|
|
8
8
|
import { c as ia } from "./abortSignals-BPpAUL1Z.js";
|
|
9
9
|
import { c as na, a as Pa } from "./signing-Cm-McVR2.js";
|
|
10
|
-
import { B as Ea, C as ca, H as
|
|
11
|
-
import { waitForTransactionReceiptSmartAware as
|
|
12
|
-
import { P as
|
|
13
|
-
import { P as
|
|
14
|
-
import { MEMPOOL_API_URLS as
|
|
15
|
-
import { O as
|
|
16
|
-
import { a as
|
|
17
|
-
import { C as
|
|
18
|
-
import {
|
|
19
|
-
import { B as
|
|
20
|
-
import { B as Ae, C as _e, e as
|
|
21
|
-
import { V as
|
|
22
|
-
import { BitcoinNetworks as
|
|
23
|
-
import { B as
|
|
24
|
-
import { B as
|
|
25
|
-
import { U as
|
|
26
|
-
import { V as
|
|
27
|
-
import { A as
|
|
28
|
-
import { S as
|
|
29
|
-
import { D as
|
|
30
|
-
import {
|
|
31
|
-
import { C as
|
|
10
|
+
import { B as Ea, C as ca, H as la, K as da, M as ua, T as ga, X as Ra } from "./validation-OSC0xTHB.js";
|
|
11
|
+
import { waitForTransactionReceiptSmartAware as _a } from "./tbv/core/utils/eth/index.js";
|
|
12
|
+
import { P as ma, b as Sa, c as Ia, d as Ca, e as Oa } from "./PeginManager-BXlh3ar0.js";
|
|
13
|
+
import { P as fa, c as xa, f as ba, r as ha, s as Va, v as Fa } from "./signPsbtsWithFallback-f7QLp0q8.js";
|
|
14
|
+
import { MEMPOOL_API_URLS as Ma, getAddressTxs as ya, getAddressUtxos as Da, getMempoolApiUrl as Ua, getNetworkFees as Ba, getOutspend as Ha, getTipHeight as La, getTxHex as Ka, getTxInfo as Xa, getUtxoInfo as ka, pushTx as Ga } from "./tbv/core/clients/mempool/index.js";
|
|
15
|
+
import { O as wa, V as Ya, a as ja, b as za, c as Ja, r as Za } from "./types-B9YhlXe8.js";
|
|
16
|
+
import { a as Qa } from "./onChainBtcPubkey-C-6UWpD8.js";
|
|
17
|
+
import { C as ae, M as ee, R as se, V as re, c as te, e as ie, d as oe, i as ne, v as Pe, a as pe, b as Ee } from "./pegin-registration-client-pcczkzMg.js";
|
|
18
|
+
import { A as le, P as de } from "./ProtocolParams.abi-q0AidvYX.js";
|
|
19
|
+
import { B as ge } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
|
|
20
|
+
import { B as Ae, C as _e, P as Te, a as me, e as Se, g as Ie, h as Ce, i as Oe, b as Ne } from "./BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js";
|
|
21
|
+
import { V as xe, b as be, a as he, d as Ve, f as Fe, p as ve } from "./parseFundingOutpoints-BQWvINfm.js";
|
|
22
|
+
import { BitcoinNetworks as ye } from "./shared/index.js";
|
|
23
|
+
import { B as Ue, a as Be, c as He, b as Le, d as Ke, g as Xe, h as ke, f as Ge, s as We, e as we } from "./psbtInputFields-CCVyaQMi.js";
|
|
24
|
+
import { B as je, D as ze, L as Je, M as Ze, c as qe, P as Qe, b as $e, a as as, S as es, T as ss, W as rs, f as ts, d as is, p as os, r as ns } from "./fundPeginTransaction-CwhRbCQC.js";
|
|
25
|
+
import { U as ps, a as Es, e as cs, f as ls, v as ds } from "./reservation-Cj9F0rP9.js";
|
|
26
|
+
import { V as gs, a as Rs, b as As, v as _s } from "./index-DQ5bfoT3.js";
|
|
27
|
+
import { A as ms, D as Ss, J as Is, a as Cs, b as Os, d as Ns, P as fs, R as xs, e as bs, c as hs, V as Vs, i as Fs } from "./json-rpc-client-DuUARJvV.js";
|
|
28
|
+
import { S as Ms, V as ys, c as Ds, p as Us, v as Bs, a as Hs } from "./primeVpAuth-DdfHSC53.js";
|
|
29
|
+
import { D as Ks, f as Xs, P as ks, a as Gs, b as Ws, o as ws, p as Ys, n as js, q as zs, U as Js, V as Zs, j as qs, c as Qs, h as $s, l as ar, k as er, e as sr, g as rr, d as tr, i as ir, r as or, m as nr, t as Pr } from "./toRefundInputs-9inv4Ai4.js";
|
|
30
|
+
import { A as Er, J as cr, G as lr, P as dr, p as ur, c as gr, d as Rr, U as Ar, V as _r, W as Tr, X as mr, M as Sr, N as Ir, O as Cr, Q as Or, S as Nr, R as fr, a as xr, b as br, z as hr, T as Vr, K as Fr, L as vr, g as Mr, h as yr, B as Dr, q as Ur, i as Br, e as Hr, I as Lr, H as Kr, u as Xr, C as kr, D as Gr, E as Wr, F as wr, r as Yr, s as jr, f as zr, j as Jr, k as Zr, v as qr, l as Qr, m as $r, n as at, o as et, t as st, x as rt, w as tt, y as it } from "./buildAndBroadcastReclaim-O6z9kvc4.js";
|
|
31
|
+
import { C as nt, P as Pt, c as pt, g as Et, i as ct } from "./peginState-CxDiaKuk.js";
|
|
32
32
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
ms as AUTH_REJECTED_RPC_CODE,
|
|
34
|
+
Er as ApplicationEntryPointMismatchError,
|
|
35
|
+
le as ApplicationRegistryABI,
|
|
36
|
+
cr as BIP68NotMatureError,
|
|
36
37
|
Ea as BITCOIN_ADDRESS_RE,
|
|
37
|
-
|
|
38
|
+
ge as BTCVaultRegistryABI,
|
|
38
39
|
Ae as BTCVaultRegistryKeyEpochsABI,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
je as BTC_DUST_SAT,
|
|
41
|
+
ye as BitcoinNetworks,
|
|
42
|
+
Ue as BitcoinScriptType,
|
|
43
|
+
ae as COMMISSION_BPS_HEADROOM,
|
|
43
44
|
ca as COMPRESSED_PUBKEY_HEX_LEN,
|
|
44
45
|
_e as CONTRACT_ERRORS,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
lr as ClaimerPegoutStatusValue,
|
|
47
|
+
nt as ContractStatus,
|
|
48
|
+
Ks as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
|
|
49
|
+
ze as DUST_THRESHOLD,
|
|
50
|
+
Ss as DaemonStatus,
|
|
51
|
+
Xs as DepositTermsRejectedError,
|
|
52
|
+
la as HEX_RE,
|
|
53
|
+
Is as JSON_RPC_ERROR_CODES,
|
|
54
|
+
Cs as JsonRpcClient,
|
|
55
|
+
Os as JsonRpcError,
|
|
55
56
|
da as KNOWN_SCRIPT_PREFIXES,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
Je as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
58
|
+
ee as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
|
|
59
|
+
Ze as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
60
|
+
ua as MAX_REASONABLE_FEE_SATS,
|
|
61
|
+
qe as MAX_REASONABLE_PEGIN_VBYTES,
|
|
62
|
+
Ma as MEMPOOL_API_URLS,
|
|
63
|
+
wa as OnChainBtcVaultStatus,
|
|
64
|
+
Qe as P2TR_INPUT_SIZE,
|
|
65
|
+
$e as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
65
66
|
s as PEGIN_DEPOSITOR_CLAIM_VOUT,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
67
|
+
dr as PEGIN_ETH_CONFIRMATIONS,
|
|
68
|
+
Te as PEGIN_FINGERPRINT_CHANGED_SELECTOR,
|
|
69
|
+
ks as PEGIN_FINGERPRINT_DOMAIN,
|
|
70
|
+
Gs as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
|
|
71
|
+
as as PEGIN_FIXED_OUTPUTS,
|
|
72
|
+
Ns as POST_WOTS_STATUSES,
|
|
73
|
+
fs as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
74
|
+
ur as ParticipantKeyDriftError,
|
|
75
|
+
fa as PayoutManager,
|
|
76
|
+
Pt as PeginAction,
|
|
77
|
+
me as PeginFingerprintChangedError,
|
|
78
|
+
Ws as PeginFingerprintInputError,
|
|
79
|
+
ma as PeginManager,
|
|
80
|
+
ws as PeginParamsAmbiguousError,
|
|
81
|
+
Ys as PeginParamsIncompleteSpaceError,
|
|
82
|
+
js as PeginParamsNotFoundError,
|
|
83
|
+
gr as PeginRegistrationMissingError,
|
|
84
|
+
Rr as PeginRegistrationNotFinalError,
|
|
85
|
+
zs as PeginSizingIntegrityError,
|
|
86
|
+
de as ProtocolParamsABI,
|
|
87
|
+
r as PsbtSubstitutionError,
|
|
88
|
+
Ar as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
|
|
89
|
+
_r as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
|
|
90
|
+
Tr as RECLAIM_MAX_FEE_RATE_SATS_VB,
|
|
91
|
+
mr as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
|
|
92
|
+
Sr as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
|
|
93
|
+
Ir as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
94
|
+
Cr as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
95
|
+
Or as REFUND_VSIZE,
|
|
96
|
+
Nr as ReclaimUneconomicalError,
|
|
97
|
+
fr as RegisteredVaultVersionMismatchError,
|
|
98
|
+
se as RegistrationLogsUnavailableError,
|
|
99
|
+
xs as RpcErrorCode,
|
|
100
|
+
es as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
101
|
+
Ms as ServerIdentityError,
|
|
102
|
+
ga as TXID_RE,
|
|
103
|
+
ss as TX_BUFFER_SIZE_OVERHEAD,
|
|
104
|
+
Js as UnanchoredPrePeginError,
|
|
105
|
+
ps as UtxoNotAvailableError,
|
|
106
|
+
xe as VAULT_APP_NAME,
|
|
107
|
+
bs as VP_BATCH_MAX_SIZE,
|
|
108
|
+
hs as VP_TERMINAL_FAILURE_STATUSES,
|
|
109
|
+
Vs as VP_TRANSIENT_STATUSES,
|
|
110
|
+
gs as VaultProviderRpcClient,
|
|
111
|
+
Zs as VaultRootMismatchError,
|
|
112
|
+
Ya as ViemOperationKeyReader,
|
|
113
|
+
re as ViemPeginRegistrationClient,
|
|
114
|
+
ja as ViemProtocolParamsReader,
|
|
115
|
+
za as ViemUniversalChallengerReader,
|
|
116
|
+
Ja as ViemVaultKeeperReader,
|
|
117
|
+
te as ViemVaultRegistryReader,
|
|
118
|
+
Rs as VpResponseValidationError,
|
|
119
|
+
ys as VpTokenRegistry,
|
|
120
|
+
rs as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
121
|
+
Ra as X_ONLY_PUBKEY_HEX_LEN,
|
|
122
|
+
xr as activateVault,
|
|
123
|
+
br as activateVaultAndRedeem,
|
|
124
|
+
Be as applyChangeOutputPolicy,
|
|
125
|
+
x as assertKeyPathSchnorrSignature,
|
|
126
|
+
Qa as assertOnChainBtcPubkey,
|
|
127
|
+
t as assertPsbtUnsignedTxMatches,
|
|
124
128
|
b as assertReturnedKeyPathSignatures,
|
|
125
129
|
i as assertScriptPathSchnorrSignature,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
Es as assertUtxosAvailable,
|
|
131
|
+
g as assertValidVaultCoreVersion,
|
|
132
|
+
hr as assertVaultProviderHintAccepted,
|
|
133
|
+
As as batchPollByProvider,
|
|
134
|
+
Vr as buildAndBroadcastReclaim,
|
|
135
|
+
Fr as buildAndBroadcastRefund,
|
|
132
136
|
K as buildChallengeAssertPsbt,
|
|
133
137
|
Sa as buildDepositTerms,
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
be as buildFundingOutpointsCommitment,
|
|
139
|
+
M as buildNoPayoutPsbt,
|
|
136
140
|
o as buildPayoutPsbt,
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
h as buildPeginInputPsbt,
|
|
142
|
+
qs as buildPeginParamsCandidates,
|
|
139
143
|
n as buildPeginTxFromFundedPrePegin,
|
|
140
144
|
P as buildPrePeginPsbt,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
y as buildReclaimPsbt,
|
|
146
|
+
D as buildRefundPsbt,
|
|
147
|
+
he as buildVaultContext,
|
|
144
148
|
na as calculateBtcTxHash,
|
|
145
|
-
|
|
149
|
+
pt as canPerformAction,
|
|
146
150
|
k as canonicalizeBtcPubkey,
|
|
147
151
|
ie as capMaxAcceptableCommissionBps,
|
|
148
152
|
ia as combineAbortSignals,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
He as computeChangeOutputFeeSats,
|
|
154
|
+
xa as computeHashlock,
|
|
155
|
+
Le as computeMaxDeposit,
|
|
156
|
+
A as computeMinClaimValue,
|
|
157
|
+
_ as computeMinPeginFee,
|
|
154
158
|
p as computeNumLocalChallengers,
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
Ke as computePeginBaseFeeSats,
|
|
160
|
+
Qs as computePeginFingerprint,
|
|
157
161
|
Ia as computeWotsBlockPublicKeysHash,
|
|
158
|
-
|
|
162
|
+
Ds as createAuthenticatedVpClient,
|
|
159
163
|
E as createPayoutScript,
|
|
160
164
|
Pa as createTaprootScriptPathSignOptions,
|
|
161
165
|
G as deriveBip86ScriptPubKeyHex,
|
|
162
166
|
c as deriveDepositorClaimDescriptor,
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
l as deriveDepositorClaimScriptPubKey,
|
|
168
|
+
$s as deriveHashlocksFromPrePegin,
|
|
165
169
|
W as deriveNativeSegwitAddress,
|
|
166
170
|
oe as derivePeginVaultId,
|
|
167
171
|
w as deriveTaprootAddress,
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
T as deriveVaultId,
|
|
173
|
+
Ve as deriveVaultRoot,
|
|
170
174
|
Ca as deriveWotsBlocksFromSeed,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
ar as describePeginParamsCandidate,
|
|
176
|
+
er as describeUnresolvedVersion,
|
|
177
|
+
sr as encodePeginFingerprintPreimage,
|
|
174
178
|
Y as ensureHexPrefix,
|
|
175
179
|
Oa as ensurePrePeginTermsApproval,
|
|
176
180
|
U as estimateReclaimFeeSats,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
T as expandAuthAnchor,
|
|
181
|
+
vr as estimateRefundFeeSats,
|
|
182
|
+
m as expandAuthAnchor,
|
|
180
183
|
S as expandHashlockSecret,
|
|
181
184
|
I as expandWotsSeed,
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
Se as extractErrorData,
|
|
186
|
+
cs as extractInputsFromTransaction,
|
|
184
187
|
d as extractPayoutSignature,
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
V as extractPeginInputSignature,
|
|
189
|
+
F as finalizePeginInputPsbt,
|
|
187
190
|
B as finalizeScriptPathWithSignatures,
|
|
188
|
-
|
|
191
|
+
ls as findOverlappingPendingVaults,
|
|
189
192
|
j as formatSatoshisToBtc,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
ba as forwardDepositApproval,
|
|
194
|
+
Fe as forwardDeriveContextHash,
|
|
195
|
+
ts as fundPeginTransaction,
|
|
193
196
|
ya as getAddressTxs,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
197
|
+
Da as getAddressUtxos,
|
|
198
|
+
Ie as getContractErrorMessage,
|
|
199
|
+
Xe as getDustThreshold,
|
|
200
|
+
Ua as getMempoolApiUrl,
|
|
198
201
|
z as getNetwork,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
Ba as getNetworkFees,
|
|
203
|
+
Ha as getOutspend,
|
|
204
|
+
Et as getPeginProtocolState,
|
|
205
|
+
ke as getPsbtInputFields,
|
|
206
|
+
Ge as getScriptType,
|
|
204
207
|
J as getSortedXOnlyPubkeys,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
La as getTipHeight,
|
|
209
|
+
Ka as getTxHex,
|
|
210
|
+
Xa as getTxInfo,
|
|
211
|
+
ka as getUtxoInfo,
|
|
212
|
+
Ce as handleContractError,
|
|
210
213
|
Z as hexToUint8Array,
|
|
211
|
-
|
|
214
|
+
ct as isActivationDeadlinePassedOnChain,
|
|
212
215
|
q as isAddressFromPublicKey,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
216
|
+
Mr as isApplicationEntryPointMismatchError,
|
|
217
|
+
Fs as isAuthRejectedError,
|
|
218
|
+
yr as isDepositAmountValid,
|
|
219
|
+
rr as isDepositTermsRejectedError,
|
|
220
|
+
Dr as isHintAccepted,
|
|
221
|
+
Oe as isKnownContractError,
|
|
222
|
+
Ur as isParticipantKeyDriftError,
|
|
223
|
+
Ne as isPeginFingerprintChangedError,
|
|
224
|
+
tr as isPeginFingerprintInputError,
|
|
225
|
+
Br as isPeginRegistrationMissingError,
|
|
226
|
+
Hr as isPeginRegistrationNotFinalError,
|
|
227
|
+
Lr as isPegoutTerminalStatus,
|
|
228
|
+
Kr as isRecognizedPegoutStatus,
|
|
229
|
+
Xr as isRegisteredVaultVersionMismatchError,
|
|
230
|
+
ne as isRegistrationLogsUnavailableError,
|
|
224
231
|
Q as isValidHex,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
ir as isWotsMismatchError,
|
|
233
|
+
kr as matchKeyHint,
|
|
234
|
+
Gr as matchKeySetHint,
|
|
235
|
+
ve as parseFundingOutpointsFromTx,
|
|
236
|
+
is as parseUnfundedWasmTransaction,
|
|
237
|
+
os as peginOutputCount,
|
|
231
238
|
C as peginP2aAnchorOutput,
|
|
232
|
-
|
|
239
|
+
Us as primeVpTokenRegistry,
|
|
233
240
|
$ as processPublicKeyToXOnly,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
241
|
+
Ga as pushTx,
|
|
242
|
+
ns as rateBasedTxBufferFee,
|
|
243
|
+
or as rebuildDepositTermsCore,
|
|
237
244
|
H as reclaimVsize,
|
|
238
|
-
|
|
245
|
+
nr as reconstructPeginParams,
|
|
239
246
|
ha as requireChangeAddress,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
Wr as resolveCurrentParticipantKeys,
|
|
248
|
+
wr as resolveParticipantKeysAtEpochs,
|
|
249
|
+
Za as resolveProtocolAddresses,
|
|
250
|
+
Yr as runDepositorPresignFlow,
|
|
251
|
+
We as selectUtxosForPegin,
|
|
252
|
+
we as shouldAddChangeOutput,
|
|
253
|
+
jr as signDepositorGraph,
|
|
247
254
|
aa as stripHexPrefix,
|
|
248
|
-
|
|
255
|
+
zr as submitWotsPublicKey,
|
|
249
256
|
O as supportedTxGraphVersions,
|
|
250
|
-
|
|
251
|
-
|
|
257
|
+
Va as supportsDepositApproval,
|
|
258
|
+
Pr as toRefundInputs,
|
|
252
259
|
ea as toXOnly,
|
|
253
260
|
sa as uint8ArrayToHex,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
261
|
+
Jr as validateDepositAmount,
|
|
262
|
+
Zr as validateMultiVaultDepositInputs,
|
|
263
|
+
Pe as validateOffchainParams,
|
|
264
|
+
qr as validateOnChainParticipantKeys,
|
|
265
|
+
pe as validatePegInConfiguration,
|
|
266
|
+
N as validatePeginP2aAnchor,
|
|
267
|
+
Qr as validateProviderSelection,
|
|
268
|
+
$r as validateRemainingCapacity,
|
|
269
|
+
_s as validateRequestDepositorClaimerArtifactsResponse,
|
|
270
|
+
Fa as validateSecretAgainstHashlock,
|
|
271
|
+
Ee as validateTBVProtocolParams,
|
|
272
|
+
ds as validateUtxosAvailable,
|
|
273
|
+
at as validateVaultAmounts,
|
|
274
|
+
et as validateVaultProviderPubkey,
|
|
275
|
+
ra as validateWalletPubkey,
|
|
276
|
+
st as verifyRegisteredParticipantKeys,
|
|
277
|
+
rt as verifyRegisteredVaultVersions,
|
|
278
|
+
Bs as verifyServerIdentity,
|
|
279
|
+
Hs as vpTokenRegistry,
|
|
280
|
+
tt as waitForPeginRegistrationDepth,
|
|
281
|
+
it as waitForPeginStatus,
|
|
282
|
+
_a as waitForTransactionReceiptSmartAware
|
|
276
283
|
};
|
|
277
284
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var gt=Object.defineProperty;var pt=(t,e,n)=>e in t?gt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var B=(t,e,n)=>pt(t,typeof e!="symbol"?e+"":e,n);const b=require("viem"),p=require("./BTCVaultRegistry.abi-BQ5tFNSu.cjs"),I=require("./BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs"),A=require("./constants-BTZdyOuk.cjs"),ft=require("./tbv/core/utils/eth/index.cjs"),x=require("./onChainBtcPubkey-BbxRrbvg.cjs"),C=require("./secp256k1-DDHQ1_za.cjs"),f=require("./sha2-DI0-0SHr.cjs"),V=25,z=9999;function _(t){if(!Number.isInteger(t)||t<0||t>=A.MAX_VP_COMMISSION_BPS_EXCLUSIVE)throw new Error(`Quoted commissionBps must be an integer in [0, ${A.MAX_VP_COMMISSION_BPS_EXCLUSIVE}), got ${t}`);return Math.min(t+V,z)}const mt=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),G=Uint8Array.from(new Array(16).fill(0).map((t,e)=>e)),Pt=G.map(t=>(9*t+5)%16),Q=(()=>{const n=[[G],[Pt]];for(let o=0;o<4;o++)for(let i of n)i.push(i[o].map(a=>mt[a]));return n})(),Y=Q[0],j=Q[1],J=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>Uint8Array.from(t)),bt=Y.map((t,e)=>t.map(n=>J[e][n])),yt=j.map((t,e)=>t.map(n=>J[e][n])),Ct=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),wt=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function M(t,e,n,o){return t===0?e^n^o:t===1?e&n|~e&o:t===2?(e|~n)^o:t===3?e&o|n&~o:e^(n|~o)}const T=new Uint32Array(16);class Bt extends f.HashMD{constructor(){super(64,20,8,!0);B(this,"h0",1732584193);B(this,"h1",-271733879);B(this,"h2",-1732584194);B(this,"h3",271733878);B(this,"h4",-1009589776)}get(){const{h0:n,h1:o,h2:i,h3:a,h4:c}=this;return[n,o,i,a,c]}set(n,o,i,a,c){this.h0=n|0,this.h1=o|0,this.h2=i|0,this.h3=a|0,this.h4=c|0}process(n,o){for(let r=0;r<16;r++,o+=4)T[r]=n.getUint32(o,!0);let i=this.h0|0,a=i,c=this.h1|0,h=c,d=this.h2|0,g=d,m=this.h3|0,y=m,s=this.h4|0,l=s;for(let r=0;r<5;r++){const u=4-r,w=Ct[r],ct=wt[r],ut=Y[r],ht=j[r],lt=bt[r],dt=yt[r];for(let P=0;P<16;P++){const $=f.rotl(i+M(r,c,d,m)+T[ut[P]]+w,lt[P])+s|0;i=s,s=m,m=f.rotl(d,10)|0,d=c,c=$}for(let P=0;P<16;P++){const $=f.rotl(a+M(u,h,g,y)+T[ht[P]]+ct,dt[P])+l|0;a=l,l=y,y=f.rotl(g,10)|0,g=h,h=$}}this.set(this.h1+d+y|0,this.h2+m+l|0,this.h3+s+a|0,this.h4+i+h|0,this.h0+c+g|0)}roundClean(){f.clean(T)}destroy(){this.destroyed=!0,f.clean(this.buffer),this.set(0,0,0,0,0)}}const Z=f.createHasher(()=>new Bt),Et="5120",N="0014",It=20,K=33,xt=65,Tt=2,At=3,Vt=4;function tt(t,e){const n=t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t;if(!/^(?:[0-9a-fA-F]{2})+$/.test(n))throw new Error(`${e} must be non-empty, even-length hex`);return`0x${n.toLowerCase()}`}function vt(t){const e=f.hexToBytes(t),n=C.schnorr.utils.lift_x(BigInt(`0x${t}`)),o=C.schnorr.utils.bytesToNumberBE(C.schnorr.utils.taggedHash("TapTweak",e));if(o>=C.secp256k1.CURVE.n)throw new Error("Proof of possession BTC pubkey has an invalid TapTweak");const i=o===0n?n:n.add(C.schnorr.Point.BASE.multiply(o));return`0x${Et}${f.bytesToHex(C.schnorr.utils.pointToBytes(i))}`}function $t(t){const e=tt(t,"depositorBtcPubkeyRaw"),n=f.hexToBytes(e.slice(2));if(n.length===32)return{xOnlyPubkey:x.assertOnChainBtcPubkey(e,"Payout BTC pubkey")};const o=n.length===K&&(n[0]===Tt||n[0]===At),i=n.length===xt&&n[0]===Vt;if(!o&&!i)throw new Error("depositorBtcPubkeyRaw must be x-only, compressed, or uncompressed");try{C.secp256k1.Point.fromBytes(n)}catch{throw new Error("depositorBtcPubkeyRaw is not a valid BTC pubkey")}return{xOnlyPubkey:f.bytesToHex(n.subarray(1,K)),compressedPubkey:o?n:void 0}}function St(t){return`0x${N}${f.bytesToHex(Z(f.sha256(t)))}`}function Rt(t,e,n){const o=tt(t,"depositorPayoutScriptPubKey");if((o.length-2)/2>A.MAX_PAYOUT_SCRIPT_LEN)throw new Error(`depositorPayoutScriptPubKey exceeds ${A.MAX_PAYOUT_SCRIPT_LEN} bytes`);const i=e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e,a=x.assertOnChainBtcPubkey(`0x${i}`,"Proof of possession BTC pubkey"),c=$t(n);if(c.xOnlyPubkey!==a)throw new Error("depositorBtcPubkeyRaw does not match the proof of possession BTC pubkey");if(o===vt(a))return o;if(o.startsWith(`0x${N}`)&&o.length===2+N.length+It*2){if(!c.compressedPubkey)throw new Error("A P2WPKH payout requires a compressed BTC pubkey");if(o===St(c.compressedPubkey))return o}throw new Error("depositorPayoutScriptPubKey does not match the proof of possession BTC pubkey")}function kt(t,e){const n=t.startsWith("0x")?t.slice(2):t;if(n.length===0||n.length%2!==0)throw new Error(`${e} must be non-empty, even-length hex`);if(!/^[0-9a-fA-F]+$/.test(n))throw new Error(`${e} contains non-hex characters`);const o=new Uint8Array(n.length/2);for(let i=0;i<o.length;i++)o[i]=Number.parseInt(n.slice(i*2,i*2+2),16);return o}function _t(t){return Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}function Nt(t){const e=new Uint8Array(t.reduce((o,i)=>o+i.length,0));let n=0;for(const o of t)e.set(o,n),n+=o.length;return e}function Ot(t){let e=0;const n=(s,l)=>{if(!Number.isSafeInteger(s)||s<0)throw new Error(`Invalid ${l} length ${s}`);if(e+s>t.length)throw new Error(`Truncated Bitcoin transaction while reading ${l}`);const r=t.slice(e,e+s);return e+=s,r},o=(s,l)=>{const r=n(s,l);let u=0n;for(let w=r.length-1;w>=0;w--)u=u<<8n|BigInt(r[w]);return u},i=s=>{const l=e,r=n(1,s)[0];let u;if(r<253)u=BigInt(r);else if(r===253){if(u=o(2,s),u<0xfdn)throw new Error(`Non-canonical ${s}`)}else if(r===254){if(u=o(4,s),u<=0xffffn)throw new Error(`Non-canonical ${s}`)}else if(u=o(8,s),u<=0xffffffffn)throw new Error(`Non-canonical ${s}`);if(u>BigInt(Number.MAX_SAFE_INTEGER))throw new Error(`${s} exceeds JavaScript's safe integer range`);return{encoded:t.slice(l,e),value:Number(u)}},a=n(4,"version"),c=t[e]===0&&t[e+1]===1;c&&(e+=2);const h=i("input count"),d=[];for(let s=0;s<h.value;s++){const l=e;n(32,`input ${s} previous transaction hash`),n(4,`input ${s} previous output index`);const r=i(`input ${s} script length`);n(r.value,`input ${s} script`),n(4,`input ${s} sequence`),d.push(t.slice(l,e))}const g=i("output count"),m=[];for(let s=0;s<g.value;s++){const l=e;n(8,`output ${s} value`);const r=i(`output ${s} script length`);n(r.value,`output ${s} script`),m.push(t.slice(l,e))}if(c){let s=!1;for(let l=0;l<h.value;l++){const r=i(`input ${l} witness item count`);s||(s=r.value>0);for(let u=0;u<r.value;u++){const w=i(`input ${l} witness item ${u} length`);n(w.value,`input ${l} witness item ${u}`)}}if(!s)throw new Error("Bitcoin transaction has superfluous witness marker")}const y=n(4,"locktime");if(e!==t.length)throw new Error(`Bitcoin transaction has ${t.length-e} trailing byte(s)`);return Nt([a,h.encoded,...d,g.encoded,...m,y])}function et(t){const e=Ot(kt(t,"transactionHex")),n=f.sha256(f.sha256(e));return n.reverse(),`0x${_t(n)}`}function nt(t,e){const n=t.startsWith("0x")?t:`0x${t}`;if(!/^0x[0-9a-fA-F]{64}$/.test(n))throw new Error("peginTxHash must be a 32-byte hex value");const o=e.startsWith("0x")?e:`0x${e}`;if(!b.isAddress(o,{strict:!0}))throw new Error(`Invalid depositor Ethereum address: ${e}`);return b.keccak256(b.encodeAbiParameters([{type:"bytes32"},{type:"address"}],[n,o])).slice(2)}const S=65535,F=1e4,v=4294967295,q=255;function ot(t){if(!Number.isInteger(t)||t<0||t>v)throw new Error(`Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`)}function it(t){const e=[];if(t.timelockAssert<=0n&&e.push(`timelockAssert must be positive, got ${t.timelockAssert}`),t.timelockAssert>BigInt(S)&&e.push(`timelockAssert ${t.timelockAssert} exceeds uint16 max (${S})`),t.timelockChallengeAssert<=0n&&e.push(`timelockChallengeAssert must be positive, got ${t.timelockChallengeAssert}`),t.tRefund<=0&&e.push(`tRefund must be positive, got ${t.tRefund}`),t.tStale<=0&&e.push(`tStale must be positive, got ${t.tStale}`),t.securityCouncilKeys.length===0&&e.push("securityCouncilKeys must not be empty"),t.councilQuorum<=0&&e.push(`councilQuorum must be positive, got ${t.councilQuorum}`),t.councilQuorum>t.securityCouncilKeys.length&&e.push(`councilQuorum (${t.councilQuorum}) exceeds securityCouncilKeys count (${t.securityCouncilKeys.length})`),t.feeRate<=0n&&e.push(`feeRate must be positive, got ${t.feeRate}`),t.minPeginFeeRate<=0n&&e.push(`minPeginFeeRate must be positive, got ${t.minPeginFeeRate}`),(!Number.isInteger(t.proverCircuitVersion)||t.proverCircuitVersion<0||t.proverCircuitVersion>S)&&e.push(`proverCircuitVersion must be a uint16, got ${t.proverCircuitVersion}`),(!Number.isInteger(t.minPrepeginDepth)||t.minPrepeginDepth<=0||t.minPrepeginDepth>v)&&e.push(`minPrepeginDepth must be a uint32 in [1, ${v}], got ${t.minPrepeginDepth}`),t.babeTotalInstances<=0&&e.push(`babeTotalInstances must be positive, got ${t.babeTotalInstances}`),t.babeInstancesToFinalize<=0&&e.push(`babeInstancesToFinalize must be positive, got ${t.babeInstancesToFinalize}`),t.babeInstancesToFinalize>t.babeTotalInstances&&e.push(`babeInstancesToFinalize (${t.babeInstancesToFinalize}) exceeds babeTotalInstances (${t.babeTotalInstances})`),(t.minVpCommissionBps<0||t.minVpCommissionBps>F)&&e.push(`minVpCommissionBps must be in [0, ${F}], got ${t.minVpCommissionBps}`),e.length>0)throw new Error(`Invalid offchain protocol parameters: ${e.join("; ")}`)}function st(t){const e=[];if(t.minimumPegInAmount<=0n&&e.push(`minimumPegInAmount must be positive, got ${t.minimumPegInAmount}`),t.maxPegInAmount<t.minimumPegInAmount&&e.push(`maxPegInAmount (${t.maxPegInAmount}) must be >= minimumPegInAmount (${t.minimumPegInAmount})`),t.pegInAckTimeout<=0n&&e.push(`pegInAckTimeout must be positive, got ${t.pegInAckTimeout}`),t.pegInActivationTimeout<=0n&&e.push(`pegInActivationTimeout must be positive, got ${t.pegInActivationTimeout}`),(!Number.isInteger(t.maxHtlcOutputCount)||t.maxHtlcOutputCount<=0||t.maxHtlcOutputCount>q)&&e.push(`maxHtlcOutputCount must be an integer in [1, ${q}], got ${t.maxHtlcOutputCount}`),(typeof t.expiredPegInGraceBlocks!="bigint"||t.expiredPegInGraceBlocks<=0n)&&e.push(`expiredPegInGraceBlocks must be a positive bigint, got ${t.expiredPegInGraceBlocks}`),e.length>0)throw new Error(`Invalid TBV protocol parameters: ${e.join("; ")}`)}function Ht(t){if(st(t),it(t.offchainParams),!Number.isInteger(t.offchainParamsVersion)||t.offchainParamsVersion<0||t.offchainParamsVersion>v)throw new Error(`Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`);C.assertValidVaultCoreVersion(t.activeVaultCoreVersion,"ProtocolParams.activeVaultCoreVersion()")}const rt="RegistrationLogsUnavailableError";class H extends Error{constructor(n){super(`The Ethereum node returned no registration logs for block ${n}, which holds a vault registration; the node may not have indexed that block yet. Try again.`);B(this,"blockNumber");this.name=rt,this.blockNumber=n}}function Mt(t){return t instanceof H?!0:typeof t!="object"||t===null?!1:t.name===rt}const U=9999;function L(t){return{depositor:t.depositor,depositorBtcPubKey:t.depositorBtcPubKey,amount:t.amount,vaultProvider:t.vaultProvider,status:t.status,applicationEntryPoint:t.applicationEntryPoint,createdAt:t.createdAt}}function R(t){const e=Number(t.offchainParamsVersion);return ot(e),{depositorSignedPeginTx:t.depositorSignedPeginTx,universalChallengersVersion:t.universalChallengersVersion,appVaultKeepersVersion:t.appVaultKeepersVersion,offchainParamsVersion:e,verifiedAt:t.verifiedAt,depositorWotsPkHash:t.depositorWotsPkHash,hashlock:t.hashlock,htlcVout:t.htlcVout,depositorPopSignature:t.depositorPopSignature,prePeginTxHash:t.prePeginTxHash,vaultProviderCommissionBps:t.vaultProviderCommissionBps,vaultCoreVersion:t.vaultCoreVersion}}const Kt=1n<<64n,W=0n,Ft=[b.getAbiItem({abi:p.BTCVaultRegistryABI,name:"PegInSubmitted"}),b.getAbiItem({abi:p.BTCVaultRegistryABI,name:"PegInSubmittedV2"})];function k(t,e,n){if(t<0n||t>=Kt)throw new Error(`getBtcVaultProtocolInfo returned ${e}=${t} for vault ${n}, outside the uint64 range — the registry may predate RFC-006`);return t}function D(t,e){return{vpKeyEpoch:k(t.vpKeyEpoch,"vpKeyEpoch",e),appKeeperKeyEpoch:k(t.appKeeperKeyEpoch,"appKeeperKeyEpoch",e),ucKeyEpoch:k(t.ucKeyEpoch,"ucKeyEpoch",e)}}class at{constructor(e,n){this.publicClient=e,this.contractAddress=n}async getVaultProviderGenesisBtcPubKey(e,n){const o=await this.publicClient.readContract({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getOperationBtcKeyAtEpoch",args:[e,W],blockNumber:n});return x.assertOnChainBtcPubkey(o,`getOperationBtcKeyAtEpoch (vp=${e}, epoch=${W})`)}async getVaultProviderApplication(e,n){return await this.publicClient.readContract({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getVaultProviderApplication",args:[e],blockNumber:n})}async getCurrentVaultProviderOperationBtcKey(e){const n=await this.publicClient.readContract({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getCurrentOperationBtcKey",args:[e]});return x.assertOnChainBtcPubkey(n,`getCurrentOperationBtcKey (vp=${e})`)}async getVaultKeyEpochs(e){const n=await this.publicClient.readContract({address:this.contractAddress,abi:I.BTCVaultRegistryKeyEpochsABI,functionName:"getBtcVaultProtocolInfo",args:[e]});return D(n,e)}async getVaultKeyEpochsBatch(e){return e.length===0?[]:(await this.publicClient.multicall({contracts:e.map(o=>({address:this.contractAddress,abi:I.BTCVaultRegistryKeyEpochsABI,functionName:"getBtcVaultProtocolInfo",args:[o]})),allowFailure:!1})).map((o,i)=>D(o,e[i]))}async getVaultBasicInfo(e){const n=await this.publicClient.readContract({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[e]});return L(n)}async getVaultProtocolInfo(e){const n=await this.publicClient.readContract({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[e]});return R(n)}async getProtocolInfoBatch(e){return e.length===0?[]:(await this.publicClient.multicall({contracts:e.map(o=>({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[o]})),allowFailure:!1})).map((o,i)=>{const a=o;if(!a.depositorSignedPeginTx||a.depositorSignedPeginTx==="0x")throw new Error(`Vault ${e[i]} not found on-chain or has no pegin transaction`);return R(a)})}async getPegInFee(e){return await this.publicClient.readContract({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getPegInFee",args:[e]})}async getVaultProviderCommission(e){const n=await this.publicClient.readContract({address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getVaultProviderCommission",args:[e]});if(!Number.isInteger(n)||n<0||n>U)throw new Error(`getVaultProviderCommission returned ${n} bps for ${e}, outside the protocol range [0, ${U}]`);return n}async getVaultData(e){const[n,o]=await this.publicClient.multicall({contracts:[{address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[e]},{address:this.contractAddress,abi:p.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[e]}],allowFailure:!1}),i=L(n),a=R(o);if(!a.depositorSignedPeginTx||a.depositorSignedPeginTx==="0x")throw new Error(`Vault ${e} not found on-chain or has no pegin transaction`);return{basic:i,protocol:a}}async getMaxAcceptableCommissionBpsBatch(e,n){if(e.length===0)return[];const o=await this.publicClient.getLogs({address:this.contractAddress,events:Ft,fromBlock:n,toBlock:n,strict:!0});if(o.length===0)throw new H(n);return e.map(i=>{const a=i.toLowerCase();let c=!1;const h=[];for(const d of o)d.args.vaultId.toLowerCase()===a&&(c=!0,d.eventName==="PegInSubmittedV2"&&h.push(d.args.maxAcceptableCommissionBps));if(h.length===1)return h[0];throw h.length>1?new Error(`Expected one PegInSubmittedV2 log for vault ${i} at block ${n}, found ${h.length} PegInSubmittedV2 logs`):c?new Error(`Vault ${i} was registered before the registry emitted the depositor's commission ceiling (no PegInSubmittedV2 log at block ${n}), so the ceiling cannot be recovered on-chain`):new Error(`Vault ${i} has no registration log at its on-chain registration block ${n}`)})}}const qt=0,Ut=255,Lt=12e4;function E(t,e){const n=t.startsWith("0x")?t:t.startsWith("0X")?`0x${t.slice(2)}`:`0x${t}`;if(!/^0x(?:[0-9a-fA-F]{2})+$/.test(n))throw new Error(`${e} must be non-empty, even-length hex`);return n}function O(t,e){if(!/^0x[0-9a-fA-F]{64}$/.test(t))throw new Error(`${e} must be a 32-byte hex value`)}const Wt="0x0000000000000000000000000000000000000000000000000000000000000000";function X(t){if(O(t,"expectedFingerprint"),t.toLowerCase()===Wt)throw new Error("expectedFingerprint must not be zero: the registry cannot resolve a zero fingerprint, so this submission would always revert")}function Dt(t){if(!Number.isInteger(t)||t<0||t>Ut)throw new Error(`htlcVout must be a uint8, got ${t}`)}class Xt{constructor(e){this.config=e}async registerPeginOnChain(e){const n={...e,popSignature:{...e.popSignature}};this.assertQuotedCommissionPresentWhenRequired(n.quotedCommissionBps),X(n.expectedFingerprint);const o=this.assertPopMatchesEthAccount(n.popSignature),i=this.normalizeBtcPubkey(n.popSignature),a=E(n.popSignature.btcPopSignature,"btcPopSignature"),c=this.normalizeRequest(n,o,i);await this.assertVaultDoesNotExist(c.vaultId,c.peginTxHash);const h=await this.readPeginFee(n.vaultProvider),d=await this.resolveMaxAcceptableCommissionBps(n.vaultProvider,n.quotedCommissionBps),g=b.encodeFunctionData({abi:p.BTCVaultRegistryABI,functionName:"submitPeginRequest",args:[o,i,a,c.unsignedPrePeginTx,c.depositorSignedPeginTx,n.vaultProvider,d,n.hashlock,n.htlcVout,c.payoutScript,n.depositorWotsPkHash,n.expectedFingerprint]});return{ethTxHash:await this.sendAndWait(g,h,!1,o),vaultId:c.vaultId,peginTxHash:c.peginTxHash}}async registerPeginBatchOnChain(e){const n={...e,popSignature:{...e.popSignature},requests:e.requests.map(r=>({...r}))};if(n.requests.length===0)throw new Error("Batch pegin requires at least one request");this.assertQuotedCommissionPresentWhenRequired(n.quotedCommissionBps),X(n.expectedFingerprint);const o=this.assertPopMatchesEthAccount(n.popSignature),i=E(n.unsignedPrePeginTx,"unsignedPrePeginTx"),a=this.normalizeBtcPubkey(n.popSignature),c=E(n.popSignature.btcPopSignature,"btcPopSignature"),h=[],d=[],g=new Set;for(const r of n.requests){const u=this.normalizeRequest({...r,unsignedPrePeginTx:n.unsignedPrePeginTx,vaultProvider:n.vaultProvider,depositorBtcPubkeyRaw:n.depositorBtcPubkeyRaw},o,a);if(g.has(u.vaultId))throw new Error(`Duplicate vault in batch: ${u.vaultId}`);g.add(u.vaultId),h.push({vaultId:u.vaultId,peginTxHash:u.peginTxHash}),d.push({depositorBtcPubKey:a,btcPopSignature:c,unsignedPrePeginTx:i,depositorSignedPeginTx:u.depositorSignedPeginTx,hashlock:r.hashlock,htlcVout:r.htlcVout,referralCode:qt,depositorPayoutBtcAddress:u.payoutScript,depositorWotsPkHash:r.depositorWotsPkHash})}for(const r of h)await this.assertVaultDoesNotExist(r.vaultId,r.peginTxHash);const m=await this.readPeginFee(n.vaultProvider),y=await this.resolveMaxAcceptableCommissionBps(n.vaultProvider,n.quotedCommissionBps),s=b.encodeFunctionData({abi:p.BTCVaultRegistryABI,functionName:"submitPeginRequestBatch",args:[o,n.vaultProvider,y,n.expectedFingerprint,d]});return{ethTxHash:await this.sendAndWait(s,m*BigInt(n.requests.length),!0,o),vaults:h}}assertQuotedCommissionPresentWhenRequired(e){if(e===void 0&&this.config.requireQuotedCommissionBps)throw new Error("quotedCommissionBps is required when the wallet approved deposit terms: the registration ceiling must anchor to the approved quote.")}assertPopMatchesEthAccount(e){return this.assertEthAccount(e.depositorEthAddress)}assertEthAccount(e){const n=this.config.ethWallet.account;if(!n)throw new Error("Ethereum wallet account not found");if(!b.isAddressEqual(e,n.address))throw new Error(`Proof of possession was signed for ${e} but the Ethereum wallet is currently connected to ${n.address}. Reconnect the original account or sign a new proof of possession.`);return n.address}normalizeBtcPubkey(e){return`0x${x.assertOnChainBtcPubkey(E(e.depositorBtcPubkey,"Proof of possession BTC pubkey"),"Proof of possession BTC pubkey")}`}normalizeRequest(e,n,o){O(e.hashlock,"hashlock"),O(e.depositorWotsPkHash,"depositorWotsPkHash"),Dt(e.htlcVout);const i=E(e.unsignedPrePeginTx,"unsignedPrePeginTx"),a=E(e.depositorSignedPeginTx,"depositorSignedPeginTx"),c=et(a);return{unsignedPrePeginTx:i,depositorSignedPeginTx:a,payoutScript:Rt(e.depositorPayoutScriptPubKey,o,e.depositorBtcPubkeyRaw),peginTxHash:c,vaultId:E(nt(c,n),"vaultId")}}async assertVaultDoesNotExist(e,n){if((await this.config.publicClient.readContract({address:this.config.btcVaultRegistry,abi:p.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[e]})).depositor!==b.zeroAddress)throw new Error(`Vault already exists (ID: ${e}, peginTxHash: ${n}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`)}async readPeginFee(e){try{return await this.config.publicClient.readContract({address:this.config.btcVaultRegistry,abi:p.BTCVaultRegistryABI,functionName:"getPegInFee",args:[e]})}catch(n){throw new Error("Failed to query pegin fee from the contract. Please check your network connection and contract address.",{cause:n})}}async resolveMaxAcceptableCommissionBps(e,n){let o;try{o=await new at(this.config.publicClient,this.config.btcVaultRegistry).getVaultProviderCommission(e)}catch(i){throw new Error("Failed to query vault provider commission from the contract. Please check your network connection and contract address.",{cause:i})}if(n!==void 0){if(o>n+V)throw new Error(`Vault provider commission changed since quote: quoted ${n} bps, chain currently reports ${o} bps (allowed drift ${V} bps). Please refresh and try again.`);return _(n)}return _(o)}async sendAndWait(e,n,o,i){let a=this.assertEthAccount(i),c;try{c=await this.config.publicClient.estimateGas({to:this.config.btcVaultRegistry,data:e,value:n,account:a})}catch(g){I.handleContractError(g)}a=this.assertEthAccount(i);let h;try{h=await this.config.ethWallet.sendTransaction({to:this.config.btcVaultRegistry,data:e,value:n,gas:c,account:a,chain:this.config.ethChain})}catch(g){I.handleContractError(g)}const d=await ft.waitForTransactionReceiptSmartAware({publicClient:this.config.publicClient,walletAddress:i,hash:h,timeout:this.config.receiptTimeoutMs??Lt});return d.status==="reverted"&&I.handleContractError(new Error(`${o?"Batch transaction":"Transaction"} reverted. Hash: ${d.transactionHash}. Check a block explorer for details.`)),d.transactionHash}}exports.COMMISSION_BPS_HEADROOM=V;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=z;exports.RegistrationLogsUnavailableError=H;exports.ViemPeginRegistrationClient=Xt;exports.ViemVaultRegistryReader=at;exports.assertValidOffchainParamsVersion=ot;exports.calculateBtcTxHash=et;exports.capMaxAcceptableCommissionBps=_;exports.derivePeginVaultId=nt;exports.isRegistrationLogsUnavailableError=Mt;exports.ripemd160=Z;exports.validateOffchainParams=it;exports.validatePegInConfiguration=Ht;exports.validateTBVProtocolParams=st;
|
|
2
|
+
//# sourceMappingURL=pegin-registration-client-CZgcU2_0.cjs.map
|