@babylonlabs-io/ts-sdk 3.1.1 → 3.2.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-BH2-LHxN.cjs +2 -0
- package/dist/BTCVaultRegistry.abi-BH2-LHxN.cjs.map +1 -0
- package/dist/{BTCVaultRegistry.abi-DBW0dyqH.js → BTCVaultRegistry.abi-BzNTa_EU.js} +19 -52
- package/dist/BTCVaultRegistry.abi-BzNTa_EU.js.map +1 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-Btg0nBz1.js +262 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-Btg0nBz1.js.map +1 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs +2 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs.map +1 -0
- package/dist/{PeginManager-8EUlm10F.cjs → PeginManager-BHplS4dM.cjs} +2 -2
- package/dist/{PeginManager-8EUlm10F.cjs.map → PeginManager-BHplS4dM.cjs.map} +1 -1
- package/dist/{PeginManager-QRwMUxZg.js → PeginManager-DcwGom01.js} +2 -2
- package/dist/{PeginManager-QRwMUxZg.js.map → PeginManager-DcwGom01.js.map} +1 -1
- package/dist/VaultErrors.abi-Boz4w97c.js +5 -0
- package/dist/VaultErrors.abi-Boz4w97c.js.map +1 -0
- package/dist/VaultErrors.abi-DQ18kM0L.cjs +2 -0
- package/dist/VaultErrors.abi-DQ18kM0L.cjs.map +1 -0
- package/dist/buildAndBroadcastReclaim-C7bq5wNM.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-C7bq5wNM.cjs.map +1 -0
- package/dist/{buildAndBroadcastReclaim-DoprHX7o.js → buildAndBroadcastReclaim-CcQ0b1be.js} +466 -456
- package/dist/buildAndBroadcastReclaim-CcQ0b1be.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +232 -229
- package/dist/index.js.map +1 -1
- package/dist/pegin-registration-client-BogzOk8B.cjs +2 -0
- package/dist/pegin-registration-client-BogzOk8B.cjs.map +1 -0
- package/dist/{pegin-registration-client-BWMwxtr8.js → pegin-registration-client-DvyrUNku.js} +45 -44
- package/dist/pegin-registration-client-DvyrUNku.js.map +1 -0
- package/dist/peginState-CIibG9S_.js +75 -0
- package/dist/peginState-CIibG9S_.js.map +1 -0
- package/dist/peginState-IyE22wWh.cjs +2 -0
- package/dist/peginState-IyE22wWh.cjs.map +1 -0
- package/dist/{reservation-DOAHVT3B.js → reservation-BZQABu4g.js} +2 -2
- package/dist/{reservation-DOAHVT3B.js.map → reservation-BZQABu4g.js.map} +1 -1
- package/dist/{reservation-ECxjZi5t.cjs → reservation-CA5knoQ0.cjs} +2 -2
- package/dist/{reservation-ECxjZi5t.cjs.map → reservation-CA5knoQ0.cjs.map} +1 -1
- package/dist/{signer-set-reader-C6g47hdk.cjs → signer-set-reader-D-CyIYR5.cjs} +2 -2
- package/dist/{signer-set-reader-C6g47hdk.cjs.map → signer-set-reader-D-CyIYR5.cjs.map} +1 -1
- package/dist/{signer-set-reader-C1VmC9_U.js → signer-set-reader-DFF9MgQN.js} +2 -2
- package/dist/{signer-set-reader-C1VmC9_U.js.map → signer-set-reader-DFF9MgQN.js.map} +1 -1
- 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 +8 -0
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/contracts/__tests__/vaultErrors.abi.test.d.ts +2 -0
- package/dist/tbv/core/contracts/__tests__/vaultErrors.abi.test.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +14 -40
- package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/abis/VaultErrors.abi.d.ts +3 -0
- package/dist/tbv/core/contracts/abis/VaultErrors.abi.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/vaultErrors.abi.json.d.ts +4 -0
- package/dist/tbv/core/contracts/errors.d.ts +7 -2
- 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.d.ts +2 -1
- package/dist/tbv/core/contracts/index.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.js +13 -10
- package/dist/tbv/core/contracts/index.js.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +225 -222
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +1 -1
- package/dist/tbv/core/services/activation/activateVault.d.ts +50 -0
- package/dist/tbv/core/services/activation/activateVault.d.ts.map +1 -1
- package/dist/tbv/core/services/activation/index.d.ts +1 -1
- package/dist/tbv/core/services/activation/index.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/__tests__/realWasmWatchtowerArtifacts.test.d.ts +9 -0
- package/dist/tbv/core/services/delegated-claim/__tests__/realWasmWatchtowerArtifacts.test.d.ts.map +1 -0
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts +5 -7
- package/dist/tbv/core/services/delegated-claim/assembleWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/index.d.ts +3 -4
- package/dist/tbv/core/services/delegated-claim/index.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/planDelegatedClaimSigning.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts +14 -8
- package/dist/tbv/core/services/delegated-claim/readWatchtowerArtifacts.d.ts.map +1 -1
- package/dist/tbv/core/services/delegated-claim/types.d.ts +32 -19
- package/dist/tbv/core/services/delegated-claim/types.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts +20 -1
- package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +58 -58
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +225 -222
- package/dist/tbv/index.js.map +1 -1
- package/dist/tbv/integrations/aave/clients/abis/AaveIntegrationAdapter.abi.json.d.ts +7 -701
- package/dist/tbv/integrations/aave/clients/query.d.ts +2 -2
- package/dist/tbv/integrations/aave/index.cjs +1 -1
- package/dist/tbv/integrations/aave/index.cjs.map +1 -1
- package/dist/tbv/integrations/aave/index.js +119 -119
- package/dist/tbv/integrations/aave/index.js.map +1 -1
- package/dist/{toRefundInputs-BZXvuOMY.cjs → toRefundInputs-8DgBT_Bg.cjs} +2 -2
- package/dist/{toRefundInputs-BZXvuOMY.cjs.map → toRefundInputs-8DgBT_Bg.cjs.map} +1 -1
- package/dist/{toRefundInputs-dKDSvpVI.js → toRefundInputs-CCMNAoRx.js} +2 -2
- package/dist/{toRefundInputs-dKDSvpVI.js.map → toRefundInputs-CCMNAoRx.js.map} +1 -1
- package/dist/types-Bda75Od0.cjs.map +1 -1
- package/dist/types-C5jj3Cc-.js.map +1 -1
- package/package.json +3 -3
- package/dist/BTCVaultRegistry.abi-CohlJX7c.cjs +0 -2
- package/dist/BTCVaultRegistry.abi-CohlJX7c.cjs.map +0 -1
- package/dist/BTCVaultRegistry.abi-DBW0dyqH.js.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js +0 -266
- package/dist/BTCVaultRegistryKeyEpochs.abi-BWoxwPQv.js.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs +0 -2
- package/dist/BTCVaultRegistryKeyEpochs.abi-DCJnzKer.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-DjX7wVb2.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-DjX7wVb2.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-DoprHX7o.js.map +0 -1
- package/dist/pegin-registration-client-BWMwxtr8.js.map +0 -1
- package/dist/pegin-registration-client-D4EguWaz.cjs +0 -2
- package/dist/pegin-registration-client-D4EguWaz.cjs.map +0 -1
- package/dist/peginState-BU2ONFXF.js +0 -68
- package/dist/peginState-BU2ONFXF.js.map +0 -1
- package/dist/peginState-DUv10EJR.cjs +0 -2
- package/dist/peginState-DUv10EJR.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,336 +1,339 @@
|
|
|
1
|
-
import { P as s, h as r, i as t, j as i, f as o, b as n, a as l, c as p, k as
|
|
1
|
+
import { P as s, h as r, i as t, j as i, f as o, b as n, a as l, c as p, k as E, d as P, e as c, g as u } from "./verifyScriptPathSchnorrSignature-B3-VkvnK.js";
|
|
2
2
|
import { a as g } from "./secp256k1-BuxBFUHm.js";
|
|
3
|
-
import { attachFinalizedAssert as R, computeMinClaimValue as A, computeMinPeginFee as _, deriveVaultId as S, expandAuthAnchor as T, expandHashlockSecret as C, expandWotsSeed as I, finalizePayout as f, finalizeWronglyChallenged as h, peginP2aAnchorOutput as
|
|
4
|
-
import { a as N, c as M, b as y, e as
|
|
5
|
-
import { c as U, a as H, b as L, e as K, f as X, r as
|
|
3
|
+
import { attachFinalizedAssert as R, computeMinClaimValue as A, computeMinPeginFee as _, deriveVaultId as S, expandAuthAnchor as T, expandHashlockSecret as C, expandWotsSeed as I, finalizePayout as f, finalizeWronglyChallenged as h, peginP2aAnchorOutput as V, pinPegoutProof as O, supportedTxGraphVersions as x, validatePeginP2aAnchor as b } from "./tbv/core/wasm/index.js";
|
|
4
|
+
import { a as N, c as M, b as y, e as v, f as D } from "./verifyKeyPathSchnorrSignature-DxPbeSdQ.js";
|
|
5
|
+
import { c as U, a as H, b as L, e as K, f as X, r as G } from "./noPayout-B-vGXJ-V.js";
|
|
6
6
|
import { b as W } from "./challengeAssert-Cp_GeRg8.js";
|
|
7
7
|
import { c as z, d as Y, a as j, b as J, e as Z, f as q, k as Q, g as $, h as aa, i as ea, j as sa, p as ra, s as ta, t as ia, u as oa, v as na } from "./bitcoin-C-TuHb-v.js";
|
|
8
8
|
import { c as pa } from "./abortSignals-BPpAUL1Z.js";
|
|
9
|
-
import { c as
|
|
9
|
+
import { c as Pa, a as ca } from "./signing-C1rR4tqs.js";
|
|
10
10
|
import { B as da, C as ga, H as ma, K as Ra, M as Aa, T as _a, X as Sa } from "./validation-OSC0xTHB.js";
|
|
11
11
|
import { waitForTransactionReceiptSmartAware as Ca } from "./tbv/core/utils/eth/index.js";
|
|
12
|
-
import { P as fa, b as ha, c as
|
|
13
|
-
import { P as Fa, c as Na, f as Ma, r as ya, s as
|
|
14
|
-
import { MEMPOOL_API_URLS as Ua, MempoolNotFoundError as Ha, getAddressTxs as La, getAddressUtxos as Ka, getMempoolApiUrl as Xa, getNetworkFees as
|
|
12
|
+
import { P as fa, b as ha, c as Va, d as Oa, e as xa } from "./PeginManager-DcwGom01.js";
|
|
13
|
+
import { P as Fa, c as Na, f as Ma, r as ya, s as va, v as Da } from "./PayoutManager-BZ212yml.js";
|
|
14
|
+
import { MEMPOOL_API_URLS as Ua, MempoolNotFoundError as Ha, getAddressTxs as La, getAddressUtxos as Ka, getMempoolApiUrl as Xa, getNetworkFees as Ga, getOutspend as ka, getTipHeight as Wa, getTxHex as wa, getTxInfo as za, getUtxoInfo as Ya, pushTx as ja } from "./tbv/core/clients/mempool/index.js";
|
|
15
15
|
import { R as Za, V as qa, a as Qa, f as $a, d as ae, g as ee, e as se, i as re, r as te, v as ie, b as oe, c as ne } from "./registration-records-CKLAv3gw.js";
|
|
16
|
-
import { V as pe, a as
|
|
17
|
-
import { C as de, M as ge, V as me, a as Re, c as Ae } from "./pegin-registration-client-
|
|
16
|
+
import { V as pe, a as Ee, b as Pe, r as ce } from "./signer-set-reader-DFF9MgQN.js";
|
|
17
|
+
import { C as de, M as ge, V as me, a as Re, c as Ae } from "./pegin-registration-client-DvyrUNku.js";
|
|
18
18
|
import { O as Se, V as Te } from "./types-C5jj3Cc-.js";
|
|
19
19
|
import { A as Ie } from "./ApplicationRegistry.abi-s8cQ1ooR.js";
|
|
20
|
-
import { B as he } from "./BTCVaultRegistry.abi-
|
|
21
|
-
import { B as
|
|
22
|
-
import { P as
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { B as
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import { C as
|
|
20
|
+
import { B as he } from "./BTCVaultRegistry.abi-BzNTa_EU.js";
|
|
21
|
+
import { B as Oe, C as xe, E as be, P as Fe, a as Ne, e as Me, g as ye, h as ve, i as De, b as Be } from "./BTCVaultRegistryKeyEpochs.abi-Btg0nBz1.js";
|
|
22
|
+
import { P as He } from "./ProtocolParams.abi-CKOVqFJP.js";
|
|
23
|
+
import { V as Ke } from "./VaultErrors.abi-Boz4w97c.js";
|
|
24
|
+
import { b as Ge } from "./buildVaultContextInputForClaim-DhBoQKyN.js";
|
|
25
|
+
import { V as We, b as we, a as ze, d as Ye, f as je } from "./deriveVaultRoot-BcvmER1E.js";
|
|
26
|
+
import { p as Ze } from "./parseFundingOutpoints-GSM-IaaK.js";
|
|
27
|
+
import { BitcoinNetworks as Qe } from "./shared/index.js";
|
|
28
|
+
import { c as as } from "./btcTxHash-BRZ8_EZq.js";
|
|
29
|
+
import { B as ss, a as rs, c as ts, b as is, d as os, g as ns, h as ls, f as ps, s as Es, e as Ps } from "./psbtInputFields-CCVyaQMi.js";
|
|
30
|
+
import { B as us, D as ds, L as gs, M as ms, c as Rs, P as As, b as _s, a as Ss, S as Ts, T as Cs, W as Is, f as fs, d as hs, p as Vs, r as Os } from "./fundPeginTransaction-CwhRbCQC.js";
|
|
31
|
+
import { U as bs, a as Fs, e as Ns, f as Ms, v as ys } from "./reservation-BZQABu4g.js";
|
|
32
|
+
import { V as Ds, a as Bs, b as Us, i as Hs, v as Ls } from "./index-CVBtBjQ5.js";
|
|
33
|
+
import { A as Xs, C as Gs, D as ks, J as Ws, a as ws, b as zs, d as Ys, P as js, R as Js, e as Zs, c as qs, V as Qs, i as $s, g as ar, f as er } from "./state-CFn1rT74.js";
|
|
34
|
+
import { S as rr, V as tr, c as ir, p as or, v as nr, a as lr } from "./primeVpAuth-CiCdRNGf.js";
|
|
35
|
+
import { D as Er, g as Pr, P as cr, a as ur, b as dr, u as gr, v as mr, t as Rr, w as Ar, U as _r, V as Sr, f as Tr, m as Cr, j as Ir, c as fr, l as hr, p as Vr, n as Or, e as xr, h as br, d as Fr, i as Nr, o as Mr, r as yr, k as vr, q as Dr, s as Br, x as Ur } from "./toRefundInputs-CCMNAoRx.js";
|
|
36
|
+
import { J as Lr, l as Kr, A as Xr, a8 as Gr, C as kr, D as Wr, n as wr, G as zr, u as Yr, W as jr, P as Jr, j as Zr, v as qr, w as Qr, ah as $r, ai as at, aj as et, ak as st, ab as rt, ac as tt, ad as it, ae as ot, af as nt, Z as lt, S as pt, V as Et, a as Pt, b as ct, d as ut, e as dt, m as gt, f as mt, g as Rt, t as At, i as _t, B as St, o as Tt, a1 as Ct, ag as It, a9 as ft, c as ht, k as Vt, h as Ot, aa as xt, E as bt, K as Ft, M as Nt, a2 as Mt, X as yt, x as vt, y as Dt, _ as Bt, a3 as Ut, a4 as Ht, p as Lt, r as Kt, a5 as Xt, a6 as Gt, a7 as kt, F as Wt, q as wt, H as zt, I as Yt, s as jt, N as Jt, O as Zt, L as qt, Q as Qt, R as $t, T as ai, U as ei, Y as si, $ as ri, z as ti, a0 as ii } from "./buildAndBroadcastReclaim-CcQ0b1be.js";
|
|
37
|
+
import { C as ni, P as li, a as pi, c as Ei, g as Pi, i as ci } from "./peginState-CIibG9S_.js";
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
Xs as AUTH_REJECTED_RPC_CODE,
|
|
40
|
+
Lr as ApplicationEntryPointMismatchError,
|
|
40
41
|
Ie as ApplicationRegistryABI,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Kr as BIP68NotMatureError,
|
|
42
|
+
Kr as ArtifactsVaultMismatchError,
|
|
43
|
+
Xr as AssertBindingError,
|
|
44
|
+
Gr as BIP68NotMatureError,
|
|
45
45
|
da as BITCOIN_ADDRESS_RE,
|
|
46
46
|
he as BTCVaultRegistryABI,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
Oe as BTCVaultRegistryKeyEpochsABI,
|
|
48
|
+
us as BTC_DUST_SAT,
|
|
49
|
+
Qe as BitcoinNetworks,
|
|
50
|
+
ss as BitcoinScriptType,
|
|
51
51
|
de as COMMISSION_BPS_HEADROOM,
|
|
52
52
|
ga as COMPRESSED_PUBKEY_HEX_LEN,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
xe as CONTRACT_ERRORS,
|
|
54
|
+
kr as ChallengerSetMismatchError,
|
|
55
|
+
Gs as ClaimerPegoutStatusValue,
|
|
56
|
+
ni as ContractStatus,
|
|
57
|
+
Wr as DELEGATED_CLAIM_TX_GRAPH_VERSION,
|
|
58
|
+
Er as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
|
|
59
|
+
ds as DUST_THRESHOLD,
|
|
60
|
+
ks as DaemonStatus,
|
|
61
|
+
wr as DelegatedClaimSigningIncompleteError,
|
|
62
|
+
Pr as DepositTermsRejectedError,
|
|
63
|
+
be as EMPTY_REVERT_MESSAGE,
|
|
64
|
+
zr as GraphFingerprintError,
|
|
64
65
|
ma as HEX_RE,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
Ws as JSON_RPC_ERROR_CODES,
|
|
67
|
+
ws as JsonRpcClient,
|
|
68
|
+
zs as JsonRpcError,
|
|
68
69
|
Ra as KNOWN_SCRIPT_PREFIXES,
|
|
69
|
-
|
|
70
|
+
gs as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
70
71
|
ge as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
|
|
71
|
-
|
|
72
|
+
ms as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
72
73
|
Aa as MAX_REASONABLE_FEE_SATS,
|
|
73
|
-
|
|
74
|
+
Rs as MAX_REASONABLE_PEGIN_VBYTES,
|
|
74
75
|
Ua as MEMPOOL_API_URLS,
|
|
75
76
|
Ha as MempoolNotFoundError,
|
|
76
77
|
Se as OnChainBtcVaultStatus,
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
As as P2TR_INPUT_SIZE,
|
|
79
|
+
_s as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
79
80
|
s as PEGIN_DEPOSITOR_CLAIM_VOUT,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
Yr as PEGIN_ETH_CONFIRMATIONS,
|
|
82
|
+
Fe as PEGIN_FINGERPRINT_CHANGED_SELECTOR,
|
|
83
|
+
cr as PEGIN_FINGERPRINT_DOMAIN,
|
|
84
|
+
ur as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
|
|
85
|
+
Ss as PEGIN_FIXED_OUTPUTS,
|
|
86
|
+
Ys as POST_WOTS_STATUSES,
|
|
87
|
+
js as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
88
|
+
jr as ParticipantKeyDriftError,
|
|
89
|
+
Jr as PayoutDestinationError,
|
|
90
|
+
Zr as PayoutInputLeafError,
|
|
90
91
|
Fa as PayoutManager,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
li as PeginAction,
|
|
93
|
+
Ne as PeginFingerprintChangedError,
|
|
94
|
+
dr as PeginFingerprintInputError,
|
|
94
95
|
fa as PeginManager,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
gr as PeginParamsAmbiguousError,
|
|
97
|
+
mr as PeginParamsIncompleteSpaceError,
|
|
98
|
+
Rr as PeginParamsNotFoundError,
|
|
99
|
+
qr as PeginRegistrationMissingError,
|
|
100
|
+
Qr as PeginRegistrationNotFinalError,
|
|
101
|
+
Ar as PeginSizingIntegrityError,
|
|
102
|
+
He as ProtocolParamsABI,
|
|
102
103
|
r as PsbtSubstitutionError,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
$r as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
|
|
105
|
+
at as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
|
|
106
|
+
et as RECLAIM_MAX_FEE_RATE_SATS_VB,
|
|
107
|
+
st as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
|
|
108
|
+
rt as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
|
|
109
|
+
tt as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
110
|
+
it as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
111
|
+
ot as REFUND_VSIZE,
|
|
112
|
+
nt as ReclaimUneconomicalError,
|
|
113
|
+
lt as RegisteredVaultVersionMismatchError,
|
|
113
114
|
Za as RegistrationLogsUnavailableError,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
Js as RpcErrorCode,
|
|
116
|
+
Ts as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
117
|
+
rr as ServerIdentityError,
|
|
118
|
+
pt as SigningPlanMismatchError,
|
|
118
119
|
_a as TXID_RE,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
Cs as TX_BUFFER_SIZE_OVERHEAD,
|
|
121
|
+
_r as UnanchoredPrePeginError,
|
|
122
|
+
bs as UtxoNotAvailableError,
|
|
123
|
+
We as VAULT_APP_NAME,
|
|
124
|
+
Ke as VAULT_ERROR_ABI,
|
|
125
|
+
Zs as VP_BATCH_MAX_SIZE,
|
|
126
|
+
qs as VP_TERMINAL_FAILURE_STATUSES,
|
|
127
|
+
Qs as VP_TRANSIENT_STATUSES,
|
|
126
128
|
qa as VaultClaimableByNotFoundError,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
Et as VaultIdBindingError,
|
|
130
|
+
Ds as VaultProviderRpcClient,
|
|
131
|
+
Sr as VaultRootMismatchError,
|
|
130
132
|
pe as ViemOperationKeyReader,
|
|
131
133
|
me as ViemPeginRegistrationClient,
|
|
132
134
|
Te as ViemProtocolParamsReader,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
Ee as ViemUniversalChallengerReader,
|
|
136
|
+
Pe as ViemVaultKeeperReader,
|
|
135
137
|
Re as ViemVaultRegistryReader,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
Bs as VpResponseValidationError,
|
|
139
|
+
tr as VpTokenRegistry,
|
|
140
|
+
Is as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
139
141
|
Sa as X_ONLY_PUBKEY_HEX_LEN,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
Pt as activateVault,
|
|
143
|
+
ct as activateVaultAndRedeem,
|
|
144
|
+
pi as activationDeadlineBlocksRemaining,
|
|
145
|
+
rs as applyChangeOutputPolicy,
|
|
146
|
+
ut as assembleWatchtowerArtifacts,
|
|
147
|
+
dt as assembleWatchtowerArtifactsFromSignatures,
|
|
148
|
+
gt as assertArtifactsUsableForVault,
|
|
149
|
+
mt as assertAssertBindsClaimAndPayout,
|
|
150
|
+
Rt as assertChallengerSetMatchesVault,
|
|
151
|
+
Tr as assertClaimBatchHomogeneous,
|
|
152
|
+
At as assertClaimSpendsVault,
|
|
151
153
|
N as assertKeyPathSchnorrSignature,
|
|
152
154
|
Qa as assertOnChainBtcPubkey,
|
|
153
|
-
|
|
155
|
+
_t as assertPayoutPaysRegisteredScript,
|
|
154
156
|
t as assertPsbtUnsignedTxMatches,
|
|
155
157
|
$a as assertRegisteredPayoutScriptBounds,
|
|
156
|
-
|
|
158
|
+
St as assertReturnedGraphMatchesFingerprint,
|
|
157
159
|
M as assertReturnedKeyPathSignatures,
|
|
158
160
|
i as assertScriptPathSchnorrSignature,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
Tt as assertTermsMatchVault,
|
|
162
|
+
Fs as assertUtxosAvailable,
|
|
161
163
|
g as assertValidVaultCoreVersion,
|
|
162
|
-
|
|
164
|
+
Ct as assertVaultProviderHintAccepted,
|
|
163
165
|
R as attachFinalizedAssert,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
Us as batchPollByProvider,
|
|
167
|
+
It as buildAndBroadcastReclaim,
|
|
168
|
+
ft as buildAndBroadcastRefund,
|
|
167
169
|
W as buildChallengeAssertPsbt,
|
|
168
170
|
ha as buildDepositTerms,
|
|
169
|
-
|
|
171
|
+
we as buildFundingOutpointsCommitment,
|
|
170
172
|
U as buildNoPayoutPsbt,
|
|
171
173
|
o as buildPayoutPsbt,
|
|
172
174
|
y as buildPeginInputPsbt,
|
|
173
|
-
|
|
175
|
+
Cr as buildPeginParamsCandidates,
|
|
174
176
|
n as buildPeginTxFromFundedPrePegin,
|
|
175
177
|
l as buildPrePeginPsbt,
|
|
176
178
|
H as buildReclaimPsbt,
|
|
177
179
|
L as buildRefundPsbt,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
ze as buildVaultContext,
|
|
181
|
+
Ge as buildVaultContextInputForClaim,
|
|
182
|
+
as as calculateBtcTxHash,
|
|
183
|
+
Ei as canPerformAction,
|
|
182
184
|
z as canonicalizeBtcPubkey,
|
|
183
185
|
Ae as capMaxAcceptableCommissionBps,
|
|
186
|
+
ht as claimExpiredVault,
|
|
184
187
|
pa as combineAbortSignals,
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
ts as computeChangeOutputFeeSats,
|
|
189
|
+
Ir as computeFundedPrePeginFee,
|
|
187
190
|
Na as computeHashlock,
|
|
188
|
-
|
|
191
|
+
is as computeMaxDeposit,
|
|
189
192
|
A as computeMinClaimValue,
|
|
190
193
|
_ as computeMinPeginFee,
|
|
191
194
|
p as computeNumLocalChallengers,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
os as computePeginBaseFeeSats,
|
|
196
|
+
fr as computePeginFingerprint,
|
|
197
|
+
Va as computeWotsBlockPublicKeysHash,
|
|
198
|
+
Vt as copyAssertConnectorLeaf,
|
|
199
|
+
ir as createAuthenticatedVpClient,
|
|
200
|
+
E as createPayoutScript,
|
|
201
|
+
Pa as createTaprootScriptPathSignOptions,
|
|
199
202
|
ca as createTaprootScriptPathSignOptionsForInput,
|
|
200
203
|
Y as deriveBip86ScriptPubKeyHex,
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
Ot as deriveClaimerWotsKeypair,
|
|
205
|
+
P as deriveDepositorClaimDescriptor,
|
|
203
206
|
c as deriveDepositorClaimScriptPubKey,
|
|
204
|
-
|
|
207
|
+
hr as deriveHashlocksFromPrePegin,
|
|
205
208
|
j as deriveNativeSegwitAddress,
|
|
206
209
|
ae as derivePeginVaultId,
|
|
207
210
|
J as deriveTaprootAddress,
|
|
208
211
|
S as deriveVaultId,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
Ye as deriveVaultRoot,
|
|
213
|
+
Oa as deriveWotsBlocksFromSeed,
|
|
214
|
+
Vr as describePeginParamsCandidate,
|
|
215
|
+
Or as describeUnresolvedVersion,
|
|
216
|
+
xr as encodePeginFingerprintPreimage,
|
|
214
217
|
Z as ensureHexPrefix,
|
|
215
|
-
|
|
218
|
+
xa as ensurePrePeginTermsApproval,
|
|
216
219
|
K as estimateReclaimFeeSats,
|
|
217
|
-
|
|
220
|
+
xt as estimateRefundFeeSats,
|
|
218
221
|
T as expandAuthAnchor,
|
|
219
222
|
C as expandHashlockSecret,
|
|
220
223
|
I as expandWotsSeed,
|
|
221
|
-
|
|
222
|
-
|
|
224
|
+
Me as extractErrorData,
|
|
225
|
+
Ns as extractInputsFromTransaction,
|
|
223
226
|
u as extractPayoutSignature,
|
|
224
|
-
|
|
227
|
+
v as extractPeginInputSignature,
|
|
225
228
|
f as finalizePayout,
|
|
226
|
-
|
|
229
|
+
D as finalizePeginInputPsbt,
|
|
227
230
|
X as finalizeScriptPathWithSignatures,
|
|
228
231
|
h as finalizeWronglyChallenged,
|
|
229
|
-
|
|
232
|
+
Ms as findOverlappingPendingVaults,
|
|
230
233
|
ee as findRegistrationRecord,
|
|
231
|
-
|
|
234
|
+
bt as fingerprintReturnedGraph,
|
|
232
235
|
q as formatSatoshisToBtc,
|
|
233
236
|
Ma as forwardDepositApproval,
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
je as forwardDeriveContextHash,
|
|
238
|
+
fs as fundPeginTransaction,
|
|
236
239
|
La as getAddressTxs,
|
|
237
240
|
Ka as getAddressUtxos,
|
|
238
|
-
|
|
239
|
-
|
|
241
|
+
ye as getContractErrorMessage,
|
|
242
|
+
ns as getDustThreshold,
|
|
240
243
|
Xa as getMempoolApiUrl,
|
|
241
244
|
Q as getNetwork,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
Ga as getNetworkFees,
|
|
246
|
+
ka as getOutspend,
|
|
247
|
+
Pi as getPeginProtocolState,
|
|
248
|
+
ls as getPsbtInputFields,
|
|
249
|
+
ps as getScriptType,
|
|
247
250
|
$ as getSortedXOnlyPubkeys,
|
|
248
251
|
Wa as getTipHeight,
|
|
249
252
|
wa as getTxHex,
|
|
250
253
|
za as getTxInfo,
|
|
251
254
|
Ya as getUtxoInfo,
|
|
252
|
-
|
|
255
|
+
ve as handleContractError,
|
|
253
256
|
aa as hexToUint8Array,
|
|
254
|
-
|
|
257
|
+
ci as isActivationDeadlinePassedOnChain,
|
|
255
258
|
ea as isAddressFromPublicKey,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
Ft as isApplicationEntryPointMismatchError,
|
|
260
|
+
$s as isAuthRejectedError,
|
|
261
|
+
Nt as isDepositAmountValid,
|
|
262
|
+
br as isDepositTermsRejectedError,
|
|
263
|
+
Mt as isHintAccepted,
|
|
261
264
|
De as isKnownContractError,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
yt as isParticipantKeyDriftError,
|
|
266
|
+
Be as isPeginFingerprintChangedError,
|
|
267
|
+
Fr as isPeginFingerprintInputError,
|
|
268
|
+
vt as isPeginRegistrationMissingError,
|
|
269
|
+
Dt as isPeginRegistrationNotFinalError,
|
|
270
|
+
ar as isPegoutTerminalStatus,
|
|
271
|
+
er as isRecognizedPegoutStatus,
|
|
272
|
+
Bt as isRegisteredVaultVersionMismatchError,
|
|
270
273
|
se as isRegistrationLogsUnavailableError,
|
|
271
|
-
|
|
274
|
+
Hs as isUnrecognizedDaemonStatusError,
|
|
272
275
|
sa as isValidHex,
|
|
273
276
|
re as isVaultClaimableByNotFoundError,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
277
|
+
Nr as isWotsMismatchError,
|
|
278
|
+
Ut as matchKeyHint,
|
|
279
|
+
Ht as matchKeySetHint,
|
|
280
|
+
Mr as orderClaimBatchByHtlcVout,
|
|
281
|
+
Ze as parseFundingOutpointsFromTx,
|
|
282
|
+
hs as parseUnfundedWasmTransaction,
|
|
283
|
+
Vs as peginOutputCount,
|
|
284
|
+
V as peginP2aAnchorOutput,
|
|
285
|
+
O as pinPegoutProof,
|
|
286
|
+
Lt as planDelegatedClaimSigning,
|
|
287
|
+
or as primeVpTokenRegistry,
|
|
285
288
|
ra as processPublicKeyToXOnly,
|
|
286
289
|
ja as pushTx,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
Os as rateBasedTxBufferFee,
|
|
291
|
+
Kt as readDelegatedClaimVaultContext,
|
|
292
|
+
Xt as readStampedParticipantKeys,
|
|
293
|
+
yr as rebuildDepositTermsCore,
|
|
294
|
+
vr as rebuildDepositTermsForClaim,
|
|
295
|
+
G as reclaimVsize,
|
|
296
|
+
Dr as reconstructPeginParams,
|
|
294
297
|
te as registrationPrePeginTxHash,
|
|
295
298
|
ya as requireChangeAddress,
|
|
296
|
-
|
|
297
|
-
|
|
299
|
+
Gt as resolveCurrentParticipantKeys,
|
|
300
|
+
kt as resolveParticipantKeysAtEpochs,
|
|
298
301
|
ce as resolveProtocolAddresses,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
Wt as runDepositorPresignFlow,
|
|
303
|
+
Br as selectSiblingRegistrations,
|
|
304
|
+
Es as selectUtxosForPegin,
|
|
305
|
+
Ps as shouldAddChangeOutput,
|
|
306
|
+
wt as signDelegatedClaimPlan,
|
|
307
|
+
zt as signDepositorGraph,
|
|
305
308
|
ta as stripHexPrefix,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
Yt as submitWotsPublicKey,
|
|
310
|
+
jt as summarizeWatchtowerArtifacts,
|
|
311
|
+
x as supportedTxGraphVersions,
|
|
312
|
+
va as supportsDepositApproval,
|
|
313
|
+
Ur as toRefundInputs,
|
|
311
314
|
ia as toXOnly,
|
|
312
315
|
oa as uint8ArrayToHex,
|
|
313
|
-
|
|
314
|
-
|
|
316
|
+
Jt as validateDepositAmount,
|
|
317
|
+
Zt as validateMultiVaultDepositInputs,
|
|
315
318
|
ie as validateOffchainParams,
|
|
316
|
-
|
|
319
|
+
qt as validateOnChainParticipantKeys,
|
|
317
320
|
oe as validatePegInConfiguration,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
b as validatePeginP2aAnchor,
|
|
322
|
+
Qt as validateProviderSelection,
|
|
323
|
+
$t as validateRemainingCapacity,
|
|
324
|
+
Ls as validateRequestDepositorClaimerArtifactsResponse,
|
|
325
|
+
Da as validateSecretAgainstHashlock,
|
|
323
326
|
ne as validateTBVProtocolParams,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
ys as validateUtxosAvailable,
|
|
328
|
+
ai as validateVaultAmounts,
|
|
329
|
+
ei as validateVaultProviderPubkey,
|
|
327
330
|
na as validateWalletPubkey,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
si as verifyRegisteredParticipantKeys,
|
|
332
|
+
ri as verifyRegisteredVaultVersions,
|
|
333
|
+
nr as verifyServerIdentity,
|
|
334
|
+
lr as vpTokenRegistry,
|
|
335
|
+
ti as waitForPeginRegistrationDepth,
|
|
336
|
+
ii as waitForPeginStatus,
|
|
334
337
|
Ca as waitForTransactionReceiptSmartAware
|
|
335
338
|
};
|
|
336
339
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const f=require("viem"),a=require("./BTCVaultRegistry.abi-BH2-LHxN.cjs"),C=require("./BTCVaultRegistryKeyEpochs.abi-CReWFJdu.cjs"),v=require("./constants-BwCg5K6R.cjs"),k=require("./tbv/core/utils/eth/index.cjs"),h=require("./registration-records-DFQgBaYi.cjs"),B=25,S=9999;function w(r){if(!Number.isInteger(r)||r<0||r>=v.MAX_VP_COMMISSION_BPS_EXCLUSIVE)throw new Error(`Quoted commissionBps must be an integer in [0, ${v.MAX_VP_COMMISSION_BPS_EXCLUSIVE}), got ${r}`);return Math.min(r+B,S)}const T=9999;function A(r){return{depositor:r.depositor,depositorBtcPubKey:r.depositorBtcPubKey,amount:r.amount,vaultProvider:r.vaultProvider,status:r.status,applicationEntryPoint:r.applicationEntryPoint,createdAt:r.createdAt}}function y(r){const t=Number(r.offchainParamsVersion);return h.assertValidOffchainParamsVersion(t),{depositorSignedPeginTx:r.depositorSignedPeginTx,universalChallengersVersion:r.universalChallengersVersion,appVaultKeepersVersion:r.appVaultKeepersVersion,offchainParamsVersion:t,verifiedAt:r.verifiedAt,depositorWotsPkHash:r.depositorWotsPkHash,hashlock:r.hashlock,htlcVout:r.htlcVout,depositorPopSignature:r.depositorPopSignature,prePeginTxHash:r.prePeginTxHash,vaultProviderCommissionBps:r.vaultProviderCommissionBps,claimExpiredUntil:r.claimExpiredUntil,vaultCoreVersion:r.vaultCoreVersion}}const _=1n<<64n,$=0n,K=[f.getAbiItem({abi:a.BTCVaultRegistryABI,name:"PegInSubmitted"}),f.getAbiItem({abi:a.BTCVaultRegistryABI,name:"PegInSubmittedV2"})],N=f.getAbiItem({abi:a.BTCVaultRegistryABI,name:"VaultClaimableBy"}),O=7200n;function M(r,t){return r>t?r:t}function H(r,t){return{vaultId:r.vaultId.toLowerCase(),depositor:r.depositor,vaultProvider:r.vaultProvider,amount:r.amount,vaultCoreVersion:r.vaultCoreVersion,universalChallengersVersion:r.universalChallengersVersion,appVaultKeepersVersion:r.appVaultKeepersVersion,proverCircuitVersion:r.proverCircuitVersion,offchainParamsVersion:r.offchainParamsVersion,peginTxHash:r.peginTxHash.toLowerCase(),depositorPayoutScriptPubKey:r.depositorPayoutBtcAddress.toLowerCase(),unsignedPrePeginTx:r.unsignedPrePeginTx,maxAcceptableCommissionBps:r.maxAcceptableCommissionBps,blockNumber:t}}function V(r,t,e){if(r<0n||r>=_)throw new Error(`getBtcVaultProtocolInfo returned ${t}=${r} for vault ${e}, outside the uint64 range — the registry may predate RFC-006`);return r}function x(r,t){return{vpKeyEpoch:V(r.vpKeyEpoch,"vpKeyEpoch",t),appKeeperKeyEpoch:V(r.appKeeperKeyEpoch,"appKeeperKeyEpoch",t),ucKeyEpoch:V(r.ucKeyEpoch,"ucKeyEpoch",t)}}class R{constructor(t,e){this.publicClient=t,this.contractAddress=e}async getVaultProviderGenesisBtcPubKey(t,e){return this.getVaultProviderOperationBtcKeyAtEpoch(t,$,e)}async getVaultProviderOperationBtcKeyAtEpoch(t,e,o){const n=await this.publicClient.readContract({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getOperationBtcKeyAtEpoch",args:[t,e],blockNumber:o});return h.assertOnChainBtcPubkey(n,`getOperationBtcKeyAtEpoch (vp=${t}, epoch=${e})`)}async getVaultProviderApplication(t,e){return await this.publicClient.readContract({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getVaultProviderApplication",args:[t],blockNumber:e})}async getCurrentVaultProviderOperationBtcKey(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getCurrentOperationBtcKey",args:[t]});return h.assertOnChainBtcPubkey(e,`getCurrentOperationBtcKey (vp=${t})`)}async getVaultKeyEpochs(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:C.BTCVaultRegistryKeyEpochsABI,functionName:"getBtcVaultProtocolInfo",args:[t]});return x(e,t)}async getVaultKeyEpochsBatch(t){return t.length===0?[]:(await this.publicClient.multicall({contracts:t.map(o=>({address:this.contractAddress,abi:C.BTCVaultRegistryKeyEpochsABI,functionName:"getBtcVaultProtocolInfo",args:[o]})),allowFailure:!1})).map((o,n)=>x(o,t[n]))}async getVaultBasicInfo(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[t]});return A(e)}async getVaultProtocolInfo(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[t]});return y(e)}async getProtocolInfoBatch(t){return t.length===0?[]:(await this.publicClient.multicall({contracts:t.map(o=>({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[o]})),allowFailure:!1})).map((o,n)=>{const i=o;if(!i.depositorSignedPeginTx||i.depositorSignedPeginTx==="0x")throw new Error(`Vault ${t[n]} not found on-chain or has no pegin transaction`);return y(i)})}async getPegInFee(t){return await this.publicClient.readContract({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getPegInFee",args:[t]})}async getVaultProviderCommission(t){const e=await this.publicClient.readContract({address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getVaultProviderCommission",args:[t]});if(!Number.isInteger(e)||e<0||e>T)throw new Error(`getVaultProviderCommission returned ${e} bps for ${t}, outside the protocol range [0, ${T}]`);return e}async getVaultData(t){const[e,o]=await this.publicClient.multicall({contracts:[{address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[t]},{address:this.contractAddress,abi:a.BTCVaultRegistryABI,functionName:"getBtcVaultProtocolInfo",args:[t]}],allowFailure:!1}),n=A(e),i=y(o);if(!i.depositorSignedPeginTx||i.depositorSignedPeginTx==="0x")throw new Error(`Vault ${t} not found on-chain or has no pegin transaction`);return{basic:n,protocol:i}}async getRegistrationRecordsAtBlock(t){const e=await this.publicClient.getLogs({address:this.contractAddress,events:K,fromBlock:t,toBlock:t,strict:!0});if(e.length===0)throw new h.RegistrationLogsUnavailableError(t);const o=new Map;for(const n of e){if(n.eventName!=="PegInSubmittedV2")continue;const i=H(n.args,n.blockNumber);if(o.has(i.vaultId))throw new Error(`Expected one PegInSubmittedV2 log for vault ${i.vaultId} at block ${t}, found more than one`);o.set(i.vaultId,i)}if(o.size===0)throw new h.RegistrationLogsUnavailableError(t,`Block ${t} holds ${e.length} PegInSubmitted registration log(s) but no PegInSubmittedV2 log: either the node served a partial answer for block ${t} (retry, preferably another node) or the registry predates the depositor's commission ceiling (vault-contracts-aave-v4 #548) and the ceiling cannot be recovered on-chain`);return[...o.values()]}async getMaxAcceptableCommissionBpsBatch(t,e){if(t.length===0)return[];const o=await this.getRegistrationRecordsAtBlock(e);return t.map(n=>h.findRegistrationRecord(o,n,e).maxAcceptableCommissionBps)}async getVaultClaimableBy(t,e,o){const i=`0x${h.assertOnChainBtcPubkey(e,`getVaultClaimableBy claimer (vault=${t})`)}`,s=t.toLowerCase(),{number:c}=await this.publicClient.getBlock({blockTag:"finalized"});if(c<o)throw new Error(`Finalized block ${c} is below vault ${t}'s registration block ${o}; the registration is not finalized yet, or the node is behind it`);let u=c;for(;;){const l=M(o,u-O+1n),p=await this.publicClient.getLogs({address:this.contractAddress,event:N,args:{vaultId:s,claimerPK:i},fromBlock:l,toBlock:u,strict:!0});if(p.length>1){const d=new Set(p.map(b=>b.transactionHash));if(d.size>1)throw new Error(`Found ${p.length} VaultClaimableBy logs for vault ${t} and claimer ${i} across ${d.size} transactions in blocks ${l}..${u}; a vault is redeemed once, so the node's answer is inconsistent`)}if(p.length>=1){const d=p[0];return{blockNumber:d.blockNumber,claimerPk:h.assertOnChainBtcPubkey(d.args.claimerPK,`VaultClaimableBy.claimerPK (vault=${t})`),peginTxHash:d.args.peginTxHash,vaultCoreVersion:d.args.vaultCoreVersion,proverCircuitVersion:d.args.proverCircuitVersion,offchainParamsVersion:d.args.offchainParamsVersion,universalChallengersVersion:d.args.universalChallengersVersion,appVaultKeepersVersion:d.args.appVaultKeepersVersion}}if(l===o)throw new h.VaultClaimableByNotFoundError(t,i,o,c);u=l-1n}}}const q=0,F=255,L=12e4;function m(r,t){const e=r.startsWith("0x")?r:r.startsWith("0X")?`0x${r.slice(2)}`:`0x${r}`;if(!/^0x(?:[0-9a-fA-F]{2})+$/.test(e))throw new Error(`${t} must be non-empty, even-length hex`);return e}function E(r,t){if(!/^0x[0-9a-fA-F]{64}$/.test(r))throw new Error(`${t} must be a 32-byte hex value`)}const z="0x0000000000000000000000000000000000000000000000000000000000000000";function I(r){if(E(r,"expectedFingerprint"),r.toLowerCase()===z)throw new Error("expectedFingerprint must not be zero: the registry cannot resolve a zero fingerprint, so this submission would always revert")}function U(r){if(!Number.isInteger(r)||r<0||r>F)throw new Error(`htlcVout must be a uint8, got ${r}`)}class W{constructor(t){this.config=t}async registerPeginOnChain(t){const e={...t,popSignature:{...t.popSignature}};this.assertQuotedCommissionPresentWhenRequired(e.quotedCommissionBps),I(e.expectedFingerprint);const o=this.assertPopMatchesEthAccount(e.popSignature),n=this.normalizeBtcPubkey(e.popSignature),i=m(e.popSignature.btcPopSignature,"btcPopSignature"),s=this.normalizeRequest(e,o,n);await this.assertVaultDoesNotExist(s.vaultId,s.peginTxHash);const c=await this.readPeginFee(e.vaultProvider),u=await this.resolveMaxAcceptableCommissionBps(e.vaultProvider,e.quotedCommissionBps),l=f.encodeFunctionData({abi:a.BTCVaultRegistryABI,functionName:"submitPeginRequest",args:[o,n,i,s.unsignedPrePeginTx,s.depositorSignedPeginTx,e.vaultProvider,u,e.hashlock,e.htlcVout,s.payoutScript,e.depositorWotsPkHash,e.expectedFingerprint]});return{ethTxHash:await this.sendAndWait(l,c,!1,o),vaultId:s.vaultId,peginTxHash:s.peginTxHash}}async registerPeginBatchOnChain(t){const e={...t,popSignature:{...t.popSignature},requests:t.requests.map(g=>({...g}))};if(e.requests.length===0)throw new Error("Batch pegin requires at least one request");this.assertQuotedCommissionPresentWhenRequired(e.quotedCommissionBps),I(e.expectedFingerprint);const o=this.assertPopMatchesEthAccount(e.popSignature),n=m(e.unsignedPrePeginTx,"unsignedPrePeginTx"),i=this.normalizeBtcPubkey(e.popSignature),s=m(e.popSignature.btcPopSignature,"btcPopSignature"),c=[],u=[],l=new Set;for(const g of e.requests){const P=this.normalizeRequest({...g,unsignedPrePeginTx:e.unsignedPrePeginTx,vaultProvider:e.vaultProvider,depositorBtcPubkeyRaw:e.depositorBtcPubkeyRaw},o,i);if(l.has(P.vaultId))throw new Error(`Duplicate vault in batch: ${P.vaultId}`);l.add(P.vaultId),c.push({vaultId:P.vaultId,peginTxHash:P.peginTxHash}),u.push({depositorBtcPubKey:i,btcPopSignature:s,unsignedPrePeginTx:n,depositorSignedPeginTx:P.depositorSignedPeginTx,hashlock:g.hashlock,htlcVout:g.htlcVout,referralCode:q,depositorPayoutBtcAddress:P.payoutScript,depositorWotsPkHash:g.depositorWotsPkHash})}for(const g of c)await this.assertVaultDoesNotExist(g.vaultId,g.peginTxHash);const p=await this.readPeginFee(e.vaultProvider),d=await this.resolveMaxAcceptableCommissionBps(e.vaultProvider,e.quotedCommissionBps),b=f.encodeFunctionData({abi:a.BTCVaultRegistryABI,functionName:"submitPeginRequestBatch",args:[o,e.vaultProvider,d,e.expectedFingerprint,u]});return{ethTxHash:await this.sendAndWait(b,p*BigInt(e.requests.length),!0,o),vaults:c}}assertQuotedCommissionPresentWhenRequired(t){if(t===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(t){return this.assertEthAccount(t.depositorEthAddress)}assertEthAccount(t){const e=this.config.ethWallet.account;if(!e)throw new Error("Ethereum wallet account not found");if(!f.isAddressEqual(t,e.address))throw new Error(`Proof of possession was signed for ${t} but the Ethereum wallet is currently connected to ${e.address}. Reconnect the original account or sign a new proof of possession.`);return e.address}normalizeBtcPubkey(t){return`0x${h.assertOnChainBtcPubkey(m(t.depositorBtcPubkey,"Proof of possession BTC pubkey"),"Proof of possession BTC pubkey")}`}normalizeRequest(t,e,o){E(t.hashlock,"hashlock"),E(t.depositorWotsPkHash,"depositorWotsPkHash"),U(t.htlcVout);const n=m(t.unsignedPrePeginTx,"unsignedPrePeginTx"),i=m(t.depositorSignedPeginTx,"depositorSignedPeginTx"),s=h.calculateBtcTxHash(i);return{unsignedPrePeginTx:n,depositorSignedPeginTx:i,payoutScript:h.assertPayoutScriptMatchesPopKey(t.depositorPayoutScriptPubKey,o,t.depositorBtcPubkeyRaw),peginTxHash:s,vaultId:m(h.derivePeginVaultId(s,e),"vaultId")}}async assertVaultDoesNotExist(t,e){if((await this.config.publicClient.readContract({address:this.config.btcVaultRegistry,abi:a.BTCVaultRegistryABI,functionName:"getBtcVaultBasicInfo",args:[t]})).depositor!==f.zeroAddress)throw new Error(`Vault already exists (ID: ${t}, peginTxHash: ${e}). 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(t){try{return await this.config.publicClient.readContract({address:this.config.btcVaultRegistry,abi:a.BTCVaultRegistryABI,functionName:"getPegInFee",args:[t]})}catch(e){throw new Error("Failed to query pegin fee from the contract. Please check your network connection and contract address.",{cause:e})}}async resolveMaxAcceptableCommissionBps(t,e){let o;try{o=await new R(this.config.publicClient,this.config.btcVaultRegistry).getVaultProviderCommission(t)}catch(n){throw new Error("Failed to query vault provider commission from the contract. Please check your network connection and contract address.",{cause:n})}if(e!==void 0){if(o>e+B)throw new Error(`Vault provider commission changed since quote: quoted ${e} bps, chain currently reports ${o} bps (allowed drift ${B} bps). Please refresh and try again.`);return w(e)}return w(o)}async sendAndWait(t,e,o,n){let i=this.assertEthAccount(n),s;try{s=await this.config.publicClient.estimateGas({to:this.config.btcVaultRegistry,data:t,value:e,account:i})}catch(l){C.handleContractError(l)}i=this.assertEthAccount(n);let c;try{c=await this.config.ethWallet.sendTransaction({to:this.config.btcVaultRegistry,data:t,value:e,gas:s,account:i,chain:this.config.ethChain})}catch(l){C.handleContractError(l)}const u=await k.waitForTransactionReceiptSmartAware({publicClient:this.config.publicClient,walletAddress:n,hash:c,timeout:this.config.receiptTimeoutMs??L});return u.status==="reverted"&&C.handleContractError(new Error(`${o?"Batch transaction":"Transaction"} reverted. Hash: ${u.transactionHash}. Check a block explorer for details.`)),u.transactionHash}}exports.COMMISSION_BPS_HEADROOM=B;exports.MAX_ACCEPTABLE_COMMISSION_BPS_CAP=S;exports.ViemPeginRegistrationClient=W;exports.ViemVaultRegistryReader=R;exports.capMaxAcceptableCommissionBps=w;
|
|
2
|
+
//# sourceMappingURL=pegin-registration-client-BogzOk8B.cjs.map
|