@babylonlabs-io/ts-sdk 0.52.0 → 0.55.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/ApplicationRegistry.abi-CLaa6E99.cjs +2 -0
- package/dist/ApplicationRegistry.abi-CLaa6E99.cjs.map +1 -0
- package/dist/{ApplicationRegistry.abi-Dn2qk6JG.js → ApplicationRegistry.abi-w5prf7Ig.js} +14 -1
- package/dist/ApplicationRegistry.abi-w5prf7Ig.js.map +1 -0
- package/dist/PayoutManager-BJmPnyRP.js +260 -0
- package/dist/PayoutManager-BJmPnyRP.js.map +1 -0
- package/dist/PayoutManager-aqtsj60t.cjs +2 -0
- package/dist/PayoutManager-aqtsj60t.cjs.map +1 -0
- package/dist/{PeginManager-BGWNJYPk.js → PeginManager-D22MLWfM.js} +132 -144
- package/dist/PeginManager-D22MLWfM.js.map +1 -0
- package/dist/PeginManager-vUUfZCzj.cjs +2 -0
- package/dist/PeginManager-vUUfZCzj.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-BAT5A6MP.js → buildAndBroadcastRefund-BiSO4zg2.js} +358 -360
- package/dist/buildAndBroadcastRefund-BiSO4zg2.js.map +1 -0
- package/dist/buildAndBroadcastRefund-Bwi1I5we.cjs +2 -0
- package/dist/buildAndBroadcastRefund-Bwi1I5we.cjs.map +1 -0
- package/dist/{challengeAssert-HNbugpqL.cjs → challengeAssert-DLQfNcfU.cjs} +2 -2
- package/dist/{challengeAssert-HNbugpqL.cjs.map → challengeAssert-DLQfNcfU.cjs.map} +1 -1
- package/dist/{challengeAssert-csvYXBJB.js → challengeAssert-DvdbpEDY.js} +2 -2
- package/dist/{challengeAssert-csvYXBJB.js.map → challengeAssert-DvdbpEDY.js.map} +1 -1
- package/dist/constants-BhclpREj.js +19 -0
- package/dist/constants-BhclpREj.js.map +1 -0
- package/dist/constants-CvbARMl-.cjs +2 -0
- package/dist/constants-CvbARMl-.cjs.map +1 -0
- package/dist/{fundPeginTransaction-96FxwYYJ.js → fundPeginTransaction-B2wyjqp0.js} +21 -22
- package/dist/fundPeginTransaction-B2wyjqp0.js.map +1 -0
- package/dist/fundPeginTransaction-BLD8FRL9.cjs +2 -0
- package/dist/fundPeginTransaction-BLD8FRL9.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +192 -190
- package/dist/index.js.map +1 -1
- package/dist/{mempoolApi-Dc1KSVNI.js → mempoolApi-CB7bHuwi.js} +106 -101
- package/dist/mempoolApi-CB7bHuwi.js.map +1 -0
- package/dist/mempoolApi-DqJByvqR.cjs +2 -0
- package/dist/mempoolApi-DqJByvqR.cjs.map +1 -0
- package/dist/noPayout-CNMqNNpc.cjs +2 -0
- package/dist/noPayout-CNMqNNpc.cjs.map +1 -0
- package/dist/{noPayout-DVx3zxUz.js → noPayout-CfBg3HzC.js} +30 -30
- package/dist/noPayout-CfBg3HzC.js.map +1 -0
- package/dist/{peginInput-B5XDDHpy.js → peginInput-BKD_b3gq.js} +10 -11
- package/dist/peginInput-BKD_b3gq.js.map +1 -0
- package/dist/{peginInput-De0C6aSj.cjs → peginInput-CAiiDZeO.cjs} +2 -2
- package/dist/peginInput-CAiiDZeO.cjs.map +1 -0
- package/dist/primeVpAuth-CF4cH5_e.cjs +2 -0
- package/dist/primeVpAuth-CF4cH5_e.cjs.map +1 -0
- package/dist/{primeVpAuth-DxMuWQCi.js → primeVpAuth-l-5x_2UV.js} +91 -85
- package/dist/{primeVpAuth-yTddDmGy.cjs.map → primeVpAuth-l-5x_2UV.js.map} +1 -1
- package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/protocol-params-validation.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +8 -0
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +2 -2
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts +10 -0
- package/dist/tbv/core/contracts/abis/ProtocolParams.abi.d.ts.map +1 -1
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.js +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +190 -188
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/PayoutManager.d.ts +6 -0
- package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/PeginManager.d.ts +10 -2
- 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/signPsbtsWithFallback.d.ts +10 -6
- package/dist/tbv/core/managers/pegin/signPsbtsWithFallback.d.ts.map +1 -1
- package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts +8 -0
- package/dist/tbv/core/primitives/__tests__/vaultCoreVersion.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.d.ts +3 -3
- package/dist/tbv/core/primitives/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.js +40 -37
- package/dist/tbv/core/primitives/index.js.map +1 -1
- package/dist/tbv/core/primitives/psbt/__tests__/assertPeginTxShape.test.d.ts +11 -0
- package/dist/tbv/core/primitives/psbt/__tests__/assertPeginTxShape.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts +11 -10
- package/dist/tbv/core/primitives/psbt/assertWasmPeginSizing.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/payout.d.ts +6 -0
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +17 -2
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts +6 -0
- package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
- package/dist/tbv/core/primitives/scripts/payout.d.ts +6 -0
- package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -1
- package/dist/tbv/core/primitives/vaultCoreVersion.d.ts +26 -0
- package/dist/tbv/core/primitives/vaultCoreVersion.d.ts.map +1 -0
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts +7 -0
- package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts +6 -0
- package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
- package/dist/tbv/core/services/deposit/verifyRegisteredVaultVersions.d.ts +8 -0
- package/dist/tbv/core/services/deposit/verifyRegisteredVaultVersions.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +6 -0
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
- package/dist/tbv/core/utils/fee/constants.d.ts +6 -14
- package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -1
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +35 -36
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +190 -188
- package/dist/tbv/index.js.map +1 -1
- package/dist/testing/MockBitcoinWallet.d.ts +1 -1
- package/dist/testing/MockBitcoinWallet.d.ts.map +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +3 -3
- package/dist/testing/index.js.map +1 -1
- package/dist/verifyScriptPathSchnorrSignature-BDznSCOR.cjs +2 -0
- package/dist/verifyScriptPathSchnorrSignature-BDznSCOR.cjs.map +1 -0
- package/dist/verifyScriptPathSchnorrSignature-DA4Z4yZ3.js +658 -0
- package/dist/verifyScriptPathSchnorrSignature-DA4Z4yZ3.js.map +1 -0
- package/dist/{waitForTransactionReceiptSmartAware-U706oKTc.cjs → waitForTransactionReceiptSmartAware-AgZ-3WV_.cjs} +2 -2
- package/dist/{waitForTransactionReceiptSmartAware-U706oKTc.cjs.map → waitForTransactionReceiptSmartAware-AgZ-3WV_.cjs.map} +1 -1
- package/dist/{waitForTransactionReceiptSmartAware-Ckg_oZAo.js → waitForTransactionReceiptSmartAware-lobLm0q0.js} +2 -2
- package/dist/{waitForTransactionReceiptSmartAware-Ckg_oZAo.js.map → waitForTransactionReceiptSmartAware-lobLm0q0.js.map} +1 -1
- package/package.json +2 -2
- package/dist/ApplicationRegistry.abi-BAPhJch3.cjs +0 -2
- package/dist/ApplicationRegistry.abi-BAPhJch3.cjs.map +0 -1
- package/dist/ApplicationRegistry.abi-Dn2qk6JG.js.map +0 -1
- package/dist/PayoutManager-BwrV3xFW.js +0 -241
- package/dist/PayoutManager-BwrV3xFW.js.map +0 -1
- package/dist/PayoutManager-CBfHfLfz.cjs +0 -2
- package/dist/PayoutManager-CBfHfLfz.cjs.map +0 -1
- package/dist/PeginManager-BGWNJYPk.js.map +0 -1
- package/dist/PeginManager-DDp-ZRIa.cjs +0 -2
- package/dist/PeginManager-DDp-ZRIa.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-3MLyCOtv.cjs +0 -2
- package/dist/buildAndBroadcastRefund-3MLyCOtv.cjs.map +0 -1
- package/dist/buildAndBroadcastRefund-BAT5A6MP.js.map +0 -1
- package/dist/constants-CSG2XeD8.cjs +0 -2
- package/dist/constants-CSG2XeD8.cjs.map +0 -1
- package/dist/constants-Cd_fN8VT.js +0 -12
- package/dist/constants-Cd_fN8VT.js.map +0 -1
- package/dist/fundPeginTransaction-96FxwYYJ.js.map +0 -1
- package/dist/fundPeginTransaction-DuMwnytD.cjs +0 -2
- package/dist/fundPeginTransaction-DuMwnytD.cjs.map +0 -1
- package/dist/mempoolApi-Dc1KSVNI.js.map +0 -1
- package/dist/mempoolApi-NMiYQAXI.cjs +0 -2
- package/dist/mempoolApi-NMiYQAXI.cjs.map +0 -1
- package/dist/noPayout-ChPNKTbm.cjs +0 -2
- package/dist/noPayout-ChPNKTbm.cjs.map +0 -1
- package/dist/noPayout-DVx3zxUz.js.map +0 -1
- package/dist/peginInput-B5XDDHpy.js.map +0 -1
- package/dist/peginInput-De0C6aSj.cjs.map +0 -1
- package/dist/primeVpAuth-DxMuWQCi.js.map +0 -1
- package/dist/primeVpAuth-yTddDmGy.cjs +0 -2
- package/dist/tbv/core/primitives/__tests__/txGraphVersion.test.d.ts +0 -7
- package/dist/tbv/core/primitives/__tests__/txGraphVersion.test.d.ts.map +0 -1
- package/dist/tbv/core/primitives/txGraphVersion.d.ts +0 -11
- package/dist/tbv/core/primitives/txGraphVersion.d.ts.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-BKECXOpa.js +0 -572
- package/dist/verifyScriptPathSchnorrSignature-BKECXOpa.js.map +0 -1
- package/dist/verifyScriptPathSchnorrSignature-CVPh04ZI.cjs +0 -2
- package/dist/verifyScriptPathSchnorrSignature-CVPh04ZI.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as T from "bitcoinjs-lib";
|
|
2
2
|
import { Buffer as a } from "buffer";
|
|
3
|
-
const
|
|
4
|
-
function
|
|
3
|
+
const P = 58, R = 43, w = 11, I = 546, f = BigInt(I), S = 30, h = 2;
|
|
4
|
+
function N(t) {
|
|
5
5
|
return t <= h ? S : 0;
|
|
6
6
|
}
|
|
7
7
|
const U = 1, O = 1;
|
|
@@ -25,27 +25,27 @@ function b(t) {
|
|
|
25
25
|
throw new Error(`Expected 0 inputs from WASM, got ${i}`);
|
|
26
26
|
if (n === 0)
|
|
27
27
|
throw new Error("Expected at least 1 output from WASM, got 0");
|
|
28
|
-
const E = a.from(t.substring(0, 8), "hex").readUInt32LE(0),
|
|
28
|
+
const E = a.from(t.substring(0, 8), "hex").readUInt32LE(0), p = a.from(
|
|
29
29
|
t.substring(t.length - 8),
|
|
30
30
|
"hex"
|
|
31
31
|
).readUInt32LE(0), u = [];
|
|
32
32
|
let s = e + 4;
|
|
33
33
|
for (let o = 0; o < n; o++) {
|
|
34
|
-
const r = t.substring(s, s + 16),
|
|
34
|
+
const r = t.substring(s, s + 16), _ = Number(a.from(r, "hex").readBigUInt64LE(0));
|
|
35
35
|
s += 16;
|
|
36
|
-
const
|
|
36
|
+
const g = parseInt(t.substring(s, s + 2), 16);
|
|
37
37
|
s += 2;
|
|
38
|
-
const
|
|
39
|
-
s +=
|
|
38
|
+
const m = t.substring(s, s + g * 2), A = a.from(m, "hex");
|
|
39
|
+
s += g * 2, u.push({ value: _, script: A });
|
|
40
40
|
}
|
|
41
|
-
return { version: E, locktime:
|
|
41
|
+
return { version: E, locktime: p, outputs: u };
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const { unfundedTxHex: c, selectedUTXOs: e, changeAddress: i, changeAmount: n, network: E } = t, { version:
|
|
45
|
-
o.version =
|
|
43
|
+
function v(t) {
|
|
44
|
+
const { unfundedTxHex: c, selectedUTXOs: e, changeAddress: i, changeAmount: n, network: E } = t, { version: p, locktime: u, outputs: s } = b(c), o = new T.Transaction();
|
|
45
|
+
o.version = p, o.locktime = u;
|
|
46
46
|
for (const r of e) {
|
|
47
|
-
const
|
|
48
|
-
o.addInput(
|
|
47
|
+
const _ = a.from(r.txid, "hex").reverse();
|
|
48
|
+
o.addInput(_, r.vout);
|
|
49
49
|
}
|
|
50
50
|
for (const r of s)
|
|
51
51
|
o.addOutput(r.script, r.value);
|
|
@@ -58,7 +58,7 @@ function M(t) {
|
|
|
58
58
|
`fundPeginTransaction: changeAmount must be 0 or strictly above DUST_THRESHOLD (${f}), got ${n}`
|
|
59
59
|
);
|
|
60
60
|
if (n > 0n) {
|
|
61
|
-
const r =
|
|
61
|
+
const r = T.address.toOutputScript(i, E);
|
|
62
62
|
o.addOutput(r, Number(n));
|
|
63
63
|
}
|
|
64
64
|
return o.toHex();
|
|
@@ -66,19 +66,18 @@ function M(t) {
|
|
|
66
66
|
export {
|
|
67
67
|
I as B,
|
|
68
68
|
f as D,
|
|
69
|
-
w as F,
|
|
70
69
|
S as L,
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
R as M,
|
|
71
|
+
P,
|
|
73
72
|
B as S,
|
|
74
|
-
|
|
73
|
+
w as T,
|
|
75
74
|
h as W,
|
|
76
75
|
U as a,
|
|
77
76
|
O as b,
|
|
78
77
|
l as c,
|
|
79
78
|
b as d,
|
|
80
|
-
|
|
79
|
+
v as f,
|
|
81
80
|
d as p,
|
|
82
|
-
|
|
81
|
+
N as r
|
|
83
82
|
};
|
|
84
|
-
//# sourceMappingURL=fundPeginTransaction-
|
|
83
|
+
//# sourceMappingURL=fundPeginTransaction-B2wyjqp0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fundPeginTransaction-B2wyjqp0.js","sources":["../src/tbv/core/utils/fee/constants.ts","../src/tbv/core/utils/transaction/fundPeginTransaction.ts"],"sourcesContent":["/**\n * Fee calculation constants for Bitcoin transactions.\n * Based on btc-staking-ts values, adapted for vault peg-in transactions.\n */\n\n// P2TR input size in vbytes (42 vbytes non-witness + 16 vbytes witness)\nexport const P2TR_INPUT_SIZE = 58;\n\n// P2TR output size in bytes (largest non-legacy output type)\nexport const MAX_NON_LEGACY_OUTPUT_SIZE = 43;\n\n// Base transaction overhead (version, input/output counts, locktime, SegWit marker)\nexport const TX_BUFFER_SIZE_OVERHEAD = 11;\n\n// Dust threshold: outputs below this may not be relayed\nexport const BTC_DUST_SAT = 546;\n\n/** Pre-computed BigInt dust threshold to avoid repeated conversions in hot paths */\nexport const DUST_THRESHOLD = BigInt(BTC_DUST_SAT);\n\n// Buffer for low fee rate estimation accuracy (when feeRate <= 2 sat/vbyte)\nexport const LOW_RATE_ESTIMATION_ACCURACY_BUFFER = 30;\n\n// Wallet relay fee rate threshold - different buffer fees are used based on this\nexport const WALLET_RELAY_FEE_RATE_THRESHOLD = 2;\n\n/**\n * Adds a buffer to the transaction fee calculation if the fee rate is low.\n *\n * Some wallets have a relayer fee requirement. If the fee rate is <= 2 sat/vbyte,\n * there's a risk the fee might not be sufficient for transaction relay.\n * We add a buffer to ensure the transaction can be relayed.\n *\n * @param feeRate - Fee rate in satoshis per vbyte\n * @returns Buffer amount in satoshis to add to the transaction fee\n */\nexport function rateBasedTxBufferFee(feeRate: number): number {\n return feeRate <= WALLET_RELAY_FEE_RATE_THRESHOLD\n ? LOW_RATE_ESTIMATION_ACCURACY_BUFFER\n : 0;\n}\n\n/**\n * Number of always-present fixed (non-HTLC) outputs in a Pre-PegIn\n * transaction. Currently this is 1 CPFP anchor output.\n */\nexport const PEGIN_FIXED_OUTPUTS = 1;\n\n/**\n * Size of the auth-anchor `OP_RETURN` output when committed into a\n * Pre-PegIn. The output carries `OP_RETURN <PUSH32 hash>` = 34 script\n * bytes, plus 8 bytes value + 1 byte scriptLen = ~43 bytes total —\n * same as {@link MAX_NON_LEGACY_OUTPUT_SIZE}. Counted as one output\n * toward the fee-estimation output budget.\n */\nexport const PEGIN_AUTH_ANCHOR_OUTPUTS = 1;\n\n/**\n * Compute the total number of outputs (before change) in a Pre-PegIn\n * transaction.\n *\n * A Pre-PegIn tx has: N HTLC outputs (one per vault) + optional\n * auth-anchor OP_RETURN output + fixed outputs (CPFP anchor). This\n * count is used for fee estimation only — the change output is handled\n * separately by `selectUtxosForPegin` when the change amount exceeds\n * the dust threshold.\n *\n * @param vaultCount - Number of vaults in the batch (≥1).\n * @param hasAuthAnchor - Whether the Pre-PegIn will carry an auth-anchor\n * OP_RETURN output. Pass the same value the\n * caller will hand to `buildPrePeginPsbt`'s\n * `authAnchorHash` (truthy ↔ true) so the fee\n * budget stays in lockstep with the output set.\n * @returns Total output count before change.\n * @throws If `vaultCount` is not a positive integer.\n */\nexport function peginOutputCount(\n vaultCount: number,\n hasAuthAnchor: boolean,\n): number {\n if (!Number.isInteger(vaultCount) || vaultCount < 1) {\n throw new Error(\n `peginOutputCount: vaultCount must be a positive integer, got ${vaultCount}`,\n );\n }\n return (\n vaultCount +\n PEGIN_FIXED_OUTPUTS +\n (hasAuthAnchor ? PEGIN_AUTH_ANCHOR_OUTPUTS : 0)\n );\n}\n\n/**\n * Safety multiplier for split transaction fee validation.\n * The signed PSBT's fee rate and absolute fee must not exceed this multiple\n * of the planned values. 5x accounts for witness estimation variance while\n * catching catastrophic wallet-side overpayment.\n */\nexport const SPLIT_TX_FEE_SAFETY_MULTIPLIER = 5;\n\n/**\n * Binary-independent cap on the implied per-HTLC reserve\n * (`htlcValue - peginAmount - depositorClaimValue`): the exact identity in\n * `assertWasmPeginSizing` is WASM-vs-WASM, so this pure-JS bound is what\n * limits a doctored binary. 100,000 vbytes = Bitcoin Core's relay ceiling\n * (MAX_STANDARD_TX_WEIGHT / 4) — ~19× the protocol-max PegIn (~5,150 vbytes\n * at 99 VKs + 99 UCs), so it can never false-positive.\n */\nexport const MAX_REASONABLE_PEGIN_VBYTES = 100_000n;\n","/**\n * Transaction Funding Utility for Peg-in Transactions\n *\n * This module funds an unfunded transaction template from the SDK by adding\n * UTXO inputs and change outputs, creating a transaction ready for wallet signing.\n *\n * Transaction Flow:\n * 1. SDK buildPrePeginPsbt() → unfunded Pre-PegIn tx (0 inputs, HTLC + CPFP outputs)\n * 2. selectUtxosForPegin() → select UTXOs and calculate fees\n * 3. fundPeginTransaction() → add inputs/change, create funded transaction\n *\n * Technical Note:\n * We manually extract the vault output from SDK hex instead of using bitcoinjs-lib\n * parsing because bitcoinjs-lib cannot parse 0-input transactions (even witness format).\n */\n\nimport * as bitcoin from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { DUST_THRESHOLD } from \"../fee/constants\";\nimport type { UTXO } from \"../utxo/selectUtxos\";\n\nexport interface FundPeginTransactionParams {\n /** Unfunded transaction hex from SDK (0 inputs, vault + depositor claim outputs) */\n unfundedTxHex: string;\n /** Selected UTXOs to use as inputs */\n selectedUTXOs: UTXO[];\n /** Change address (from wallet) */\n changeAddress: string;\n /** Change amount in satoshis */\n changeAmount: bigint;\n /** Bitcoin network */\n network: bitcoin.Network;\n}\n\n/** A single parsed output from the unfunded WASM transaction */\nexport interface ParsedOutput {\n value: number;\n script: Buffer;\n}\n\n/** Parsed data from an unfunded WASM transaction */\ninterface ParsedUnfundedTx {\n version: number;\n locktime: number;\n outputs: ParsedOutput[];\n}\n\n/**\n * Parses an unfunded transaction hex from WASM.\n *\n * WASM produces witness-format transactions with 0 inputs, which bitcoinjs-lib cannot parse.\n * This function manually extracts the transaction components.\n *\n * Format: [version:4bytes][marker:0x00][flag:0x01][inputs:1byte=0x00][outputCount:1byte]\n * [output1: value:8bytes + scriptLen:1byte + script:N bytes]\n * [output2: ...]\n * [locktime:4bytes]\n *\n * @param unfundedTxHex - Raw transaction hex from WASM\n * @returns Parsed transaction components\n * @throws Error if transaction structure is invalid\n */\nexport function parseUnfundedWasmTransaction(\n unfundedTxHex: string,\n): ParsedUnfundedTx {\n // Check if witness markers are present (0x00 0x01 after version)\n const hasWitnessMarkers = unfundedTxHex.substring(8, 12) === \"0001\";\n const dataOffset = hasWitnessMarkers ? 12 : 8; // Skip version (8) + optional witness markers (4)\n\n // Parse input/output counts\n const inputCount = parseInt(\n unfundedTxHex.substring(dataOffset, dataOffset + 2),\n 16,\n );\n const outputCount = parseInt(\n unfundedTxHex.substring(dataOffset + 2, dataOffset + 4),\n 16,\n );\n\n if (inputCount !== 0) {\n throw new Error(`Expected 0 inputs from WASM, got ${inputCount}`);\n }\n if (outputCount === 0) {\n throw new Error(\"Expected at least 1 output from WASM, got 0\");\n }\n\n // Parse version (first 4 bytes, little-endian)\n const version = Buffer.from(unfundedTxHex.substring(0, 8), \"hex\").readUInt32LE(0);\n\n // Parse locktime (last 4 bytes, little-endian)\n const locktime = Buffer.from(\n unfundedTxHex.substring(unfundedTxHex.length - 8),\n \"hex\",\n ).readUInt32LE(0);\n\n // Parse all outputs sequentially\n const outputs: ParsedOutput[] = [];\n let pos = dataOffset + 4; // position after input/output counts\n\n for (let i = 0; i < outputCount; i++) {\n const valueHex = unfundedTxHex.substring(pos, pos + 16);\n const value = Number(Buffer.from(valueHex, \"hex\").readBigUInt64LE(0));\n pos += 16;\n\n const scriptLen = parseInt(unfundedTxHex.substring(pos, pos + 2), 16);\n pos += 2;\n\n const scriptHex = unfundedTxHex.substring(pos, pos + scriptLen * 2);\n const script = Buffer.from(scriptHex, \"hex\");\n pos += scriptLen * 2;\n\n outputs.push({ value, script });\n }\n\n return { version, locktime, outputs };\n}\n\n/**\n * Funds an unfunded peg-in transaction by adding inputs and change output.\n *\n * Takes an unfunded transaction template (0 inputs, 1 vault output) from the SDK\n * and adds UTXO inputs and a change output to create a funded transaction ready\n * for wallet signing.\n *\n * @param params - Transaction funding parameters\n * @returns Transaction hex string ready for wallet signing\n */\nexport function fundPeginTransaction(\n params: FundPeginTransactionParams,\n): string {\n const { unfundedTxHex, selectedUTXOs, changeAddress, changeAmount, network } =\n params;\n\n // Parse the unfunded transaction from WASM\n const { version, locktime, outputs } =\n parseUnfundedWasmTransaction(unfundedTxHex);\n\n // Create a new transaction with the extracted data\n const tx = new bitcoin.Transaction();\n tx.version = version;\n tx.locktime = locktime;\n\n // Add inputs from selected UTXOs\n for (const utxo of selectedUTXOs) {\n // Bitcoin uses reversed byte order for txid\n const txHash = Buffer.from(utxo.txid, \"hex\").reverse();\n tx.addInput(txHash, utxo.vout);\n }\n\n // Add all WASM outputs (vault output at index 0, depositor claim at index 1, etc.)\n for (const output of outputs) {\n tx.addOutput(output.script, output.value);\n }\n\n // Trust the selector's change decision: `selectUtxosForPegin` runs every\n // candidate set through `applyChangeOutputPolicy` and returns\n // `changeAmount = 0n` whenever the residual would be at-or-below dust\n // after paying the change-output fee. Validate the contract at this\n // boundary — a hand-built or stale `changeAmount` in (0, DUST_THRESHOLD]\n // would produce a non-relayable dust output, and emitting one would also\n // bypass the canonical fee policy that the selector applied.\n if (changeAmount < 0n) {\n throw new Error(\n `fundPeginTransaction: changeAmount cannot be negative, got ${changeAmount}`,\n );\n }\n if (changeAmount > 0n && changeAmount <= DUST_THRESHOLD) {\n throw new Error(\n `fundPeginTransaction: changeAmount must be 0 or strictly above DUST_THRESHOLD (${DUST_THRESHOLD}), got ${changeAmount}`,\n );\n }\n if (changeAmount > 0n) {\n const changeScript = bitcoin.address.toOutputScript(changeAddress, network);\n tx.addOutput(changeScript, Number(changeAmount));\n }\n\n return tx.toHex();\n}\n\n// Re-export getNetwork from the canonical location in primitives\nexport { getNetwork } from \"../../primitives/utils/bitcoin\";\n"],"names":["P2TR_INPUT_SIZE","MAX_NON_LEGACY_OUTPUT_SIZE","TX_BUFFER_SIZE_OVERHEAD","BTC_DUST_SAT","DUST_THRESHOLD","LOW_RATE_ESTIMATION_ACCURACY_BUFFER","WALLET_RELAY_FEE_RATE_THRESHOLD","rateBasedTxBufferFee","feeRate","PEGIN_FIXED_OUTPUTS","PEGIN_AUTH_ANCHOR_OUTPUTS","peginOutputCount","vaultCount","hasAuthAnchor","SPLIT_TX_FEE_SAFETY_MULTIPLIER","MAX_REASONABLE_PEGIN_VBYTES","parseUnfundedWasmTransaction","unfundedTxHex","dataOffset","inputCount","outputCount","version","Buffer","locktime","outputs","pos","i","valueHex","value","scriptLen","scriptHex","script","fundPeginTransaction","params","selectedUTXOs","changeAddress","changeAmount","network","tx","bitcoin","utxo","txHash","output","changeScript"],"mappings":";;AAMO,MAAMA,IAAkB,IAGlBC,IAA6B,IAG7BC,IAA0B,IAG1BC,IAAe,KAGfC,IAAiB,OAAOD,CAAY,GAGpCE,IAAsC,IAGtCC,IAAkC;AAYxC,SAASC,EAAqBC,GAAyB;AAC5D,SAAOA,KAAWF,IACdD,IACA;AACN;AAMO,MAAMI,IAAsB,GAStBC,IAA4B;AAqBlC,SAASC,EACdC,GACAC,GACQ;AACR,MAAI,CAAC,OAAO,UAAUD,CAAU,KAAKA,IAAa;AAChD,UAAM,IAAI;AAAA,MACR,gEAAgEA,CAAU;AAAA,IAAA;AAG9E,SACEA,IACAH,KACCI,IAAgBH,IAA4B;AAEjD;AAQO,MAAMI,IAAiC,GAUjCC,IAA8B;AC7CpC,SAASC,EACdC,GACkB;AAGlB,QAAMC,IADoBD,EAAc,UAAU,GAAG,EAAE,MAAM,SACtB,KAAK,GAGtCE,IAAa;AAAA,IACjBF,EAAc,UAAUC,GAAYA,IAAa,CAAC;AAAA,IAClD;AAAA,EAAA,GAEIE,IAAc;AAAA,IAClBH,EAAc,UAAUC,IAAa,GAAGA,IAAa,CAAC;AAAA,IACtD;AAAA,EAAA;AAGF,MAAIC,MAAe;AACjB,UAAM,IAAI,MAAM,oCAAoCA,CAAU,EAAE;AAElE,MAAIC,MAAgB;AAClB,UAAM,IAAI,MAAM,6CAA6C;AAI/D,QAAMC,IAAUC,EAAO,KAAKL,EAAc,UAAU,GAAG,CAAC,GAAG,KAAK,EAAE,aAAa,CAAC,GAG1EM,IAAWD,EAAO;AAAA,IACtBL,EAAc,UAAUA,EAAc,SAAS,CAAC;AAAA,IAChD;AAAA,EAAA,EACA,aAAa,CAAC,GAGVO,IAA0B,CAAA;AAChC,MAAIC,IAAMP,IAAa;AAEvB,WAASQ,IAAI,GAAGA,IAAIN,GAAaM,KAAK;AACpC,UAAMC,IAAWV,EAAc,UAAUQ,GAAKA,IAAM,EAAE,GAChDG,IAAQ,OAAON,EAAO,KAAKK,GAAU,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACpE,IAAAF,KAAO;AAEP,UAAMI,IAAY,SAASZ,EAAc,UAAUQ,GAAKA,IAAM,CAAC,GAAG,EAAE;AACpE,IAAAA,KAAO;AAEP,UAAMK,IAAYb,EAAc,UAAUQ,GAAKA,IAAMI,IAAY,CAAC,GAC5DE,IAAST,EAAO,KAAKQ,GAAW,KAAK;AAC3C,IAAAL,KAAOI,IAAY,GAEnBL,EAAQ,KAAK,EAAE,OAAAI,GAAO,QAAAG,EAAA,CAAQ;AAAA,EAChC;AAEA,SAAO,EAAE,SAAAV,GAAS,UAAAE,GAAU,SAAAC,EAAA;AAC9B;AAYO,SAASQ,EACdC,GACQ;AACR,QAAM,EAAE,eAAAhB,GAAe,eAAAiB,GAAe,eAAAC,GAAe,cAAAC,GAAc,SAAAC,MACjEJ,GAGI,EAAE,SAAAZ,GAAS,UAAAE,GAAU,SAAAC,EAAA,IACzBR,EAA6BC,CAAa,GAGtCqB,IAAK,IAAIC,EAAQ,YAAA;AACvB,EAAAD,EAAG,UAAUjB,GACbiB,EAAG,WAAWf;AAGd,aAAWiB,KAAQN,GAAe;AAEhC,UAAMO,IAASnB,EAAO,KAAKkB,EAAK,MAAM,KAAK,EAAE,QAAA;AAC7C,IAAAF,EAAG,SAASG,GAAQD,EAAK,IAAI;AAAA,EAC/B;AAGA,aAAWE,KAAUlB;AACnB,IAAAc,EAAG,UAAUI,EAAO,QAAQA,EAAO,KAAK;AAU1C,MAAIN,IAAe;AACjB,UAAM,IAAI;AAAA,MACR,8DAA8DA,CAAY;AAAA,IAAA;AAG9E,MAAIA,IAAe,MAAMA,KAAgBhC;AACvC,UAAM,IAAI;AAAA,MACR,kFAAkFA,CAAc,UAAUgC,CAAY;AAAA,IAAA;AAG1H,MAAIA,IAAe,IAAI;AACrB,UAAMO,IAAeJ,EAAQ,QAAQ,eAAeJ,GAAeE,CAAO;AAC1E,IAAAC,EAAG,UAAUK,GAAc,OAAOP,CAAY,CAAC;AAAA,EACjD;AAEA,SAAOE,EAAG,MAAA;AACZ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const b=require("bitcoinjs-lib"),u=require("buffer");function m(t){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(c,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return c.default=t,Object.freeze(c)}const p=m(b),N=58,B=43,h=11,S=546,f=BigInt(S),g=30,O=2;function d(t){return t<=O?g:0}const I=1,U=1;function l(t,c){if(!Number.isInteger(t)||t<1)throw new Error(`peginOutputCount: vaultCount must be a positive integer, got ${t}`);return t+I+(c?U:0)}const F=5,D=100000n;function L(t){const n=t.substring(8,12)==="0001"?12:8,i=parseInt(t.substring(n,n+2),16),r=parseInt(t.substring(n+2,n+4),16);if(i!==0)throw new Error(`Expected 0 inputs from WASM, got ${i}`);if(r===0)throw new Error("Expected at least 1 output from WASM, got 0");const E=u.Buffer.from(t.substring(0,8),"hex").readUInt32LE(0),a=u.Buffer.from(t.substring(t.length-8),"hex").readUInt32LE(0),_=[];let e=n+4;for(let o=0;o<r;o++){const s=t.substring(e,e+16),T=Number(u.Buffer.from(s,"hex").readBigUInt64LE(0));e+=16;const A=parseInt(t.substring(e,e+2),16);e+=2;const R=t.substring(e,e+A*2),P=u.Buffer.from(R,"hex");e+=A*2,_.push({value:T,script:P})}return{version:E,locktime:a,outputs:_}}function C(t){const{unfundedTxHex:c,selectedUTXOs:n,changeAddress:i,changeAmount:r,network:E}=t,{version:a,locktime:_,outputs:e}=L(c),o=new p.Transaction;o.version=a,o.locktime=_;for(const s of n){const T=u.Buffer.from(s.txid,"hex").reverse();o.addInput(T,s.vout)}for(const s of e)o.addOutput(s.script,s.value);if(r<0n)throw new Error(`fundPeginTransaction: changeAmount cannot be negative, got ${r}`);if(r>0n&&r<=f)throw new Error(`fundPeginTransaction: changeAmount must be 0 or strictly above DUST_THRESHOLD (${f}), got ${r}`);if(r>0n){const s=p.address.toOutputScript(i,E);o.addOutput(s,Number(r))}return o.toHex()}exports.BTC_DUST_SAT=S;exports.DUST_THRESHOLD=f;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=g;exports.MAX_NON_LEGACY_OUTPUT_SIZE=B;exports.MAX_REASONABLE_PEGIN_VBYTES=D;exports.P2TR_INPUT_SIZE=N;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=U;exports.PEGIN_FIXED_OUTPUTS=I;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=F;exports.TX_BUFFER_SIZE_OVERHEAD=h;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=O;exports.fundPeginTransaction=C;exports.parseUnfundedWasmTransaction=L;exports.peginOutputCount=l;exports.rateBasedTxBufferFee=d;
|
|
2
|
+
//# sourceMappingURL=fundPeginTransaction-BLD8FRL9.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fundPeginTransaction-BLD8FRL9.cjs","sources":["../src/tbv/core/utils/fee/constants.ts","../src/tbv/core/utils/transaction/fundPeginTransaction.ts"],"sourcesContent":["/**\n * Fee calculation constants for Bitcoin transactions.\n * Based on btc-staking-ts values, adapted for vault peg-in transactions.\n */\n\n// P2TR input size in vbytes (42 vbytes non-witness + 16 vbytes witness)\nexport const P2TR_INPUT_SIZE = 58;\n\n// P2TR output size in bytes (largest non-legacy output type)\nexport const MAX_NON_LEGACY_OUTPUT_SIZE = 43;\n\n// Base transaction overhead (version, input/output counts, locktime, SegWit marker)\nexport const TX_BUFFER_SIZE_OVERHEAD = 11;\n\n// Dust threshold: outputs below this may not be relayed\nexport const BTC_DUST_SAT = 546;\n\n/** Pre-computed BigInt dust threshold to avoid repeated conversions in hot paths */\nexport const DUST_THRESHOLD = BigInt(BTC_DUST_SAT);\n\n// Buffer for low fee rate estimation accuracy (when feeRate <= 2 sat/vbyte)\nexport const LOW_RATE_ESTIMATION_ACCURACY_BUFFER = 30;\n\n// Wallet relay fee rate threshold - different buffer fees are used based on this\nexport const WALLET_RELAY_FEE_RATE_THRESHOLD = 2;\n\n/**\n * Adds a buffer to the transaction fee calculation if the fee rate is low.\n *\n * Some wallets have a relayer fee requirement. If the fee rate is <= 2 sat/vbyte,\n * there's a risk the fee might not be sufficient for transaction relay.\n * We add a buffer to ensure the transaction can be relayed.\n *\n * @param feeRate - Fee rate in satoshis per vbyte\n * @returns Buffer amount in satoshis to add to the transaction fee\n */\nexport function rateBasedTxBufferFee(feeRate: number): number {\n return feeRate <= WALLET_RELAY_FEE_RATE_THRESHOLD\n ? LOW_RATE_ESTIMATION_ACCURACY_BUFFER\n : 0;\n}\n\n/**\n * Number of always-present fixed (non-HTLC) outputs in a Pre-PegIn\n * transaction. Currently this is 1 CPFP anchor output.\n */\nexport const PEGIN_FIXED_OUTPUTS = 1;\n\n/**\n * Size of the auth-anchor `OP_RETURN` output when committed into a\n * Pre-PegIn. The output carries `OP_RETURN <PUSH32 hash>` = 34 script\n * bytes, plus 8 bytes value + 1 byte scriptLen = ~43 bytes total —\n * same as {@link MAX_NON_LEGACY_OUTPUT_SIZE}. Counted as one output\n * toward the fee-estimation output budget.\n */\nexport const PEGIN_AUTH_ANCHOR_OUTPUTS = 1;\n\n/**\n * Compute the total number of outputs (before change) in a Pre-PegIn\n * transaction.\n *\n * A Pre-PegIn tx has: N HTLC outputs (one per vault) + optional\n * auth-anchor OP_RETURN output + fixed outputs (CPFP anchor). This\n * count is used for fee estimation only — the change output is handled\n * separately by `selectUtxosForPegin` when the change amount exceeds\n * the dust threshold.\n *\n * @param vaultCount - Number of vaults in the batch (≥1).\n * @param hasAuthAnchor - Whether the Pre-PegIn will carry an auth-anchor\n * OP_RETURN output. Pass the same value the\n * caller will hand to `buildPrePeginPsbt`'s\n * `authAnchorHash` (truthy ↔ true) so the fee\n * budget stays in lockstep with the output set.\n * @returns Total output count before change.\n * @throws If `vaultCount` is not a positive integer.\n */\nexport function peginOutputCount(\n vaultCount: number,\n hasAuthAnchor: boolean,\n): number {\n if (!Number.isInteger(vaultCount) || vaultCount < 1) {\n throw new Error(\n `peginOutputCount: vaultCount must be a positive integer, got ${vaultCount}`,\n );\n }\n return (\n vaultCount +\n PEGIN_FIXED_OUTPUTS +\n (hasAuthAnchor ? PEGIN_AUTH_ANCHOR_OUTPUTS : 0)\n );\n}\n\n/**\n * Safety multiplier for split transaction fee validation.\n * The signed PSBT's fee rate and absolute fee must not exceed this multiple\n * of the planned values. 5x accounts for witness estimation variance while\n * catching catastrophic wallet-side overpayment.\n */\nexport const SPLIT_TX_FEE_SAFETY_MULTIPLIER = 5;\n\n/**\n * Binary-independent cap on the implied per-HTLC reserve\n * (`htlcValue - peginAmount - depositorClaimValue`): the exact identity in\n * `assertWasmPeginSizing` is WASM-vs-WASM, so this pure-JS bound is what\n * limits a doctored binary. 100,000 vbytes = Bitcoin Core's relay ceiling\n * (MAX_STANDARD_TX_WEIGHT / 4) — ~19× the protocol-max PegIn (~5,150 vbytes\n * at 99 VKs + 99 UCs), so it can never false-positive.\n */\nexport const MAX_REASONABLE_PEGIN_VBYTES = 100_000n;\n","/**\n * Transaction Funding Utility for Peg-in Transactions\n *\n * This module funds an unfunded transaction template from the SDK by adding\n * UTXO inputs and change outputs, creating a transaction ready for wallet signing.\n *\n * Transaction Flow:\n * 1. SDK buildPrePeginPsbt() → unfunded Pre-PegIn tx (0 inputs, HTLC + CPFP outputs)\n * 2. selectUtxosForPegin() → select UTXOs and calculate fees\n * 3. fundPeginTransaction() → add inputs/change, create funded transaction\n *\n * Technical Note:\n * We manually extract the vault output from SDK hex instead of using bitcoinjs-lib\n * parsing because bitcoinjs-lib cannot parse 0-input transactions (even witness format).\n */\n\nimport * as bitcoin from \"bitcoinjs-lib\";\nimport { Buffer } from \"buffer\";\n\nimport { DUST_THRESHOLD } from \"../fee/constants\";\nimport type { UTXO } from \"../utxo/selectUtxos\";\n\nexport interface FundPeginTransactionParams {\n /** Unfunded transaction hex from SDK (0 inputs, vault + depositor claim outputs) */\n unfundedTxHex: string;\n /** Selected UTXOs to use as inputs */\n selectedUTXOs: UTXO[];\n /** Change address (from wallet) */\n changeAddress: string;\n /** Change amount in satoshis */\n changeAmount: bigint;\n /** Bitcoin network */\n network: bitcoin.Network;\n}\n\n/** A single parsed output from the unfunded WASM transaction */\nexport interface ParsedOutput {\n value: number;\n script: Buffer;\n}\n\n/** Parsed data from an unfunded WASM transaction */\ninterface ParsedUnfundedTx {\n version: number;\n locktime: number;\n outputs: ParsedOutput[];\n}\n\n/**\n * Parses an unfunded transaction hex from WASM.\n *\n * WASM produces witness-format transactions with 0 inputs, which bitcoinjs-lib cannot parse.\n * This function manually extracts the transaction components.\n *\n * Format: [version:4bytes][marker:0x00][flag:0x01][inputs:1byte=0x00][outputCount:1byte]\n * [output1: value:8bytes + scriptLen:1byte + script:N bytes]\n * [output2: ...]\n * [locktime:4bytes]\n *\n * @param unfundedTxHex - Raw transaction hex from WASM\n * @returns Parsed transaction components\n * @throws Error if transaction structure is invalid\n */\nexport function parseUnfundedWasmTransaction(\n unfundedTxHex: string,\n): ParsedUnfundedTx {\n // Check if witness markers are present (0x00 0x01 after version)\n const hasWitnessMarkers = unfundedTxHex.substring(8, 12) === \"0001\";\n const dataOffset = hasWitnessMarkers ? 12 : 8; // Skip version (8) + optional witness markers (4)\n\n // Parse input/output counts\n const inputCount = parseInt(\n unfundedTxHex.substring(dataOffset, dataOffset + 2),\n 16,\n );\n const outputCount = parseInt(\n unfundedTxHex.substring(dataOffset + 2, dataOffset + 4),\n 16,\n );\n\n if (inputCount !== 0) {\n throw new Error(`Expected 0 inputs from WASM, got ${inputCount}`);\n }\n if (outputCount === 0) {\n throw new Error(\"Expected at least 1 output from WASM, got 0\");\n }\n\n // Parse version (first 4 bytes, little-endian)\n const version = Buffer.from(unfundedTxHex.substring(0, 8), \"hex\").readUInt32LE(0);\n\n // Parse locktime (last 4 bytes, little-endian)\n const locktime = Buffer.from(\n unfundedTxHex.substring(unfundedTxHex.length - 8),\n \"hex\",\n ).readUInt32LE(0);\n\n // Parse all outputs sequentially\n const outputs: ParsedOutput[] = [];\n let pos = dataOffset + 4; // position after input/output counts\n\n for (let i = 0; i < outputCount; i++) {\n const valueHex = unfundedTxHex.substring(pos, pos + 16);\n const value = Number(Buffer.from(valueHex, \"hex\").readBigUInt64LE(0));\n pos += 16;\n\n const scriptLen = parseInt(unfundedTxHex.substring(pos, pos + 2), 16);\n pos += 2;\n\n const scriptHex = unfundedTxHex.substring(pos, pos + scriptLen * 2);\n const script = Buffer.from(scriptHex, \"hex\");\n pos += scriptLen * 2;\n\n outputs.push({ value, script });\n }\n\n return { version, locktime, outputs };\n}\n\n/**\n * Funds an unfunded peg-in transaction by adding inputs and change output.\n *\n * Takes an unfunded transaction template (0 inputs, 1 vault output) from the SDK\n * and adds UTXO inputs and a change output to create a funded transaction ready\n * for wallet signing.\n *\n * @param params - Transaction funding parameters\n * @returns Transaction hex string ready for wallet signing\n */\nexport function fundPeginTransaction(\n params: FundPeginTransactionParams,\n): string {\n const { unfundedTxHex, selectedUTXOs, changeAddress, changeAmount, network } =\n params;\n\n // Parse the unfunded transaction from WASM\n const { version, locktime, outputs } =\n parseUnfundedWasmTransaction(unfundedTxHex);\n\n // Create a new transaction with the extracted data\n const tx = new bitcoin.Transaction();\n tx.version = version;\n tx.locktime = locktime;\n\n // Add inputs from selected UTXOs\n for (const utxo of selectedUTXOs) {\n // Bitcoin uses reversed byte order for txid\n const txHash = Buffer.from(utxo.txid, \"hex\").reverse();\n tx.addInput(txHash, utxo.vout);\n }\n\n // Add all WASM outputs (vault output at index 0, depositor claim at index 1, etc.)\n for (const output of outputs) {\n tx.addOutput(output.script, output.value);\n }\n\n // Trust the selector's change decision: `selectUtxosForPegin` runs every\n // candidate set through `applyChangeOutputPolicy` and returns\n // `changeAmount = 0n` whenever the residual would be at-or-below dust\n // after paying the change-output fee. Validate the contract at this\n // boundary — a hand-built or stale `changeAmount` in (0, DUST_THRESHOLD]\n // would produce a non-relayable dust output, and emitting one would also\n // bypass the canonical fee policy that the selector applied.\n if (changeAmount < 0n) {\n throw new Error(\n `fundPeginTransaction: changeAmount cannot be negative, got ${changeAmount}`,\n );\n }\n if (changeAmount > 0n && changeAmount <= DUST_THRESHOLD) {\n throw new Error(\n `fundPeginTransaction: changeAmount must be 0 or strictly above DUST_THRESHOLD (${DUST_THRESHOLD}), got ${changeAmount}`,\n );\n }\n if (changeAmount > 0n) {\n const changeScript = bitcoin.address.toOutputScript(changeAddress, network);\n tx.addOutput(changeScript, Number(changeAmount));\n }\n\n return tx.toHex();\n}\n\n// Re-export getNetwork from the canonical location in primitives\nexport { getNetwork } from \"../../primitives/utils/bitcoin\";\n"],"names":["P2TR_INPUT_SIZE","MAX_NON_LEGACY_OUTPUT_SIZE","TX_BUFFER_SIZE_OVERHEAD","BTC_DUST_SAT","DUST_THRESHOLD","LOW_RATE_ESTIMATION_ACCURACY_BUFFER","WALLET_RELAY_FEE_RATE_THRESHOLD","rateBasedTxBufferFee","feeRate","PEGIN_FIXED_OUTPUTS","PEGIN_AUTH_ANCHOR_OUTPUTS","peginOutputCount","vaultCount","hasAuthAnchor","SPLIT_TX_FEE_SAFETY_MULTIPLIER","MAX_REASONABLE_PEGIN_VBYTES","parseUnfundedWasmTransaction","unfundedTxHex","dataOffset","inputCount","outputCount","version","Buffer","locktime","outputs","pos","i","valueHex","value","scriptLen","scriptHex","script","fundPeginTransaction","params","selectedUTXOs","changeAddress","changeAmount","network","tx","bitcoin","utxo","txHash","output","changeScript"],"mappings":"4VAMaA,EAAkB,GAGlBC,EAA6B,GAG7BC,EAA0B,GAG1BC,EAAe,IAGfC,EAAiB,OAAOD,CAAY,EAGpCE,EAAsC,GAGtCC,EAAkC,EAYxC,SAASC,EAAqBC,EAAyB,CAC5D,OAAOA,GAAWF,EACdD,EACA,CACN,CAMO,MAAMI,EAAsB,EAStBC,EAA4B,EAqBlC,SAASC,EACdC,EACAC,EACQ,CACR,GAAI,CAAC,OAAO,UAAUD,CAAU,GAAKA,EAAa,EAChD,MAAM,IAAI,MACR,gEAAgEA,CAAU,EAAA,EAG9E,OACEA,EACAH,GACCI,EAAgBH,EAA4B,EAEjD,CAQO,MAAMI,EAAiC,EAUjCC,EAA8B,QC7CpC,SAASC,EACdC,EACkB,CAGlB,MAAMC,EADoBD,EAAc,UAAU,EAAG,EAAE,IAAM,OACtB,GAAK,EAGtCE,EAAa,SACjBF,EAAc,UAAUC,EAAYA,EAAa,CAAC,EAClD,EAAA,EAEIE,EAAc,SAClBH,EAAc,UAAUC,EAAa,EAAGA,EAAa,CAAC,EACtD,EAAA,EAGF,GAAIC,IAAe,EACjB,MAAM,IAAI,MAAM,oCAAoCA,CAAU,EAAE,EAElE,GAAIC,IAAgB,EAClB,MAAM,IAAI,MAAM,6CAA6C,EAI/D,MAAMC,EAAUC,EAAAA,OAAO,KAAKL,EAAc,UAAU,EAAG,CAAC,EAAG,KAAK,EAAE,aAAa,CAAC,EAG1EM,EAAWD,EAAAA,OAAO,KACtBL,EAAc,UAAUA,EAAc,OAAS,CAAC,EAChD,KAAA,EACA,aAAa,CAAC,EAGVO,EAA0B,CAAA,EAChC,IAAIC,EAAMP,EAAa,EAEvB,QAASQ,EAAI,EAAGA,EAAIN,EAAaM,IAAK,CACpC,MAAMC,EAAWV,EAAc,UAAUQ,EAAKA,EAAM,EAAE,EAChDG,EAAQ,OAAON,EAAAA,OAAO,KAAKK,EAAU,KAAK,EAAE,gBAAgB,CAAC,CAAC,EACpEF,GAAO,GAEP,MAAMI,EAAY,SAASZ,EAAc,UAAUQ,EAAKA,EAAM,CAAC,EAAG,EAAE,EACpEA,GAAO,EAEP,MAAMK,EAAYb,EAAc,UAAUQ,EAAKA,EAAMI,EAAY,CAAC,EAC5DE,EAAST,EAAAA,OAAO,KAAKQ,EAAW,KAAK,EAC3CL,GAAOI,EAAY,EAEnBL,EAAQ,KAAK,CAAE,MAAAI,EAAO,OAAAG,CAAA,CAAQ,CAChC,CAEA,MAAO,CAAE,QAAAV,EAAS,SAAAE,EAAU,QAAAC,CAAA,CAC9B,CAYO,SAASQ,EACdC,EACQ,CACR,KAAM,CAAE,cAAAhB,EAAe,cAAAiB,EAAe,cAAAC,EAAe,aAAAC,EAAc,QAAAC,GACjEJ,EAGI,CAAE,QAAAZ,EAAS,SAAAE,EAAU,QAAAC,CAAA,EACzBR,EAA6BC,CAAa,EAGtCqB,EAAK,IAAIC,EAAQ,YACvBD,EAAG,QAAUjB,EACbiB,EAAG,SAAWf,EAGd,UAAWiB,KAAQN,EAAe,CAEhC,MAAMO,EAASnB,EAAAA,OAAO,KAAKkB,EAAK,KAAM,KAAK,EAAE,QAAA,EAC7CF,EAAG,SAASG,EAAQD,EAAK,IAAI,CAC/B,CAGA,UAAWE,KAAUlB,EACnBc,EAAG,UAAUI,EAAO,OAAQA,EAAO,KAAK,EAU1C,GAAIN,EAAe,GACjB,MAAM,IAAI,MACR,8DAA8DA,CAAY,EAAA,EAG9E,GAAIA,EAAe,IAAMA,GAAgBhC,EACvC,MAAM,IAAI,MACR,kFAAkFA,CAAc,UAAUgC,CAAY,EAAA,EAG1H,GAAIA,EAAe,GAAI,CACrB,MAAMO,EAAeJ,EAAQ,QAAQ,eAAeJ,EAAeE,CAAO,EAC1EC,EAAG,UAAUK,EAAc,OAAOP,CAAY,CAAC,CACjD,CAEA,OAAOE,EAAG,MAAA,CACZ"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./challengeAssert-HNbugpqL.cjs"),n=require("./verifyScriptPathSchnorrSignature-CVPh04ZI.cjs"),l=require("@babylonlabs-io/babylon-tbv-rust-wasm"),E=require("./peginInput-De0C6aSj.cjs"),A=require("./noPayout-ChPNKTbm.cjs"),r=require("./bitcoin-CHfKAhcI.cjs"),R=require("./signing-Bnsro0hE.cjs"),c=require("./validation-u8W7Lp2x.cjs"),u=require("./PeginManager-DDp-ZRIa.cjs"),S=require("./PayoutManager-CBfHfLfz.cjs"),_=require("./ApplicationRegistry.abi-BAPhJch3.cjs"),m=require("./BTCVaultRegistry.abi-JdeqLz4x.cjs"),d=require("./errors-CGcNP0rV.cjs"),O=require("./shared/index.cjs"),o=require("./waitForTransactionReceiptSmartAware-U706oKTc.cjs"),t=require("./fundPeginTransaction-DuMwnytD.cjs"),P=require("./reservation-ClEs2X0H.cjs"),i=require("./mempoolApi-NMiYQAXI.cjs"),a=require("./primeVpAuth-yTddDmGy.cjs"),s=require("./types-WA0LrDk1.cjs"),g=require("./errors-Bu0H-dZD.cjs"),e=require("./buildAndBroadcastRefund-3MLyCOtv.cjs"),T=require("./peginState-CBBJw4Za.cjs");exports.buildChallengeAssertPsbt=p.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=p.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=p.computeNumLocalChallengers;exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.TX_GRAPH_VERSION_V1=n.TX_GRAPH_VERSION_V1;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=n.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.createPayoutScript=n.createPayoutScript;exports.extractPayoutSignature=n.extractPayoutSignature;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>l.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>l.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>l.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>l.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>l.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>l.expandWotsSeed});Object.defineProperty(exports,"supportedTxGraphVersions",{enumerable:!0,get:()=>l.supportedTxGraphVersions});exports.buildPeginInputPsbt=E.buildPeginInputPsbt;exports.extractPeginInputSignature=E.extractPeginInputSignature;exports.finalizePeginInputPsbt=E.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=A.buildNoPayoutPsbt;exports.buildRefundPsbt=A.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=R.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=c.BITCOIN_ADDRESS_RE;exports.HEX_RE=c.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=c.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=c.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=c.TXID_RE;exports.PeginManager=u.PeginManager;exports.VAULT_APP_NAME=u.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=u.buildFundingOutpointsCommitment;exports.buildVaultContext=u.buildVaultContext;exports.computeWotsBlockPublicKeysHash=u.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=u.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=u.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=u.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=S.PayoutManager;exports.computeHashlock=S.computeHashlock;exports.validateSecretAgainstHashlock=S.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=d.CONTRACT_ERRORS;exports.extractErrorData=d.extractErrorData;exports.getContractErrorMessage=d.getContractErrorMessage;exports.handleContractError=d.handleContractError;exports.isKnownContractError=d.isKnownContractError;exports.BitcoinNetworks=O.BitcoinNetworks;exports.BitcoinScriptType=o.BitcoinScriptType;exports.applyChangeOutputPolicy=o.applyChangeOutputPolicy;exports.calculateBtcTxHash=o.calculateBtcTxHash;exports.computeChangeOutputFeeSats=o.computeChangeOutputFeeSats;exports.computeMaxDeposit=o.computeMaxDeposit;exports.computePeginBaseFeeSats=o.computePeginBaseFeeSats;exports.getDustThreshold=o.getDustThreshold;exports.getPsbtInputFields=o.getPsbtInputFields;exports.getScriptType=o.getScriptType;exports.selectUtxosForPegin=o.selectUtxosForPegin;exports.shouldAddChangeOutput=o.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=o.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=t.BTC_DUST_SAT;exports.DUST_THRESHOLD=t.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=t.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=t.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=t.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=t.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=t.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=t.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=t.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=t.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=t.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=t.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=t.fundPeginTransaction;exports.parseUnfundedWasmTransaction=t.parseUnfundedWasmTransaction;exports.peginOutputCount=t.peginOutputCount;exports.rateBasedTxBufferFee=t.rateBasedTxBufferFee;exports.UtxoNotAvailableError=P.UtxoNotAvailableError;exports.assertUtxosAvailable=P.assertUtxosAvailable;exports.extractInputsFromTransaction=P.extractInputsFromTransaction;exports.findOverlappingPendingVaults=P.findOverlappingPendingVaults;exports.validateUtxosAvailable=P.validateUtxosAvailable;exports.MEMPOOL_API_URLS=i.MEMPOOL_API_URLS;exports.ViemVaultRegistryReader=i.ViemVaultRegistryReader;exports.getAddressTxs=i.getAddressTxs;exports.getAddressUtxos=i.getAddressUtxos;exports.getMempoolApiUrl=i.getMempoolApiUrl;exports.getNetworkFees=i.getNetworkFees;exports.getOutspend=i.getOutspend;exports.getTipHeight=i.getTipHeight;exports.getTxHex=i.getTxHex;exports.getTxInfo=i.getTxInfo;exports.getUtxoInfo=i.getUtxoInfo;exports.pushTx=i.pushTx;exports.validateOffchainParams=i.validateOffchainParams;exports.validatePegInConfiguration=i.validatePegInConfiguration;exports.validateTBVProtocolParams=i.validateTBVProtocolParams;exports.OnChainBtcVaultStatus=a.OnChainBtcVaultStatus;exports.ServerIdentityError=a.ServerIdentityError;exports.VaultProviderRpcClient=a.VaultProviderRpcClient;exports.ViemProtocolParamsReader=a.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=a.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=a.ViemVaultKeeperReader;exports.VpResponseValidationError=a.VpResponseValidationError;exports.VpTokenRegistry=a.VpTokenRegistry;exports.batchPollByProvider=a.batchPollByProvider;exports.createAuthenticatedVpClient=a.createAuthenticatedVpClient;exports.primeVpTokenRegistry=a.primeVpTokenRegistry;exports.resolveProtocolAddresses=a.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=a.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=a.verifyServerIdentity;exports.vpTokenRegistry=a.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=s.AUTH_EXPIRED_DATA_KIND;exports.DaemonStatus=s.DaemonStatus;exports.JSON_RPC_ERROR_CODES=s.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=s.JsonRpcClient;exports.JsonRpcError=s.JsonRpcError;exports.POST_WOTS_STATUSES=s.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=s.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=s.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=s.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=s.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=g.isWotsMismatchError;exports.parseFundingOutpointsFromTx=g.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=T.ContractStatus;exports.PeginAction=T.PeginAction;exports.canPerformAction=T.canPerformAction;exports.getPeginProtocolState=T.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=T.isActivationDeadlinePassedOnChain;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./challengeAssert-DLQfNcfU.cjs"),R=require("./constants-CvbARMl-.cjs"),n=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("./verifyScriptPathSchnorrSignature-BDznSCOR.cjs"),S=require("./peginInput-CAiiDZeO.cjs"),E=require("./noPayout-CNMqNNpc.cjs"),t=require("./bitcoin-CHfKAhcI.cjs"),m=require("./signing-Bnsro0hE.cjs"),c=require("./validation-u8W7Lp2x.cjs"),l=require("./PeginManager-vUUfZCzj.cjs"),A=require("./PayoutManager-aqtsj60t.cjs"),g=require("./ApplicationRegistry.abi-CLaa6E99.cjs"),O=require("./BTCVaultRegistry.abi-JdeqLz4x.cjs"),d=require("./errors-CGcNP0rV.cjs"),b=require("./shared/index.cjs"),o=require("./waitForTransactionReceiptSmartAware-AgZ-3WV_.cjs"),r=require("./fundPeginTransaction-BLD8FRL9.cjs"),P=require("./reservation-ClEs2X0H.cjs"),i=require("./mempoolApi-DqJByvqR.cjs"),a=require("./primeVpAuth-CF4cH5_e.cjs"),s=require("./types-WA0LrDk1.cjs"),_=require("./errors-Bu0H-dZD.cjs"),e=require("./buildAndBroadcastRefund-Bwi1I5we.cjs"),p=require("./peginState-CBBJw4Za.cjs");exports.buildChallengeAssertPsbt=T.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=T.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=T.computeNumLocalChallengers;exports.assertValidVaultCoreVersion=R.assertValidVaultCoreVersion;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>n.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>n.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>n.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>n.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>n.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>n.expandWotsSeed});Object.defineProperty(exports,"peginP2aAnchorOutput",{enumerable:!0,get:()=>n.peginP2aAnchorOutput});Object.defineProperty(exports,"supportedTxGraphVersions",{enumerable:!0,get:()=>n.supportedTxGraphVersions});Object.defineProperty(exports,"validatePeginP2aAnchor",{enumerable:!0,get:()=>n.validatePeginP2aAnchor});exports.PsbtSubstitutionError=u.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=u.assertScriptPathSchnorrSignature;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=u.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=u.buildPrePeginPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.buildPeginInputPsbt=S.buildPeginInputPsbt;exports.extractPeginInputSignature=S.extractPeginInputSignature;exports.finalizePeginInputPsbt=S.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=t.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=t.deriveNativeSegwitAddress;exports.deriveTaprootAddress=t.deriveTaprootAddress;exports.ensureHexPrefix=t.ensureHexPrefix;exports.formatSatoshisToBtc=t.formatSatoshisToBtc;exports.getNetwork=t.getNetwork;exports.getSortedXOnlyPubkeys=t.getSortedXOnlyPubkeys;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.createTaprootScriptPathSignOptions=m.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=c.BITCOIN_ADDRESS_RE;exports.HEX_RE=c.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=c.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=c.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=c.TXID_RE;exports.PeginManager=l.PeginManager;exports.VAULT_APP_NAME=l.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=l.buildFundingOutpointsCommitment;exports.buildVaultContext=l.buildVaultContext;exports.computeWotsBlockPublicKeysHash=l.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=l.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=l.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=l.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=A.PayoutManager;exports.computeHashlock=A.computeHashlock;exports.validateSecretAgainstHashlock=A.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=g.ApplicationRegistryABI;exports.ProtocolParamsABI=g.ProtocolParamsABI;exports.BTCVaultRegistryABI=O.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=d.CONTRACT_ERRORS;exports.extractErrorData=d.extractErrorData;exports.getContractErrorMessage=d.getContractErrorMessage;exports.handleContractError=d.handleContractError;exports.isKnownContractError=d.isKnownContractError;exports.BitcoinNetworks=b.BitcoinNetworks;exports.BitcoinScriptType=o.BitcoinScriptType;exports.applyChangeOutputPolicy=o.applyChangeOutputPolicy;exports.calculateBtcTxHash=o.calculateBtcTxHash;exports.computeChangeOutputFeeSats=o.computeChangeOutputFeeSats;exports.computeMaxDeposit=o.computeMaxDeposit;exports.computePeginBaseFeeSats=o.computePeginBaseFeeSats;exports.getDustThreshold=o.getDustThreshold;exports.getPsbtInputFields=o.getPsbtInputFields;exports.getScriptType=o.getScriptType;exports.selectUtxosForPegin=o.selectUtxosForPegin;exports.shouldAddChangeOutput=o.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=o.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=r.BTC_DUST_SAT;exports.DUST_THRESHOLD=r.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=r.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=r.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=r.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=r.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=r.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=r.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=r.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=r.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=r.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=r.fundPeginTransaction;exports.parseUnfundedWasmTransaction=r.parseUnfundedWasmTransaction;exports.peginOutputCount=r.peginOutputCount;exports.rateBasedTxBufferFee=r.rateBasedTxBufferFee;exports.UtxoNotAvailableError=P.UtxoNotAvailableError;exports.assertUtxosAvailable=P.assertUtxosAvailable;exports.extractInputsFromTransaction=P.extractInputsFromTransaction;exports.findOverlappingPendingVaults=P.findOverlappingPendingVaults;exports.validateUtxosAvailable=P.validateUtxosAvailable;exports.MEMPOOL_API_URLS=i.MEMPOOL_API_URLS;exports.ViemVaultRegistryReader=i.ViemVaultRegistryReader;exports.getAddressTxs=i.getAddressTxs;exports.getAddressUtxos=i.getAddressUtxos;exports.getMempoolApiUrl=i.getMempoolApiUrl;exports.getNetworkFees=i.getNetworkFees;exports.getOutspend=i.getOutspend;exports.getTipHeight=i.getTipHeight;exports.getTxHex=i.getTxHex;exports.getTxInfo=i.getTxInfo;exports.getUtxoInfo=i.getUtxoInfo;exports.pushTx=i.pushTx;exports.validateOffchainParams=i.validateOffchainParams;exports.validatePegInConfiguration=i.validatePegInConfiguration;exports.validateTBVProtocolParams=i.validateTBVProtocolParams;exports.OnChainBtcVaultStatus=a.OnChainBtcVaultStatus;exports.ServerIdentityError=a.ServerIdentityError;exports.VaultProviderRpcClient=a.VaultProviderRpcClient;exports.ViemProtocolParamsReader=a.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=a.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=a.ViemVaultKeeperReader;exports.VpResponseValidationError=a.VpResponseValidationError;exports.VpTokenRegistry=a.VpTokenRegistry;exports.batchPollByProvider=a.batchPollByProvider;exports.createAuthenticatedVpClient=a.createAuthenticatedVpClient;exports.primeVpTokenRegistry=a.primeVpTokenRegistry;exports.resolveProtocolAddresses=a.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=a.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=a.verifyServerIdentity;exports.vpTokenRegistry=a.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=s.AUTH_EXPIRED_DATA_KIND;exports.DaemonStatus=s.DaemonStatus;exports.JSON_RPC_ERROR_CODES=s.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=s.JsonRpcClient;exports.JsonRpcError=s.JsonRpcError;exports.POST_WOTS_STATUSES=s.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=s.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=s.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=s.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=s.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=_.isWotsMismatchError;exports.parseFundingOutpointsFromTx=_.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=p.ContractStatus;exports.PeginAction=p.PeginAction;exports.canPerformAction=p.canPerformAction;exports.getPeginProtocolState=p.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=p.isActivationDeadlinePassedOnChain;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,198 +1,200 @@
|
|
|
1
|
-
import { a as s, b as t, c as r } from "./challengeAssert-
|
|
2
|
-
import {
|
|
3
|
-
import { computeMinClaimValue as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { c as Z } from "./
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { P as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { B as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { C as
|
|
1
|
+
import { a as s, b as t, c as r } from "./challengeAssert-DvdbpEDY.js";
|
|
2
|
+
import { a as i } from "./constants-BhclpREj.js";
|
|
3
|
+
import { computeMinClaimValue as u, computeMinPeginFee as l, deriveVaultId as p, expandAuthAnchor as d, expandHashlockSecret as P, expandWotsSeed as c, peginP2aAnchorOutput as T, supportedTxGraphVersions as E, validatePeginP2aAnchor as A } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
4
|
+
import { P as g, d as _, f as R, c as m, b as x, a as f, g as b, e as V } from "./verifyScriptPathSchnorrSignature-DA4Z4yZ3.js";
|
|
5
|
+
import { b as I, e as h, f as v } from "./peginInput-BKD_b3gq.js";
|
|
6
|
+
import { a as F, b as U } from "./noPayout-CfBg3HzC.js";
|
|
7
|
+
import { d as y, a as B, b as D, e as M, f as H, j as L, g as X, h as k, i as W, c as w, p as K, s as G, t as Y, u as Z, v as J } from "./bitcoin-B5aNKtsk.js";
|
|
8
|
+
import { c as q } from "./signing-DaLvGwQe.js";
|
|
9
|
+
import { B as Q, H as $, K as aa, M as ea, T as sa } from "./validation-CxqROCno.js";
|
|
10
|
+
import { P as ra, V as oa, b as ia, a as na, c as ua, f as la, d as pa, e as da } from "./PeginManager-D22MLWfM.js";
|
|
11
|
+
import { P as ca, c as Ta, v as Ea } from "./PayoutManager-BJmPnyRP.js";
|
|
12
|
+
import { A as Sa, P as ga } from "./ApplicationRegistry.abi-w5prf7Ig.js";
|
|
13
|
+
import { B as Ra } from "./BTCVaultRegistry.abi-Chs4AFBj.js";
|
|
14
|
+
import { C as xa, e as fa, g as ba, h as Va, i as Oa } from "./errors-Blc-JWnI.js";
|
|
15
|
+
import { BitcoinNetworks as ha } from "./shared/index.js";
|
|
16
|
+
import { B as Ca, a as Fa, f as Ua, c as Na, b as ya, d as Ba, g as Da, i as Ma, h as Ha, s as La, e as Xa, w as ka } from "./waitForTransactionReceiptSmartAware-lobLm0q0.js";
|
|
17
|
+
import { B as wa, D as Ka, L as Ga, M as Ya, c as Za, P as Ja, b as ja, a as qa, S as za, T as Qa, W as $a, f as ae, d as ee, p as se, r as te } from "./fundPeginTransaction-B2wyjqp0.js";
|
|
18
|
+
import { U as oe, a as ie, e as ne, f as ue, v as le } from "./reservation-cHDRn4DA.js";
|
|
19
|
+
import { M as de, V as Pe, g as ce, a as Te, b as Ee, c as Ae, d as Se, e as ge, f as _e, h as Re, i as me, p as xe, v as fe, j as be, k as Ve } from "./mempoolApi-CB7bHuwi.js";
|
|
20
|
+
import { O as Ie, S as he, V as ve, g as Ce, h as Fe, i as Ue, a as Ne, d as ye, b as Be, f as De, p as Me, r as He, v as Le, c as Xe, e as ke } from "./primeVpAuth-l-5x_2UV.js";
|
|
21
|
+
import { A as we, D as Ke, b as Ge, J as Ye, a as Ze, d as Je, P as je, R as qe, e as ze, c as Qe, V as $e } from "./types-CQDRQvV-.js";
|
|
22
|
+
import { i as es, p as ss } from "./errors-9AkghWyk.js";
|
|
23
|
+
import { B as rs, C as os, p as is, q as ns, t as us, u as ls, R as ps, a as ds, n as Ps, o as cs, i as Ts, m as Es, l as As, j as Ss, r as gs, b as _s, s as Rs, v as ms, g as xs, h as fs, d as bs, c as Vs, e as Os, f as Is, k as hs, w as vs } from "./buildAndBroadcastRefund-BiSO4zg2.js";
|
|
24
|
+
import { C as Fs, P as Us, c as Ns, g as ys, i as Bs } from "./peginState-BB81JI6I.js";
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
le as MEMPOOL_API_URLS,
|
|
26
|
+
we as AUTH_EXPIRED_DATA_KIND,
|
|
27
|
+
Sa as ApplicationRegistryABI,
|
|
28
|
+
rs as BIP68NotMatureError,
|
|
29
|
+
Q as BITCOIN_ADDRESS_RE,
|
|
30
|
+
Ra as BTCVaultRegistryABI,
|
|
31
|
+
wa as BTC_DUST_SAT,
|
|
32
|
+
ha as BitcoinNetworks,
|
|
33
|
+
Ca as BitcoinScriptType,
|
|
34
|
+
xa as CONTRACT_ERRORS,
|
|
35
|
+
os as ClaimerPegoutStatusValue,
|
|
36
|
+
Fs as ContractStatus,
|
|
37
|
+
Ka as DUST_THRESHOLD,
|
|
38
|
+
Ke as DaemonStatus,
|
|
39
|
+
$ as HEX_RE,
|
|
40
|
+
Ge as JSON_RPC_ERROR_CODES,
|
|
41
|
+
Ye as JsonRpcClient,
|
|
42
|
+
Ze as JsonRpcError,
|
|
43
|
+
aa as KNOWN_SCRIPT_PREFIXES,
|
|
44
|
+
Ga as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
45
|
+
Ya as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
46
|
+
ea as MAX_REASONABLE_FEE_SATS,
|
|
47
|
+
Za as MAX_REASONABLE_PEGIN_VBYTES,
|
|
48
|
+
de as MEMPOOL_API_URLS,
|
|
49
49
|
Ie as OnChainBtcVaultStatus,
|
|
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
|
-
|
|
50
|
+
Ja as P2TR_INPUT_SIZE,
|
|
51
|
+
ja as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
52
|
+
qa as PEGIN_FIXED_OUTPUTS,
|
|
53
|
+
Je as POST_WOTS_STATUSES,
|
|
54
|
+
je as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
55
|
+
ca as PayoutManager,
|
|
56
|
+
Us as PeginAction,
|
|
57
|
+
ra as PeginManager,
|
|
58
|
+
ga as ProtocolParamsABI,
|
|
59
|
+
g as PsbtSubstitutionError,
|
|
60
|
+
is as REFUND_MAX_FEE_FRACTION_DENOMINATOR,
|
|
61
|
+
ns as REFUND_MAX_FEE_FRACTION_NUMERATOR,
|
|
62
|
+
us as REFUND_MAX_FEE_RATE_SATS_VB,
|
|
63
|
+
ls as REFUND_VSIZE,
|
|
64
|
+
ps as RegisteredVaultVersionMismatchError,
|
|
65
|
+
qe as RpcErrorCode,
|
|
66
|
+
za as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
67
|
+
he as ServerIdentityError,
|
|
68
|
+
sa as TXID_RE,
|
|
69
|
+
Qa as TX_BUFFER_SIZE_OVERHEAD,
|
|
70
|
+
oe as UtxoNotAvailableError,
|
|
71
|
+
oa as VAULT_APP_NAME,
|
|
72
|
+
ze as VP_BATCH_MAX_SIZE,
|
|
73
|
+
Qe as VP_TERMINAL_FAILURE_STATUSES,
|
|
74
|
+
$e as VP_TRANSIENT_STATUSES,
|
|
75
|
+
ve as VaultProviderRpcClient,
|
|
76
|
+
Ce as ViemProtocolParamsReader,
|
|
77
|
+
Fe as ViemUniversalChallengerReader,
|
|
78
|
+
Ue as ViemVaultKeeperReader,
|
|
79
|
+
Pe as ViemVaultRegistryReader,
|
|
80
|
+
Ne as VpResponseValidationError,
|
|
81
|
+
ye as VpTokenRegistry,
|
|
82
|
+
$a as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
83
|
+
ds as activateVault,
|
|
84
|
+
Fa as applyChangeOutputPolicy,
|
|
85
|
+
_ as assertPsbtUnsignedTxMatches,
|
|
86
|
+
R as assertScriptPathSchnorrSignature,
|
|
87
|
+
ie as assertUtxosAvailable,
|
|
88
|
+
i as assertValidVaultCoreVersion,
|
|
89
|
+
Be as batchPollByProvider,
|
|
90
|
+
Ps as buildAndBroadcastRefund,
|
|
91
91
|
s as buildChallengeAssertPsbt,
|
|
92
92
|
t as buildDepositorPayoutPsbt,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
ia as buildFundingOutpointsCommitment,
|
|
94
|
+
F as buildNoPayoutPsbt,
|
|
95
|
+
m as buildPayoutPsbt,
|
|
96
|
+
I as buildPeginInputPsbt,
|
|
97
|
+
x as buildPeginTxFromFundedPrePegin,
|
|
98
|
+
f as buildPrePeginPsbt,
|
|
99
|
+
U as buildRefundPsbt,
|
|
100
|
+
na as buildVaultContext,
|
|
101
|
+
Ua as calculateBtcTxHash,
|
|
102
|
+
Ns as canPerformAction,
|
|
103
|
+
Na as computeChangeOutputFeeSats,
|
|
104
|
+
Ta as computeHashlock,
|
|
105
|
+
ya as computeMaxDeposit,
|
|
106
|
+
u as computeMinClaimValue,
|
|
107
|
+
l as computeMinPeginFee,
|
|
108
108
|
r as computeNumLocalChallengers,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
109
|
+
Ba as computePeginBaseFeeSats,
|
|
110
|
+
ua as computeWotsBlockPublicKeysHash,
|
|
111
|
+
De as createAuthenticatedVpClient,
|
|
112
|
+
b as createPayoutScript,
|
|
113
|
+
q as createTaprootScriptPathSignOptions,
|
|
114
|
+
y as deriveBip86ScriptPubKeyHex,
|
|
115
|
+
B as deriveNativeSegwitAddress,
|
|
116
|
+
D as deriveTaprootAddress,
|
|
117
|
+
p as deriveVaultId,
|
|
118
|
+
la as deriveVaultRoot,
|
|
119
|
+
pa as deriveWotsBlocksFromSeed,
|
|
120
|
+
M as ensureHexPrefix,
|
|
121
|
+
cs as estimateRefundFeeSats,
|
|
122
|
+
da as estimateSubmitPeginRequestBatchGas,
|
|
123
|
+
d as expandAuthAnchor,
|
|
124
|
+
P as expandHashlockSecret,
|
|
125
|
+
c as expandWotsSeed,
|
|
126
|
+
fa as extractErrorData,
|
|
127
|
+
ne as extractInputsFromTransaction,
|
|
128
|
+
V as extractPayoutSignature,
|
|
129
|
+
h as extractPeginInputSignature,
|
|
130
|
+
v as finalizePeginInputPsbt,
|
|
131
|
+
ue as findOverlappingPendingVaults,
|
|
132
|
+
H as formatSatoshisToBtc,
|
|
133
|
+
ae as fundPeginTransaction,
|
|
134
|
+
ce as getAddressTxs,
|
|
135
|
+
Te as getAddressUtxos,
|
|
136
|
+
ba as getContractErrorMessage,
|
|
137
|
+
Da as getDustThreshold,
|
|
138
|
+
Ee as getMempoolApiUrl,
|
|
139
|
+
L as getNetwork,
|
|
140
|
+
Ae as getNetworkFees,
|
|
141
|
+
Se as getOutspend,
|
|
142
|
+
ys as getPeginProtocolState,
|
|
143
|
+
Ma as getPsbtInputFields,
|
|
144
|
+
Ha as getScriptType,
|
|
145
|
+
X as getSortedXOnlyPubkeys,
|
|
146
|
+
ge as getTipHeight,
|
|
147
|
+
_e as getTxHex,
|
|
148
|
+
Re as getTxInfo,
|
|
149
|
+
me as getUtxoInfo,
|
|
150
|
+
Va as handleContractError,
|
|
151
|
+
k as hexToUint8Array,
|
|
152
|
+
Bs as isActivationDeadlinePassedOnChain,
|
|
153
|
+
W as isAddressFromPublicKey,
|
|
154
|
+
Ts as isDepositAmountValid,
|
|
155
|
+
Oa as isKnownContractError,
|
|
156
|
+
Es as isPegoutTerminalStatus,
|
|
157
|
+
As as isRecognizedPegoutStatus,
|
|
158
|
+
Ss as isRegisteredVaultVersionMismatchError,
|
|
159
|
+
w as isValidHex,
|
|
160
|
+
es as isWotsMismatchError,
|
|
161
|
+
ss as parseFundingOutpointsFromTx,
|
|
162
|
+
ee as parseUnfundedWasmTransaction,
|
|
163
|
+
se as peginOutputCount,
|
|
164
|
+
T as peginP2aAnchorOutput,
|
|
165
|
+
Me as primeVpTokenRegistry,
|
|
166
|
+
K as processPublicKeyToXOnly,
|
|
167
|
+
xe as pushTx,
|
|
168
|
+
te as rateBasedTxBufferFee,
|
|
169
|
+
He as resolveProtocolAddresses,
|
|
170
|
+
gs as runDepositorPresignFlow,
|
|
171
|
+
La as selectUtxosForPegin,
|
|
172
|
+
Xa as shouldAddChangeOutput,
|
|
173
|
+
_s as signDepositorGraph,
|
|
174
|
+
G as stripHexPrefix,
|
|
175
|
+
Rs as submitWotsPublicKey,
|
|
176
|
+
E as supportedTxGraphVersions,
|
|
177
|
+
Y as toXOnly,
|
|
178
|
+
Z as uint8ArrayToHex,
|
|
179
|
+
ms as validateDepositAmount,
|
|
180
|
+
xs as validateMultiVaultDepositInputs,
|
|
181
|
+
fe as validateOffchainParams,
|
|
182
|
+
fs as validateOnChainParticipantKeys,
|
|
183
|
+
be as validatePegInConfiguration,
|
|
184
|
+
A as validatePeginP2aAnchor,
|
|
185
|
+
bs as validateProviderSelection,
|
|
186
|
+
Vs as validateRemainingCapacity,
|
|
187
|
+
Le as validateRequestDepositorClaimerArtifactsResponse,
|
|
188
|
+
Ea as validateSecretAgainstHashlock,
|
|
189
|
+
Ve as validateTBVProtocolParams,
|
|
190
|
+
le as validateUtxosAvailable,
|
|
191
|
+
Os as validateVaultAmounts,
|
|
190
192
|
Is as validateVaultProviderPubkey,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
J as validateWalletPubkey,
|
|
194
|
+
hs as verifyRegisteredVaultVersions,
|
|
195
|
+
Xe as verifyServerIdentity,
|
|
196
|
+
ke as vpTokenRegistry,
|
|
197
|
+
vs as waitForPeginStatus,
|
|
198
|
+
ka as waitForTransactionReceiptSmartAware
|
|
197
199
|
};
|
|
198
200
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;"}
|