@babylonlabs-io/ts-sdk 0.0.0-semantic-release.2 → 0.1.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/LICENSE +1 -1
- package/README.md +124 -6
- package/dist/MockEthereumWallet-CKQlH2AM.cjs +2 -0
- package/dist/MockEthereumWallet-CKQlH2AM.cjs.map +1 -0
- package/dist/MockEthereumWallet-ibdry7pZ.js +127 -0
- package/dist/MockEthereumWallet-ibdry7pZ.js.map +1 -0
- package/dist/PayoutManager-Dg_i_S7w.cjs +2 -0
- package/dist/PayoutManager-Dg_i_S7w.cjs.map +1 -0
- package/dist/PayoutManager-rMj54HDh.js +1112 -0
- package/dist/PayoutManager-rMj54HDh.js.map +1 -0
- package/dist/challengeAssert-34HqeVFH.cjs +2 -0
- package/dist/challengeAssert-34HqeVFH.cjs.map +1 -0
- package/dist/challengeAssert-DVErOd8l.js +423 -0
- package/dist/challengeAssert-DVErOd8l.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +62 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.d.ts +3 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +5 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/wallets/__tests__/BitcoinWallet.test.d.ts +2 -0
- package/dist/shared/wallets/__tests__/BitcoinWallet.test.d.ts.map +1 -0
- package/dist/shared/wallets/__tests__/EthereumWallet.test.d.ts +2 -0
- package/dist/shared/wallets/__tests__/EthereumWallet.test.d.ts.map +1 -0
- package/dist/shared/wallets/index.d.ts +4 -0
- package/dist/shared/wallets/index.d.ts.map +1 -0
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts +106 -0
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts.map +1 -0
- package/dist/shared/wallets/interfaces/EthereumWallet.d.ts +6 -0
- package/dist/shared/wallets/interfaces/EthereumWallet.d.ts.map +1 -0
- package/dist/shared/wallets/interfaces/index.d.ts +4 -0
- package/dist/shared/wallets/interfaces/index.d.ts.map +1 -0
- package/dist/shared/wallets/mocks/MockBitcoinWallet.d.ts +29 -0
- package/dist/shared/wallets/mocks/MockBitcoinWallet.d.ts.map +1 -0
- package/dist/shared/wallets/mocks/MockEthereumWallet.d.ts +51 -0
- package/dist/shared/wallets/mocks/MockEthereumWallet.d.ts.map +1 -0
- package/dist/shared/wallets/mocks/index.d.ts +5 -0
- package/dist/shared/wallets/mocks/index.d.ts.map +1 -0
- package/dist/tbv/core/clients/index.d.ts +9 -0
- package/dist/tbv/core/clients/index.d.ts.map +1 -0
- package/dist/tbv/core/clients/mempool/index.d.ts +11 -0
- package/dist/tbv/core/clients/mempool/index.d.ts.map +1 -0
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts +94 -0
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts.map +1 -0
- package/dist/tbv/core/clients/mempool/types.d.ts +98 -0
- package/dist/tbv/core/clients/mempool/types.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts +187 -0
- package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts.map +1 -0
- package/dist/tbv/core/contracts/errors.d.ts +50 -0
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -0
- package/dist/tbv/core/contracts/index.d.ts +11 -0
- package/dist/tbv/core/contracts/index.d.ts.map +1 -0
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.d.ts +17 -1
- package/dist/tbv/core/index.d.ts.map +1 -1
- package/dist/tbv/core/index.js +59 -1
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/PayoutManager.d.ts +158 -0
- package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -0
- package/dist/tbv/core/managers/PeginManager.d.ts +327 -0
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -0
- package/dist/tbv/core/managers/__tests__/PayoutManager.test.d.ts +8 -0
- package/dist/tbv/core/managers/__tests__/PayoutManager.test.d.ts.map +1 -0
- package/dist/tbv/core/managers/__tests__/PeginManager.test.d.ts +8 -0
- package/dist/tbv/core/managers/__tests__/PeginManager.test.d.ts.map +1 -0
- package/dist/tbv/core/managers/index.d.ts +75 -0
- package/dist/tbv/core/managers/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/index.cjs +2 -0
- package/dist/tbv/core/primitives/index.d.ts +77 -0
- package/dist/tbv/core/primitives/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/index.js +21 -0
- package/dist/tbv/{integrations/morpho → core/primitives}/index.js.map +1 -1
- package/dist/tbv/core/primitives/psbt/__tests__/constants.d.ts +137 -0
- package/dist/tbv/core/primitives/psbt/__tests__/constants.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts +71 -0
- package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/__tests__/payout.test.d.ts +8 -0
- package/dist/tbv/core/primitives/psbt/__tests__/payout.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/__tests__/pegin.test.d.ts +5 -0
- package/dist/tbv/core/primitives/psbt/__tests__/pegin.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts +27 -0
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/depositorPayout.d.ts +27 -0
- package/dist/tbv/core/primitives/psbt/depositorPayout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/index.d.ts +27 -0
- package/dist/tbv/core/primitives/psbt/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/noPayout.d.ts +28 -0
- package/dist/tbv/core/primitives/psbt/noPayout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/payout.d.ts +99 -0
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +88 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -0
- package/dist/tbv/core/primitives/scripts/__tests__/payout.test.d.ts +5 -0
- package/dist/tbv/core/primitives/scripts/__tests__/payout.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/scripts/index.d.ts +10 -0
- package/dist/tbv/core/primitives/scripts/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/scripts/payout.d.ts +102 -0
- package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/utils/__tests__/bitcoin.test.d.ts +5 -0
- package/dist/tbv/core/primitives/utils/__tests__/bitcoin.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts +132 -0
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -0
- package/dist/tbv/core/primitives/utils/index.d.ts +9 -0
- package/dist/tbv/core/primitives/utils/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/btc/index.d.ts +10 -0
- package/dist/tbv/core/utils/btc/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/btc/psbtInputFields.d.ts +41 -0
- package/dist/tbv/core/utils/btc/psbtInputFields.d.ts.map +1 -0
- package/dist/tbv/core/utils/btc/scriptType.d.ts +34 -0
- package/dist/tbv/core/utils/btc/scriptType.d.ts.map +1 -0
- package/dist/tbv/core/utils/fee/constants.d.ts +25 -0
- package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -0
- package/dist/tbv/core/utils/fee/index.d.ts +7 -0
- package/dist/tbv/core/utils/fee/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/index.d.ts +16 -0
- package/dist/tbv/core/utils/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/__tests__/btcTxHash.test.d.ts +5 -0
- package/dist/tbv/core/utils/transaction/__tests__/btcTxHash.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/__tests__/createSplitTransaction.test.d.ts +5 -0
- package/dist/tbv/core/utils/transaction/__tests__/createSplitTransaction.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/__tests__/fundPeginTransaction.test.d.ts +5 -0
- package/dist/tbv/core/utils/transaction/__tests__/fundPeginTransaction.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/btcTxHash.d.ts +15 -0
- package/dist/tbv/core/utils/transaction/btcTxHash.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/createSplitTransaction.d.ts +106 -0
- package/dist/tbv/core/utils/transaction/createSplitTransaction.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/fundPeginTransaction.d.ts +70 -0
- package/dist/tbv/core/utils/transaction/fundPeginTransaction.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/index.d.ts +9 -0
- package/dist/tbv/core/utils/transaction/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/__tests__/selectUtxos.test.d.ts +5 -0
- package/dist/tbv/core/utils/utxo/__tests__/selectUtxos.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/index.d.ts +7 -0
- package/dist/tbv/core/utils/utxo/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/selectUtxos.d.ts +65 -0
- package/dist/tbv/core/utils/utxo/selectUtxos.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +59 -1
- package/dist/tbv/index.js.map +1 -1
- package/dist/tbv/integrations/aave/clients/__tests__/spoke.test.d.ts +2 -0
- package/dist/tbv/integrations/aave/clients/__tests__/spoke.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/__tests__/transaction.test.d.ts +2 -0
- package/dist/tbv/integrations/aave/clients/__tests__/transaction.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/abis/AaveIntegrationController.abi.json.d.ts +1879 -0
- package/dist/tbv/integrations/aave/clients/abis/AaveSpoke.abi.json.d.ts +1262 -0
- package/dist/tbv/integrations/aave/clients/index.d.ts +4 -0
- package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/query.d.ts +27 -0
- package/dist/tbv/integrations/aave/clients/query.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/spoke.d.ts +161 -0
- package/dist/tbv/integrations/aave/clients/spoke.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/transaction.d.ts +110 -0
- package/dist/tbv/integrations/aave/clients/transaction.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/config.d.ts +7 -0
- package/dist/tbv/integrations/aave/config.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/constants.d.ts +113 -0
- package/dist/tbv/integrations/aave/constants.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/index.cjs +2 -0
- package/dist/tbv/integrations/aave/index.cjs.map +1 -0
- package/dist/tbv/integrations/aave/index.d.ts +53 -0
- package/dist/tbv/integrations/aave/index.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/index.js +307 -0
- package/dist/tbv/integrations/aave/index.js.map +1 -0
- package/dist/tbv/integrations/aave/types.d.ts +66 -0
- package/dist/tbv/integrations/aave/types.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/aaveConversions.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/aaveConversions.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/borrowRatio.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/borrowRatio.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/debtUtils.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/debtUtils.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/healthFactor.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/healthFactor.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSelection.test.d.ts +2 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSelection.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSplit.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSplit.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/aaveConversions.d.ts +24 -0
- package/dist/tbv/integrations/aave/utils/aaveConversions.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/borrowRatio.d.ts +15 -0
- package/dist/tbv/integrations/aave/utils/borrowRatio.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/debtUtils.d.ts +14 -0
- package/dist/tbv/integrations/aave/utils/debtUtils.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/healthFactor.d.ts +108 -0
- package/dist/tbv/integrations/aave/utils/healthFactor.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/index.d.ts +10 -0
- package/dist/tbv/integrations/aave/utils/index.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/vaultSelection.d.ts +33 -0
- package/dist/tbv/integrations/aave/utils/vaultSelection.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/vaultSplit.d.ts +191 -0
- package/dist/tbv/integrations/aave/utils/vaultSplit.d.ts.map +1 -0
- package/package.json +37 -7
- package/dist/shared/__tests__/example.test.d.ts +0 -6
- package/dist/shared/__tests__/example.test.d.ts.map +0 -1
- package/dist/tbv/core/__tests__/example.test.d.ts +0 -6
- package/dist/tbv/core/__tests__/example.test.d.ts.map +0 -1
- package/dist/tbv/integrations/morpho/index.cjs +0 -2
- package/dist/tbv/integrations/morpho/index.d.ts +0 -2
- package/dist/tbv/integrations/morpho/index.d.ts.map +0 -1
- package/dist/tbv/integrations/morpho/index.js +0 -2
- /package/dist/tbv/{integrations/morpho → core/primitives}/index.cjs.map +0 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { createPegInTransaction as K, createPayoutConnector as L, tapInternalPubkey as x, getPeginPayoutScript as O, getAssertNoPayoutScriptInfo as W, getChallengeAssertScriptInfo as N } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
2
|
+
import * as $ from "@bitcoin-js/tiny-secp256k1-asmjs";
|
|
3
|
+
import { Buffer as a } from "buffer";
|
|
4
|
+
import { payments as P, networks as H, initEccLib as T, Transaction as g, Psbt as w } from "bitcoinjs-lib";
|
|
5
|
+
async function Y(t) {
|
|
6
|
+
const n = await K({
|
|
7
|
+
depositorPubkey: t.depositorPubkey,
|
|
8
|
+
vaultProviderPubkey: t.vaultProviderPubkey,
|
|
9
|
+
vaultKeeperPubkeys: t.vaultKeeperPubkeys,
|
|
10
|
+
universalChallengerPubkeys: t.universalChallengerPubkeys,
|
|
11
|
+
timelockPegin: t.timelockPegin,
|
|
12
|
+
pegInAmount: t.pegInAmount,
|
|
13
|
+
depositorClaimValue: t.depositorClaimValue,
|
|
14
|
+
network: t.network
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
psbtHex: n.txHex,
|
|
18
|
+
txid: n.txid,
|
|
19
|
+
vaultScriptPubKey: n.vaultScriptPubKey,
|
|
20
|
+
vaultValue: n.vaultValue
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async function F(t) {
|
|
24
|
+
const n = await L(
|
|
25
|
+
{
|
|
26
|
+
depositor: t.depositor,
|
|
27
|
+
vaultProvider: t.vaultProvider,
|
|
28
|
+
vaultKeepers: t.vaultKeepers,
|
|
29
|
+
universalChallengers: t.universalChallengers,
|
|
30
|
+
timelockPegin: t.timelockPegin
|
|
31
|
+
},
|
|
32
|
+
t.network
|
|
33
|
+
);
|
|
34
|
+
return {
|
|
35
|
+
payoutScript: n.payoutScript,
|
|
36
|
+
taprootScriptHash: n.taprootScriptHash,
|
|
37
|
+
scriptPubKey: n.scriptPubKey,
|
|
38
|
+
address: n.address
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function p(t) {
|
|
42
|
+
return t.startsWith("0x") ? t.slice(2) : t;
|
|
43
|
+
}
|
|
44
|
+
function f(t) {
|
|
45
|
+
const n = p(t);
|
|
46
|
+
if (!E(n))
|
|
47
|
+
throw new Error(`Invalid hex string: ${t}`);
|
|
48
|
+
const e = new Uint8Array(n.length / 2);
|
|
49
|
+
for (let o = 0; o < n.length; o += 2)
|
|
50
|
+
e[o / 2] = parseInt(n.slice(o, o + 2), 16);
|
|
51
|
+
return e;
|
|
52
|
+
}
|
|
53
|
+
function v(t) {
|
|
54
|
+
return Array.from(t).map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
55
|
+
}
|
|
56
|
+
function D(t) {
|
|
57
|
+
return t.length === 32 ? t : t.slice(1, 33);
|
|
58
|
+
}
|
|
59
|
+
function E(t) {
|
|
60
|
+
return /^[0-9a-fA-F]*$/.test(t) && t.length % 2 === 0;
|
|
61
|
+
}
|
|
62
|
+
function U(t) {
|
|
63
|
+
const n = p(t);
|
|
64
|
+
if (!E(n))
|
|
65
|
+
throw new Error(`Invalid hex characters in public key: ${t}`);
|
|
66
|
+
if (n.length === 64)
|
|
67
|
+
return n;
|
|
68
|
+
if (n.length !== 66 && n.length !== 130)
|
|
69
|
+
throw new Error(
|
|
70
|
+
`Invalid public key length: ${n.length} (expected 64, 66, or 130 hex chars)`
|
|
71
|
+
);
|
|
72
|
+
const e = f(n);
|
|
73
|
+
return v(D(e));
|
|
74
|
+
}
|
|
75
|
+
function Z(t) {
|
|
76
|
+
const n = p(t);
|
|
77
|
+
return E(n);
|
|
78
|
+
}
|
|
79
|
+
function tt(t, n) {
|
|
80
|
+
const e = U(t), o = n ?? e;
|
|
81
|
+
if (e.toLowerCase() !== o.toLowerCase())
|
|
82
|
+
throw new Error(
|
|
83
|
+
`Wallet public key does not match vault depositor. Expected: ${o}, Got: ${e}. Please connect the wallet that was used to create this vault.`
|
|
84
|
+
);
|
|
85
|
+
return { walletPubkeyRaw: t, walletPubkeyXOnly: e, depositorPubkey: o };
|
|
86
|
+
}
|
|
87
|
+
let C = !1;
|
|
88
|
+
function M() {
|
|
89
|
+
C || (T($), C = !0);
|
|
90
|
+
}
|
|
91
|
+
function q(t) {
|
|
92
|
+
switch (t) {
|
|
93
|
+
case "bitcoin":
|
|
94
|
+
return H.bitcoin;
|
|
95
|
+
case "testnet":
|
|
96
|
+
case "signet":
|
|
97
|
+
return H.testnet;
|
|
98
|
+
case "regtest":
|
|
99
|
+
return H.regtest;
|
|
100
|
+
default:
|
|
101
|
+
throw new Error(`Unknown network: ${t}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function X(t, n) {
|
|
105
|
+
M();
|
|
106
|
+
const e = f(U(t)), { address: o } = P.p2tr({
|
|
107
|
+
internalPubkey: a.from(e),
|
|
108
|
+
network: q(n)
|
|
109
|
+
});
|
|
110
|
+
if (!o)
|
|
111
|
+
throw new Error("Failed to derive taproot address from public key");
|
|
112
|
+
return o;
|
|
113
|
+
}
|
|
114
|
+
function _(t, n) {
|
|
115
|
+
const e = p(t);
|
|
116
|
+
if (e.length !== 66)
|
|
117
|
+
throw new Error(
|
|
118
|
+
`Native SegWit requires a compressed public key (66 hex chars), got ${e.length}`
|
|
119
|
+
);
|
|
120
|
+
const { address: o } = P.p2wpkh({
|
|
121
|
+
pubkey: a.from(f(e)),
|
|
122
|
+
network: q(n)
|
|
123
|
+
});
|
|
124
|
+
if (!o)
|
|
125
|
+
throw new Error(
|
|
126
|
+
"Failed to derive native segwit address from public key"
|
|
127
|
+
);
|
|
128
|
+
return o;
|
|
129
|
+
}
|
|
130
|
+
function et(t, n, e) {
|
|
131
|
+
const o = p(n);
|
|
132
|
+
try {
|
|
133
|
+
if (t === X(o, e))
|
|
134
|
+
return !0;
|
|
135
|
+
} catch {
|
|
136
|
+
}
|
|
137
|
+
const s = [];
|
|
138
|
+
o.length === 66 ? s.push(o) : o.length === 64 && s.push(`02${o}`, `03${o}`);
|
|
139
|
+
for (const r of s)
|
|
140
|
+
try {
|
|
141
|
+
if (t === _(r, e))
|
|
142
|
+
return !0;
|
|
143
|
+
} catch {
|
|
144
|
+
}
|
|
145
|
+
return !1;
|
|
146
|
+
}
|
|
147
|
+
T($);
|
|
148
|
+
async function nt(t) {
|
|
149
|
+
const n = p(t.payoutTxHex), e = p(t.peginTxHex), o = p(t.assertTxHex), s = await F({
|
|
150
|
+
depositor: t.depositorBtcPubkey,
|
|
151
|
+
vaultProvider: t.vaultProviderBtcPubkey,
|
|
152
|
+
vaultKeepers: t.vaultKeeperBtcPubkeys,
|
|
153
|
+
universalChallengers: t.universalChallengerBtcPubkeys,
|
|
154
|
+
timelockPegin: t.timelockPegin,
|
|
155
|
+
network: t.network
|
|
156
|
+
}), r = f(s.payoutScript), c = z(x, r), i = g.fromHex(n), u = g.fromHex(e), d = g.fromHex(o), l = new w();
|
|
157
|
+
if (l.setVersion(i.version), l.setLocktime(i.locktime), i.ins.length !== 2)
|
|
158
|
+
throw new Error(
|
|
159
|
+
`Payout transaction must have exactly 2 inputs, got ${i.ins.length}`
|
|
160
|
+
);
|
|
161
|
+
const h = i.ins[0], y = i.ins[1], k = v(
|
|
162
|
+
new Uint8Array(h.hash).slice().reverse()
|
|
163
|
+
), B = u.getId();
|
|
164
|
+
if (k !== B)
|
|
165
|
+
throw new Error(
|
|
166
|
+
`Input 0 does not reference pegin transaction. Expected ${B}, got ${k}`
|
|
167
|
+
);
|
|
168
|
+
const b = v(
|
|
169
|
+
new Uint8Array(y.hash).slice().reverse()
|
|
170
|
+
), I = d.getId();
|
|
171
|
+
if (b !== I)
|
|
172
|
+
throw new Error(
|
|
173
|
+
`Input 1 does not reference assert transaction. Expected ${I}, got ${b}`
|
|
174
|
+
);
|
|
175
|
+
const m = u.outs[h.index];
|
|
176
|
+
if (!m)
|
|
177
|
+
throw new Error(
|
|
178
|
+
`Previous output not found for input 0 (txid: ${k}, index: ${h.index})`
|
|
179
|
+
);
|
|
180
|
+
const S = d.outs[y.index];
|
|
181
|
+
if (!S)
|
|
182
|
+
throw new Error(
|
|
183
|
+
`Previous output not found for input 1 (txid: ${b}, index: ${y.index})`
|
|
184
|
+
);
|
|
185
|
+
l.addInput({
|
|
186
|
+
hash: h.hash,
|
|
187
|
+
index: h.index,
|
|
188
|
+
sequence: h.sequence,
|
|
189
|
+
witnessUtxo: {
|
|
190
|
+
script: m.script,
|
|
191
|
+
value: m.value
|
|
192
|
+
},
|
|
193
|
+
tapLeafScript: [
|
|
194
|
+
{
|
|
195
|
+
leafVersion: 192,
|
|
196
|
+
script: a.from(r),
|
|
197
|
+
controlBlock: a.from(c)
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
tapInternalKey: a.from(x)
|
|
201
|
+
// sighashType omitted - defaults to SIGHASH_DEFAULT (0x00) for Taproot
|
|
202
|
+
}), l.addInput({
|
|
203
|
+
hash: y.hash,
|
|
204
|
+
index: y.index,
|
|
205
|
+
sequence: y.sequence,
|
|
206
|
+
witnessUtxo: {
|
|
207
|
+
script: S.script,
|
|
208
|
+
value: S.value
|
|
209
|
+
}
|
|
210
|
+
// No tapLeafScript - depositor doesn't sign this input
|
|
211
|
+
});
|
|
212
|
+
for (const A of i.outs)
|
|
213
|
+
l.addOutput({
|
|
214
|
+
script: A.script,
|
|
215
|
+
value: A.value
|
|
216
|
+
});
|
|
217
|
+
return {
|
|
218
|
+
psbtHex: l.toHex()
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function ot(t, n, e = 0) {
|
|
222
|
+
const o = w.fromHex(t);
|
|
223
|
+
if (e >= o.data.inputs.length)
|
|
224
|
+
throw new Error(
|
|
225
|
+
`Input index ${e} out of range (${o.data.inputs.length} inputs)`
|
|
226
|
+
);
|
|
227
|
+
const s = o.data.inputs[e];
|
|
228
|
+
if (s.tapScriptSig && s.tapScriptSig.length > 0) {
|
|
229
|
+
const r = f(n);
|
|
230
|
+
for (const c of s.tapScriptSig)
|
|
231
|
+
if (c.pubkey.equals(a.from(r)))
|
|
232
|
+
return V(c.signature, e);
|
|
233
|
+
throw new Error(
|
|
234
|
+
`No signature found for depositor pubkey: ${n} at input ${e}`
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
if (s.finalScriptWitness && s.finalScriptWitness.length > 0) {
|
|
238
|
+
const r = j(s.finalScriptWitness);
|
|
239
|
+
if (r.length >= 1)
|
|
240
|
+
return V(r[0], e);
|
|
241
|
+
}
|
|
242
|
+
throw new Error(
|
|
243
|
+
`No tapScriptSig or finalScriptWitness found in signed PSBT at input ${e}`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
function V(t, n) {
|
|
247
|
+
if (t.length === 64)
|
|
248
|
+
return v(new Uint8Array(t));
|
|
249
|
+
if (t.length === 65)
|
|
250
|
+
return v(new Uint8Array(t.subarray(0, 64)));
|
|
251
|
+
throw new Error(
|
|
252
|
+
`Unexpected signature length at input ${n}: ${t.length}`
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function j(t) {
|
|
256
|
+
const n = [];
|
|
257
|
+
let e = 0;
|
|
258
|
+
const o = () => {
|
|
259
|
+
const r = t[e++];
|
|
260
|
+
if (r < 253) return r;
|
|
261
|
+
if (r === 253) {
|
|
262
|
+
const c = t[e] | t[e + 1] << 8;
|
|
263
|
+
return e += 2, c;
|
|
264
|
+
}
|
|
265
|
+
if (r === 254) {
|
|
266
|
+
const c = t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24;
|
|
267
|
+
return e += 4, c;
|
|
268
|
+
}
|
|
269
|
+
return e += 8, 0;
|
|
270
|
+
}, s = o();
|
|
271
|
+
for (let r = 0; r < s; r++) {
|
|
272
|
+
const c = o();
|
|
273
|
+
n.push(t.subarray(e, e + c)), e += c;
|
|
274
|
+
}
|
|
275
|
+
return n;
|
|
276
|
+
}
|
|
277
|
+
function z(t, n) {
|
|
278
|
+
const e = { output: a.from(n) }, s = P.p2tr({
|
|
279
|
+
internalPubkey: a.from(t),
|
|
280
|
+
scriptTree: e
|
|
281
|
+
}).pubkey;
|
|
282
|
+
if (!s)
|
|
283
|
+
throw new Error("Failed to compute output key");
|
|
284
|
+
const r = 192, c = s[0] === 3 ? 1 : 0, i = r | c, u = new Uint8Array(1 + t.length);
|
|
285
|
+
return u[0] = i, u.set(t, 1), u;
|
|
286
|
+
}
|
|
287
|
+
T($);
|
|
288
|
+
async function rt(t) {
|
|
289
|
+
const n = p(t.payoutTxHex), e = g.fromHex(n), o = await O(t.connectorParams), s = f(o), r = G(x, s), c = new w();
|
|
290
|
+
c.setVersion(e.version), c.setLocktime(e.locktime);
|
|
291
|
+
for (let i = 0; i < e.ins.length; i++) {
|
|
292
|
+
const u = e.ins[i], d = t.prevouts[i];
|
|
293
|
+
if (!d)
|
|
294
|
+
throw new Error(`Missing prevout data for input ${i}`);
|
|
295
|
+
const l = {
|
|
296
|
+
hash: u.hash,
|
|
297
|
+
index: u.index,
|
|
298
|
+
sequence: u.sequence,
|
|
299
|
+
witnessUtxo: {
|
|
300
|
+
script: a.from(f(p(d.script_pubkey))),
|
|
301
|
+
value: d.value
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
i === 0 && (l.tapLeafScript = [
|
|
305
|
+
{
|
|
306
|
+
leafVersion: 192,
|
|
307
|
+
script: a.from(s),
|
|
308
|
+
controlBlock: a.from(r)
|
|
309
|
+
}
|
|
310
|
+
], l.tapInternalKey = a.from(x)), c.addInput(l);
|
|
311
|
+
}
|
|
312
|
+
for (const i of e.outs)
|
|
313
|
+
c.addOutput({
|
|
314
|
+
script: i.script,
|
|
315
|
+
value: i.value
|
|
316
|
+
});
|
|
317
|
+
return c.toHex();
|
|
318
|
+
}
|
|
319
|
+
function G(t, n) {
|
|
320
|
+
const e = { output: a.from(n) }, s = P.p2tr({
|
|
321
|
+
internalPubkey: a.from(t),
|
|
322
|
+
scriptTree: e
|
|
323
|
+
}).pubkey;
|
|
324
|
+
if (!s)
|
|
325
|
+
throw new Error("Failed to compute output key");
|
|
326
|
+
const r = 192, c = s[0] === 3 ? 1 : 0, i = r | c, u = new Uint8Array(1 + t.length);
|
|
327
|
+
return u[0] = i, u.set(t, 1), u;
|
|
328
|
+
}
|
|
329
|
+
async function st(t) {
|
|
330
|
+
const n = p(t.noPayoutTxHex), e = g.fromHex(n), { noPayoutScript: o, noPayoutControlBlock: s } = await W(
|
|
331
|
+
t.connectorParams,
|
|
332
|
+
t.challengerPubkey
|
|
333
|
+
), r = f(o), c = f(s), i = new w();
|
|
334
|
+
i.setVersion(e.version), i.setLocktime(e.locktime);
|
|
335
|
+
for (let u = 0; u < e.ins.length; u++) {
|
|
336
|
+
const d = e.ins[u], l = t.prevouts[u];
|
|
337
|
+
if (!l)
|
|
338
|
+
throw new Error(`Missing prevout data for input ${u}`);
|
|
339
|
+
const h = {
|
|
340
|
+
hash: d.hash,
|
|
341
|
+
index: d.index,
|
|
342
|
+
sequence: d.sequence,
|
|
343
|
+
witnessUtxo: {
|
|
344
|
+
script: a.from(f(p(l.script_pubkey))),
|
|
345
|
+
value: l.value
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
u === 0 && (h.tapLeafScript = [
|
|
349
|
+
{
|
|
350
|
+
leafVersion: 192,
|
|
351
|
+
script: a.from(r),
|
|
352
|
+
controlBlock: a.from(c)
|
|
353
|
+
}
|
|
354
|
+
], h.tapInternalKey = a.from(x)), i.addInput(h);
|
|
355
|
+
}
|
|
356
|
+
for (const u of e.outs)
|
|
357
|
+
i.addOutput({
|
|
358
|
+
script: u.script,
|
|
359
|
+
value: u.value
|
|
360
|
+
});
|
|
361
|
+
return i.toHex();
|
|
362
|
+
}
|
|
363
|
+
async function it(t) {
|
|
364
|
+
const n = p(t.challengeAssertTxHex), e = g.fromHex(n);
|
|
365
|
+
if (t.connectorParamsPerInput.length !== e.ins.length)
|
|
366
|
+
throw new Error(
|
|
367
|
+
`Expected ${e.ins.length} connector params, got ${t.connectorParamsPerInput.length}`
|
|
368
|
+
);
|
|
369
|
+
const o = await Promise.all(
|
|
370
|
+
t.connectorParamsPerInput.map((r) => N(r))
|
|
371
|
+
), s = new w();
|
|
372
|
+
s.setVersion(e.version), s.setLocktime(e.locktime);
|
|
373
|
+
for (let r = 0; r < e.ins.length; r++) {
|
|
374
|
+
const c = e.ins[r], i = t.prevouts[r];
|
|
375
|
+
if (!i)
|
|
376
|
+
throw new Error(`Missing prevout data for input ${r}`);
|
|
377
|
+
const { script: u, controlBlock: d } = o[r], l = f(u), h = f(d);
|
|
378
|
+
s.addInput({
|
|
379
|
+
hash: c.hash,
|
|
380
|
+
index: c.index,
|
|
381
|
+
sequence: c.sequence,
|
|
382
|
+
witnessUtxo: {
|
|
383
|
+
script: a.from(f(p(i.script_pubkey))),
|
|
384
|
+
value: i.value
|
|
385
|
+
},
|
|
386
|
+
tapLeafScript: [
|
|
387
|
+
{
|
|
388
|
+
leafVersion: 192,
|
|
389
|
+
script: a.from(l),
|
|
390
|
+
controlBlock: a.from(h)
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
tapInternalKey: a.from(x)
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
for (const r of e.outs)
|
|
397
|
+
s.addOutput({
|
|
398
|
+
script: r.script,
|
|
399
|
+
value: r.value
|
|
400
|
+
});
|
|
401
|
+
return s.toHex();
|
|
402
|
+
}
|
|
403
|
+
export {
|
|
404
|
+
nt as a,
|
|
405
|
+
Y as b,
|
|
406
|
+
rt as c,
|
|
407
|
+
st as d,
|
|
408
|
+
ot as e,
|
|
409
|
+
it as f,
|
|
410
|
+
F as g,
|
|
411
|
+
_ as h,
|
|
412
|
+
X as i,
|
|
413
|
+
f as j,
|
|
414
|
+
et as k,
|
|
415
|
+
Z as l,
|
|
416
|
+
q as m,
|
|
417
|
+
U as p,
|
|
418
|
+
p as s,
|
|
419
|
+
D as t,
|
|
420
|
+
v as u,
|
|
421
|
+
tt as v
|
|
422
|
+
};
|
|
423
|
+
//# sourceMappingURL=challengeAssert-DVErOd8l.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"challengeAssert-DVErOd8l.js","sources":["../src/tbv/core/primitives/psbt/pegin.ts","../src/tbv/core/primitives/scripts/payout.ts","../src/tbv/core/primitives/utils/bitcoin.ts","../src/tbv/core/primitives/psbt/payout.ts","../src/tbv/core/primitives/psbt/depositorPayout.ts","../src/tbv/core/primitives/psbt/noPayout.ts","../src/tbv/core/primitives/psbt/challengeAssert.ts"],"sourcesContent":["/**\n * Peg-in PSBT Builder Primitive\n *\n * This module provides pure functions for building unsigned peg-in PSBTs\n * by wrapping the WASM implementation from @babylonlabs-io/babylon-tbv-rust-wasm.\n *\n * @module primitives/psbt/pegin\n */\n\nimport {\n createPegInTransaction,\n type Network,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\n/**\n * Parameters for building an unsigned peg-in PSBT\n */\nexport interface PeginParams {\n /**\n * Depositor's BTC public key (x-only, 64-char hex without 0x prefix)\n */\n depositorPubkey: string;\n\n /**\n * Vault provider's BTC public key (x-only, 64-char hex)\n */\n vaultProviderPubkey: string;\n\n /**\n * Array of vault keeper BTC public keys (x-only, 64-char hex)\n */\n vaultKeeperPubkeys: string[];\n\n /**\n * Array of universal challenger BTC public keys (x-only, 64-char hex)\n */\n universalChallengerPubkeys: string[];\n\n /**\n * CSV timelock in blocks for the PegIn output\n */\n timelockPegin: number;\n\n /**\n * Amount to peg in (in satoshis)\n */\n pegInAmount: bigint;\n\n /**\n * Amount in satoshis for the depositor's claim output\n */\n depositorClaimValue: bigint;\n\n /**\n * Bitcoin network\n */\n network: Network;\n}\n\n/**\n * Result of building an unsigned peg-in PSBT\n */\nexport interface PeginPsbtResult {\n /**\n * Unsigned transaction hex\n *\n * Note: This is an unfunded transaction with no inputs and one output (the pegin output).\n * The caller is responsible for:\n * - Selecting UTXOs to fund the transaction\n * - Calculating transaction fees\n * - Adding inputs to cover pegInAmount + fees\n * - Adding a change output if needed\n * - Creating and signing the PSBT via wallet\n */\n psbtHex: string;\n\n /**\n * Transaction ID (will change after adding inputs and signing)\n */\n txid: string;\n\n /**\n * Vault script pubkey hex\n */\n vaultScriptPubKey: string;\n\n /**\n * Vault output value (in satoshis)\n */\n vaultValue: bigint;\n}\n\n/**\n * Build unsigned peg-in PSBT using WASM.\n *\n * This is a pure function that wraps the Rust WASM implementation.\n * It creates an unfunded Bitcoin transaction with no inputs and one output\n * (the peg-in output to the vault address).\n *\n * The returned transaction must be funded by the caller by:\n * 1. Selecting appropriate UTXOs from the wallet\n * 2. Calculating transaction fees based on selected inputs\n * 3. Adding inputs to cover pegInAmount + fees\n * 4. Adding a change output if the input value exceeds pegInAmount + fees\n * 5. Creating a PSBT and signing it via the wallet\n *\n * @param params - Peg-in parameters\n * @returns Unsigned PSBT and transaction details\n *\n * @throws If WASM initialization fails or parameters are invalid\n */\nexport async function buildPeginPsbt(\n params: PeginParams,\n): Promise<PeginPsbtResult> {\n // Call the WASM wrapper with the exact parameter names it expects\n const result = await createPegInTransaction({\n depositorPubkey: params.depositorPubkey,\n vaultProviderPubkey: params.vaultProviderPubkey,\n vaultKeeperPubkeys: params.vaultKeeperPubkeys,\n universalChallengerPubkeys: params.universalChallengerPubkeys,\n timelockPegin: params.timelockPegin,\n pegInAmount: params.pegInAmount,\n depositorClaimValue: params.depositorClaimValue,\n network: params.network,\n });\n\n return {\n psbtHex: result.txHex,\n txid: result.txid,\n vaultScriptPubKey: result.vaultScriptPubKey,\n vaultValue: result.vaultValue,\n };\n}\n","/**\n * Payout Script Generator Primitive\n *\n * This module provides pure functions for generating payout scripts and taproot information\n * by wrapping the WASM implementation from @babylonlabs-io/babylon-tbv-rust-wasm.\n *\n * The payout script is used for signing payout transactions in the vault system.\n * It defines the spending conditions for the vault output, enabling the depositor\n * to authorize payouts during the peg-in flow (Step 3).\n *\n * @remarks\n * This is a low-level primitive. For most use cases, prefer using {@link buildPayoutPsbt}\n * which handles script creation internally. For high-level wallet orchestration, use\n * PayoutManager from the managers module.\n *\n * @see {@link buildPayoutPsbt} - Higher-level function that uses this internally\n *\n * @module primitives/scripts/payout\n */\n\nimport {\n createPayoutConnector,\n type Network,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\n/**\n * Parameters for creating a payout script.\n *\n * These parameters define the participants in a vault and are used to generate\n * the taproot script that controls how funds can be spent from the vault.\n */\nexport interface PayoutScriptParams {\n /**\n * Depositor's BTC public key (x-only, 64-char hex without 0x prefix).\n *\n * This is the user depositing BTC into the vault. The depositor must sign\n * payout transactions to authorize fund distribution.\n */\n depositor: string;\n\n /**\n * Vault provider's BTC public key (x-only, 64-char hex without 0x prefix).\n *\n * The service provider managing vault operations. Also referred to as\n * \"claimer\" in the WASM layer.\n */\n vaultProvider: string;\n\n /**\n * Array of vault keeper BTC public keys (x-only, 64-char hex without 0x prefix).\n *\n * Vault keepers participate in vault operations and script spending conditions.\n */\n vaultKeepers: string[];\n\n /**\n * Array of universal challenger BTC public keys (x-only, 64-char hex without 0x prefix).\n *\n * These parties can challenge the vault under certain conditions.\n */\n universalChallengers: string[];\n\n /**\n * CSV timelock in blocks for the PegIn output.\n */\n timelockPegin: number;\n\n /**\n * Bitcoin network for script generation.\n *\n * Must match the network used for all other vault operations to ensure\n * address encoding compatibility.\n */\n network: Network;\n}\n\n/**\n * Result of creating a payout script.\n *\n * Contains all the taproot-related data needed for constructing and signing\n * payout transactions from the vault.\n */\nexport interface PayoutScriptResult {\n /**\n * The payout script hex used in taproot script path spending.\n *\n * This is the raw script bytes that define the spending conditions,\n * encoded as a hexadecimal string. Used when constructing the\n * tapLeafScript for PSBT signing.\n */\n payoutScript: string;\n\n /**\n * The taproot script hash (leaf hash) for the payout script.\n *\n * This is the tagged hash of the script used in taproot tree construction.\n * Required for computing the control block during script path spending.\n */\n taprootScriptHash: string;\n\n /**\n * The full scriptPubKey for the vault output address.\n *\n * This is the complete output script (OP_1 <32-byte-key>) that should be\n * used when creating the vault output in a peg-in transaction.\n */\n scriptPubKey: string;\n\n /**\n * The vault Bitcoin address derived from the script.\n *\n * A human-readable bech32m address (bc1p... for mainnet, tb1p... for testnet/signet)\n * that can be used to receive funds into the vault.\n */\n address: string;\n}\n\n/**\n * Create payout script and taproot information using WASM.\n *\n * This is a pure function that wraps the Rust WASM implementation.\n * The payout connector generates the necessary taproot scripts and information\n * required for signing payout transactions.\n *\n * @remarks\n * The generated script encodes spending conditions that require signatures from\n * the depositor and vault provider (or liquidators in challenge scenarios).\n * This script is used internally by {@link buildPayoutPsbt}.\n *\n * @param params - Payout script parameters defining vault participants and network\n * @returns Payout script and taproot information for PSBT construction\n *\n * @see {@link buildPayoutPsbt} - Use this for building complete payout PSBTs\n */\nexport async function createPayoutScript(\n params: PayoutScriptParams,\n): Promise<PayoutScriptResult> {\n // Call the WASM wrapper with the correct parameter structure\n const connector = await createPayoutConnector(\n {\n depositor: params.depositor,\n vaultProvider: params.vaultProvider,\n vaultKeepers: params.vaultKeepers,\n universalChallengers: params.universalChallengers,\n timelockPegin: params.timelockPegin,\n },\n params.network,\n );\n\n return {\n payoutScript: connector.payoutScript,\n taprootScriptHash: connector.taprootScriptHash,\n scriptPubKey: connector.scriptPubKey,\n address: connector.address,\n };\n}\n","/**\n * Bitcoin Utilities\n *\n * Common pure utility functions for Bitcoin operations including:\n * - Public key conversions (x-only format)\n * - Hex string manipulation\n * - Uint8Array conversions and validation\n * - Address derivation and validation\n *\n * All functions are pure (no side effects) and work in Node.js, browsers,\n * and serverless environments.\n *\n * @module primitives/utils/bitcoin\n */\n\nimport * as ecc from \"@bitcoin-js/tiny-secp256k1-asmjs\";\nimport { Buffer } from \"buffer\";\nimport { initEccLib, networks, payments } from \"bitcoinjs-lib\";\n\nimport type { Network } from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\n\n/**\n * Strip \"0x\" prefix from hex string if present.\n *\n * Bitcoin expects plain hex (no \"0x\" prefix), but frontend often uses\n * Ethereum-style \"0x\"-prefixed hex.\n *\n * @param hex - Hex string with or without \"0x\" prefix\n * @returns Hex string without \"0x\" prefix\n */\nexport function stripHexPrefix(hex: string): string {\n return hex.startsWith(\"0x\") ? hex.slice(2) : hex;\n}\n\n/**\n * Convert hex string to Uint8Array.\n *\n * @param hex - Hex string (with or without 0x prefix)\n * @returns Uint8Array\n * @throws If hex is invalid\n */\nexport function hexToUint8Array(hex: string): Uint8Array {\n const cleanHex = stripHexPrefix(hex);\n if (!isValidHexRaw(cleanHex)) {\n throw new Error(`Invalid hex string: ${hex}`);\n }\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < cleanHex.length; i += 2) {\n bytes[i / 2] = parseInt(cleanHex.slice(i, i + 2), 16);\n }\n return bytes;\n}\n\n/**\n * Convert Uint8Array to hex string (without 0x prefix).\n *\n * @param bytes - Uint8Array to convert\n * @returns Hex string without 0x prefix\n */\nexport function uint8ArrayToHex(bytes: Uint8Array): string {\n return Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n\n/**\n * Convert a 33-byte public key to 32-byte x-only format (removes first byte).\n *\n * Used for Taproot/Schnorr signatures which only need the x-coordinate.\n * If the input is already 32 bytes, returns it unchanged.\n *\n * @param pubKey - 33-byte or 32-byte public key\n * @returns 32-byte x-only public key\n */\nexport function toXOnly(pubKey: Uint8Array): Uint8Array {\n return pubKey.length === 32 ? pubKey : pubKey.slice(1, 33);\n}\n\n/**\n * Internal helper: Validate hex string format without stripping prefix\n *\n * @internal\n * @param hex - Hex string (must already have prefix stripped)\n * @returns true if valid hex string\n */\nfunction isValidHexRaw(hex: string): boolean {\n return /^[0-9a-fA-F]*$/.test(hex) && hex.length % 2 === 0;\n}\n\n/**\n * Process and convert a public key to x-only format (32 bytes hex).\n *\n * Handles:\n * - 0x prefix removal\n * - Hex character validation\n * - Length validation\n * - Conversion to x-only format\n *\n * Accepts:\n * - 64 hex chars (32 bytes) - already x-only\n * - 66 hex chars (33 bytes) - compressed pubkey\n * - 130 hex chars (65 bytes) - uncompressed pubkey\n *\n * @param publicKeyHex - Public key in hex format (with or without 0x prefix)\n * @returns X-only public key as 32 bytes hex string (without 0x prefix)\n * @throws If public key format is invalid or contains invalid hex characters\n */\nexport function processPublicKeyToXOnly(publicKeyHex: string): string {\n // Remove '0x' prefix if present\n const cleanHex = stripHexPrefix(publicKeyHex);\n\n // Validate hex characters early to prevent silent failures\n if (!isValidHexRaw(cleanHex)) {\n throw new Error(`Invalid hex characters in public key: ${publicKeyHex}`);\n }\n\n // If already 64 chars (32 bytes), it's already x-only format\n if (cleanHex.length === 64) {\n return cleanHex;\n }\n\n // Validate public key length (should be 66 chars for compressed or 130 for uncompressed)\n if (cleanHex.length !== 66 && cleanHex.length !== 130) {\n throw new Error(\n `Invalid public key length: ${cleanHex.length} (expected 64, 66, or 130 hex chars)`,\n );\n }\n\n const pubkeyBytes = hexToUint8Array(cleanHex);\n return uint8ArrayToHex(toXOnly(pubkeyBytes));\n}\n\n/**\n * Validate hex string format.\n *\n * Checks that the string contains only valid hexadecimal characters (0-9, a-f, A-F)\n * and has an even length (since each byte is represented by 2 hex characters).\n *\n * @param hex - String to validate (with or without 0x prefix)\n * @returns true if valid hex string\n */\nexport function isValidHex(hex: string): boolean {\n const cleanHex = stripHexPrefix(hex);\n return isValidHexRaw(cleanHex);\n}\n\n/**\n * Result of validating a wallet public key against an expected depositor public key.\n */\nexport interface WalletPubkeyValidationResult {\n /** Wallet's raw public key (as returned by wallet, may be compressed) */\n walletPubkeyRaw: string;\n /** Wallet's public key in x-only format (32 bytes, 64 hex chars) */\n walletPubkeyXOnly: string;\n /** The validated depositor public key (x-only format) */\n depositorPubkey: string;\n}\n\n/**\n * Validate that a wallet's public key matches the expected depositor public key.\n *\n * This function:\n * 1. Converts the wallet pubkey to x-only format\n * 2. Uses the expected depositor pubkey if provided, otherwise falls back to wallet pubkey\n * 3. Validates they match (case-insensitive)\n *\n * @param walletPubkeyRaw - Raw public key from wallet (may be compressed 66 chars or x-only 64 chars)\n * @param expectedDepositorPubkey - Expected depositor public key (x-only, optional)\n * @returns Validation result with both pubkey formats\n * @throws If wallet pubkey doesn't match expected depositor pubkey\n */\nexport function validateWalletPubkey(\n walletPubkeyRaw: string,\n expectedDepositorPubkey?: string,\n): WalletPubkeyValidationResult {\n const walletPubkeyXOnly = processPublicKeyToXOnly(walletPubkeyRaw);\n const depositorPubkey = expectedDepositorPubkey ?? walletPubkeyXOnly;\n\n if (walletPubkeyXOnly.toLowerCase() !== depositorPubkey.toLowerCase()) {\n throw new Error(\n `Wallet public key does not match vault depositor. ` +\n `Expected: ${depositorPubkey}, Got: ${walletPubkeyXOnly}. ` +\n `Please connect the wallet that was used to create this vault.`\n );\n }\n\n return { walletPubkeyRaw, walletPubkeyXOnly, depositorPubkey };\n}\n\n// ============================================================================\n// Address derivation and validation\n// ============================================================================\n\nlet eccInitialized = false;\n\nfunction ensureEcc(): void {\n if (!eccInitialized) {\n initEccLib(ecc);\n eccInitialized = true;\n }\n}\n\n/**\n * Map SDK network type to bitcoinjs-lib Network object.\n *\n * @param network - Network type (\"bitcoin\", \"testnet\", \"signet\", \"regtest\")\n * @returns bitcoinjs-lib Network object\n */\nexport function getNetwork(network: Network): networks.Network {\n switch (network) {\n case \"bitcoin\":\n return networks.bitcoin;\n case \"testnet\":\n case \"signet\":\n return networks.testnet;\n case \"regtest\":\n return networks.regtest;\n default:\n throw new Error(`Unknown network: ${network}`);\n }\n}\n\n/**\n * Derive a Taproot (P2TR) address from a public key.\n *\n * @param publicKeyHex - Compressed (66 hex) or x-only (64 hex) public key\n * @param network - Bitcoin network\n * @returns Taproot address (bc1p... / tb1p... / bcrt1p...)\n */\nexport function deriveTaprootAddress(\n publicKeyHex: string,\n network: Network,\n): string {\n ensureEcc();\n const xOnly = hexToUint8Array(processPublicKeyToXOnly(publicKeyHex));\n const { address } = payments.p2tr({\n internalPubkey: Buffer.from(xOnly),\n network: getNetwork(network),\n });\n if (!address) {\n throw new Error(\"Failed to derive taproot address from public key\");\n }\n return address;\n}\n\n/**\n * Derive a Native SegWit (P2WPKH) address from a compressed public key.\n *\n * @param publicKeyHex - Compressed public key (66 hex chars, with or without 0x prefix)\n * @param network - Bitcoin network\n * @returns Native SegWit address (bc1q... / tb1q... / bcrt1q...)\n * @throws If publicKeyHex is not a compressed public key (66 hex chars)\n */\nexport function deriveNativeSegwitAddress(\n publicKeyHex: string,\n network: Network,\n): string {\n const cleanHex = stripHexPrefix(publicKeyHex);\n if (cleanHex.length !== 66) {\n throw new Error(\n `Native SegWit requires a compressed public key (66 hex chars), got ${cleanHex.length}`,\n );\n }\n const { address } = payments.p2wpkh({\n pubkey: Buffer.from(hexToUint8Array(cleanHex)),\n network: getNetwork(network),\n });\n if (!address) {\n throw new Error(\n \"Failed to derive native segwit address from public key\",\n );\n }\n return address;\n}\n\n/**\n * Validate that a BTC address was derived from the given public key.\n *\n * Derives Taproot (P2TR) and Native SegWit (P2WPKH) addresses from the\n * public key and checks if the provided address matches any of them.\n *\n * When the input is an x-only key (64 hex chars), both possible compressed\n * keys (`02` + x and `03` + x) are tried for Native SegWit derivation,\n * since the y-parity is unknown.\n *\n * @param address - BTC address to validate\n * @param publicKeyHex - Public key from the wallet (x-only 64 or compressed 66 hex chars)\n * @param network - Bitcoin network\n * @returns true if the address matches the public key\n */\nexport function isAddressFromPublicKey(\n address: string,\n publicKeyHex: string,\n network: Network,\n): boolean {\n const cleanHex = stripHexPrefix(publicKeyHex);\n\n // P2TR — works with both x-only and compressed keys\n try {\n if (address === deriveTaprootAddress(cleanHex, network)) {\n return true;\n }\n } catch {\n // derivation failed, continue\n }\n\n // Build the list of compressed keys to try for P2WPKH\n const compressedKeys: string[] = [];\n if (cleanHex.length === 66) {\n compressedKeys.push(cleanHex);\n } else if (cleanHex.length === 64) {\n // x-only key — try both even (02) and odd (03) y-parity\n compressedKeys.push(`02${cleanHex}`, `03${cleanHex}`);\n }\n\n for (const key of compressedKeys) {\n try {\n if (address === deriveNativeSegwitAddress(key, network)) {\n return true;\n }\n } catch {\n // derivation failed, continue\n }\n }\n\n return false;\n}\n","/**\n * Payout PSBT Builder Primitives\n *\n * This module provides pure functions for building unsigned payout PSBTs and extracting\n * Schnorr signatures from signed PSBTs. It uses WASM-generated scripts from the payout\n * connector and bitcoinjs-lib for PSBT construction.\n *\n * The Payout transaction references the Assert transaction (input 1).\n *\n * @module primitives/psbt/payout\n */\n\nimport {\n type Network,\n tapInternalPubkey,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport * as ecc from \"@bitcoin-js/tiny-secp256k1-asmjs\";\nimport { Buffer } from \"buffer\";\nimport { initEccLib, payments, Psbt, Transaction } from \"bitcoinjs-lib\";\nimport { createPayoutScript } from \"../scripts/payout\";\nimport {\n hexToUint8Array,\n stripHexPrefix,\n uint8ArrayToHex,\n} from \"../utils/bitcoin\";\n\n// Initialize ECC library for bitcoinjs-lib\ninitEccLib(ecc);\n\n/**\n * Parameters for building an unsigned Payout PSBT\n *\n * Payout is used in the challenge path after Assert, when the claimer proves validity.\n * Input 1 references the Assert transaction.\n */\nexport interface PayoutParams {\n /**\n * Payout transaction hex (unsigned)\n * This is the transaction that needs to be signed by the depositor\n */\n payoutTxHex: string;\n\n /**\n * Assert transaction hex\n * Payout input 1 references Assert output 0\n */\n assertTxHex: string;\n\n /**\n * Peg-in transaction hex\n * This transaction created the vault output that we're spending\n */\n peginTxHex: string;\n\n /**\n * Depositor's BTC public key (x-only, 64-char hex without 0x prefix)\n */\n depositorBtcPubkey: string;\n\n /**\n * Vault provider's BTC public key (x-only, 64-char hex)\n */\n vaultProviderBtcPubkey: string;\n\n /**\n * Vault keeper BTC public keys (x-only, 64-char hex)\n */\n vaultKeeperBtcPubkeys: string[];\n\n /**\n * Universal challenger BTC public keys (x-only, 64-char hex)\n */\n universalChallengerBtcPubkeys: string[];\n\n /**\n * CSV timelock in blocks for the PegIn output.\n */\n timelockPegin: number;\n\n /**\n * Bitcoin network\n */\n network: Network;\n}\n\n/**\n * Result of building an unsigned payout PSBT\n */\nexport interface PayoutPsbtResult {\n /**\n * Unsigned PSBT hex ready for signing\n */\n psbtHex: string;\n}\n\n/**\n * Build unsigned Payout PSBT for depositor to sign.\n *\n * Payout is used in the **challenge path** when the claimer proves validity:\n * 1. Vault provider submits Claim transaction\n * 2. Challenge is raised during challenge period\n * 3. Claimer submits Assert transaction to prove validity\n * 4. Payout can be executed (references Assert tx)\n *\n * Payout transactions have the following structure:\n * - Input 0: from PeginTx output0 (signed by depositor)\n * - Input 1: from Assert output0 (NOT signed by depositor)\n *\n * @param params - Payout parameters\n * @returns Unsigned PSBT ready for depositor to sign\n *\n * @throws If payout transaction does not have exactly 2 inputs\n * @throws If input 0 does not reference the pegin transaction\n * @throws If input 1 does not reference the assert transaction\n * @throws If previous output is not found for either input\n */\nexport async function buildPayoutPsbt(\n params: PayoutParams,\n): Promise<PayoutPsbtResult> {\n // Normalize hex inputs (strip 0x prefix if present)\n const payoutTxHex = stripHexPrefix(params.payoutTxHex);\n const peginTxHex = stripHexPrefix(params.peginTxHex);\n const assertTxHex = stripHexPrefix(params.assertTxHex);\n\n // Get payout script from WASM\n const payoutConnector = await createPayoutScript({\n depositor: params.depositorBtcPubkey,\n vaultProvider: params.vaultProviderBtcPubkey,\n vaultKeepers: params.vaultKeeperBtcPubkeys,\n universalChallengers: params.universalChallengerBtcPubkeys,\n timelockPegin: params.timelockPegin,\n network: params.network,\n });\n\n const payoutScriptBytes = hexToUint8Array(payoutConnector.payoutScript);\n const controlBlock = computeControlBlock(tapInternalPubkey, payoutScriptBytes);\n\n // Parse transactions\n const payoutTx = Transaction.fromHex(payoutTxHex);\n const peginTx = Transaction.fromHex(peginTxHex);\n const assertTx = Transaction.fromHex(assertTxHex);\n\n // Create PSBT\n const psbt = new Psbt();\n psbt.setVersion(payoutTx.version);\n psbt.setLocktime(payoutTx.locktime);\n\n // PayoutTx has exactly 2 inputs:\n // - Input 0: from PeginTx output0 (signed by depositor using taproot script path)\n // - Input 1: from Assert output0 (signed by claimer/challengers, not depositor)\n //\n // IMPORTANT: For Taproot SIGHASH_DEFAULT (0x00), the sighash commits to ALL inputs'\n // prevouts, not just the one being signed. Therefore, we must include BOTH inputs\n // in the PSBT so the wallet computes the correct sighash that the VP expects.\n\n // Verify payout transaction has expected structure\n if (payoutTx.ins.length !== 2) {\n throw new Error(\n `Payout transaction must have exactly 2 inputs, got ${payoutTx.ins.length}`,\n );\n }\n\n const input0 = payoutTx.ins[0];\n const input1 = payoutTx.ins[1];\n\n // Verify input 0 references the pegin transaction\n const input0Txid = uint8ArrayToHex(\n new Uint8Array(input0.hash).slice().reverse(),\n );\n const peginTxid = peginTx.getId();\n\n if (input0Txid !== peginTxid) {\n throw new Error(\n `Input 0 does not reference pegin transaction. ` +\n `Expected ${peginTxid}, got ${input0Txid}`,\n );\n }\n\n // Verify input 1 references the assert transaction\n const input1Txid = uint8ArrayToHex(\n new Uint8Array(input1.hash).slice().reverse(),\n );\n const expectedInput1Txid = assertTx.getId();\n\n if (input1Txid !== expectedInput1Txid) {\n throw new Error(\n `Input 1 does not reference assert transaction. ` +\n `Expected ${expectedInput1Txid}, got ${input1Txid}`,\n );\n }\n\n const peginPrevOut = peginTx.outs[input0.index];\n if (!peginPrevOut) {\n throw new Error(\n `Previous output not found for input 0 (txid: ${input0Txid}, index: ${input0.index})`,\n );\n }\n\n const input1PrevOut = assertTx.outs[input1.index];\n if (!input1PrevOut) {\n throw new Error(\n `Previous output not found for input 1 (txid: ${input1Txid}, index: ${input1.index})`,\n );\n }\n\n // Input 0: Depositor signs using Taproot script path spend\n // This input includes tapLeafScript for signing\n psbt.addInput({\n hash: input0.hash,\n index: input0.index,\n sequence: input0.sequence,\n witnessUtxo: {\n script: peginPrevOut.script,\n value: peginPrevOut.value,\n },\n tapLeafScript: [\n {\n leafVersion: 0xc0,\n script: Buffer.from(payoutScriptBytes),\n controlBlock: Buffer.from(controlBlock),\n },\n ],\n tapInternalKey: Buffer.from(tapInternalPubkey),\n // sighashType omitted - defaults to SIGHASH_DEFAULT (0x00) for Taproot\n });\n\n // Input 1: From Assert transaction (NOT signed by depositor)\n // We include this with witnessUtxo so the sighash is computed correctly,\n // but we do NOT include tapLeafScript since the depositor doesn't sign it.\n psbt.addInput({\n hash: input1.hash,\n index: input1.index,\n sequence: input1.sequence,\n witnessUtxo: {\n script: input1PrevOut.script,\n value: input1PrevOut.value,\n },\n // No tapLeafScript - depositor doesn't sign this input\n });\n\n // Add outputs\n for (const output of payoutTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return {\n psbtHex: psbt.toHex(),\n };\n}\n\n/**\n * Extract Schnorr signature from signed payout PSBT.\n *\n * This function supports two cases:\n * 1. Non-finalized PSBT: Extracts from tapScriptSig field\n * 2. Finalized PSBT: Extracts from witness data\n *\n * The signature is returned as a 64-byte hex string (128 hex characters)\n * with any sighash flag byte removed if present.\n *\n * @param signedPsbtHex - Signed PSBT hex\n * @param depositorPubkey - Depositor's public key (x-only, 64-char hex)\n * @param inputIndex - Input index to extract signature from (default: 0)\n * @returns 64-byte Schnorr signature (128 hex characters, no sighash flag)\n *\n * @throws If no signature is found in the PSBT\n * @throws If the signature has an unexpected length\n */\nexport function extractPayoutSignature(\n signedPsbtHex: string,\n depositorPubkey: string,\n inputIndex = 0,\n): string {\n const signedPsbt = Psbt.fromHex(signedPsbtHex);\n\n if (inputIndex >= signedPsbt.data.inputs.length) {\n throw new Error(\n `Input index ${inputIndex} out of range (${signedPsbt.data.inputs.length} inputs)`,\n );\n }\n\n const input = signedPsbt.data.inputs[inputIndex];\n\n // Case 1: Non-finalized PSBT — extract from tapScriptSig\n if (input.tapScriptSig && input.tapScriptSig.length > 0) {\n const depositorPubkeyBytes = hexToUint8Array(depositorPubkey);\n\n for (const sigEntry of input.tapScriptSig) {\n if (sigEntry.pubkey.equals(Buffer.from(depositorPubkeyBytes))) {\n return extractSchnorrSig(sigEntry.signature, inputIndex);\n }\n }\n\n throw new Error(\n `No signature found for depositor pubkey: ${depositorPubkey} at input ${inputIndex}`,\n );\n }\n\n // Case 2: Finalized PSBT — extract from finalScriptWitness\n // Taproot script-path witness: [signature, script, controlBlock]\n if (input.finalScriptWitness && input.finalScriptWitness.length > 0) {\n const witnessStack = parseWitnessStack(input.finalScriptWitness);\n if (witnessStack.length >= 1) {\n return extractSchnorrSig(witnessStack[0], inputIndex);\n }\n }\n\n throw new Error(\n `No tapScriptSig or finalScriptWitness found in signed PSBT at input ${inputIndex}`,\n );\n}\n\n/**\n * Extract and validate a 64-byte Schnorr signature, stripping sighash flag if present.\n * @internal\n */\nfunction extractSchnorrSig(sig: Uint8Array, inputIndex: number): string {\n if (sig.length === 64) {\n return uint8ArrayToHex(new Uint8Array(sig));\n } else if (sig.length === 65) {\n return uint8ArrayToHex(new Uint8Array(sig.subarray(0, 64)));\n }\n throw new Error(\n `Unexpected signature length at input ${inputIndex}: ${sig.length}`,\n );\n}\n\n/**\n * Parse a BIP-141 serialized witness stack into individual stack items.\n * Format: [varint item_count] [varint len, data]...\n * @internal\n */\nfunction parseWitnessStack(witness: Buffer): Buffer[] {\n const items: Buffer[] = [];\n let offset = 0;\n\n const readVarInt = (): number => {\n const first = witness[offset++];\n if (first < 0xfd) return first;\n if (first === 0xfd) {\n const val = witness[offset] | (witness[offset + 1] << 8);\n offset += 2;\n return val;\n }\n if (first === 0xfe) {\n const val =\n witness[offset] |\n (witness[offset + 1] << 8) |\n (witness[offset + 2] << 16) |\n (witness[offset + 3] << 24);\n offset += 4;\n return val;\n }\n // 0xff — 8-byte, won't happen for witness data\n offset += 8;\n return 0;\n };\n\n const count = readVarInt();\n for (let i = 0; i < count; i++) {\n const len = readVarInt();\n items.push(witness.subarray(offset, offset + len) as Buffer);\n offset += len;\n }\n\n return items;\n}\n\n/**\n * Compute control block for Taproot script path spend.\n *\n * For a single script (no tree), the control block format is:\n * [leaf_version | parity] || [internal_key_x_only]\n *\n * The leaf version for Tapscript is 0xc0, and the parity bit indicates\n * whether the output key has an odd or even y-coordinate.\n *\n * @param internalKey - Taproot internal public key (x-only, 32 bytes)\n * @param script - Taproot script to compute control block for\n * @returns Control block buffer\n *\n * @internal\n */\nfunction computeControlBlock(\n internalKey: Uint8Array,\n script: Uint8Array,\n): Uint8Array {\n // Convert to actual Buffer instances for bitcoinjs-lib runtime type checks\n const scriptTree = { output: Buffer.from(script) };\n const payment = payments.p2tr({\n internalPubkey: Buffer.from(internalKey),\n scriptTree,\n });\n\n const outputKey = payment.pubkey;\n if (!outputKey) {\n throw new Error(\"Failed to compute output key\");\n }\n\n // Control block: [leaf_version | parity] || [internal_key_x_only]\n const leafVersion = 0xc0;\n const parity = outputKey[0] === 0x03 ? 1 : 0; // 0x02 = even, 0x03 = odd\n const controlByte = leafVersion | parity;\n\n const result = new Uint8Array(1 + internalKey.length);\n result[0] = controlByte;\n result.set(internalKey, 1);\n return result;\n}\n","/**\n * Depositor Payout PSBT Builder\n *\n * Builds unsigned PSBTs for the depositor's own Payout transaction\n * (depositor-as-claimer path). The depositor signs input 0 using the\n * payout taproot script from WasmPeginPayoutConnector (PegIn vault UTXO).\n *\n * Input 0 spends PegIn:0 (the vault UTXO) — the same connector used for\n * VP/VK payout signing. The VP verifies this signature using the\n * PeginPayoutConnector's payout script.\n *\n * @module primitives/psbt/depositorPayout\n * @see btc-vault crates/vault/src/sign.rs — verify_depositor_signature / get_payout_tap_leaf_hash\n */\n\nimport {\n type PayoutConnectorParams,\n getPeginPayoutScript,\n tapInternalPubkey,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport * as ecc from \"@bitcoin-js/tiny-secp256k1-asmjs\";\nimport { Buffer } from \"buffer\";\nimport { initEccLib, payments, Psbt, Transaction } from \"bitcoinjs-lib\";\n\nimport {\n hexToUint8Array,\n stripHexPrefix,\n} from \"../utils/bitcoin\";\n\n// Initialize ECC library for bitcoinjs-lib\ninitEccLib(ecc);\n\n/**\n * Parameters for building a depositor Payout PSBT\n */\nexport interface DepositorPayoutParams {\n /** Payout transaction hex (unsigned) from VP */\n payoutTxHex: string;\n /** Prevouts for all inputs [{script_pubkey, value}] from VP */\n prevouts: Array<{ script_pubkey: string; value: number }>;\n /** Parameters for the PeginPayout connector (depositor, VP, VKs, UCs, timelock) */\n connectorParams: PayoutConnectorParams;\n}\n\n/**\n * Build unsigned depositor Payout PSBT.\n *\n * The depositor's payout transaction has 2 inputs:\n * - Input 0: PegIn:0 (vault UTXO) — depositor signs using PeginPayoutConnector payout script\n * - Input 1: Assert:0 — NOT signed by depositor\n *\n * @param params - Depositor payout parameters\n * @returns Unsigned PSBT hex ready for signing\n */\nexport async function buildDepositorPayoutPsbt(\n params: DepositorPayoutParams,\n): Promise<string> {\n const payoutTxHex = stripHexPrefix(params.payoutTxHex);\n const payoutTx = Transaction.fromHex(payoutTxHex);\n\n // Get payout script from WASM (PeginPayoutConnector — same as VP/VK payout)\n const payoutScriptHex = await getPeginPayoutScript(params.connectorParams);\n const scriptBytes = hexToUint8Array(payoutScriptHex);\n const controlBlock = computeControlBlock(tapInternalPubkey, scriptBytes);\n\n const psbt = new Psbt();\n psbt.setVersion(payoutTx.version);\n psbt.setLocktime(payoutTx.locktime);\n\n // Add all inputs - depositor signs input 0 only\n for (let i = 0; i < payoutTx.ins.length; i++) {\n const input = payoutTx.ins[i];\n const prevout = params.prevouts[i];\n\n if (!prevout) {\n throw new Error(`Missing prevout data for input ${i}`);\n }\n\n const inputData: Parameters<typeof psbt.addInput>[0] = {\n hash: input.hash,\n index: input.index,\n sequence: input.sequence,\n witnessUtxo: {\n script: Buffer.from(hexToUint8Array(stripHexPrefix(prevout.script_pubkey))),\n value: prevout.value,\n },\n };\n\n // Input 0: depositor signs using taproot script path\n if (i === 0) {\n inputData.tapLeafScript = [\n {\n leafVersion: 0xc0,\n script: Buffer.from(scriptBytes),\n controlBlock: Buffer.from(controlBlock),\n },\n ];\n inputData.tapInternalKey = Buffer.from(tapInternalPubkey);\n }\n\n psbt.addInput(inputData);\n }\n\n // Add outputs\n for (const output of payoutTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return psbt.toHex();\n}\n\n/**\n * Compute control block for Taproot script path spend.\n * @internal\n */\nfunction computeControlBlock(\n internalKey: Uint8Array,\n script: Uint8Array,\n): Uint8Array {\n const scriptTree = { output: Buffer.from(script) };\n const payment = payments.p2tr({\n internalPubkey: Buffer.from(internalKey),\n scriptTree,\n });\n\n const outputKey = payment.pubkey;\n if (!outputKey) {\n throw new Error(\"Failed to compute output key\");\n }\n\n const leafVersion = 0xc0;\n const parity = outputKey[0] === 0x03 ? 1 : 0;\n const controlByte = leafVersion | parity;\n\n const result = new Uint8Array(1 + internalKey.length);\n result[0] = controlByte;\n result.set(internalKey, 1);\n return result;\n}\n","/**\n * NoPayout PSBT Builder\n *\n * Builds unsigned PSBTs for the depositor's NoPayout transaction\n * (depositor-as-claimer path, per challenger). The depositor signs input 0\n * using the NoPayout taproot script from WasmAssertPayoutNoPayoutConnector.\n *\n * @module primitives/psbt/noPayout\n * @see btc-vault crates/vault/docs/btc-transactions-spec.md — Assert output 0 NoPayout connector\n */\n\nimport {\n type AssertPayoutNoPayoutConnectorParams,\n getAssertNoPayoutScriptInfo,\n tapInternalPubkey,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction } from \"bitcoinjs-lib\";\n\nimport {\n hexToUint8Array,\n stripHexPrefix,\n} from \"../utils/bitcoin\";\n\n/**\n * Parameters for building a NoPayout PSBT\n */\nexport interface NoPayoutParams {\n /** NoPayout transaction hex (unsigned) from VP */\n noPayoutTxHex: string;\n /** Challenger's x-only public key (hex encoded) */\n challengerPubkey: string;\n /** Prevouts for all inputs [{script_pubkey, value}] from VP */\n prevouts: Array<{ script_pubkey: string; value: number }>;\n /** Parameters for the Assert Payout/NoPayout connector */\n connectorParams: AssertPayoutNoPayoutConnectorParams;\n}\n\n/**\n * Build unsigned NoPayout PSBT.\n *\n * The NoPayout transaction is specific to each challenger.\n * Input 0 is the one the depositor signs using the NoPayout taproot script path.\n *\n * @param params - NoPayout parameters\n * @returns Unsigned PSBT hex ready for signing\n */\nexport async function buildNoPayoutPsbt(\n params: NoPayoutParams,\n): Promise<string> {\n const noPayoutTxHex = stripHexPrefix(params.noPayoutTxHex);\n const noPayoutTx = Transaction.fromHex(noPayoutTxHex);\n\n // Get NoPayout script and control block for this challenger\n const { noPayoutScript, noPayoutControlBlock } =\n await getAssertNoPayoutScriptInfo(\n params.connectorParams,\n params.challengerPubkey,\n );\n\n const scriptBytes = hexToUint8Array(noPayoutScript);\n const controlBlockBytes = hexToUint8Array(noPayoutControlBlock);\n\n const psbt = new Psbt();\n psbt.setVersion(noPayoutTx.version);\n psbt.setLocktime(noPayoutTx.locktime);\n\n // Add all inputs - depositor signs input 0 only\n for (let i = 0; i < noPayoutTx.ins.length; i++) {\n const input = noPayoutTx.ins[i];\n const prevout = params.prevouts[i];\n\n if (!prevout) {\n throw new Error(`Missing prevout data for input ${i}`);\n }\n\n const inputData: Parameters<typeof psbt.addInput>[0] = {\n hash: input.hash,\n index: input.index,\n sequence: input.sequence,\n witnessUtxo: {\n script: Buffer.from(hexToUint8Array(stripHexPrefix(prevout.script_pubkey))),\n value: prevout.value,\n },\n };\n\n // Input 0: depositor signs using taproot script path\n if (i === 0) {\n inputData.tapLeafScript = [\n {\n leafVersion: 0xc0,\n script: Buffer.from(scriptBytes),\n controlBlock: Buffer.from(controlBlockBytes),\n },\n ];\n inputData.tapInternalKey = Buffer.from(tapInternalPubkey);\n }\n\n psbt.addInput(inputData);\n }\n\n // Add outputs\n for (const output of noPayoutTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return psbt.toHex();\n}\n","/**\n * ChallengeAssert PSBT Builder\n *\n * Builds an unsigned PSBT for a ChallengeAssert transaction\n * (depositor-as-claimer path, per challenger). The ChallengeAssert tx has\n * NUM_UTXOS_FOR_CHALLENGE_ASSERT (3) inputs, each spending a different Assert\n * output segment. The depositor signs ALL inputs, each with its own taproot\n * script derived from the per-segment connector params.\n *\n * @module primitives/psbt/challengeAssert\n * @see btc-vault crates/vault/docs/btc-transactions-spec.md — ChallengeAssert connector (NUM_UTXOS_FOR_CHALLENGE_ASSERT=3)\n */\n\nimport {\n type ChallengeAssertConnectorParams,\n getChallengeAssertScriptInfo,\n tapInternalPubkey,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction } from \"bitcoinjs-lib\";\n\nimport {\n hexToUint8Array,\n stripHexPrefix,\n} from \"../utils/bitcoin\";\n\n/**\n * Parameters for building a ChallengeAssert PSBT\n */\nexport interface ChallengeAssertParams {\n /** ChallengeAssert transaction hex (unsigned) from VP */\n challengeAssertTxHex: string;\n /** Prevouts for all inputs [{script_pubkey, value}] from VP (flat, one per input) */\n prevouts: Array<{ script_pubkey: string; value: number }>;\n /** Per-input connector params (one per input/segment, determines the taproot script) */\n connectorParamsPerInput: ChallengeAssertConnectorParams[];\n}\n\n/**\n * Build unsigned ChallengeAssert PSBT.\n *\n * The ChallengeAssert transaction has 3 inputs (one per Assert output segment).\n * Each input has its own taproot script derived from its connector params.\n * The depositor signs all inputs.\n *\n * @param params - ChallengeAssert parameters\n * @returns Unsigned PSBT hex ready for signing\n */\nexport async function buildChallengeAssertPsbt(\n params: ChallengeAssertParams,\n): Promise<string> {\n const challengeAssertTxHex = stripHexPrefix(params.challengeAssertTxHex);\n const challengeAssertTx = Transaction.fromHex(challengeAssertTxHex);\n\n if (params.connectorParamsPerInput.length !== challengeAssertTx.ins.length) {\n throw new Error(\n `Expected ${challengeAssertTx.ins.length} connector params, got ${params.connectorParamsPerInput.length}`,\n );\n }\n\n // Get script and control block for each input from WASM\n const scriptInfos = await Promise.all(\n params.connectorParamsPerInput.map((cp) => getChallengeAssertScriptInfo(cp)),\n );\n\n const psbt = new Psbt();\n psbt.setVersion(challengeAssertTx.version);\n psbt.setLocktime(challengeAssertTx.locktime);\n\n // Add all inputs — depositor signs every input\n for (let i = 0; i < challengeAssertTx.ins.length; i++) {\n const input = challengeAssertTx.ins[i];\n const prevout = params.prevouts[i];\n\n if (!prevout) {\n throw new Error(`Missing prevout data for input ${i}`);\n }\n\n const { script, controlBlock } = scriptInfos[i];\n const scriptBytes = hexToUint8Array(script);\n const controlBlockBytes = hexToUint8Array(controlBlock);\n\n psbt.addInput({\n hash: input.hash,\n index: input.index,\n sequence: input.sequence,\n witnessUtxo: {\n script: Buffer.from(hexToUint8Array(stripHexPrefix(prevout.script_pubkey))),\n value: prevout.value,\n },\n tapLeafScript: [\n {\n leafVersion: 0xc0,\n script: Buffer.from(scriptBytes),\n controlBlock: Buffer.from(controlBlockBytes),\n },\n ],\n tapInternalKey: Buffer.from(tapInternalPubkey),\n });\n }\n\n // Add outputs\n for (const output of challengeAssertTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return psbt.toHex();\n}\n"],"names":["buildPeginPsbt","params","result","createPegInTransaction","createPayoutScript","connector","createPayoutConnector","stripHexPrefix","hex","hexToUint8Array","cleanHex","isValidHexRaw","bytes","i","uint8ArrayToHex","b","toXOnly","pubKey","processPublicKeyToXOnly","publicKeyHex","pubkeyBytes","isValidHex","validateWalletPubkey","walletPubkeyRaw","expectedDepositorPubkey","walletPubkeyXOnly","depositorPubkey","eccInitialized","ensureEcc","initEccLib","ecc","getNetwork","network","networks","deriveTaprootAddress","xOnly","address","payments","Buffer","deriveNativeSegwitAddress","isAddressFromPublicKey","compressedKeys","key","buildPayoutPsbt","payoutTxHex","peginTxHex","assertTxHex","payoutConnector","payoutScriptBytes","controlBlock","computeControlBlock","tapInternalPubkey","payoutTx","Transaction","peginTx","assertTx","psbt","Psbt","input0","input1","input0Txid","peginTxid","input1Txid","expectedInput1Txid","peginPrevOut","input1PrevOut","output","extractPayoutSignature","signedPsbtHex","inputIndex","signedPsbt","input","depositorPubkeyBytes","sigEntry","extractSchnorrSig","witnessStack","parseWitnessStack","sig","witness","items","offset","readVarInt","first","val","count","len","internalKey","script","scriptTree","outputKey","leafVersion","parity","controlByte","buildDepositorPayoutPsbt","payoutScriptHex","getPeginPayoutScript","scriptBytes","prevout","inputData","buildNoPayoutPsbt","noPayoutTxHex","noPayoutTx","noPayoutScript","noPayoutControlBlock","getAssertNoPayoutScriptInfo","controlBlockBytes","buildChallengeAssertPsbt","challengeAssertTxHex","challengeAssertTx","scriptInfos","cp","getChallengeAssertScriptInfo"],"mappings":";;;;AA+GA,eAAsBA,EACpBC,GAC0B;AAE1B,QAAMC,IAAS,MAAMC,EAAuB;AAAA,IAC1C,iBAAiBF,EAAO;AAAA,IACxB,qBAAqBA,EAAO;AAAA,IAC5B,oBAAoBA,EAAO;AAAA,IAC3B,4BAA4BA,EAAO;AAAA,IACnC,eAAeA,EAAO;AAAA,IACtB,aAAaA,EAAO;AAAA,IACpB,qBAAqBA,EAAO;AAAA,IAC5B,SAASA,EAAO;AAAA,EAAA,CACjB;AAED,SAAO;AAAA,IACL,SAASC,EAAO;AAAA,IAChB,MAAMA,EAAO;AAAA,IACb,mBAAmBA,EAAO;AAAA,IAC1B,YAAYA,EAAO;AAAA,EAAA;AAEvB;ACEA,eAAsBE,EACpBH,GAC6B;AAE7B,QAAMI,IAAY,MAAMC;AAAA,IACtB;AAAA,MACE,WAAWL,EAAO;AAAA,MAClB,eAAeA,EAAO;AAAA,MACtB,cAAcA,EAAO;AAAA,MACrB,sBAAsBA,EAAO;AAAA,MAC7B,eAAeA,EAAO;AAAA,IAAA;AAAA,IAExBA,EAAO;AAAA,EAAA;AAGT,SAAO;AAAA,IACL,cAAcI,EAAU;AAAA,IACxB,mBAAmBA,EAAU;AAAA,IAC7B,cAAcA,EAAU;AAAA,IACxB,SAASA,EAAU;AAAA,EAAA;AAEvB;AC7HO,SAASE,EAAeC,GAAqB;AAClD,SAAOA,EAAI,WAAW,IAAI,IAAIA,EAAI,MAAM,CAAC,IAAIA;AAC/C;AASO,SAASC,EAAgBD,GAAyB;AACvD,QAAME,IAAWH,EAAeC,CAAG;AACnC,MAAI,CAACG,EAAcD,CAAQ;AACzB,UAAM,IAAI,MAAM,uBAAuBF,CAAG,EAAE;AAE9C,QAAMI,IAAQ,IAAI,WAAWF,EAAS,SAAS,CAAC;AAChD,WAASG,IAAI,GA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CAAM,GACpCkB,IAAoBhG,EAAgBwC,CAAY;AAEtD,IAAAO,EAAK,SAAS;AAAA,MACZ,MAAMe,EAAM;AAAA,MACZ,OAAOA,EAAM;AAAA,MACb,UAAUA,EAAM;AAAA,MAChB,aAAa;AAAA,QACX,QAAQjC,EAAO,KAAK7B,EAAgBF,EAAe0F,EAAQ,aAAa,CAAC,CAAC;AAAA,QAC1E,OAAOA,EAAQ;AAAA,MAAA;AAAA,MAEjB,eAAe;AAAA,QACb;AAAA,UACE,aAAa;AAAA,UACb,QAAQ3D,EAAO,KAAK0D,CAAW;AAAA,UAC/B,cAAc1D,EAAO,KAAKmE,CAAiB;AAAA,QAAA;AAAA,MAC7C;AAAA,MAEF,gBAAgBnE,EAAO,KAAKa,CAAiB;AAAA,IAAA,CAC9C;AAAA,EACH;AAGA,aAAWe,KAAU0C,EAAkB;AACrC,IAAApD,EAAK,UAAU;AAAA,MACb,QAAQU,EAAO;AAAA,MACf,OAAOA,EAAO;AAAA,IAAA,CACf;AAGH,SAAOV,EAAK,MAAA;AACd;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./MockEthereumWallet-CKQlH2AM.cjs"),t=require("./challengeAssert-34HqeVFH.cjs"),e=require("./PayoutManager-Dg_i_S7w.cjs");exports.MockBitcoinWallet=r.MockBitcoinWallet;exports.MockEthereumWallet=r.MockEthereumWallet;exports.buildChallengeAssertPsbt=t.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=t.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=t.buildNoPayoutPsbt;exports.buildPayoutPsbt=t.buildPayoutPsbt;exports.buildPeginPsbt=t.buildPeginPsbt;exports.createPayoutScript=t.createPayoutScript;exports.deriveNativeSegwitAddress=t.deriveNativeSegwitAddress;exports.deriveTaprootAddress=t.deriveTaprootAddress;exports.extractPayoutSignature=t.extractPayoutSignature;exports.getNetwork=t.getNetwork;exports.hexToUint8Array=t.hexToUint8Array;exports.isAddressFromPublicKey=t.isAddressFromPublicKey;exports.isValidHex=t.isValidHex;exports.processPublicKeyToXOnly=t.processPublicKeyToXOnly;exports.stripHexPrefix=t.stripHexPrefix;exports.toXOnly=t.toXOnly;exports.uint8ArrayToHex=t.uint8ArrayToHex;exports.validateWalletPubkey=t.validateWalletPubkey;exports.BTCVaultsManagerABI=e.BTCVaultsManagerABI;exports.BTC_DUST_SAT=e.BTC_DUST_SAT;exports.BitcoinScriptType=e.BitcoinScriptType;exports.CONTRACT_ERRORS=e.CONTRACT_ERRORS;exports.DUST_THRESHOLD=e.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=e.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=e.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=e.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MEMPOOL_API_URLS=e.MEMPOOL_API_URLS;exports.P2TR_INPUT_SIZE=e.P2TR_INPUT_SIZE;exports.PayoutManager=e.PayoutManager;exports.PeginManager=e.PeginManager;exports.TX_BUFFER_SIZE_OVERHEAD=e.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=e.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.createSplitTransaction=e.createSplitTransaction;exports.createSplitTransactionPsbt=e.createSplitTransactionPsbt;exports.extractErrorData=e.extractErrorData;exports.fundPeginTransaction=e.fundPeginTransaction;exports.getAddressTxs=e.getAddressTxs;exports.getAddressUtxos=e.getAddressUtxos;exports.getContractErrorMessage=e.getContractErrorMessage;exports.getDustThreshold=e.getDustThreshold;exports.getMempoolApiUrl=e.getMempoolApiUrl;exports.getNetworkFees=e.getNetworkFees;exports.getPsbtInputFields=e.getPsbtInputFields;exports.getScriptType=e.getScriptType;exports.getTxHex=e.getTxHex;exports.getTxInfo=e.getTxInfo;exports.getUtxoInfo=e.getUtxoInfo;exports.handleContractError=e.handleContractError;exports.isKnownContractError=e.isKnownContractError;exports.parseUnfundedWasmTransaction=e.parseUnfundedWasmTransaction;exports.pushTx=e.pushTx;exports.rateBasedTxBufferFee=e.rateBasedTxBufferFee;exports.selectUtxosForPegin=e.selectUtxosForPegin;exports.shouldAddChangeOutput=e.shouldAddChangeOutput;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
import { M as e, a as t } from "./MockEthereumWallet-ibdry7pZ.js";
|
|
2
|
+
import { f as o, c as i, d as T, a as n, b as l, g as d, h as u, i as c, e as E, m as A, j as P, k as g, l as _, p, s as x, t as S, u as b, v as y } from "./challengeAssert-DVErOd8l.js";
|
|
3
|
+
import { x as U, B as C, e as M, C as O, D as F, F as f, L as h, M as I, v as B, P as H, k as L, j as N, T as m, W as D, c as k, b as W, d as v, y as w, f as X, l as Y, m as K, z as V, g as Z, n as j, o as G, i as q, h as z, q as J, t as Q, u as $, E as aa, A as sa, p as ea, w as ta, r as ra, s as oa, a as ia } from "./PayoutManager-rMj54HDh.js";
|
|
4
|
+
export {
|
|
5
|
+
U as BTCVaultsManagerABI,
|
|
6
|
+
C as BTC_DUST_SAT,
|
|
7
|
+
M as BitcoinScriptType,
|
|
8
|
+
O as CONTRACT_ERRORS,
|
|
9
|
+
F as DUST_THRESHOLD,
|
|
10
|
+
f as FEE_SAFETY_MARGIN,
|
|
11
|
+
h as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
12
|
+
I as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
13
|
+
B as MEMPOOL_API_URLS,
|
|
14
|
+
e as MockBitcoinWallet,
|
|
15
|
+
t as MockEthereumWallet,
|
|
16
|
+
H as P2TR_INPUT_SIZE,
|
|
17
|
+
L as PayoutManager,
|
|
18
|
+
N as PeginManager,
|
|
19
|
+
m as TX_BUFFER_SIZE_OVERHEAD,
|
|
20
|
+
D as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
21
|
+
o as buildChallengeAssertPsbt,
|
|
22
|
+
i as buildDepositorPayoutPsbt,
|
|
23
|
+
T as buildNoPayoutPsbt,
|
|
24
|
+
n as buildPayoutPsbt,
|
|
25
|
+
l as buildPeginPsbt,
|
|
26
|
+
k as calculateBtcTxHash,
|
|
27
|
+
d as createPayoutScript,
|
|
28
|
+
W as createSplitTransaction,
|
|
29
|
+
v as createSplitTransactionPsbt,
|
|
30
|
+
u as deriveNativeSegwitAddress,
|
|
31
|
+
c as deriveTaprootAddress,
|
|
32
|
+
w as extractErrorData,
|
|
33
|
+
E as extractPayoutSignature,
|
|
34
|
+
X as fundPeginTransaction,
|
|
35
|
+
Y as getAddressTxs,
|
|
36
|
+
K as getAddressUtxos,
|
|
37
|
+
V as getContractErrorMessage,
|
|
38
|
+
Z as getDustThreshold,
|
|
39
|
+
j as getMempoolApiUrl,
|
|
40
|
+
A as getNetwork,
|
|
41
|
+
G as getNetworkFees,
|
|
42
|
+
q as getPsbtInputFields,
|
|
43
|
+
z as getScriptType,
|
|
44
|
+
J as getTxHex,
|
|
45
|
+
Q as getTxInfo,
|
|
46
|
+
$ as getUtxoInfo,
|
|
47
|
+
aa as handleContractError,
|
|
48
|
+
P as hexToUint8Array,
|
|
49
|
+
g as isAddressFromPublicKey,
|
|
50
|
+
sa as isKnownContractError,
|
|
51
|
+
_ as isValidHex,
|
|
52
|
+
ea as parseUnfundedWasmTransaction,
|
|
53
|
+
p as processPublicKeyToXOnly,
|
|
54
|
+
ta as pushTx,
|
|
55
|
+
ra as rateBasedTxBufferFee,
|
|
56
|
+
oa as selectUtxosForPegin,
|
|
57
|
+
ia as shouldAddChangeOutput,
|
|
58
|
+
x as stripHexPrefix,
|
|
59
|
+
S as toXOnly,
|
|
60
|
+
b as uint8ArrayToHex,
|
|
61
|
+
y as validateWalletPubkey
|
|
62
|
+
};
|
|
2
63
|
//# 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":";;;"}
|
package/dist/shared/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../MockEthereumWallet-CKQlH2AM.cjs");exports.MockBitcoinWallet=e.MockBitcoinWallet;exports.MockEthereumWallet=e.MockEthereumWallet;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export type { BitcoinNetwork, BitcoinWallet, Hash, SignPsbtOptions, } from './wallets';
|
|
2
|
+
export { MockBitcoinWallet, MockEthereumWallet } from './wallets';
|
|
3
|
+
export type { MockBitcoinWalletConfig, MockEthereumWalletConfig, } from './wallets';
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,cAAc,EACd,aAAa,EACb,IAAI,EACJ,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAElE,YAAY,EACV,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,WAAW,CAAC"}
|
package/dist/shared/index.js
CHANGED
package/dist/shared/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":";"}
|