@babylonlabs-io/ts-sdk 0.73.0 → 0.74.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/index.cjs +1 -1
- package/dist/index.js +164 -159
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.d.ts +3 -0
- package/dist/tbv/core/index.d.ts.map +1 -1
- package/dist/tbv/core/index.js +157 -152
- package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.golden.test.d.ts +62 -0
- package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.golden.test.d.ts.map +1 -0
- package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.test.d.ts +15 -0
- package/dist/tbv/core/pegin-fingerprint/__tests__/peginFingerprint.test.d.ts.map +1 -0
- package/dist/tbv/core/pegin-fingerprint/index.d.ts +14 -0
- package/dist/tbv/core/pegin-fingerprint/index.d.ts.map +1 -0
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts +141 -0
- package/dist/tbv/core/pegin-fingerprint/peginFingerprint.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +157 -152
- package/dist/toRefundInputs-BwG6T0PP.cjs +2 -0
- package/dist/toRefundInputs-BwG6T0PP.cjs.map +1 -0
- package/dist/{toRefundInputs-BkcFhvDp.js → toRefundInputs-C3oIN0aW.js} +237 -139
- package/dist/toRefundInputs-C3oIN0aW.js.map +1 -0
- package/package.json +2 -2
- package/dist/toRefundInputs-BkcFhvDp.js.map +0 -1
- package/dist/toRefundInputs-CatCKniS.cjs +0 -2
- package/dist/toRefundInputs-CatCKniS.cjs.map +0 -1
package/dist/tbv/index.js
CHANGED
|
@@ -1,270 +1,275 @@
|
|
|
1
|
-
import { P as s, h as t, i as r, j as i, f as o, b as n, a as P, c as p, k as
|
|
2
|
-
import { a as
|
|
3
|
-
import { computeMinClaimValue as _, computeMinPeginFee as g, deriveVaultId as T, expandAuthAnchor as m, expandHashlockSecret as S, expandWotsSeed as
|
|
4
|
-
import { a as
|
|
5
|
-
import { c as F, a as
|
|
1
|
+
import { P as s, h as t, i as r, j as i, f as o, b as n, a as P, c as p, k as E, d as c, e as u, g as d } from "../verifyScriptPathSchnorrSignature-Ciq_xZhw.js";
|
|
2
|
+
import { a as R } from "../vaultCoreVersion-D_fP9P3C.js";
|
|
3
|
+
import { computeMinClaimValue as _, computeMinPeginFee as g, deriveVaultId as T, expandAuthAnchor as m, expandHashlockSecret as S, expandWotsSeed as I, peginP2aAnchorOutput as C, supportedTxGraphVersions as O, validatePeginP2aAnchor as f } from "./core/wasm/index.js";
|
|
4
|
+
import { a as N, c as b, b as V, e as h, f as v } from "../verifyKeyPathSchnorrSignature-BrgUJmV0.js";
|
|
5
|
+
import { c as F, a as D, b as y, e as U, f as B, r as H } from "../noPayout-DpGRzidi.js";
|
|
6
6
|
import { b as K } from "../challengeAssert-Cp_GeRg8.js";
|
|
7
|
-
import { c as k, d 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 ta } 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
|
|
10
|
+
import { B as Ea, C as ca, H as ua, K as da, M as la, T as Ra, X as Aa } from "../validation-OSC0xTHB.js";
|
|
11
11
|
import { waitForTransactionReceiptSmartAware as ga } from "./core/utils/eth/index.js";
|
|
12
|
-
import { P as ma, b as Sa, c as
|
|
13
|
-
import { P as
|
|
14
|
-
import { MEMPOOL_API_URLS as
|
|
12
|
+
import { P as ma, b as Sa, c as Ia, d as Ca, a as Oa, e as fa } from "../PeginManager-C9RPOd0L.js";
|
|
13
|
+
import { P as Na, c as ba, f as Va, r as ha, s as va, v as Ma } from "../signPsbtsWithFallback-0VBALhjS.js";
|
|
14
|
+
import { MEMPOOL_API_URLS as Da, getAddressTxs as ya, getAddressUtxos as Ua, getMempoolApiUrl as Ba, getNetworkFees as Ha, getOutspend as La, getTipHeight as Ka, getTxHex as Xa, getTxInfo as ka, getUtxoInfo as Ga, pushTx as Wa } from "./core/clients/mempool/index.js";
|
|
15
15
|
import { O as Ya, V as ja, a as za, b as Ja, c as Za, r as qa } from "../types-CPDLZm3l.js";
|
|
16
16
|
import { a as $a } from "../onChainBtcPubkey-C-6UWpD8.js";
|
|
17
17
|
import { C as ee, M as se, V as te, c as re, e as ie, d as oe, v as ne, a as Pe, b as pe } from "../pegin-registration-client-BdRiR8br.js";
|
|
18
|
-
import { ApplicationRegistryABI as
|
|
18
|
+
import { ApplicationRegistryABI as ce, ProtocolParamsABI as ue } from "./core/contracts/index.js";
|
|
19
19
|
import { B as le } from "../BTCVaultRegistry.abi-CJwWI2EO.js";
|
|
20
|
-
import { B as
|
|
21
|
-
import { V as
|
|
22
|
-
import { B as
|
|
23
|
-
import { B as Xe, D as ke, L as
|
|
20
|
+
import { B as Ae, C as _e, e as ge, g as Te, h as me, i as Se } from "../BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js";
|
|
21
|
+
import { V as Ce, b as Oe, a as fe, d as xe, f as Ne, p as be } from "../parseFundingOutpoints-B67CoXpF.js";
|
|
22
|
+
import { B as he, a as ve, c as Me, b as Fe, d as De, g as ye, h as Ue, f as Be, s as He, e as Le } from "../psbtInputFields-B3e05Xe6.js";
|
|
23
|
+
import { B as Xe, D as ke, L as Ge, M as We, c as we, P as Ye, b as je, a as ze, S as Je, T as Ze, W as qe, f as Qe, d as $e, p as as, r as es } from "../fundPeginTransaction-B2wyjqp0.js";
|
|
24
24
|
import { U as ts, a as rs, e as is, f as os, v as ns } from "../reservation-Cj9F0rP9.js";
|
|
25
|
-
import { V as ps, a as
|
|
26
|
-
import { A as ls, D as
|
|
27
|
-
import { S as
|
|
28
|
-
import { D as
|
|
29
|
-
import { H as
|
|
30
|
-
import { C as
|
|
25
|
+
import { V as ps, a as Es, b as cs, v as us } from "../index-LgmJhdEN.js";
|
|
26
|
+
import { A as ls, D as Rs, J as As, a as _s, b as gs, d as Ts, P as ms, R as Ss, e as Is, c as Cs, V as Os, i as fs } from "../json-rpc-client-DuUARJvV.js";
|
|
27
|
+
import { S as Ns, V as bs, c as Vs, p as hs, v as vs, a as Ms } from "../primeVpAuth-DvaD45q_.js";
|
|
28
|
+
import { D as Ds, d as ys, P as Us, a as Bs, b as Hs, n as Ls, o as Ks, m as Xs, p as ks, U as Gs, V as Ws, h as ws, c as Ys, g as js, k as zs, j as Js, e as Zs, f as qs, i as Qs, r as $s, l as at, t as et } from "../toRefundInputs-C3oIN0aW.js";
|
|
29
|
+
import { H as tt, E as rt, P as it, o as ot, c as nt, d as Pt, S as pt, T as Et, U as ct, V as ut, K as dt, L as lt, M as Rt, N as At, O as _t, R as gt, a as Tt, b as mt, y as St, Q as It, I as Ct, J as Ot, g as ft, z as xt, p as Nt, i as bt, e as Vt, G as ht, F as vt, t as Mt, A as Ft, B as Dt, C as yt, D as Ut, r as Bt, s as Ht, f as Lt, h as Kt, j as Xt, v as kt, k as Gt, l as Wt, m as wt, n as Yt, q as jt, u as zt, w as Jt, x as Zt } from "../buildAndBroadcastReclaim-BXclIcu_.js";
|
|
30
|
+
import { C as Qt, P as $t, c as ar, g as er, i as sr } from "../peginState-CxDiaKuk.js";
|
|
31
31
|
export {
|
|
32
32
|
ls as AUTH_REJECTED_RPC_CODE,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
ce as ApplicationRegistryABI,
|
|
34
|
+
tt as BIP68NotMatureError,
|
|
35
|
+
Ea as BITCOIN_ADDRESS_RE,
|
|
36
36
|
le as BTCVaultRegistryABI,
|
|
37
|
-
|
|
37
|
+
Ae as BTCVaultRegistryKeyEpochsABI,
|
|
38
38
|
Xe as BTC_DUST_SAT,
|
|
39
|
-
|
|
39
|
+
he as BitcoinScriptType,
|
|
40
40
|
ee as COMMISSION_BPS_HEADROOM,
|
|
41
|
-
|
|
41
|
+
ca as COMPRESSED_PUBKEY_HEX_LEN,
|
|
42
42
|
_e as CONTRACT_ERRORS,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
rt as ClaimerPegoutStatusValue,
|
|
44
|
+
Qt as ContractStatus,
|
|
45
|
+
Ds as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
|
|
46
46
|
ke as DUST_THRESHOLD,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
Rs as DaemonStatus,
|
|
48
|
+
ys as DepositTermsRejectedError,
|
|
49
|
+
ua as HEX_RE,
|
|
50
|
+
As as JSON_RPC_ERROR_CODES,
|
|
51
51
|
_s as JsonRpcClient,
|
|
52
52
|
gs as JsonRpcError,
|
|
53
53
|
da as KNOWN_SCRIPT_PREFIXES,
|
|
54
|
-
|
|
54
|
+
Ge as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
55
55
|
se as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
|
|
56
|
-
|
|
56
|
+
We as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
57
57
|
la as MAX_REASONABLE_FEE_SATS,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
we as MAX_REASONABLE_PEGIN_VBYTES,
|
|
59
|
+
Da as MEMPOOL_API_URLS,
|
|
60
60
|
Ya as OnChainBtcVaultStatus,
|
|
61
61
|
Ye as P2TR_INPUT_SIZE,
|
|
62
62
|
je as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
63
63
|
s as PEGIN_DEPOSITOR_CLAIM_VOUT,
|
|
64
|
-
|
|
64
|
+
it as PEGIN_ETH_CONFIRMATIONS,
|
|
65
|
+
Us as PEGIN_FINGERPRINT_DOMAIN,
|
|
66
|
+
Bs as PEGIN_FINGERPRINT_DOMAIN_PREIMAGE,
|
|
65
67
|
ze as PEGIN_FIXED_OUTPUTS,
|
|
66
68
|
Ts as POST_WOTS_STATUSES,
|
|
67
69
|
ms as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
ot as ParticipantKeyDriftError,
|
|
71
|
+
Na as PayoutManager,
|
|
72
|
+
$t as PeginAction,
|
|
73
|
+
Hs as PeginFingerprintInputError,
|
|
71
74
|
ma as PeginManager,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
Ls as PeginParamsAmbiguousError,
|
|
76
|
+
Ks as PeginParamsIncompleteSpaceError,
|
|
77
|
+
Xs as PeginParamsNotFoundError,
|
|
78
|
+
nt as PeginRegistrationMissingError,
|
|
79
|
+
Pt as PeginRegistrationNotFinalError,
|
|
80
|
+
ks as PeginSizingIntegrityError,
|
|
81
|
+
ue as ProtocolParamsABI,
|
|
79
82
|
t as PsbtSubstitutionError,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
pt as RECLAIM_MAX_FEE_FRACTION_DENOMINATOR,
|
|
84
|
+
Et as RECLAIM_MAX_FEE_FRACTION_NUMERATOR,
|
|
85
|
+
ct as RECLAIM_MAX_FEE_RATE_SATS_VB,
|
|
86
|
+
ut as RECLAIM_WARN_FEE_FRACTION_NUMERATOR,
|
|
87
|
+
dt as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
|
|
88
|
+
lt as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
89
|
+
Rt as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
90
|
+
At as REFUND_VSIZE,
|
|
91
|
+
_t as ReclaimUneconomicalError,
|
|
92
|
+
gt as RegisteredVaultVersionMismatchError,
|
|
90
93
|
Ss as RpcErrorCode,
|
|
91
94
|
Je as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
Ns as ServerIdentityError,
|
|
96
|
+
Ra as TXID_RE,
|
|
94
97
|
Ze as TX_BUFFER_SIZE_OVERHEAD,
|
|
95
|
-
|
|
98
|
+
Gs as UnanchoredPrePeginError,
|
|
96
99
|
ts as UtxoNotAvailableError,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
Ce as VAULT_APP_NAME,
|
|
101
|
+
Is as VP_BATCH_MAX_SIZE,
|
|
102
|
+
Cs as VP_TERMINAL_FAILURE_STATUSES,
|
|
103
|
+
Os as VP_TRANSIENT_STATUSES,
|
|
101
104
|
ps as VaultProviderRpcClient,
|
|
102
|
-
|
|
105
|
+
Ws as VaultRootMismatchError,
|
|
103
106
|
ja as ViemOperationKeyReader,
|
|
104
107
|
te as ViemPeginRegistrationClient,
|
|
105
108
|
za as ViemProtocolParamsReader,
|
|
106
109
|
Ja as ViemUniversalChallengerReader,
|
|
107
110
|
Za as ViemVaultKeeperReader,
|
|
108
111
|
re as ViemVaultRegistryReader,
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
Es as VpResponseValidationError,
|
|
113
|
+
bs as VpTokenRegistry,
|
|
111
114
|
qe as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
Aa as X_ONLY_PUBKEY_HEX_LEN,
|
|
116
|
+
Tt as activateVault,
|
|
117
|
+
mt as activateVaultAndRedeem,
|
|
118
|
+
ve as applyChangeOutputPolicy,
|
|
119
|
+
N as assertKeyPathSchnorrSignature,
|
|
117
120
|
$a as assertOnChainBtcPubkey,
|
|
118
121
|
r as assertPsbtUnsignedTxMatches,
|
|
119
|
-
|
|
122
|
+
b as assertReturnedKeyPathSignatures,
|
|
120
123
|
i as assertScriptPathSchnorrSignature,
|
|
121
124
|
rs as assertUtxosAvailable,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
R as assertValidVaultCoreVersion,
|
|
126
|
+
St as assertVaultProviderHintAccepted,
|
|
127
|
+
cs as batchPollByProvider,
|
|
128
|
+
It as buildAndBroadcastReclaim,
|
|
129
|
+
Ct as buildAndBroadcastRefund,
|
|
127
130
|
K as buildChallengeAssertPsbt,
|
|
128
131
|
Sa as buildDepositTerms,
|
|
129
|
-
|
|
132
|
+
Oe as buildFundingOutpointsCommitment,
|
|
130
133
|
F as buildNoPayoutPsbt,
|
|
131
134
|
o as buildPayoutPsbt,
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
V as buildPeginInputPsbt,
|
|
136
|
+
ws as buildPeginParamsCandidates,
|
|
134
137
|
n as buildPeginTxFromFundedPrePegin,
|
|
135
138
|
P as buildPrePeginPsbt,
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
D as buildReclaimPsbt,
|
|
140
|
+
y as buildRefundPsbt,
|
|
138
141
|
fe as buildVaultContext,
|
|
139
142
|
na as calculateBtcTxHash,
|
|
140
|
-
|
|
143
|
+
ar as canPerformAction,
|
|
141
144
|
k as canonicalizeBtcPubkey,
|
|
142
145
|
ie as capMaxAcceptableCommissionBps,
|
|
143
146
|
ia as combineAbortSignals,
|
|
144
147
|
Me as computeChangeOutputFeeSats,
|
|
145
|
-
|
|
148
|
+
ba as computeHashlock,
|
|
146
149
|
Fe as computeMaxDeposit,
|
|
147
150
|
_ as computeMinClaimValue,
|
|
148
151
|
g as computeMinPeginFee,
|
|
149
152
|
p as computeNumLocalChallengers,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
De as computePeginBaseFeeSats,
|
|
154
|
+
Ys as computePeginFingerprint,
|
|
155
|
+
Ia as computeWotsBlockPublicKeysHash,
|
|
156
|
+
Vs as createAuthenticatedVpClient,
|
|
157
|
+
E as createPayoutScript,
|
|
154
158
|
Pa as createTaprootScriptPathSignOptions,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
G as deriveBip86ScriptPubKeyHex,
|
|
160
|
+
c as deriveDepositorClaimDescriptor,
|
|
161
|
+
u as deriveDepositorClaimScriptPubKey,
|
|
162
|
+
js as deriveHashlocksFromPrePegin,
|
|
163
|
+
W as deriveNativeSegwitAddress,
|
|
160
164
|
oe as derivePeginVaultId,
|
|
161
|
-
|
|
165
|
+
w as deriveTaprootAddress,
|
|
162
166
|
T as deriveVaultId,
|
|
163
167
|
xe as deriveVaultRoot,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
Ca as deriveWotsBlocksFromSeed,
|
|
169
|
+
zs as describePeginParamsCandidate,
|
|
170
|
+
Js as describeUnresolvedVersion,
|
|
171
|
+
Zs as encodePeginFingerprintPreimage,
|
|
167
172
|
Y as ensureHexPrefix,
|
|
168
|
-
|
|
173
|
+
Oa as ensurePrePeginTermsApproval,
|
|
169
174
|
U as estimateReclaimFeeSats,
|
|
170
|
-
|
|
175
|
+
Ot as estimateRefundFeeSats,
|
|
171
176
|
fa as estimateSubmitPeginRequestBatchGas,
|
|
172
177
|
m as expandAuthAnchor,
|
|
173
178
|
S as expandHashlockSecret,
|
|
174
|
-
|
|
179
|
+
I as expandWotsSeed,
|
|
175
180
|
ge as extractErrorData,
|
|
176
181
|
is as extractInputsFromTransaction,
|
|
177
182
|
d as extractPayoutSignature,
|
|
178
|
-
|
|
179
|
-
|
|
183
|
+
h as extractPeginInputSignature,
|
|
184
|
+
v as finalizePeginInputPsbt,
|
|
180
185
|
B as finalizeScriptPathWithSignatures,
|
|
181
186
|
os as findOverlappingPendingVaults,
|
|
182
187
|
j as formatSatoshisToBtc,
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
Va as forwardDepositApproval,
|
|
189
|
+
Ne as forwardDeriveContextHash,
|
|
185
190
|
Qe as fundPeginTransaction,
|
|
186
|
-
|
|
191
|
+
ya as getAddressTxs,
|
|
187
192
|
Ua as getAddressUtxos,
|
|
188
193
|
Te as getContractErrorMessage,
|
|
189
|
-
|
|
194
|
+
ye as getDustThreshold,
|
|
190
195
|
Ba as getMempoolApiUrl,
|
|
191
196
|
z as getNetwork,
|
|
192
197
|
Ha as getNetworkFees,
|
|
193
198
|
La as getOutspend,
|
|
194
|
-
|
|
199
|
+
er as getPeginProtocolState,
|
|
195
200
|
Ue as getPsbtInputFields,
|
|
196
201
|
Be as getScriptType,
|
|
197
202
|
J as getSortedXOnlyPubkeys,
|
|
198
203
|
Ka as getTipHeight,
|
|
199
204
|
Xa as getTxHex,
|
|
200
205
|
ka as getTxInfo,
|
|
201
|
-
|
|
206
|
+
Ga as getUtxoInfo,
|
|
202
207
|
me as handleContractError,
|
|
203
208
|
Z as hexToUint8Array,
|
|
204
|
-
|
|
209
|
+
sr as isActivationDeadlinePassedOnChain,
|
|
205
210
|
q as isAddressFromPublicKey,
|
|
206
211
|
fs as isAuthRejectedError,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
212
|
+
ft as isDepositAmountValid,
|
|
213
|
+
qs as isDepositTermsRejectedError,
|
|
214
|
+
xt as isHintAccepted,
|
|
210
215
|
Se as isKnownContractError,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
216
|
+
Nt as isParticipantKeyDriftError,
|
|
217
|
+
bt as isPeginRegistrationMissingError,
|
|
218
|
+
Vt as isPeginRegistrationNotFinalError,
|
|
219
|
+
ht as isPegoutTerminalStatus,
|
|
220
|
+
vt as isRecognizedPegoutStatus,
|
|
221
|
+
Mt as isRegisteredVaultVersionMismatchError,
|
|
217
222
|
Q as isValidHex,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
223
|
+
Qs as isWotsMismatchError,
|
|
224
|
+
Ft as matchKeyHint,
|
|
225
|
+
Dt as matchKeySetHint,
|
|
226
|
+
be as parseFundingOutpointsFromTx,
|
|
222
227
|
$e as parseUnfundedWasmTransaction,
|
|
223
228
|
as as peginOutputCount,
|
|
224
|
-
|
|
225
|
-
|
|
229
|
+
C as peginP2aAnchorOutput,
|
|
230
|
+
hs as primeVpTokenRegistry,
|
|
226
231
|
$ as processPublicKeyToXOnly,
|
|
227
|
-
|
|
232
|
+
Wa as pushTx,
|
|
228
233
|
es as rateBasedTxBufferFee,
|
|
229
|
-
|
|
234
|
+
$s as rebuildDepositTermsCore,
|
|
230
235
|
H as reclaimVsize,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
236
|
+
at as reconstructPeginParams,
|
|
237
|
+
ha as requireChangeAddress,
|
|
238
|
+
yt as resolveCurrentParticipantKeys,
|
|
239
|
+
Ut as resolveParticipantKeysAtEpochs,
|
|
235
240
|
qa as resolveProtocolAddresses,
|
|
236
|
-
|
|
241
|
+
Bt as runDepositorPresignFlow,
|
|
237
242
|
He as selectUtxosForPegin,
|
|
238
243
|
Le as shouldAddChangeOutput,
|
|
239
|
-
|
|
244
|
+
Ht as signDepositorGraph,
|
|
240
245
|
aa as stripHexPrefix,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
Lt as submitWotsPublicKey,
|
|
247
|
+
O as supportedTxGraphVersions,
|
|
248
|
+
va as supportsDepositApproval,
|
|
249
|
+
et as toRefundInputs,
|
|
245
250
|
ea as toXOnly,
|
|
246
251
|
sa as uint8ArrayToHex,
|
|
247
|
-
|
|
248
|
-
|
|
252
|
+
Kt as validateDepositAmount,
|
|
253
|
+
Xt as validateMultiVaultDepositInputs,
|
|
249
254
|
ne as validateOffchainParams,
|
|
250
|
-
|
|
255
|
+
kt as validateOnChainParticipantKeys,
|
|
251
256
|
Pe as validatePegInConfiguration,
|
|
252
257
|
f as validatePeginP2aAnchor,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
258
|
+
Gt as validateProviderSelection,
|
|
259
|
+
Wt as validateRemainingCapacity,
|
|
260
|
+
us as validateRequestDepositorClaimerArtifactsResponse,
|
|
256
261
|
Ma as validateSecretAgainstHashlock,
|
|
257
262
|
pe as validateTBVProtocolParams,
|
|
258
263
|
ns as validateUtxosAvailable,
|
|
259
|
-
|
|
260
|
-
|
|
264
|
+
wt as validateVaultAmounts,
|
|
265
|
+
Yt as validateVaultProviderPubkey,
|
|
261
266
|
ta as validateWalletPubkey,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
267
|
+
jt as verifyRegisteredParticipantKeys,
|
|
268
|
+
zt as verifyRegisteredVaultVersions,
|
|
269
|
+
vs as verifyServerIdentity,
|
|
265
270
|
Ms as vpTokenRegistry,
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
Jt as waitForPeginRegistrationDepth,
|
|
272
|
+
Zt as waitForPeginStatus,
|
|
268
273
|
ga as waitForTransactionReceiptSmartAware
|
|
269
274
|
};
|
|
270
275
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var he=Object.defineProperty;var de=(e,r,t)=>r in e?he(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var U=(e,r,t)=>de(e,typeof r!="symbol"?r+"":r,t);const x=require("viem"),pe=require("./sha2-DI0-0SHr.cjs"),H=require("./signPsbtsWithFallback-DMSpIQWH.cjs"),Q=require("./PeginManager-E-UHA1un.cjs"),m=require("./bitcoin-D-O2GjbC.cjs"),v=require("./tbv/core/wasm/index.cjs"),q=require("./parseFundingOutpoints-B4iQeX6q.cjs"),J=require("bitcoinjs-lib"),S=require("./verifyScriptPathSchnorrSignature-BfNUSgA7.cjs"),G=require("./fundPeginTransaction-BLD8FRL9.cjs"),Y=require("./signing-BJ3X66b-.cjs"),K="DepositTermsRejectedError";class Z extends Error{constructor(t,n="device-envelope"){super(t);U(this,"reason");this.name=K,this.reason=n}}function me(e){if(e instanceof Z)return!0;if(typeof e!="object"||e===null)return!1;const r=e;return r.name===K&&r.reason==="device-envelope"}async function ee(e){const r=e.siblings.length;if(r===0)throw new Error("rebuildDepositTermsCore: at least one sibling is required");for(const[o,E]of e.siblings.entries())if(E.amount<=0n)throw new Error(`rebuildDepositTermsCore: sibling[${o}] has non-positive on-chain pegin amount ${E.amount}; the chain-read vault record is invalid. Resume refused.`);if(e.prepeginMaxFee<=0n)throw new Error(`rebuildDepositTermsCore: prepeginMaxFee must be > 0, got ${e.prepeginMaxFee}`);const t=m.stripHexPrefix(e.prepeginTxid).toLowerCase(),n=m.stripHexPrefix(Y.calculateBtcTxHash(e.fundedPrePeginTxHex)).toLowerCase();if(n!==t)throw new Error(`Funded Pre-PegIn tx hashes to ${n}, expected ${t} (on-chain prepeginTxid). Resume refused.`);const h=H.findAuthAnchorOpReturn(m.stripHexPrefix(e.fundedPrePeginTxHex));if(h===void 0)throw new Error("Funded Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN commitment — it either predates auth anchoring or is malformed. The intent resume path requires the anchor to prove sibling completeness. Resume refused.");if(h.vout!==r)throw new Error(`Auth-anchor OP_RETURN at vout ${h.vout} does not match the discovered sibling count ${r}; the discovered sibling set does not cover this transaction's HTLC outputs (a lagging index can cause this — retry later). Resume refused.`);const c=e.vaultKeeperBtcPubkeys.length,u=e.universalChallengerBtcPubkeys.length,l=await v.computeMinClaimValue(e.vaultCoreVersion,c,u,e.councilQuorum,e.councilSize,e.protocolFeeRate),a=await v.computeMinPeginFee(e.vaultCoreVersion,c,u,e.minPeginFeeRate),d=await v.peginP2aAnchorOutput(e.vaultCoreVersion),s=(d==null?void 0:d.value)??0n;if(l<=0n)throw new Error(`WASM returned non-positive depositorClaimValue ${l}; expected > 0. Resume refused.`);if(a<=0n)throw new Error(`WASM returned non-positive peginMaxFee ${a}; expected > 0. Resume refused.`);if(s<0n)throw new Error(`WASM returned negative P2A anchor value ${s}. Resume refused.`);const i=a+s,b=e.minPeginFeeRate*G.MAX_REASONABLE_PEGIN_VBYTES;if(i<=0n||i>b)throw new Error(`WASM implied PegIn reserve ${i} sat is outside (0, ${b}] (minPeginFeeRate=${e.minPeginFeeRate} × ${G.MAX_REASONABLE_PEGIN_VBYTES} vbytes). Resume refused.`);const w=e.siblings.map(o=>o.amount+l+a+s),C=await Promise.all(e.siblings.map(async o=>(await v.getPrePeginHtlcConnectorInfo({txGraphVersion:e.vaultCoreVersion,depositorPubkey:e.depositorBtcPubkey,vaultProviderPubkey:e.vaultProviderBtcPubkey,vaultKeeperPubkeys:[...e.vaultKeeperBtcPubkeys],universalChallengerPubkeys:[...e.universalChallengerBtcPubkeys],hashlock:m.stripHexPrefix(o.hashlock),timelockRefund:e.timelockRefund,network:e.network})).scriptPubKey)),R=J.Transaction.fromHex(m.stripHexPrefix(e.fundedPrePeginTxHex)).outs.map(o=>({value:o.value,script:o.script}));return S.assertEncodedHtlcOutputsMatch(R,w,C),Q.buildDepositTerms({vaultCoreVersion:e.vaultCoreVersion,protocolFeeRate:e.protocolFeeRate,timelockPegin:e.timelockPegin,timelockAssert:e.timelockAssert,timelockRefund:e.timelockRefund,prepeginTxid:e.prepeginTxid,prepeginMaxFee:e.prepeginMaxFee,vaultProviderBtcPubkey:e.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:e.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:e.universalChallengerBtcPubkeys,maxAcceptableCommissionBps:e.maxAcceptableCommissionBps,peginAmounts:e.siblings.map(o=>o.amount),depositorClaimValue:l,peginMaxFee:a})}function ge(e){const r=(e instanceof Error?e.message:typeof e=="string"?e:"").toLowerCase();return r.includes("wots")&&r.includes("hash")&&r.includes("does not match")}const re="TBV.PeginFingerprint.v1",te=x.keccak256(x.toHex(re)),L=65535,j=2n**64n-1n,Pe=2n**256n-1n,fe=/^0x[0-9a-fA-F]{64}$/,W=1;class f extends Error{constructor(r){super(r),this.name="PeginFingerprintInputError"}}function N(e,r,t,n){if(typeof r!="bigint")throw new f(`${e} must be a bigint (Solidity ${n}), got ${typeof r}`);if(r<0n||r>t)throw new f(`${e} must fit Solidity ${n} (0..${t}), got ${r}`)}function I(e,r){if(!Number.isInteger(r)||r<0||r>L)throw new f(`${e} must be an integer fitting Solidity uint16 (0..${L}), got ${r}`)}function ve(e,r){if(!fe.test(r))throw new f(`${e} must be 32 bytes as 0x-prefixed hex (66 characters), got "${r}"`);return r.toLowerCase()}function be(e){if(!x.isAddress(e,{strict:!1}))throw new f(`registryAddress must be a 20-byte 0x-prefixed address, got "${e}"`);const r=e.toLowerCase();if(r===x.zeroAddress)throw new f("registryAddress must not be the zero address; a zero here means the registry address was never resolved");return r}const Ee=[{name:"domain",type:"bytes32"},{name:"chainId",type:"uint256"},{name:"registry",type:"address"},{name:"vaultProviderBtcKey",type:"bytes32"},{name:"appKeeperKeyEpoch",type:"uint64"},{name:"ucKeyEpoch",type:"uint64"},{name:"appVaultKeepersVersion",type:"uint16"},{name:"universalChallengersVersion",type:"uint16"},{name:"offchainParamsVersion",type:"uint16"},{name:"vaultCoreVersion",type:"uint16"}];function ne(e){if(N("chainId",e.chainId,Pe,"uint256"),e.chainId===0n)throw new f("chainId must not be 0; a zero here means the chain id was never resolved");const r=be(e.registryAddress),t=ve("vaultProviderBtcKey",e.vaultProviderBtcKey);if(N("appKeeperKeyEpoch",e.appKeeperKeyEpoch,j,"uint64"),N("ucKeyEpoch",e.ucKeyEpoch,j,"uint64"),I("appVaultKeepersVersion",e.appVaultKeepersVersion),I("universalChallengersVersion",e.universalChallengersVersion),I("offchainParamsVersion",e.offchainParamsVersion),I("vaultCoreVersion",e.vaultCoreVersion),e.vaultCoreVersion<W)throw new f(`vaultCoreVersion must be at least ${W}; ${e.vaultCoreVersion} means the version was never resolved`);return x.encodeAbiParameters(Ee,[te,e.chainId,r,t,e.appKeeperKeyEpoch,e.ucKeyEpoch,e.appVaultKeepersVersion,e.universalChallengersVersion,e.offchainParamsVersion,e.vaultCoreVersion])}function ye(e){return x.keccak256(ne(e))}class oe extends Error{constructor(r,t){super(`Re-derived vault root does not match this Pre-PegIn: derived auth-anchor hash ${r}, transaction commits to ${t}. Connect the same wallet, on the same account and the same network, that created the deposit.`),this.derivedAuthAnchorHash=r,this.onChainAuthAnchorHash=t,this.name="VaultRootMismatchError"}}class B extends Error{constructor(r){super(r),this.name="UnanchoredPrePeginError"}}class se extends Error{constructor(r,t,n=[]){super(`No candidate parameter set reproduces this Pre-PegIn's HTLC outputs (${r} candidate(s) tried). `+(n.length>0?`${n.length} version(s) could not be resolved and may hold the answer: ${n.join(" | ")}. `:"")+`Sample rejections: ${t.join(" | ")}`),this.candidatesTried=r,this.sampleRejections=t,this.unresolvedLabels=n,this.name="PeginParamsNotFoundError"}}class ie extends Error{constructor(r){super(`${r.length} candidate parameter sets reproduce this Pre-PegIn's HTLC outputs, so the vault's stamped versions cannot be determined: ${r.join(" | ")}. Reconstruction refused.`),this.survivorLabels=r,this.name="PeginParamsAmbiguousError"}}class ae extends Error{constructor(r,t){super(`A candidate matched this Pre-PegIn (${r}), but ${t.length} version(s) could not be resolved, so the search space did not provably contain the true parameters: ${t.join(" | ")}. A version sharing the matched timelockRefund and participants is indistinguishable from the true one, so the match cannot be trusted. Reconstruction refused.`),this.matchedLabel=r,this.unresolvedLabels=t,this.name="PeginParamsIncompleteSpaceError"}}class A extends Error{constructor(r){super(`${r}. Reconstruction refused.`),this.name="PeginSizingIntegrityError"}}async function we(e){const{wallet:r,depositorBtcPubkey:t,fundedPrePeginTxHex:n}=e,h=m.stripHexPrefix(n),c=H.findAuthAnchorOpReturn(h);if(c===void 0)throw new B("Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN, so the number of HTLC outputs it funds cannot be determined. Legacy pre-anchor deposits are not recoverable by this path.");const u=c.vout;if(u===0)throw new B("Pre-PegIn's auth-anchor OP_RETURN is at vout 0, implying zero HTLC outputs; there is nothing to recover.");const l=q.parseFundingOutpointsFromTx(h),a=await q.deriveVaultRoot(r,{depositorBtcPubkey:m.hexToUint8Array(m.processPublicKeyToXOnly(t)),fundingOutpoints:l});try{const s=await v.expandAuthAnchor(a);let i;try{i=m.uint8ArrayToHex(pe.sha256(s))}finally{s.fill(0)}if(i!==c.hash)throw new oe(i,c.hash)}catch(s){throw a.fill(0),s}const{hashlocks:d}=await Q.expandPerVaultSecrets(a,u);return{vaultCount:u,hashlocks:d,authAnchorHash:c.hash}}function Re(e){const{vaultCoreVersion:r,offchainParams:t,participantKeySets:n}=e;if(!Number.isInteger(r)||r<1)throw new Error(`buildPeginParamsCandidates: vaultCoreVersion must be a positive integer, got ${r}`);if(t.length===0)throw new Error("buildPeginParamsCandidates: at least one offchain-params version is required");if(n.length===0)throw new Error("buildPeginParamsCandidates: at least one participant key set is required");const h=[];for(const c of t)for(const u of n)h.push({vaultCoreVersion:r,offchainParams:c,participants:u});return h}function ce(e){return`${e.axis} v${e.version} (${e.reason})`}function F(e){const{participants:r}=e;return`core=${e.vaultCoreVersion} offchain=${e.offchainParams.version} keepers=${r.appVaultKeepersVersion} challengers=${r.universalChallengersVersion} vp=${r.vaultProvider}`}const X=5;function xe(e,r){return JSON.stringify({terms:e,peginAmounts:r},(t,n)=>typeof n=="bigint"?`${n}`:n)}function Ce(e){const{offchainParams:r,participants:t}=e;return[e.vaultCoreVersion,t.vaultKeeperBtcPubkeys.length,t.universalChallengerBtcPubkeys.length,r.councilQuorum,r.councilSize,r.protocolFeeRate,r.minPeginFeeRate].join("|")}async function ke(e){const{offchainParams:r,participants:t}=e,n=t.vaultKeeperBtcPubkeys.length,h=t.universalChallengerBtcPubkeys.length,[c,u,l]=await Promise.all([v.computeMinClaimValue(e.vaultCoreVersion,n,h,r.councilQuorum,r.councilSize,r.protocolFeeRate),v.computeMinPeginFee(e.vaultCoreVersion,n,h,r.minPeginFeeRate),v.peginP2aAnchorOutput(e.vaultCoreVersion)]),a=(l==null?void 0:l.value)??0n;if(c<=0n)throw new A(`WASM returned non-positive depositorClaimValue ${c} for graph version ${e.vaultCoreVersion}`);if(u<=0n)throw new A(`WASM returned non-positive peginMaxFee ${u} for graph version ${e.vaultCoreVersion}`);if(a<0n)throw new A(`WASM returned negative P2A anchor value ${a} for graph version ${e.vaultCoreVersion}`);return{depositorClaimValue:c,peginMaxFee:u,p2aAnchorValue:a}}async function Ve(e){const{hashlocks:r,fundedPrePeginTxHex:t,depositorBtcPubkey:n,prepeginMaxFee:h,maxAcceptableCommissionBps:c,network:u,candidates:l,unresolvedVersions:a}=e;if(r.length===0)throw new Error("reconstructPeginParams: at least one hashlock is required");if(l.length===0)throw new Error("reconstructPeginParams: candidate space is empty");const d=m.processPublicKeyToXOnly(n),s=m.stripHexPrefix(t),i=H.findAuthAnchorOpReturn(s);if(i===void 0)throw new B("Pre-PegIn carries no single, unambiguous auth-anchor OP_RETURN; the sibling set cannot be proven complete. Reconstruction refused.");if(i.vout!==r.length)throw new Error(`reconstructPeginParams: ${r.length} hashlock(s) supplied but the auth-anchor OP_RETURN sits at vout ${i.vout}, so the transaction funds ${i.vout} HTLC output(s). Reconstruction refused.`);const b=J.Transaction.fromHex(s).outs,w=r.map((p,g)=>BigInt(b[g].value)),C=m.stripHexPrefix(Y.calculateBtcTxHash(s)).toLowerCase(),R=new Map,o=[],E=[],M=[];let O=0;for(const p of l)try{const g=Ce(p);let P=R.get(g);P===void 0&&(P=await ke(p),R.set(g,P));const k=P.depositorClaimValue+P.peginMaxFee+P.p2aAnchorValue,V=w.map(T=>T-k),$=V.findIndex(T=>T<=0n);if($!==-1)throw new S.HtlcOutputMismatchError(`HTLC output[${$}] value ${w[$]} is not above this candidate's reserve ${k}, so it implies a non-positive pegin amount ${V[$]}.`);const{offchainParams:y,participants:_}=p,D=await ee({vaultCoreVersion:p.vaultCoreVersion,siblings:r.map((T,le)=>({hashlock:T,amount:V[le]})),fundedPrePeginTxHex:s,depositorBtcPubkey:d,vaultProviderBtcPubkey:_.vaultProviderBtcPubkey,vaultKeeperBtcPubkeys:_.vaultKeeperBtcPubkeys,universalChallengerBtcPubkeys:_.universalChallengerBtcPubkeys,protocolFeeRate:y.protocolFeeRate,minPeginFeeRate:y.minPeginFeeRate,councilQuorum:y.councilQuorum,councilSize:y.councilSize,timelockPegin:y.timelockPegin,timelockAssert:y.timelockAssert,timelockRefund:y.timelockRefund,prepeginTxid:C,prepeginMaxFee:h,maxAcceptableCommissionBps:c,network:u});o.push({candidate:p,terms:D,peginAmounts:V,fingerprint:xe(D,V)})}catch(g){if(g instanceof A)throw g;const P=F(p),k=g instanceof Error?g.message:String(g);g instanceof S.HtlcOutputMismatchError?E.length<X&&E.push(`[${P}] ${k}`):(O++,M.length<X&&M.push(`${P} (${k})`))}const ue=a.length+O,z=[...a.map(ce),...M];if(o.length===0)throw new se(l.length,E,z);if(new Set(o.map(p=>p.fingerprint)).size>1)throw new ie(o.map(p=>F(p.candidate)));if(ue>0)throw new ae(F(o[0].candidate),z);return{candidate:o[0].candidate,terms:o[0].terms,peginAmounts:o[0].peginAmounts,authAnchorHash:i.hash,candidatesTried:l.length,matchedCandidates:o.map(p=>p.candidate)}}function Te(e,r){const{htlcVout:t,depositorBtcPubkey:n,applicationEntryPoint:h,fundedPrePeginTxHex:c,hashlocks:u,network:l}=r,{candidate:a,peginAmounts:d}=e,{offchainParams:s,participants:i}=a;if(u.length!==d.length)throw new Error(`toRefundInputs: ${u.length} hashlock(s) but ${d.length} reconstructed amount(s); the reconstruction and the hashlock vector describe different transactions.`);if(!Number.isInteger(t)||t<0||t>=d.length)throw new Error(`toRefundInputs: htlcVout ${t} is outside the reconstructed batch of ${d.length} vault(s).`);const b=d.map((R,o)=>({hashlock:m.ensureHexPrefix(u[o]),amount:R,htlcVout:o})),w={vaultCoreVersion:a.vaultCoreVersion,hashlock:b[t].hashlock,htlcVout:t,offchainParamsVersion:s.version,appVaultKeepersVersion:i.appVaultKeepersVersion,universalChallengersVersion:i.universalChallengersVersion,vaultProvider:i.vaultProvider,applicationEntryPoint:h,amount:d[t],unsignedPrePeginTxHex:c,depositorBtcPubkey:n,batch:b},C={vaultProviderPubkey:i.vaultProviderBtcPubkey,vaultKeeperPubkeys:i.vaultKeeperBtcPubkeys,universalChallengerPubkeys:i.universalChallengerBtcPubkeys,timelockRefund:s.timelockRefund,feeRate:s.protocolFeeRate,minPeginFeeRate:s.minPeginFeeRate,numLocalChallengers:i.vaultKeeperBtcPubkeys.length,councilQuorum:s.councilQuorum,councilSize:s.councilSize,network:l};return{vault:w,context:C}}exports.DEPOSIT_TERMS_REJECTED_ERROR_NAME=K;exports.DepositTermsRejectedError=Z;exports.PEGIN_FINGERPRINT_DOMAIN=te;exports.PEGIN_FINGERPRINT_DOMAIN_PREIMAGE=re;exports.PeginFingerprintInputError=f;exports.PeginParamsAmbiguousError=ie;exports.PeginParamsIncompleteSpaceError=ae;exports.PeginParamsNotFoundError=se;exports.PeginSizingIntegrityError=A;exports.UnanchoredPrePeginError=B;exports.VaultRootMismatchError=oe;exports.buildPeginParamsCandidates=Re;exports.computePeginFingerprint=ye;exports.deriveHashlocksFromPrePegin=we;exports.describePeginParamsCandidate=F;exports.describeUnresolvedVersion=ce;exports.encodePeginFingerprintPreimage=ne;exports.isDepositTermsRejectedError=me;exports.isWotsMismatchError=ge;exports.rebuildDepositTermsCore=ee;exports.reconstructPeginParams=Ve;exports.toRefundInputs=Te;
|
|
2
|
+
//# sourceMappingURL=toRefundInputs-BwG6T0PP.cjs.map
|