@babylonlabs-io/ts-sdk 0.67.0 → 0.68.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/PeginManager--2R3T2S8.js +1458 -0
- package/dist/PeginManager--2R3T2S8.js.map +1 -0
- package/dist/PeginManager-CKWq8ouZ.cjs +2 -0
- package/dist/PeginManager-CKWq8ouZ.cjs.map +1 -0
- package/dist/{batchPoll-cIxrSLLJ.js → batchPoll-Cjj1du0i.js} +372 -421
- package/dist/batchPoll-Cjj1du0i.js.map +1 -0
- package/dist/batchPoll-REVZiE-M.cjs +2 -0
- package/dist/batchPoll-REVZiE-M.cjs.map +1 -0
- package/dist/{bitcoin-d9eaaZB_.js → bitcoin-Ch_jxnDa.js} +3 -3
- package/dist/{bitcoin-d9eaaZB_.js.map → bitcoin-Ch_jxnDa.js.map} +1 -1
- package/dist/{buildAndBroadcastRefund-C4LiPATK.js → buildAndBroadcastRefund-CpMDJ8up.js} +142 -150
- package/dist/buildAndBroadcastRefund-CpMDJ8up.js.map +1 -0
- package/dist/buildAndBroadcastRefund-DrXwxrW1.cjs +2 -0
- package/dist/buildAndBroadcastRefund-DrXwxrW1.cjs.map +1 -0
- package/dist/challengeAssert-BNQ8sToz.js +64 -0
- package/dist/challengeAssert-BNQ8sToz.js.map +1 -0
- package/dist/challengeAssert-BrpC3-cQ.cjs +2 -0
- package/dist/challengeAssert-BrpC3-cQ.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +246 -243
- package/dist/mempoolApi-EU1La9wk.cjs +2 -0
- package/dist/{mempoolApi-CXfr-L6x.cjs.map → mempoolApi-EU1La9wk.cjs.map} +1 -1
- package/dist/{mempoolApi-BxSINXIB.js → mempoolApi-_D-jvtj_.js} +191 -117
- package/dist/{mempoolApi-BxSINXIB.js.map → mempoolApi-_D-jvtj_.js.map} +1 -1
- package/dist/{noPayout-BaZGRLD2.js → noPayout-CXn-geIS.js} +3 -3
- package/dist/{noPayout-BaZGRLD2.js.map → noPayout-CXn-geIS.js.map} +1 -1
- package/dist/{noPayout-CnQ1WLtr.cjs → noPayout-Ox27Td9x.cjs} +2 -2
- package/dist/{noPayout-CnQ1WLtr.cjs.map → noPayout-Ox27Td9x.cjs.map} +1 -1
- package/dist/{onChainBtcPubkey-DeF4cKoO.js → onChainBtcPubkey-BAHZyKQL.js} +2 -2
- package/dist/{onChainBtcPubkey-DeF4cKoO.js.map → onChainBtcPubkey-BAHZyKQL.js.map} +1 -1
- package/dist/{parseFundingOutpoints-pBRE11Hr.js → parseFundingOutpoints-CO-f6IHK.js} +2 -2
- package/dist/{parseFundingOutpoints-pBRE11Hr.js.map → parseFundingOutpoints-CO-f6IHK.js.map} +1 -1
- package/dist/{reservation-B4i_PQhY.js → reservation-CBAvoF3U.js} +2 -2
- package/dist/{reservation-B4i_PQhY.js.map → reservation-CBAvoF3U.js.map} +1 -1
- package/dist/{signPsbtsWithFallback-Bb66DfY5.js → signPsbtsWithFallback-Bv79gLFe.js} +122 -100
- package/dist/signPsbtsWithFallback-Bv79gLFe.js.map +1 -0
- package/dist/signPsbtsWithFallback-DJ4kE9UI.cjs +2 -0
- package/dist/signPsbtsWithFallback-DJ4kE9UI.cjs.map +1 -0
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +3 -3
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322P2wpkhVectors.d.ts +32 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322P2wpkhVectors.d.ts.map +1 -0
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts +9 -6
- package/dist/tbv/core/clients/vault-provider/auth/__tests__/bip322Verify.test.d.ts.map +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts +45 -20
- package/dist/tbv/core/clients/vault-provider/auth/bip322Verify.d.ts.map +1 -1
- package/dist/tbv/core/deposit-terms/__tests__/depositTerms.test.d.ts +2 -0
- package/dist/tbv/core/deposit-terms/__tests__/depositTerms.test.d.ts.map +1 -0
- package/dist/tbv/core/deposit-terms/depositTerms.d.ts +41 -4
- package/dist/tbv/core/deposit-terms/depositTerms.d.ts.map +1 -1
- package/dist/tbv/core/deposit-terms/prePeginApproval.d.ts +10 -5
- package/dist/tbv/core/deposit-terms/prePeginApproval.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +244 -241
- package/dist/tbv/core/managers/PayoutManager.d.ts +8 -2
- package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/PeginManager.d.ts +7 -0
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/managers/pegin/__tests__/verifyPopWitness.test.d.ts +11 -0
- package/dist/tbv/core/managers/pegin/__tests__/verifyPopWitness.test.d.ts.map +1 -0
- package/dist/tbv/core/managers/pegin/expandPerVaultSecrets.d.ts.map +1 -1
- package/dist/tbv/core/managers/pegin/index.d.ts +1 -0
- package/dist/tbv/core/managers/pegin/index.d.ts.map +1 -1
- package/dist/tbv/core/managers/pegin/verifyPopWitness.d.ts +21 -0
- package/dist/tbv/core/managers/pegin/verifyPopWitness.d.ts.map +1 -0
- package/dist/tbv/core/primitives/challengers.d.ts +31 -5
- package/dist/tbv/core/primitives/challengers.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.d.ts +2 -0
- package/dist/tbv/core/primitives/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.js +43 -41
- package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts +5 -0
- package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/__tests__/verifyKeyPathSchnorrSignature.test.d.ts +12 -0
- package/dist/tbv/core/primitives/psbt/__tests__/verifyKeyPathSchnorrSignature.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/payout.d.ts +19 -7
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/verifyKeyPathSchnorrSignature.d.ts +64 -0
- package/dist/tbv/core/primitives/psbt/verifyKeyPathSchnorrSignature.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/verifyP2wpkhEcdsaSignature.d.ts +40 -0
- package/dist/tbv/core/primitives/psbt/verifyP2wpkhEcdsaSignature.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.d.ts +2 -1
- package/dist/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.d.ts.map +1 -1
- package/dist/tbv/core/primitives/utils/__tests__/taproot.test.d.ts +13 -0
- package/dist/tbv/core/primitives/utils/__tests__/taproot.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/utils/taproot.d.ts +29 -0
- package/dist/tbv/core/primitives/utils/taproot.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +2 -2
- 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/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/utils/index.js +2 -2
- package/dist/tbv/core/utils/witness/witnessStack.d.ts +24 -0
- package/dist/tbv/core/utils/witness/witnessStack.d.ts.map +1 -0
- package/dist/tbv/core/vault-secrets/index.js +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +244 -241
- package/dist/testing/MockBitcoinWallet.d.ts +10 -1
- package/dist/testing/MockBitcoinWallet.d.ts.map +1 -1
- package/dist/testing/__tests__/MockBitcoinWallet.test.d.ts +2 -0
- package/dist/testing/__tests__/MockBitcoinWallet.test.d.ts.map +1 -0
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +134 -47
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/signBip322P2wpkhWitness.d.ts +20 -0
- package/dist/testing/signBip322P2wpkhWitness.d.ts.map +1 -0
- package/dist/{toRefundInputs-BY_fcvrv.js → toRefundInputs-9hv_6k0E.js} +6 -6
- package/dist/{toRefundInputs-BY_fcvrv.js.map → toRefundInputs-9hv_6k0E.js.map} +1 -1
- package/dist/{toRefundInputs-DYL9C-aG.cjs → toRefundInputs-D8sFs44p.cjs} +2 -2
- package/dist/{toRefundInputs-DYL9C-aG.cjs.map → toRefundInputs-D8sFs44p.cjs.map} +1 -1
- package/dist/verifyKeyPathSchnorrSignature-DCOzQkDf.cjs +2 -0
- package/dist/verifyKeyPathSchnorrSignature-DCOzQkDf.cjs.map +1 -0
- package/dist/verifyKeyPathSchnorrSignature-oGCUbjjZ.js +363 -0
- package/dist/verifyKeyPathSchnorrSignature-oGCUbjjZ.js.map +1 -0
- package/dist/verifyScriptPathSchnorrSignature-Dy9gF5RF.js +931 -0
- package/dist/verifyScriptPathSchnorrSignature-Dy9gF5RF.js.map +1 -0
- package/dist/verifyScriptPathSchnorrSignature-la8XOAFm.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-la8XOAFm.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/PeginManager-BBl4xkWz.js +0 -1359
- package/dist/PeginManager-BBl4xkWz.js.map +0 -1
- package/dist/PeginManager-p-ajwSxG.cjs +0 -2
- package/dist/PeginManager-p-ajwSxG.cjs.map +0 -1
- package/dist/batchPoll-6L5oToGr.cjs +0 -2
- package/dist/batchPoll-6L5oToGr.cjs.map +0 -1
- package/dist/batchPoll-cIxrSLLJ.js.map +0 -1
- package/dist/buildAndBroadcastRefund-C4LiPATK.js.map +0 -1
- package/dist/buildAndBroadcastRefund-Daw5ZUKR.cjs +0 -2
- package/dist/buildAndBroadcastRefund-Daw5ZUKR.cjs.map +0 -1
- package/dist/challengeAssert-BFRE2DM-.cjs +0 -2
- package/dist/challengeAssert-BFRE2DM-.cjs.map +0 -1
- package/dist/challengeAssert-C7PzyJ7g.js +0 -75
- package/dist/challengeAssert-C7PzyJ7g.js.map +0 -1
- package/dist/mempoolApi-CXfr-L6x.cjs +0 -2
- package/dist/peginInput-Ci921gTl.cjs +0 -2
- package/dist/peginInput-Ci921gTl.cjs.map +0 -1
- package/dist/peginInput-HQPWZfly.js +0 -123
- package/dist/peginInput-HQPWZfly.js.map +0 -1
- package/dist/signPsbtsWithFallback-Bb66DfY5.js.map +0 -1
- package/dist/signPsbtsWithFallback-PTgWxsG3.cjs +0 -2
- package/dist/signPsbtsWithFallback-PTgWxsG3.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-DPAd_qke.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-DPAd_qke.cjs.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-i-koT139.js +0 -817
- package/dist/verifyScriptPathSchnorrSignature-i-koT139.js.map +0 -1
package/dist/tbv/index.js
CHANGED
|
@@ -1,246 +1,249 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { computeMinClaimValue as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { c as
|
|
8
|
-
import { B as
|
|
9
|
-
import { c as
|
|
10
|
-
import { C as
|
|
11
|
-
import { P as
|
|
12
|
-
import { A as
|
|
13
|
-
import { B as
|
|
14
|
-
import { B as
|
|
15
|
-
import { C as
|
|
16
|
-
import { V as
|
|
17
|
-
import { B as
|
|
18
|
-
import { B as
|
|
19
|
-
import { U as
|
|
20
|
-
import { M as
|
|
21
|
-
import { O as
|
|
22
|
-
import { A as
|
|
23
|
-
import { a as
|
|
24
|
-
import { D as
|
|
25
|
-
import { H as
|
|
26
|
-
import { C as
|
|
1
|
+
import { P as s, f as t, g as r, d as i, b as o, a as n, c as P, h as p, e as u } from "../verifyScriptPathSchnorrSignature-Dy9gF5RF.js";
|
|
2
|
+
import { a as c } from "../constants-GjWXdaqV.js";
|
|
3
|
+
import { computeMinClaimValue as E, computeMinPeginFee as g, deriveVaultId as A, expandAuthAnchor as T, expandHashlockSecret as S, expandWotsSeed as R, peginP2aAnchorOutput as m, supportedTxGraphVersions as _, validatePeginP2aAnchor as f } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
4
|
+
import { a as x, c as h, b as O, e as b, f as I } from "../verifyKeyPathSchnorrSignature-oGCUbjjZ.js";
|
|
5
|
+
import { a as V, b as y } from "../noPayout-CXn-geIS.js";
|
|
6
|
+
import { b as F } from "../challengeAssert-BNQ8sToz.js";
|
|
7
|
+
import { c as N, d as B, a as U, b as H, e as K, f as L, k, g as X, h as w, i as W, j as G, p as j, s as J, t as z, u as Y, v as Z } from "../bitcoin-Ch_jxnDa.js";
|
|
8
|
+
import { B as Q, H as $, K as aa, M as ea, T as sa, c as ta } from "../validation-Dj3dqYtl.js";
|
|
9
|
+
import { c as ia } from "../signing-DaLvGwQe.js";
|
|
10
|
+
import { C as na, M as Pa, P as pa, b as ua, a as da, c as ca, d as la, f as Ea, e as ga } from "../PeginManager--2R3T2S8.js";
|
|
11
|
+
import { P as Ta, c as Sa, f as Ra, r as ma, s as _a, v as fa } from "../signPsbtsWithFallback-Bv79gLFe.js";
|
|
12
|
+
import { A as xa, P as ha } from "../ProtocolParams.abi-C0TSRaHV.js";
|
|
13
|
+
import { B as ba } from "../BTCVaultRegistry.abi-CJwWI2EO.js";
|
|
14
|
+
import { B as va } from "../BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js";
|
|
15
|
+
import { C as ya, e as Da, g as Fa, h as Ma, i as Na } from "../errors-Blc-JWnI.js";
|
|
16
|
+
import { V as Ua, b as Ha, a as Ka, d as La, f as ka, p as Xa } from "../parseFundingOutpoints-CO-f6IHK.js";
|
|
17
|
+
import { B as Wa, a as Ga, f as ja, c as Ja, b as za, d as Ya, g as Za, i as qa, h as Qa, s as $a, e as ae, w as ee } from "../waitForTransactionReceiptSmartAware-lobLm0q0.js";
|
|
18
|
+
import { B as te, D as re, L as ie, M as oe, c as ne, P as Pe, b as pe, a as ue, S as de, T as ce, W as le, f as Ee, d as ge, p as Ae, r as Te } from "../fundPeginTransaction-B2wyjqp0.js";
|
|
19
|
+
import { U as Re, a as me, e as _e, f as fe, v as Ce } from "../reservation-CBAvoF3U.js";
|
|
20
|
+
import { M as he, V as Oe, g as be, a as Ie, b as ve, c as Ve, d as ye, e as De, f as Fe, h as Me, i as Ne, p as Be, v as Ue, j as He, k as Ke } from "../mempoolApi-_D-jvtj_.js";
|
|
21
|
+
import { O as ke, S as Xe, V as we, g as We, h as Ge, i as je, j as Je, a as ze, d as Ye, b as Ze, f as qe, p as Qe, r as $e, v as as, c as es, e as ss } from "../batchPoll-Cjj1du0i.js";
|
|
22
|
+
import { A as rs, D as is, J as os, a as ns, b as Ps, d as ps, P as us, R as ds, e as cs, c as ls, V as Es, i as gs } from "../json-rpc-client-DuUARJvV.js";
|
|
23
|
+
import { a as Ts } from "../onChainBtcPubkey-BAHZyKQL.js";
|
|
24
|
+
import { D as Rs, a as ms, h as _s, j as fs, P as Cs, k as xs, U as hs, V as Os, c as bs, d as Is, f as vs, e as Vs, b as ys, i as Ds, r as Fs, g as Ms, t as Ns } from "../toRefundInputs-9hv_6k0E.js";
|
|
25
|
+
import { H as Us, E as Hs, P as Ks, o as Ls, c as ks, d as Xs, K as ws, L as Ws, M as Gs, N as js, R as Js, a as zs, b as Ys, y as Zs, I as qs, J as Qs, g as $s, z as at, p as et, i as st, e as tt, G as rt, F as it, t as ot, A as nt, B as Pt, C as pt, D as ut, r as dt, s as ct, f as lt, h as Et, j as gt, v as At, k as Tt, l as St, m as Rt, n as mt, q as _t, u as ft, w as Ct, x as xt } from "../buildAndBroadcastRefund-CpMDJ8up.js";
|
|
26
|
+
import { C as Ot, P as bt, c as It, g as vt, i as Vt } from "../peginState-CxDiaKuk.js";
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
28
|
+
rs as AUTH_REJECTED_RPC_CODE,
|
|
29
|
+
xa as ApplicationRegistryABI,
|
|
30
|
+
Us as BIP68NotMatureError,
|
|
31
|
+
Q as BITCOIN_ADDRESS_RE,
|
|
32
|
+
ba as BTCVaultRegistryABI,
|
|
33
|
+
va as BTCVaultRegistryKeyEpochsABI,
|
|
34
|
+
te as BTC_DUST_SAT,
|
|
35
|
+
Wa as BitcoinScriptType,
|
|
36
|
+
na as COMMISSION_BPS_HEADROOM,
|
|
37
|
+
ya as CONTRACT_ERRORS,
|
|
38
|
+
Hs as ClaimerPegoutStatusValue,
|
|
39
|
+
Ot as ContractStatus,
|
|
40
|
+
Rs as DEPOSIT_TERMS_REJECTED_ERROR_NAME,
|
|
41
|
+
re as DUST_THRESHOLD,
|
|
42
|
+
is as DaemonStatus,
|
|
43
|
+
ms as DepositTermsRejectedError,
|
|
44
|
+
$ as HEX_RE,
|
|
45
|
+
os as JSON_RPC_ERROR_CODES,
|
|
46
|
+
ns as JsonRpcClient,
|
|
47
|
+
Ps as JsonRpcError,
|
|
48
|
+
aa as KNOWN_SCRIPT_PREFIXES,
|
|
49
|
+
ie as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
50
|
+
Pa as MAX_ACCEPTABLE_COMMISSION_BPS_CAP,
|
|
51
|
+
oe as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
52
|
+
ea as MAX_REASONABLE_FEE_SATS,
|
|
53
|
+
ne as MAX_REASONABLE_PEGIN_VBYTES,
|
|
54
|
+
he as MEMPOOL_API_URLS,
|
|
55
|
+
ke as OnChainBtcVaultStatus,
|
|
56
|
+
Pe as P2TR_INPUT_SIZE,
|
|
57
|
+
pe as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
58
|
+
Ks as PEGIN_ETH_CONFIRMATIONS,
|
|
59
|
+
ue as PEGIN_FIXED_OUTPUTS,
|
|
60
|
+
ps as POST_WOTS_STATUSES,
|
|
61
|
+
us as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
62
|
+
Ls as ParticipantKeyDriftError,
|
|
63
|
+
Ta as PayoutManager,
|
|
64
|
+
bt as PeginAction,
|
|
65
|
+
pa as PeginManager,
|
|
66
|
+
_s as PeginParamsAmbiguousError,
|
|
67
|
+
fs as PeginParamsIncompleteSpaceError,
|
|
68
|
+
Cs as PeginParamsNotFoundError,
|
|
69
|
+
ks as PeginRegistrationMissingError,
|
|
70
|
+
Xs as PeginRegistrationNotFinalError,
|
|
71
|
+
xs as PeginSizingIntegrityError,
|
|
72
|
+
ha as ProtocolParamsABI,
|
|
73
|
+
s as PsbtSubstitutionError,
|
|
74
|
+
ws as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
|
|
75
|
+
Ws as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
76
|
+
Gs as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
77
|
+
js as REFUND_VSIZE,
|
|
78
|
+
Js as RegisteredVaultVersionMismatchError,
|
|
79
|
+
ds as RpcErrorCode,
|
|
80
|
+
de as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
81
|
+
Xe as ServerIdentityError,
|
|
82
|
+
sa as TXID_RE,
|
|
83
|
+
ce as TX_BUFFER_SIZE_OVERHEAD,
|
|
84
|
+
hs as UnanchoredPrePeginError,
|
|
85
|
+
Re as UtxoNotAvailableError,
|
|
86
|
+
Ua as VAULT_APP_NAME,
|
|
87
|
+
cs as VP_BATCH_MAX_SIZE,
|
|
88
|
+
ls as VP_TERMINAL_FAILURE_STATUSES,
|
|
89
|
+
Es as VP_TRANSIENT_STATUSES,
|
|
90
|
+
we as VaultProviderRpcClient,
|
|
91
|
+
Os as VaultRootMismatchError,
|
|
92
|
+
We as ViemOperationKeyReader,
|
|
93
|
+
Ge as ViemProtocolParamsReader,
|
|
94
|
+
je as ViemUniversalChallengerReader,
|
|
95
|
+
Je as ViemVaultKeeperReader,
|
|
96
|
+
Oe as ViemVaultRegistryReader,
|
|
97
|
+
ze as VpResponseValidationError,
|
|
98
|
+
Ye as VpTokenRegistry,
|
|
99
|
+
le as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
100
|
+
zs as activateVault,
|
|
101
|
+
Ys as activateVaultAndRedeem,
|
|
102
|
+
Ga as applyChangeOutputPolicy,
|
|
103
|
+
x as assertKeyPathSchnorrSignature,
|
|
104
|
+
Ts as assertOnChainBtcPubkey,
|
|
105
|
+
t as assertPsbtUnsignedTxMatches,
|
|
106
|
+
h as assertReturnedKeyPathSignatures,
|
|
107
|
+
r as assertScriptPathSchnorrSignature,
|
|
108
|
+
me as assertUtxosAvailable,
|
|
109
|
+
c as assertValidVaultCoreVersion,
|
|
110
|
+
Zs as assertVaultProviderHintAccepted,
|
|
111
|
+
Ze as batchPollByProvider,
|
|
112
|
+
qs as buildAndBroadcastRefund,
|
|
113
|
+
F as buildChallengeAssertPsbt,
|
|
114
|
+
ua as buildDepositTerms,
|
|
115
|
+
Ha as buildFundingOutpointsCommitment,
|
|
114
116
|
V as buildNoPayoutPsbt,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
i as buildPayoutPsbt,
|
|
118
|
+
O as buildPeginInputPsbt,
|
|
119
|
+
bs as buildPeginParamsCandidates,
|
|
120
|
+
o as buildPeginTxFromFundedPrePegin,
|
|
121
|
+
n as buildPrePeginPsbt,
|
|
120
122
|
y as buildRefundPsbt,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
123
|
+
Ka as buildVaultContext,
|
|
124
|
+
ja as calculateBtcTxHash,
|
|
125
|
+
It as canPerformAction,
|
|
126
|
+
N as canonicalizeBtcPubkey,
|
|
127
|
+
da as capMaxAcceptableCommissionBps,
|
|
128
|
+
ta as combineAbortSignals,
|
|
129
|
+
Ja as computeChangeOutputFeeSats,
|
|
130
|
+
Sa as computeHashlock,
|
|
131
|
+
za as computeMaxDeposit,
|
|
132
|
+
E as computeMinClaimValue,
|
|
133
|
+
g as computeMinPeginFee,
|
|
134
|
+
P as computeNumLocalChallengers,
|
|
135
|
+
Ya as computePeginBaseFeeSats,
|
|
136
|
+
ca as computeWotsBlockPublicKeysHash,
|
|
137
|
+
qe as createAuthenticatedVpClient,
|
|
138
|
+
p as createPayoutScript,
|
|
139
|
+
ia as createTaprootScriptPathSignOptions,
|
|
140
|
+
B as deriveBip86ScriptPubKeyHex,
|
|
141
|
+
Is as deriveHashlocksFromPrePegin,
|
|
142
|
+
U as deriveNativeSegwitAddress,
|
|
143
|
+
H as deriveTaprootAddress,
|
|
144
|
+
A as deriveVaultId,
|
|
145
|
+
La as deriveVaultRoot,
|
|
146
|
+
la as deriveWotsBlocksFromSeed,
|
|
147
|
+
vs as describePeginParamsCandidate,
|
|
148
|
+
Vs as describeUnresolvedVersion,
|
|
149
|
+
K as ensureHexPrefix,
|
|
150
|
+
Ea as ensurePrePeginTermsApproval,
|
|
151
|
+
Qs as estimateRefundFeeSats,
|
|
152
|
+
ga as estimateSubmitPeginRequestBatchGas,
|
|
153
|
+
T as expandAuthAnchor,
|
|
154
|
+
S as expandHashlockSecret,
|
|
155
|
+
R as expandWotsSeed,
|
|
156
|
+
Da as extractErrorData,
|
|
157
|
+
_e as extractInputsFromTransaction,
|
|
158
|
+
u as extractPayoutSignature,
|
|
159
|
+
b as extractPeginInputSignature,
|
|
160
|
+
I as finalizePeginInputPsbt,
|
|
161
|
+
fe as findOverlappingPendingVaults,
|
|
162
|
+
L as formatSatoshisToBtc,
|
|
163
|
+
Ra as forwardDepositApproval,
|
|
164
|
+
ka as forwardDeriveContextHash,
|
|
165
|
+
Ee as fundPeginTransaction,
|
|
166
|
+
be as getAddressTxs,
|
|
167
|
+
Ie as getAddressUtxos,
|
|
168
|
+
Fa as getContractErrorMessage,
|
|
169
|
+
Za as getDustThreshold,
|
|
170
|
+
ve as getMempoolApiUrl,
|
|
171
|
+
k as getNetwork,
|
|
172
|
+
Ve as getNetworkFees,
|
|
173
|
+
ye as getOutspend,
|
|
174
|
+
vt as getPeginProtocolState,
|
|
175
|
+
qa as getPsbtInputFields,
|
|
176
|
+
Qa as getScriptType,
|
|
177
|
+
X as getSortedXOnlyPubkeys,
|
|
178
|
+
De as getTipHeight,
|
|
179
|
+
Fe as getTxHex,
|
|
180
|
+
Me as getTxInfo,
|
|
181
|
+
Ne as getUtxoInfo,
|
|
182
|
+
Ma as handleContractError,
|
|
183
|
+
w as hexToUint8Array,
|
|
184
|
+
Vt as isActivationDeadlinePassedOnChain,
|
|
185
|
+
W as isAddressFromPublicKey,
|
|
186
|
+
gs as isAuthRejectedError,
|
|
187
|
+
$s as isDepositAmountValid,
|
|
188
|
+
ys as isDepositTermsRejectedError,
|
|
189
|
+
at as isHintAccepted,
|
|
190
|
+
Na as isKnownContractError,
|
|
191
|
+
et as isParticipantKeyDriftError,
|
|
192
|
+
st as isPeginRegistrationMissingError,
|
|
193
|
+
tt as isPeginRegistrationNotFinalError,
|
|
194
|
+
rt as isPegoutTerminalStatus,
|
|
195
|
+
it as isRecognizedPegoutStatus,
|
|
196
|
+
ot as isRegisteredVaultVersionMismatchError,
|
|
197
|
+
G as isValidHex,
|
|
198
|
+
Ds as isWotsMismatchError,
|
|
199
|
+
nt as matchKeyHint,
|
|
200
|
+
Pt as matchKeySetHint,
|
|
201
|
+
Xa as parseFundingOutpointsFromTx,
|
|
202
|
+
ge as parseUnfundedWasmTransaction,
|
|
203
|
+
Ae as peginOutputCount,
|
|
204
|
+
m as peginP2aAnchorOutput,
|
|
205
|
+
Qe as primeVpTokenRegistry,
|
|
206
|
+
j as processPublicKeyToXOnly,
|
|
207
|
+
Be as pushTx,
|
|
208
|
+
Te as rateBasedTxBufferFee,
|
|
209
|
+
Fs as rebuildDepositTermsCore,
|
|
210
|
+
Ms as reconstructPeginParams,
|
|
211
|
+
ma as requireChangeAddress,
|
|
212
|
+
pt as resolveCurrentParticipantKeys,
|
|
213
|
+
ut as resolveParticipantKeysAtEpochs,
|
|
214
|
+
$e as resolveProtocolAddresses,
|
|
215
|
+
dt as runDepositorPresignFlow,
|
|
216
|
+
$a as selectUtxosForPegin,
|
|
217
|
+
ae as shouldAddChangeOutput,
|
|
218
|
+
ct as signDepositorGraph,
|
|
219
|
+
J as stripHexPrefix,
|
|
220
|
+
lt as submitWotsPublicKey,
|
|
221
|
+
_ as supportedTxGraphVersions,
|
|
222
|
+
_a as supportsDepositApproval,
|
|
223
|
+
Ns as toRefundInputs,
|
|
224
|
+
z as toXOnly,
|
|
225
|
+
Y as uint8ArrayToHex,
|
|
226
|
+
Et as validateDepositAmount,
|
|
227
|
+
gt as validateMultiVaultDepositInputs,
|
|
228
|
+
Ue as validateOffchainParams,
|
|
229
|
+
At as validateOnChainParticipantKeys,
|
|
230
|
+
He as validatePegInConfiguration,
|
|
231
|
+
f as validatePeginP2aAnchor,
|
|
232
|
+
Tt as validateProviderSelection,
|
|
233
|
+
St as validateRemainingCapacity,
|
|
234
|
+
as as validateRequestDepositorClaimerArtifactsResponse,
|
|
235
|
+
fa as validateSecretAgainstHashlock,
|
|
236
|
+
Ke as validateTBVProtocolParams,
|
|
237
|
+
Ce as validateUtxosAvailable,
|
|
238
|
+
Rt as validateVaultAmounts,
|
|
239
|
+
mt as validateVaultProviderPubkey,
|
|
240
|
+
Z as validateWalletPubkey,
|
|
241
|
+
_t as verifyRegisteredParticipantKeys,
|
|
242
|
+
ft as verifyRegisteredVaultVersions,
|
|
243
|
+
es as verifyServerIdentity,
|
|
244
|
+
ss as vpTokenRegistry,
|
|
245
|
+
Ct as waitForPeginRegistrationDepth,
|
|
246
|
+
xt as waitForPeginStatus,
|
|
247
|
+
ee as waitForTransactionReceiptSmartAware
|
|
245
248
|
};
|
|
246
249
|
//# sourceMappingURL=index.js.map
|
|
@@ -8,6 +8,15 @@ export interface MockBitcoinWalletConfig {
|
|
|
8
8
|
address?: string;
|
|
9
9
|
network?: BitcoinNetwork;
|
|
10
10
|
shouldFailSigning?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 32-byte hex key `signMessage` signs BIP-322 proofs with. Defaults to
|
|
13
|
+
* the privkey-1 test key, whose x-only pubkey is the default
|
|
14
|
+
* `publicKeyHex` (the secp256k1 generator's x coordinate). PoP flows
|
|
15
|
+
* verify the witness against `publicKeyHex`: overriding only this key
|
|
16
|
+
* derives the matching `publicKeyHex`, and a divergent pair throws at
|
|
17
|
+
* sign time. Test material only — never a real key.
|
|
18
|
+
*/
|
|
19
|
+
privateKeyHex?: string;
|
|
11
20
|
/**
|
|
12
21
|
* Optional override for `deriveContextHash`. When omitted the mock
|
|
13
22
|
* returns a deterministic 64-char lowercase hex string derived from
|
|
@@ -25,7 +34,7 @@ export declare class MockBitcoinWallet implements BitcoinWallet {
|
|
|
25
34
|
getAddress(): Promise<string>;
|
|
26
35
|
signPsbt(psbtHex: string, _options?: SignPsbtOptions): Promise<string>;
|
|
27
36
|
signPsbts(psbtsHexes: string[], _options?: SignPsbtOptions[]): Promise<string[]>;
|
|
28
|
-
signMessage(message: string,
|
|
37
|
+
signMessage(message: string, _type: "bip322-simple" | "ecdsa"): Promise<string>;
|
|
29
38
|
getNetwork(): Promise<BitcoinNetwork>;
|
|
30
39
|
deriveContextHash(appName: string, context: string): Promise<string>;
|
|
31
40
|
/** Updates configuration for testing different scenarios. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockBitcoinWallet.d.ts","sourceRoot":"","sources":["../../src/testing/MockBitcoinWallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MockBitcoinWallet.d.ts","sourceRoot":"","sources":["../../src/testing/MockBitcoinWallet.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAChB,MAAM,4CAA4C,CAAC;AAOpD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3E;AAkDD,uCAAuC;AACvC,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,MAAM,CAAoC;gBAEtC,MAAM,GAAE,uBAA4B;IAqB1C,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAIlC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IActE,SAAS,CACb,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,OAAO,CAAC,MAAM,EAAE,CAAC;IASd,WAAW,CACf,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,eAAe,GAAG,OAAO,GAC/B,OAAO,CAAC,MAAM,CAAC;IAqCZ,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;IAIrC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1E,6DAA6D;IAC7D,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI;IAO7D,uCAAuC;IACvC,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockBitcoinWallet.test.d.ts","sourceRoot":"","sources":["../../../src/testing/__tests__/MockBitcoinWallet.test.ts"],"names":[],"mappings":""}
|
package/dist/testing/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var O=(s,e,t)=>e in s?m(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var c=(s,e,t)=>O(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("@bitcoin-js/tiny-secp256k1-asmjs"),p=require("../sha2-DsrLC4NM.cjs"),o=require("buffer"),u=require("../bitcoin-m84N5a8o.cjs"),d=require("bitcoinjs-lib"),k=require("../shared/index.cjs");function B(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const y=B(v),I="BIP0322-signed-message",E=1,g=0,D=71,K=100,x=0,_=0,T=0,N=32,F=4294967295,M=0,U=0,A=32,C=106,W=2,R=32,$=0;function G(s,e){const t=y.pointFromScalar(e,!0);if(!t)throw new Error("signBip322P2wpkhWitness: invalid private key");const n=p.sha256(new TextEncoder().encode(I)),i=p.sha256(o.Buffer.concat([n,n,o.Buffer.from(s)])),r=d.payments.p2wpkh({pubkey:o.Buffer.from(t)});if(!r.output||!r.hash)throw new Error("signBip322P2wpkhWitness: could not derive P2WPKH script");const a=new d.Transaction;a.version=x,a.locktime=_,a.addInput(o.Buffer.alloc(N,0),F,T,o.Buffer.concat([o.Buffer.from([U,A]),o.Buffer.from(i)])),a.addOutput(r.output,g);const h=new d.Transaction;h.version=x,h.locktime=_,h.addInput(a.getHash(),M,T),h.addOutput(o.Buffer.from([C]),g);const q=d.payments.p2pkh({hash:r.hash}).output;if(!q)throw new Error("signBip322P2wpkhWitness: could not build scriptCode");const S=h.hashForWitnessV0(0,q,g,E);let l;for(let f=0;f<K;f++){const b=o.Buffer.alloc(R,0);b.writeUInt32LE(f,$);const w=d.script.signature.encode(o.Buffer.from(y.sign(S,e,b)),E);if(w.length>=D){l=w;break}}if(!l)throw new Error("signBip322P2wpkhWitness: could not grind a 71/72-byte signature");return Uint8Array.from([W,l.length,...l,t.length,...t])}const X=async(s,e)=>{const t=new TextEncoder,n=t.encode(s),i=t.encode(e),r=new Uint8Array(4+n.length+4+i.length),a=new DataView(r.buffer);return a.setUint32(0,n.length),r.set(n,4),a.setUint32(4+n.length,i.length),r.set(i,4+n.length+4),u.uint8ArrayToHex(p.sha256(r))},j=`${"00".repeat(31)}01`;function H(s){return u.uint8ArrayToHex(y.xOnlyPointFromScalar(Uint8Array.from(o.Buffer.from(s,"hex"))))}const P={publicKeyHex:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",address:"tb1pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx6jks",network:k.BitcoinNetworks.SIGNET,shouldFailSigning:!1,privateKeyHex:j,deriveContextHash:X};class L{constructor(e={}){c(this,"config");this.config={...P,...e.publicKeyHex?{publicKeyHex:e.publicKeyHex}:{},...e.address?{address:e.address}:{},...e.network!==void 0?{network:e.network}:{},...e.shouldFailSigning!==void 0?{shouldFailSigning:e.shouldFailSigning}:{},...e.privateKeyHex?{privateKeyHex:e.privateKeyHex}:{},...e.deriveContextHash?{deriveContextHash:e.deriveContextHash}:{}},e.privateKeyHex&&!e.publicKeyHex&&(this.config.publicKeyHex=H(e.privateKeyHex))}async getPublicKeyHex(){return this.config.publicKeyHex}async getAddress(){return this.config.address}async signPsbt(e,t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid PSBT: empty hex string");return e+"deadbeef"}async signPsbts(e,t){const n=[];for(const i of e){const r=await this.signPsbt(i);n.push(r)}return n}async signMessage(e,t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid message: empty string");const n=H(this.config.privateKeyHex);let i;try{i=u.canonicalizeBtcPubkey(this.config.publicKeyHex)}catch{i=void 0}if(i!==n)throw new Error(`MockBitcoinWallet.signMessage: privateKeyHex signs as x-only pubkey ${n}, but publicKeyHex is ${this.config.publicKeyHex}. Pass a matching publicKeyHex/privateKeyHex pair.`);const r=G(new TextEncoder().encode(e),Uint8Array.from(o.Buffer.from(this.config.privateKeyHex,"hex")));return`0x${u.uint8ArrayToHex(r)}`}async getNetwork(){return this.config.network}async deriveContextHash(e,t){return this.config.deriveContextHash(e,t)}updateConfig(e){this.config={...this.config,...e}}reset(){this.config={...P}}}class V{constructor(e={}){c(this,"account");c(this,"chain");c(this,"shouldFailOperations");c(this,"transactionDelay");c(this,"nonce",0);this.account={address:e.address||"0x742d35cc6634c0532925a3b844bc9e7595f0beb0"},this.chain={id:e.chainId??11155111},this.shouldFailOperations=e.shouldFailOperations??!1,this.transactionDelay=e.transactionDelay??0,this.signMessage=this.signMessage.bind(this),this.sendTransaction=this.sendTransaction.bind(this)}async signMessage(e){const t=e.message,n=e.account||this.account.address;if(this.shouldFailOperations)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid message: empty string");const i=`personal_sign:${t}-${n}-${this.chain.id}`;return`0x${o.Buffer.from(i).toString("hex").slice(0,130).padEnd(130,"0")}`}async sendTransaction(e){var i;if(this.shouldFailOperations)throw new Error("Mock transaction failed");if(!e.to)throw new Error("Invalid transaction: missing 'to' address");this.transactionDelay>0&&await new Promise(r=>setTimeout(r,this.transactionDelay)),this.nonce++;const t=JSON.stringify({from:this.account.address,to:e.to,value:((i=e.value)==null?void 0:i.toString())||"0",nonce:this.nonce,chainId:this.chain.id});return`0x${o.Buffer.from(t).toString("hex").slice(0,64).padEnd(64,"0")}`}updateConfig(e){e.address!==void 0&&(this.account.address=e.address),e.chainId!==void 0&&(this.chain.id=e.chainId),e.shouldFailOperations!==void 0&&(this.shouldFailOperations=e.shouldFailOperations),e.transactionDelay!==void 0&&(this.transactionDelay=e.transactionDelay)}reset(){this.account.address="0x742d35cc6634c0532925a3b844bc9e7595f0beb0",this.chain.id=11155111,this.shouldFailOperations=!1,this.transactionDelay=0,this.nonce=0}getCurrentNonce(){return this.nonce}}exports.MockBitcoinWallet=L;exports.MockEthereumWallet=V;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|