@babylonlabs-io/ts-sdk 3.0.0 → 3.0.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-CKf7Bjmj.js → PeginManager-D8WGB8eN.js} +2 -2
- package/dist/{PeginManager-CKf7Bjmj.js.map → PeginManager-D8WGB8eN.js.map} +1 -1
- package/dist/{PeginManager-Dt2Z5ljw.cjs → PeginManager-IgDHy_eU.cjs} +2 -2
- package/dist/{PeginManager-Dt2Z5ljw.cjs.map → PeginManager-IgDHy_eU.cjs.map} +1 -1
- package/dist/buildAndBroadcastReclaim-B8aFMGf-.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-B8aFMGf-.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-T5ZFPUpM.js → buildAndBroadcastReclaim-D5520lbL.js} +1015 -935
- package/dist/buildAndBroadcastReclaim-D5520lbL.js.map +1 -0
- package/dist/index-D2mybjXD.js +522 -0
- package/dist/index-D2mybjXD.js.map +1 -0
- package/dist/index-MRdle0fs.cjs +2 -0
- package/dist/index-MRdle0fs.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +215 -214
- package/dist/pegin-registration-client-B0j6ugt9.cjs +2 -0
- package/dist/pegin-registration-client-B0j6ugt9.cjs.map +1 -0
- package/dist/{pegin-registration-client-C5Hktrja.js → pegin-registration-client-ilkV1mLP.js} +103 -88
- package/dist/pegin-registration-client-ilkV1mLP.js.map +1 -0
- package/dist/primeVpAuth-BDWBKYhv.cjs +2 -0
- package/dist/primeVpAuth-BDWBKYhv.cjs.map +1 -0
- package/dist/primeVpAuth-D0ZnsjRi.js +805 -0
- package/dist/primeVpAuth-D0ZnsjRi.js.map +1 -0
- package/dist/state-C4WoNCy1.cjs +2 -0
- package/dist/state-C4WoNCy1.cjs.map +1 -0
- package/dist/{state-mE-QfITd.js → state-CFn1rT74.js} +128 -101
- package/dist/state-CFn1rT74.js.map +1 -0
- package/dist/tbv/core/clients/eth/index.cjs +1 -1
- package/dist/tbv/core/clients/eth/index.js +2 -2
- package/dist/tbv/core/clients/eth/types.d.ts +12 -5
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +12 -3
- 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 +52 -51
- package/dist/tbv/core/clients/mempool/index.cjs +1 -1
- package/dist/tbv/core/clients/mempool/index.cjs.map +1 -1
- package/dist/tbv/core/clients/mempool/index.d.ts +1 -1
- package/dist/tbv/core/clients/mempool/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/mempool/index.js +85 -71
- package/dist/tbv/core/clients/mempool/index.js.map +1 -1
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts +10 -0
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/api.d.ts +17 -14
- package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts +8 -0
- package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts +8 -0
- package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +18 -2
- package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts +26 -6
- package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts +17 -15
- package/dist/tbv/core/clients/vault-provider/batchAttribution.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts +15 -9
- package/dist/tbv/core/clients/vault-provider/batchPoll.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +3 -2
- package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/status/index.cjs +1 -1
- package/dist/tbv/core/clients/vault-provider/status/index.js +2 -2
- package/dist/tbv/core/clients/vault-provider/types.d.ts +36 -23
- package/dist/tbv/core/clients/vault-provider/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/validators.d.ts +12 -4
- package/dist/tbv/core/clients/vault-provider/validators.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +213 -212
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +1 -1
- package/dist/tbv/core/services/deposit/graphFingerprint.d.ts +39 -0
- package/dist/tbv/core/services/deposit/graphFingerprint.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/interfaces.d.ts +2 -2
- package/dist/tbv/core/services/deposit/interfaces.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +3 -1
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/submitWotsPublicKey.d.ts +3 -1
- package/dist/tbv/core/services/deposit/submitWotsPublicKey.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts +11 -2
- package/dist/tbv/core/services/deposit/waitForPeginStatus.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/services/pegout/state.d.ts +2 -2
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +213 -212
- package/dist/{toRefundInputs-DIIdhjvu.js → toRefundInputs-10RYIfh1.js} +2 -2
- package/dist/{toRefundInputs-DIIdhjvu.js.map → toRefundInputs-10RYIfh1.js.map} +1 -1
- package/dist/{toRefundInputs-B_GlIXjk.cjs → toRefundInputs-a-0HRyrl.cjs} +2 -2
- package/dist/{toRefundInputs-B_GlIXjk.cjs.map → toRefundInputs-a-0HRyrl.cjs.map} +1 -1
- package/dist/{types-DJxOEU3P.cjs → types-BueQoMjO.cjs} +2 -2
- package/dist/{types-DJxOEU3P.cjs.map → types-BueQoMjO.cjs.map} +1 -1
- package/dist/{types-Dz1kVqn6.js → types-DGkejGZH.js} +2 -2
- package/dist/{types-Dz1kVqn6.js.map → types-DGkejGZH.js.map} +1 -1
- package/package.json +3 -3
- package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-BDc-SK9i.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-T5ZFPUpM.js.map +0 -1
- package/dist/index-B6w5MM-8.js +0 -528
- package/dist/index-B6w5MM-8.js.map +0 -1
- package/dist/index-EHLYplSd.cjs +0 -2
- package/dist/index-EHLYplSd.cjs.map +0 -1
- package/dist/pegin-registration-client-BdJ6c7si.cjs +0 -2
- package/dist/pegin-registration-client-BdJ6c7si.cjs.map +0 -1
- package/dist/pegin-registration-client-C5Hktrja.js.map +0 -1
- package/dist/primeVpAuth-Bdy_B_Sq.js +0 -745
- package/dist/primeVpAuth-Bdy_B_Sq.js.map +0 -1
- package/dist/primeVpAuth-CQRsu6VB.cjs +0 -2
- package/dist/primeVpAuth-CQRsu6VB.cjs.map +0 -1
- package/dist/state-DMFlvLL3.cjs +0 -2
- package/dist/state-DMFlvLL3.cjs.map +0 -1
- package/dist/state-mE-QfITd.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -9,299 +9,300 @@ import { c as Pa } from "./abortSignals-BPpAUL1Z.js";
|
|
|
9
9
|
import { c as la, a as ca, b as ua } from "./signing-Dhr2t0Z6.js";
|
|
10
10
|
import { B as ga, C as Ra, H as Aa, K as _a, M as ma, T as Ta, X as Sa } from "./validation-OSC0xTHB.js";
|
|
11
11
|
import { waitForTransactionReceiptSmartAware as Ia } from "./tbv/core/utils/eth/index.js";
|
|
12
|
-
import { P as ha, b as Oa, c as Na, d as ba, e as Va } from "./PeginManager-
|
|
12
|
+
import { P as ha, b as Oa, c as Na, d as ba, e as Va } from "./PeginManager-D8WGB8eN.js";
|
|
13
13
|
import { P as Fa, c as Ma, f as va, r as ya, s as Da, v as Ua } from "./PayoutManager-BSwbUQeF.js";
|
|
14
|
-
import { MEMPOOL_API_URLS as Ha,
|
|
15
|
-
import { O as
|
|
16
|
-
import { a as
|
|
17
|
-
import { C as
|
|
18
|
-
import { A as
|
|
19
|
-
import { B as
|
|
20
|
-
import { B as
|
|
21
|
-
import { V as
|
|
22
|
-
import { p as
|
|
23
|
-
import { BitcoinNetworks as
|
|
24
|
-
import { B as
|
|
25
|
-
import { B as
|
|
26
|
-
import { U as
|
|
27
|
-
import { V as
|
|
28
|
-
import { A as
|
|
29
|
-
import { S as
|
|
30
|
-
import { D as
|
|
31
|
-
import { t as
|
|
32
|
-
import { C as
|
|
14
|
+
import { MEMPOOL_API_URLS as Ha, MempoolNotFoundError as La, getAddressTxs as Ka, getAddressUtxos as Xa, getMempoolApiUrl as Ga, getNetworkFees as ka, getOutspend as Wa, getTipHeight as wa, getTxHex as za, getTxInfo as Ya, getUtxoInfo as ja, pushTx as Ja } from "./tbv/core/clients/mempool/index.js";
|
|
15
|
+
import { O as qa, V as Qa, a as $a, b as ae, c as ee, r as se } from "./types-DGkejGZH.js";
|
|
16
|
+
import { a as te, d as ie } from "./onChainBtcPubkey-CCTdl53s.js";
|
|
17
|
+
import { C as ne, M as pe, R as Pe, V as Ee, c as le, d as ce, i as ue, v as de, a as ge, b as Re } from "./pegin-registration-client-ilkV1mLP.js";
|
|
18
|
+
import { A as _e, P as me } from "./ProtocolParams.abi-q0AidvYX.js";
|
|
19
|
+
import { B as Se } from "./BTCVaultRegistry.abi-B0x9_Bza.js";
|
|
20
|
+
import { B as Ie, C as fe, P as he, a as Oe, e as Ne, g as be, h as Ve, i as xe, b as Fe } from "./BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js";
|
|
21
|
+
import { V as ve, b as ye, a as De, d as Ue, f as Be } from "./deriveVaultRoot-BcvmER1E.js";
|
|
22
|
+
import { p as Le } from "./parseFundingOutpoints-GSM-IaaK.js";
|
|
23
|
+
import { BitcoinNetworks as Xe } from "./shared/index.js";
|
|
24
|
+
import { B as ke, a as We, c as we, b as ze, d as Ye, g as je, h as Je, f as Ze, s as qe, e as Qe } from "./psbtInputFields-CCVyaQMi.js";
|
|
25
|
+
import { B as as, D as es, L as ss, M as rs, c as ts, P as is, b as os, a as ns, S as ps, T as Ps, W as Es, f as ls, d as cs, p as us, r as ds } from "./fundPeginTransaction-CwhRbCQC.js";
|
|
26
|
+
import { U as Rs, a as As, e as _s, f as ms, v as Ts } from "./reservation-DOAHVT3B.js";
|
|
27
|
+
import { V as Cs, a as Is, b as fs, i as hs, v as Os } from "./index-D2mybjXD.js";
|
|
28
|
+
import { A as bs, C as Vs, D as xs, J as Fs, a as Ms, b as vs, d as ys, P as Ds, R as Us, e as Bs, c as Hs, V as Ls, i as Ks, g as Xs, f as Gs } from "./state-CFn1rT74.js";
|
|
29
|
+
import { S as Ws, V as ws, c as zs, p as Ys, v as js, a as Js } from "./primeVpAuth-D0ZnsjRi.js";
|
|
30
|
+
import { D as qs, f as Qs, P as $s, a as ar, b as er, o as sr, p as rr, n as tr, q as ir, U as or, V as nr, j as pr, c as Pr, h as Er, l as lr, k as cr, e as ur, g as dr, d as gr, i as Rr, r as Ar, m as _r, t as mr } from "./toRefundInputs-10RYIfh1.js";
|
|
31
|
+
import { t as Sr, A as Cr, X as Ir, C as fr, D as hr, G as Or, i as Nr, I as br, P as Vr, j as xr, k as Fr, a4 as Mr, a5 as vr, a6 as yr, a7 as Dr, _ as Ur, $ as Br, a0 as Hr, a1 as Lr, a2 as Kr, R as Xr, V as Gr, a as kr, b as Wr, c as wr, e as zr, f as Yr, h as jr, g as Jr, n as Zr, O as qr, a3 as Qr, Y as $r, d as at, Z as et, o as st, u as rt, x as tt, Q as it, J as ot, l as nt, m as pt, L as Pt, S as Et, T as lt, U as ct, W as ut, r as dt, p as gt, q as Rt, s as At, y as _t, z as mt, v as Tt, B as St, E as Ct, F as It, H as ft, K as ht, M as Ot, w as Nt, N as bt } from "./buildAndBroadcastReclaim-D5520lbL.js";
|
|
32
|
+
import { C as xt, P as Ft, a as Mt, c as vt, g as yt, i as Dt } from "./peginState-BU2ONFXF.js";
|
|
33
33
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
bs as AUTH_REJECTED_RPC_CODE,
|
|
35
|
+
Sr as ApplicationEntryPointMismatchError,
|
|
36
|
+
_e as ApplicationRegistryABI,
|
|
37
|
+
Cr as ArtifactsVaultMismatchError,
|
|
38
|
+
Ir as BIP68NotMatureError,
|
|
39
39
|
ga as BITCOIN_ADDRESS_RE,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
Se as BTCVaultRegistryABI,
|
|
41
|
+
Ie as BTCVaultRegistryKeyEpochsABI,
|
|
42
|
+
as as BTC_DUST_SAT,
|
|
43
|
+
Xe as BitcoinNetworks,
|
|
44
|
+
ke as BitcoinScriptType,
|
|
45
|
+
ne as COMMISSION_BPS_HEADROOM,
|
|
46
46
|
Ra as COMPRESSED_PUBKEY_HEX_LEN,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
fe as CONTRACT_ERRORS,
|
|
48
|
+
fr as ChallengerSetMismatchError,
|
|
49
|
+
Vs as ClaimerPegoutStatusValue,
|
|
50
|
+
xt as ContractStatus,
|
|
51
|
+
hr as DELEGATED_CLAIM_TX_GRAPH_VERSION,
|
|
52
|
+
qs as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
|
|
53
|
+
es as DUST_THRESHOLD,
|
|
54
|
+
xs as DaemonStatus,
|
|
55
|
+
Qs as DepositTermsRejectedError,
|
|
56
|
+
Or as GraphFingerprintError,
|
|
57
57
|
Aa as HEX_RE,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
Fs as JSON_RPC_ERROR_CODES,
|
|
59
|
+
Ms as JsonRpcClient,
|
|
60
|
+
vs as JsonRpcError,
|
|
61
61
|
_a as KNOWN_SCRIPT_PREFIXES,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
ss as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
63
|
+
pe as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
|
|
64
|
+
rs as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
65
65
|
ma as MAX_REASONABLE_FEE_SATS,
|
|
66
|
-
|
|
66
|
+
ts as MAX_REASONABLE_PEGIN_VBYTES,
|
|
67
67
|
Ha as MEMPOOL_API_URLS,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
is as
|
|
68
|
+
La as MempoolNotFoundError,
|
|
69
|
+
qa as OnChainBtcVaultStatus,
|
|
70
|
+
is as P2TR_INPUT_SIZE,
|
|
71
|
+
os as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
71
72
|
s as PEGIN_DEPOSITOR_CLAIM_VOUT,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
Nr as PEGIN_ETH_CONFIRMATIONS,
|
|
74
|
+
he as PEGIN_FINGERPRINT_CHANGED_SELECTOR,
|
|
75
|
+
$s as PEGIN_FINGERPRINT_DOMAIN,
|
|
76
|
+
ar as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
|
|
77
|
+
ns as PEGIN_FIXED_OUTPUTS,
|
|
78
|
+
ys as POST_WOTS_STATUSES,
|
|
79
|
+
Ds as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
80
|
+
br as ParticipantKeyDriftError,
|
|
81
|
+
Vr as PayoutDestinationError,
|
|
81
82
|
Fa as PayoutManager,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
Ft as PeginAction,
|
|
84
|
+
Oe as PeginFingerprintChangedError,
|
|
85
|
+
er as PeginFingerprintInputError,
|
|
85
86
|
ha as PeginManager,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
sr as PeginParamsAmbiguousError,
|
|
88
|
+
rr as PeginParamsIncompleteSpaceError,
|
|
89
|
+
tr as PeginParamsNotFoundError,
|
|
90
|
+
xr as PeginRegistrationMissingError,
|
|
91
|
+
Fr as PeginRegistrationNotFinalError,
|
|
92
|
+
ir as PeginSizingIntegrityError,
|
|
93
|
+
me as ProtocolParamsABI,
|
|
93
94
|
r as PsbtSubstitutionError,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
95
|
+
Mr as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
|
|
96
|
+
vr as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
|
|
97
|
+
yr as RECLAIM_MAX_FEE_RATE_SATS_VB,
|
|
98
|
+
Dr as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
|
|
99
|
+
Ur as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
|
|
100
|
+
Br as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
101
|
+
Hr as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
102
|
+
Lr as REFUND_VSIZE,
|
|
103
|
+
Kr as ReclaimUneconomicalError,
|
|
104
|
+
Xr as RegisteredVaultVersionMismatchError,
|
|
105
|
+
Pe as RegistrationLogsUnavailableError,
|
|
106
|
+
Us as RpcErrorCode,
|
|
107
|
+
ps as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
108
|
+
Ws as ServerIdentityError,
|
|
108
109
|
Ta as TXID_RE,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
110
|
+
Ps as TX_BUFFER_SIZE_OVERHEAD,
|
|
111
|
+
or as UnanchoredPrePeginError,
|
|
112
|
+
Rs as UtxoNotAvailableError,
|
|
113
|
+
ve as VAULT_APP_NAME,
|
|
114
|
+
Bs as VP_BATCH_MAX_SIZE,
|
|
115
|
+
Hs as VP_TERMINAL_FAILURE_STATUSES,
|
|
116
|
+
Ls as VP_TRANSIENT_STATUSES,
|
|
117
|
+
Gr as VaultIdBindingError,
|
|
118
|
+
Cs as VaultProviderRpcClient,
|
|
119
|
+
nr as VaultRootMismatchError,
|
|
120
|
+
Qa as ViemOperationKeyReader,
|
|
121
|
+
Ee as ViemPeginRegistrationClient,
|
|
122
|
+
$a as ViemProtocolParamsReader,
|
|
123
|
+
ae as ViemUniversalChallengerReader,
|
|
124
|
+
ee as ViemVaultKeeperReader,
|
|
125
|
+
le as ViemVaultRegistryReader,
|
|
126
|
+
Is as VpResponseValidationError,
|
|
127
|
+
ws as VpTokenRegistry,
|
|
128
|
+
Es as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
128
129
|
Sa as X_ONLY_PUBKEY_HEX_LEN,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
kr as activateVault,
|
|
131
|
+
Wr as activateVaultAndRedeem,
|
|
132
|
+
Mt as activationDeadlineBlocksRemaining,
|
|
133
|
+
We as applyChangeOutputPolicy,
|
|
134
|
+
wr as assembleWatchtowerArtifacts,
|
|
135
|
+
zr as assertArtifactsUsableForVault,
|
|
136
|
+
Yr as assertChallengerSetMatchesVault,
|
|
137
|
+
jr as assertClaimSpendsVault,
|
|
137
138
|
F as assertKeyPathSchnorrSignature,
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
te as assertOnChainBtcPubkey,
|
|
140
|
+
Jr as assertPayoutPaysRegisteredScript,
|
|
140
141
|
t as assertPsbtUnsignedTxMatches,
|
|
141
|
-
|
|
142
|
+
Zr as assertReturnedGraphMatchesFingerprint,
|
|
142
143
|
M as assertReturnedKeyPathSignatures,
|
|
143
144
|
i as assertScriptPathSchnorrSignature,
|
|
144
|
-
|
|
145
|
+
As as assertUtxosAvailable,
|
|
145
146
|
g as assertValidVaultCoreVersion,
|
|
146
|
-
|
|
147
|
+
qr as assertVaultProviderHintAccepted,
|
|
147
148
|
A as attachFinalizedAssert,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
fs as batchPollByProvider,
|
|
150
|
+
Qr as buildAndBroadcastReclaim,
|
|
151
|
+
$r as buildAndBroadcastRefund,
|
|
151
152
|
W as buildChallengeAssertPsbt,
|
|
152
153
|
Oa as buildDepositTerms,
|
|
153
|
-
|
|
154
|
+
ye as buildFundingOutpointsCommitment,
|
|
154
155
|
B as buildNoPayoutPsbt,
|
|
155
156
|
o as buildPayoutPsbt,
|
|
156
157
|
v as buildPeginInputPsbt,
|
|
157
|
-
|
|
158
|
+
pr as buildPeginParamsCandidates,
|
|
158
159
|
n as buildPeginTxFromFundedPrePegin,
|
|
159
160
|
p as buildPrePeginPsbt,
|
|
160
161
|
H as buildReclaimPsbt,
|
|
161
162
|
L as buildRefundPsbt,
|
|
162
|
-
|
|
163
|
+
De as buildVaultContext,
|
|
163
164
|
la as calculateBtcTxHash,
|
|
164
|
-
|
|
165
|
+
vt as canPerformAction,
|
|
165
166
|
z as canonicalizeBtcPubkey,
|
|
166
|
-
|
|
167
|
+
ce as capMaxAcceptableCommissionBps,
|
|
167
168
|
Pa as combineAbortSignals,
|
|
168
|
-
|
|
169
|
+
we as computeChangeOutputFeeSats,
|
|
169
170
|
Ma as computeHashlock,
|
|
170
|
-
|
|
171
|
+
ze as computeMaxDeposit,
|
|
171
172
|
_ as computeMinClaimValue,
|
|
172
173
|
m as computeMinPeginFee,
|
|
173
174
|
P as computeNumLocalChallengers,
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
Ye as computePeginBaseFeeSats,
|
|
176
|
+
Pr as computePeginFingerprint,
|
|
176
177
|
Na as computeWotsBlockPublicKeysHash,
|
|
177
|
-
|
|
178
|
+
zs as createAuthenticatedVpClient,
|
|
178
179
|
E as createPayoutScript,
|
|
179
180
|
ca as createTaprootScriptPathSignOptions,
|
|
180
181
|
ua as createTaprootScriptPathSignOptionsForInput,
|
|
181
182
|
Y as deriveBip86ScriptPubKeyHex,
|
|
182
|
-
|
|
183
|
+
at as deriveClaimerWotsKeypair,
|
|
183
184
|
l as deriveDepositorClaimDescriptor,
|
|
184
185
|
c as deriveDepositorClaimScriptPubKey,
|
|
185
|
-
|
|
186
|
+
Er as deriveHashlocksFromPrePegin,
|
|
186
187
|
j as deriveNativeSegwitAddress,
|
|
187
|
-
|
|
188
|
+
ie as derivePeginVaultId,
|
|
188
189
|
J as deriveTaprootAddress,
|
|
189
190
|
T as deriveVaultId,
|
|
190
|
-
|
|
191
|
+
Ue as deriveVaultRoot,
|
|
191
192
|
ba as deriveWotsBlocksFromSeed,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
lr as describePeginParamsCandidate,
|
|
194
|
+
cr as describeUnresolvedVersion,
|
|
195
|
+
ur as encodePeginFingerprintPreimage,
|
|
195
196
|
Z as ensureHexPrefix,
|
|
196
197
|
Va as ensurePrePeginTermsApproval,
|
|
197
198
|
K as estimateReclaimFeeSats,
|
|
198
|
-
|
|
199
|
+
et as estimateRefundFeeSats,
|
|
199
200
|
S as expandAuthAnchor,
|
|
200
201
|
C as expandHashlockSecret,
|
|
201
202
|
I as expandWotsSeed,
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
Ne as extractErrorData,
|
|
204
|
+
_s as extractInputsFromTransaction,
|
|
204
205
|
u as extractPayoutSignature,
|
|
205
206
|
y as extractPeginInputSignature,
|
|
206
207
|
f as finalizePayout,
|
|
207
208
|
D as finalizePeginInputPsbt,
|
|
208
209
|
X as finalizeScriptPathWithSignatures,
|
|
209
210
|
h as finalizeWronglyChallenged,
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
ms as findOverlappingPendingVaults,
|
|
212
|
+
st as fingerprintReturnedGraph,
|
|
212
213
|
q as formatSatoshisToBtc,
|
|
213
214
|
va as forwardDepositApproval,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
215
|
+
Be as forwardDeriveContextHash,
|
|
216
|
+
ls as fundPeginTransaction,
|
|
217
|
+
Ka as getAddressTxs,
|
|
218
|
+
Xa as getAddressUtxos,
|
|
219
|
+
be as getContractErrorMessage,
|
|
220
|
+
je as getDustThreshold,
|
|
221
|
+
Ga as getMempoolApiUrl,
|
|
221
222
|
Q as getNetwork,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
ka as getNetworkFees,
|
|
224
|
+
Wa as getOutspend,
|
|
225
|
+
yt as getPeginProtocolState,
|
|
226
|
+
Je as getPsbtInputFields,
|
|
227
|
+
Ze as getScriptType,
|
|
227
228
|
$ as getSortedXOnlyPubkeys,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
wa as getTipHeight,
|
|
230
|
+
za as getTxHex,
|
|
231
|
+
Ya as getTxInfo,
|
|
232
|
+
ja as getUtxoInfo,
|
|
233
|
+
Ve as handleContractError,
|
|
233
234
|
aa as hexToUint8Array,
|
|
234
|
-
|
|
235
|
+
Dt as isActivationDeadlinePassedOnChain,
|
|
235
236
|
ea as isAddressFromPublicKey,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
237
|
+
rt as isApplicationEntryPointMismatchError,
|
|
238
|
+
Ks as isAuthRejectedError,
|
|
239
|
+
tt as isDepositAmountValid,
|
|
240
|
+
dr as isDepositTermsRejectedError,
|
|
241
|
+
it as isHintAccepted,
|
|
242
|
+
xe as isKnownContractError,
|
|
243
|
+
ot as isParticipantKeyDriftError,
|
|
244
|
+
Fe as isPeginFingerprintChangedError,
|
|
245
|
+
gr as isPeginFingerprintInputError,
|
|
246
|
+
nt as isPeginRegistrationMissingError,
|
|
247
|
+
pt as isPeginRegistrationNotFinalError,
|
|
248
|
+
Xs as isPegoutTerminalStatus,
|
|
249
|
+
Gs as isRecognizedPegoutStatus,
|
|
250
|
+
Pt as isRegisteredVaultVersionMismatchError,
|
|
251
|
+
ue as isRegistrationLogsUnavailableError,
|
|
252
|
+
hs as isUnrecognizedDaemonStatusError,
|
|
252
253
|
sa as isValidHex,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
Rr as isWotsMismatchError,
|
|
255
|
+
Et as matchKeyHint,
|
|
256
|
+
lt as matchKeySetHint,
|
|
257
|
+
Le as parseFundingOutpointsFromTx,
|
|
258
|
+
cs as parseUnfundedWasmTransaction,
|
|
259
|
+
us as peginOutputCount,
|
|
259
260
|
O as peginP2aAnchorOutput,
|
|
260
261
|
N as pinPegoutProof,
|
|
261
|
-
|
|
262
|
+
Ys as primeVpTokenRegistry,
|
|
262
263
|
ra as processPublicKeyToXOnly,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
Ja as pushTx,
|
|
265
|
+
ds as rateBasedTxBufferFee,
|
|
266
|
+
Ar as rebuildDepositTermsCore,
|
|
266
267
|
G as reclaimVsize,
|
|
267
|
-
|
|
268
|
+
_r as reconstructPeginParams,
|
|
268
269
|
ya as requireChangeAddress,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
270
|
+
ct as resolveCurrentParticipantKeys,
|
|
271
|
+
ut as resolveParticipantKeysAtEpochs,
|
|
272
|
+
se as resolveProtocolAddresses,
|
|
273
|
+
dt as runDepositorPresignFlow,
|
|
274
|
+
qe as selectUtxosForPegin,
|
|
275
|
+
Qe as shouldAddChangeOutput,
|
|
276
|
+
gt as signDepositorGraph,
|
|
276
277
|
ta as stripHexPrefix,
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
Rt as submitWotsPublicKey,
|
|
279
|
+
At as summarizeWatchtowerArtifacts,
|
|
279
280
|
b as supportedTxGraphVersions,
|
|
280
281
|
Da as supportsDepositApproval,
|
|
281
|
-
|
|
282
|
+
mr as toRefundInputs,
|
|
282
283
|
ia as toXOnly,
|
|
283
284
|
oa as uint8ArrayToHex,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
_t as validateDepositAmount,
|
|
286
|
+
mt as validateMultiVaultDepositInputs,
|
|
287
|
+
de as validateOffchainParams,
|
|
288
|
+
Tt as validateOnChainParticipantKeys,
|
|
289
|
+
ge as validatePegInConfiguration,
|
|
289
290
|
V as validatePeginP2aAnchor,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
St as validateProviderSelection,
|
|
292
|
+
Ct as validateRemainingCapacity,
|
|
293
|
+
Os as validateRequestDepositorClaimerArtifactsResponse,
|
|
293
294
|
Ua as validateSecretAgainstHashlock,
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
Re as validateTBVProtocolParams,
|
|
296
|
+
Ts as validateUtxosAvailable,
|
|
297
|
+
It as validateVaultAmounts,
|
|
298
|
+
ft as validateVaultProviderPubkey,
|
|
298
299
|
na as validateWalletPubkey,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
300
|
+
ht as verifyRegisteredParticipantKeys,
|
|
301
|
+
Ot as verifyRegisteredVaultVersions,
|
|
302
|
+
js as verifyServerIdentity,
|
|
303
|
+
Js as vpTokenRegistry,
|
|
304
|
+
Nt as waitForPeginRegistrationDepth,
|
|
305
|
+
bt as waitForPeginStatus,
|
|
305
306
|
Ia as waitForTransactionReceiptSmartAware
|
|
306
307
|
};
|
|
307
308
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var ht=Object.defineProperty;var lt=(t,e,o)=>e in t?ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var b=(t,e,o)=>lt(t,typeof e!="symbol"?e+"":e,o);const E=require("viem"),h=require("./BTCVaultRegistry.abi-BQ5tFNSu.cjs"),I=require("./BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs"),V=require("./constants-BTZdyOuk.cjs"),gt=require("./tbv/core/utils/eth/index.cjs"),C=require("./onChainBtcPubkey-BlzxYImF.cjs"),P=require("./secp256k1-DDHQ1_za.cjs"),l=require("./sha2-Ce6KewYx.cjs"),A=25,W=9999;function $(t){if(!Number.isInteger(t)||t<0||t>=V.MAX_VP_COMMISSION_BPS_EXCLUSIVE)throw new Error(`Quoted commissionBps must be an integer in [0, ${V.MAX_VP_COMMISSION_BPS_EXCLUSIVE}), got ${t}`);return Math.min(t+A,W)}const dt=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),X=Uint8Array.from(new Array(16).fill(0).map((t,e)=>e)),pt=X.map(t=>(9*t+5)%16),z=(()=>{const o=[[X],[pt]];for(let n=0;n<4;n++)for(let i of o)i.push(i[n].map(s=>dt[s]));return o})(),G=z[0],Q=z[1],Y=[[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)),ft=G.map((t,e)=>t.map(o=>Y[e][o])),Pt=Q.map((t,e)=>t.map(o=>Y[e][o])),mt=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),bt=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function K(t,e,o,n){return t===0?e^o^n:t===1?e&o|~e&n:t===2?(e|~o)^n:t===3?e&n|o&~n:e^(o|~n)}const T=new Uint32Array(16);class yt extends l.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:o,h1:n,h2:i,h3:s,h4:r}=this;return[o,n,i,s,r]}set(o,n,i,s,r){this.h0=o|0,this.h1=n|0,this.h2=i|0,this.h3=s|0,this.h4=r|0}process(o,n){for(let a=0;a<16;a++,n+=4)T[a]=o.getUint32(n,!0);let i=this.h0|0,s=i,r=this.h1|0,c=r,u=this.h2|0,g=u,f=this.h3|0,B=f,m=this.h4|0,w=m;for(let a=0;a<5;a++){const d=4-a,it=mt[a],st=bt[a],rt=G[a],at=Q[a],ct=ft[a],ut=Pt[a];for(let p=0;p<16;p++){const S=l.rotl(i+K(a,r,u,f)+T[rt[p]]+it,ct[p])+m|0;i=m,m=f,f=l.rotl(u,10)|0,u=r,r=S}for(let p=0;p<16;p++){const S=l.rotl(s+K(d,c,g,B)+T[at[p]]+st,ut[p])+w|0;s=w,w=B,B=l.rotl(g,10)|0,g=c,c=S}}this.set(this.h1+u+B|0,this.h2+f+w|0,this.h3+m+s|0,this.h4+i+c|0,this.h0+r+g|0)}roundClean(){l.clean(T)}destroy(){this.destroyed=!0,l.clean(this.buffer),this.set(0,0,0,0,0)}}const j=l.createHasher(()=>new yt),Ct="5120",_="0014",Bt=20,M=33,Et=65,wt=2,It=3,Tt=4;function Z(t,e){const o=t.startsWith("0x")||t.startsWith("0X")?t.slice(2):t;if(!/^(?:[0-9a-fA-F]{2})+$/.test(o))throw new Error(`${e} must be non-empty, even-length hex`);return`0x${o.toLowerCase()}`}function Vt(t){const e=l.hexToBytes(t),o=P.schnorr.utils.lift_x(BigInt(`0x${t}`)),n=P.schnorr.utils.bytesToNumberBE(P.schnorr.utils.taggedHash("TapTweak",e));if(n>=P.secp256k1.CURVE.n)throw new Error("Proof of possession BTC pubkey has an invalid TapTweak");const i=n===0n?o:o.add(P.schnorr.Point.BASE.multiply(n));return`0x${Ct}${l.bytesToHex(P.schnorr.utils.pointToBytes(i))}`}function At(t){const e=Z(t,"depositorBtcPubkeyRaw"),o=l.hexToBytes(e.slice(2));if(o.length===32)return{xOnlyPubkey:C.assertOnChainBtcPubkey(e,"Payout BTC pubkey")};const n=o.length===M&&(o[0]===wt||o[0]===It),i=o.length===Et&&o[0]===Tt;if(!n&&!i)throw new Error("depositorBtcPubkeyRaw must be x-only, compressed, or uncompressed");try{P.secp256k1.Point.fromBytes(o)}catch{throw new Error("depositorBtcPubkeyRaw is not a valid BTC pubkey")}return{xOnlyPubkey:l.bytesToHex(o.subarray(1,M)),compressedPubkey:n?o:void 0}}function xt(t){return`0x${_}${l.bytesToHex(j(l.sha256(t)))}`}function St(t,e,o){const n=Z(t,"depositorPayoutScriptPubKey");if((n.length-2)/2>V.MAX_PAYOUT_SCRIPT_LEN)throw new Error(`depositorPayoutScriptPubKey exceeds ${V.MAX_PAYOUT_SCRIPT_LEN} bytes`);const i=e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e,s=C.assertOnChainBtcPubkey(`0x${i}`,"Proof of possession BTC pubkey"),r=At(o);if(r.xOnlyPubkey!==s)throw new Error("depositorBtcPubkeyRaw does not match the proof of possession BTC pubkey");if(n===Vt(s))return n;if(n.startsWith(`0x${_}`)&&n.length===2+_.length+Bt*2){if(!r.compressedPubkey)throw new Error("A P2WPKH payout requires a compressed BTC pubkey");if(n===xt(r.compressedPubkey))return n}throw new Error("depositorPayoutScriptPubKey does not match the proof of possession BTC pubkey")}const R=65535,H=1e4,x=4294967295,F=255;function J(t){if(!Number.isInteger(t)||t<0||t>x)throw new Error(`Invalid offchainParamsVersion from contract: must be a uint32, got ${t}`)}function tt(t){const e=[];if(t.timelockAssert<=0n&&e.push(`timelockAssert must be positive, got ${t.timelockAssert}`),t.timelockAssert>BigInt(R)&&e.push(`timelockAssert ${t.timelockAssert} exceeds uint16 max (${R})`),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>R)&&e.push(`proverCircuitVersion must be a uint16, got ${t.proverCircuitVersion}`),(!Number.isInteger(t.minPrepeginDepth)||t.minPrepeginDepth<=0||t.minPrepeginDepth>x)&&e.push(`minPrepeginDepth must be a uint32 in [1, ${x}], 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>H)&&e.push(`minVpCommissionBps must be in [0, ${H}], got ${t.minVpCommissionBps}`),e.length>0)throw new Error(`Invalid offchain protocol parameters: ${e.join("; ")}`)}function et(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>F)&&e.push(`maxHtlcOutputCount must be an integer in [1, ${F}], 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 Rt(t){if(et(t),tt(t.offchainParams),!Number.isInteger(t.offchainParamsVersion)||t.offchainParamsVersion<0||t.offchainParamsVersion>x)throw new Error(`Invalid peg-in configuration: offchainParamsVersion must be a uint32, got ${t.offchainParamsVersion}`);P.assertValidVaultCoreVersion(t.activeVaultCoreVersion,"ProtocolParams.activeVaultCoreVersion()")}const ot="RegistrationLogsUnavailableError";class N extends Error{constructor(o){super(`The Ethereum node returned no registration logs for block ${o}, which holds a vault registration; the node may not have indexed that block yet. Try again.`);b(this,"blockNumber");this.name=ot,this.blockNumber=o}}function vt(t){return t instanceof N?!0:typeof t!="object"||t===null?!1:t.name===ot}const q=9999;function U(t){return{depositor:t.depositor,depositorBtcPubKey:t.depositorBtcPubKey,amount:t.amount,vaultProvider:t.vaultProvider,status:t.status,applicationEntryPoint:t.applicationEntryPoint,createdAt:t.createdAt}}function v(t){const e=Number(t.offchainParamsVersion);return J(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,$t=0n,_t=[E.getAbiItem({abi:h.BTCVaultRegistryABI,name:"PegInSubmitted"}),E.getAbiItem({abi:h.BTCVaultRegistryABI,name:"PegInSubmittedV2"})];function k(t,e,o){if(t<0n||t>=kt)throw new Error(`getBtcVaultProtocolInfo returned ${e}=${t} for vault ${o}, 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 nt{constructor(e,o){this.publicClient=e,this.contractAddress=o}async getVaultProviderGenesisBtcPubKey(e,o){return this.getVaultProviderOperationBtcKeyAtEpoch(e,$t,o)}async getVaultProviderOperationBtcKeyAtEpoch(e,o,n){const i=await this.publicClient.readContract({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getOperationBtcKeyAtEpoch",args:[e,o],blockNumber:n});return C.assertOnChainBtcPubkey(i,`getOperationBtcKeyAtEpoch (vp=${e}, epoch=${o})`)}async getVaultProviderApplication(e,o){return await this.publicClient.readContract({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getVaultProviderApplication",args:[e],blockNumber:o})}async getCurrentVaultProviderOperationBtcKey(e){const o=await this.publicClient.readContract({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getCurrentOperationBtcKey",args:[e]});return C.assertOnChainBtcPubkey(o,`getCurrentOperationBtcKey (vp=${e})`)}async getVaultKeyEpochs(e){const o=await this.publicClient.readContract({address:this.contractAddress,abi:I.BTCVaultRegistryKeyEpochsABI,functionName:"getBtcVaultProtocolInfo",args:[e]});return D(o,e)}async getVaultKeyEpochsBatch(e){return e.length===0?[]:(await this.publicClient.multicall({contracts:e.map(n=>({address:this.contractAddress,abi:I.BTCVaultRegistryKeyEpochsABI,functionName:"getBtcVaultProtocolInfo",args:[n]})),allowFailure:!1})).map((n,i)=>D(n,e[i]))}async getVaultBasicInfo(e){const o=await this.publicClient.readContract({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[e]});return U(o)}async getVaultProtocolInfo(e){const o=await this.publicClient.readContract({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[e]});return v(o)}async getProtocolInfoBatch(e){return e.length===0?[]:(await this.publicClient.multicall({contracts:e.map(n=>({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[n]})),allowFailure:!1})).map((n,i)=>{const s=n;if(!s.depositorSignedPeginTx||s.depositorSignedPeginTx==="0x")throw new Error(`Vault ${e[i]} not found on-chain or has no pegin transaction`);return v(s)})}async getPegInFee(e){return await this.publicClient.readContract({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getPegInFee",args:[e]})}async getVaultProviderCommission(e){const o=await this.publicClient.readContract({address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getVaultProviderCommission",args:[e]});if(!Number.isInteger(o)||o<0||o>q)throw new Error(`getVaultProviderCommission returned ${o} bps for ${e}, outside the protocol range [0, ${q}]`);return o}async getVaultData(e){const[o,n]=await this.publicClient.multicall({contracts:[{address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[e]},{address:this.contractAddress,abi:h.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[e]}],allowFailure:!1}),i=U(o),s=v(n);if(!s.depositorSignedPeginTx||s.depositorSignedPeginTx==="0x")throw new Error(`Vault ${e} not found on-chain or has no pegin transaction`);return{basic:i,protocol:s}}async getMaxAcceptableCommissionBpsBatch(e,o){if(e.length===0)return[];const n=await this.publicClient.getLogs({address:this.contractAddress,events:_t,fromBlock:o,toBlock:o,strict:!0});if(n.length===0)throw new N(o);return e.map(i=>{const s=i.toLowerCase();let r=!1;const c=[];for(const u of n)u.args.vaultId.toLowerCase()===s&&(r=!0,u.eventName==="PegInSubmittedV2"&&c.push(u.args.maxAcceptableCommissionBps));if(c.length===1)return c[0];throw c.length>1?new Error(`Expected one PegInSubmittedV2 log for vault ${i} at block ${o}, found ${c.length} PegInSubmittedV2 logs`):r?new Error(`Vault ${i} was registered before the registry emitted the depositor's commission ceiling (no PegInSubmittedV2 log at block ${o}), so the ceiling cannot be recovered on-chain`):new Error(`Vault ${i} has no registration log at its on-chain registration block ${o}`)})}}const Ot=0,Nt=255,Kt=12e4;function y(t,e){const o=t.startsWith("0x")?t:t.startsWith("0X")?`0x${t.slice(2)}`:`0x${t}`;if(!/^0x(?:[0-9a-fA-F]{2})+$/.test(o))throw new Error(`${e} must be non-empty, even-length hex`);return o}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 Mt="0x0000000000000000000000000000000000000000000000000000000000000000";function L(t){if(O(t,"expectedFingerprint"),t.toLowerCase()===Mt)throw new Error("expectedFingerprint must not be zero: the registry cannot resolve a zero fingerprint, so this submission would always revert")}function Ht(t){if(!Number.isInteger(t)||t<0||t>Nt)throw new Error(`htlcVout must be a uint8, got ${t}`)}class Ft{constructor(e){this.config=e}async registerPeginOnChain(e){const o={...e,popSignature:{...e.popSignature}};this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps),L(o.expectedFingerprint);const n=this.assertPopMatchesEthAccount(o.popSignature),i=this.normalizeBtcPubkey(o.popSignature),s=y(o.popSignature.btcPopSignature,"btcPopSignature"),r=this.normalizeRequest(o,n,i);await this.assertVaultDoesNotExist(r.vaultId,r.peginTxHash);const c=await this.readPeginFee(o.vaultProvider),u=await this.resolveMaxAcceptableCommissionBps(o.vaultProvider,o.quotedCommissionBps),g=E.encodeFunctionData({abi:h.BTCVaultRegistryABI,functionName:"submitPeginRequest",args:[n,i,s,r.unsignedPrePeginTx,r.depositorSignedPeginTx,o.vaultProvider,u,o.hashlock,o.htlcVout,r.payoutScript,o.depositorWotsPkHash,o.expectedFingerprint]});return{ethTxHash:await this.sendAndWait(g,c,!1,n),vaultId:r.vaultId,peginTxHash:r.peginTxHash}}async registerPeginBatchOnChain(e){const o={...e,popSignature:{...e.popSignature},requests:e.requests.map(a=>({...a}))};if(o.requests.length===0)throw new Error("Batch pegin requires at least one request");this.assertQuotedCommissionPresentWhenRequired(o.quotedCommissionBps),L(o.expectedFingerprint);const n=this.assertPopMatchesEthAccount(o.popSignature),i=y(o.unsignedPrePeginTx,"unsignedPrePeginTx"),s=this.normalizeBtcPubkey(o.popSignature),r=y(o.popSignature.btcPopSignature,"btcPopSignature"),c=[],u=[],g=new Set;for(const a of o.requests){const d=this.normalizeRequest({...a,unsignedPrePeginTx:o.unsignedPrePeginTx,vaultProvider:o.vaultProvider,depositorBtcPubkeyRaw:o.depositorBtcPubkeyRaw},n,s);if(g.has(d.vaultId))throw new Error(`Duplicate vault in batch: ${d.vaultId}`);g.add(d.vaultId),c.push({vaultId:d.vaultId,peginTxHash:d.peginTxHash}),u.push({depositorBtcPubKey:s,btcPopSignature:r,unsignedPrePeginTx:i,depositorSignedPeginTx:d.depositorSignedPeginTx,hashlock:a.hashlock,htlcVout:a.htlcVout,referralCode:Ot,depositorPayoutBtcAddress:d.payoutScript,depositorWotsPkHash:a.depositorWotsPkHash})}for(const a of c)await this.assertVaultDoesNotExist(a.vaultId,a.peginTxHash);const f=await this.readPeginFee(o.vaultProvider),B=await this.resolveMaxAcceptableCommissionBps(o.vaultProvider,o.quotedCommissionBps),m=E.encodeFunctionData({abi:h.BTCVaultRegistryABI,functionName:"submitPeginRequestBatch",args:[n,o.vaultProvider,B,o.expectedFingerprint,u]});return{ethTxHash:await this.sendAndWait(m,f*BigInt(o.requests.length),!0,n),vaults:c}}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 o=this.config.ethWallet.account;if(!o)throw new Error("Ethereum wallet account not found");if(!E.isAddressEqual(e,o.address))throw new Error(`Proof of possession was signed for ${e} but the Ethereum wallet is currently connected to ${o.address}. Reconnect the original account or sign a new proof of possession.`);return o.address}normalizeBtcPubkey(e){return`0x${C.assertOnChainBtcPubkey(y(e.depositorBtcPubkey,"Proof of possession BTC pubkey"),"Proof of possession BTC pubkey")}`}normalizeRequest(e,o,n){O(e.hashlock,"hashlock"),O(e.depositorWotsPkHash,"depositorWotsPkHash"),Ht(e.htlcVout);const i=y(e.unsignedPrePeginTx,"unsignedPrePeginTx"),s=y(e.depositorSignedPeginTx,"depositorSignedPeginTx"),r=C.calculateBtcTxHash(s);return{unsignedPrePeginTx:i,depositorSignedPeginTx:s,payoutScript:St(e.depositorPayoutScriptPubKey,n,e.depositorBtcPubkeyRaw),peginTxHash:r,vaultId:y(C.derivePeginVaultId(r,o),"vaultId")}}async assertVaultDoesNotExist(e,o){if((await this.config.publicClient.readContract({address:this.config.btcVaultRegistry,abi:h.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[e]})).depositor!==E.zeroAddress)throw new Error(`Vault already exists (ID: ${e}, peginTxHash: ${o}). 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:h.BTCVaultRegistryABI,functionName:"getPegInFee",args:[e]})}catch(o){throw new Error("Failed to query pegin fee from the contract. Please check your network connection and contract address.",{cause:o})}}async resolveMaxAcceptableCommissionBps(e,o){let n;try{n=await new nt(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(o!==void 0){if(n>o+A)throw new Error(`Vault provider commission changed since quote: quoted ${o} bps, chain currently reports ${n} bps (allowed drift ${A} bps). Please refresh and try again.`);return $(o)}return $(n)}async sendAndWait(e,o,n,i){let s=this.assertEthAccount(i),r;try{r=await this.config.publicClient.estimateGas({to:this.config.btcVaultRegistry,data:e,value:o,account:s})}catch(g){I.handleContractError(g)}s=this.assertEthAccount(i);let c;try{c=await this.config.ethWallet.sendTransaction({to:this.config.btcVaultRegistry,data:e,value:o,gas:r,account:s,chain:this.config.ethChain})}catch(g){I.handleContractError(g)}const u=await gt.waitForTransactionReceiptSmartAware({publicClient:this.config.publicClient,walletAddress:i,hash:c,timeout:this.config.receiptTimeoutMs??Kt});return u.status==="reverted"&&I.handleContractError(new Error(`${n?"Batch transaction":"Transaction"} reverted. Hash: ${u.transactionHash}. Check a block explorer for details.`)),u.transactionHash}}exports.COMMISSION_BPS_HEADROOM=A;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=W;exports.RegistrationLogsUnavailableError=N;exports.ViemPeginRegistrationClient=Ft;exports.ViemVaultRegistryReader=nt;exports.assertValidOffchainParamsVersion=J;exports.capMaxAcceptableCommissionBps=$;exports.isRegistrationLogsUnavailableError=vt;exports.ripemd160=j;exports.validateOffchainParams=tt;exports.validatePegInConfiguration=Rt;exports.validateTBVProtocolParams=et;
|
|
2
|
+
//# sourceMappingURL=pegin-registration-client-B0j6ugt9.cjs.map
|