@babylonlabs-io/ts-sdk 0.3.0 → 0.4.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.
Files changed (48) hide show
  1. package/dist/{PayoutManager-BkOfdb2_.js → PayoutManager-BK1jKgL5.js} +405 -364
  2. package/dist/PayoutManager-BK1jKgL5.js.map +1 -0
  3. package/dist/PayoutManager-CzKMN6xT.cjs +2 -0
  4. package/dist/PayoutManager-CzKMN6xT.cjs.map +1 -0
  5. package/dist/challengeAssert-DOa5L0kv.cjs +2 -0
  6. package/dist/challengeAssert-DOa5L0kv.cjs.map +1 -0
  7. package/dist/challengeAssert-Dvcg38_y.js +606 -0
  8. package/dist/challengeAssert-Dvcg38_y.js.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.js +62 -58
  11. package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts +50 -4
  12. package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts.map +1 -1
  13. package/dist/tbv/core/index.cjs +1 -1
  14. package/dist/tbv/core/index.js +62 -58
  15. package/dist/tbv/core/managers/PeginManager.d.ts +89 -48
  16. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  17. package/dist/tbv/core/managers/__tests__/PeginManager.test.d.ts +1 -1
  18. package/dist/tbv/core/managers/index.d.ts +4 -4
  19. package/dist/tbv/core/managers/index.d.ts.map +1 -1
  20. package/dist/tbv/core/primitives/index.cjs +1 -1
  21. package/dist/tbv/core/primitives/index.d.ts +5 -3
  22. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  23. package/dist/tbv/core/primitives/index.js +22 -18
  24. package/dist/tbv/core/primitives/psbt/__tests__/pegin.test.d.ts +1 -1
  25. package/dist/tbv/core/primitives/psbt/index.d.ts +8 -3
  26. package/dist/tbv/core/primitives/psbt/index.d.ts.map +1 -1
  27. package/dist/tbv/core/primitives/psbt/pegin.d.ts +76 -59
  28. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  29. package/dist/tbv/core/primitives/psbt/peginInput.d.ts +69 -0
  30. package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -0
  31. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +11 -0
  32. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  33. package/dist/tbv/core/primitives/utils/index.d.ts +1 -1
  34. package/dist/tbv/core/primitives/utils/index.d.ts.map +1 -1
  35. package/dist/tbv/index.cjs +1 -1
  36. package/dist/tbv/index.js +62 -58
  37. package/dist/tbv/integrations/aave/clients/abis/AaveIntegrationController.abi.json.d.ts +16 -1
  38. package/dist/tbv/integrations/aave/index.cjs +1 -1
  39. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  40. package/dist/tbv/integrations/aave/index.js +3 -3
  41. package/package.json +3 -3
  42. package/dist/PayoutManager-BkOfdb2_.js.map +0 -1
  43. package/dist/PayoutManager-DZ7EIcAJ.cjs +0 -2
  44. package/dist/PayoutManager-DZ7EIcAJ.cjs.map +0 -1
  45. package/dist/challengeAssert-34HqeVFH.cjs +0 -2
  46. package/dist/challengeAssert-34HqeVFH.cjs.map +0 -1
  47. package/dist/challengeAssert-DVErOd8l.js +0 -423
  48. package/dist/challengeAssert-DVErOd8l.js.map +0 -1
@@ -1,88 +1,105 @@
1
1
  import { Network } from '@babylonlabs-io/babylon-tbv-rust-wasm';
2
2
  /**
3
- * Parameters for building an unsigned peg-in PSBT
3
+ * Parameters for building an unfunded Pre-PegIn PSBT
4
4
  */
5
- export interface PeginParams {
6
- /**
7
- * Depositor's BTC public key (x-only, 64-char hex without 0x prefix)
8
- */
5
+ export interface PrePeginParams {
6
+ /** Depositor's BTC public key (x-only, 64-char hex without 0x prefix) */
9
7
  depositorPubkey: string;
10
- /**
11
- * Vault provider's BTC public key (x-only, 64-char hex)
12
- */
8
+ /** Vault provider's BTC public key (x-only, 64-char hex) */
13
9
  vaultProviderPubkey: string;
14
- /**
15
- * Array of vault keeper BTC public keys (x-only, 64-char hex)
16
- */
10
+ /** Array of vault keeper BTC public keys (x-only, 64-char hex) */
17
11
  vaultKeeperPubkeys: string[];
18
- /**
19
- * Array of universal challenger BTC public keys (x-only, 64-char hex)
20
- */
12
+ /** Array of universal challenger BTC public keys (x-only, 64-char hex) */
21
13
  universalChallengerPubkeys: string[];
22
- /**
23
- * CSV timelock in blocks for the PegIn output
24
- */
25
- timelockPegin: number;
26
- /**
27
- * Amount to peg in (in satoshis)
28
- */
14
+ /** SHA256 hash commitment (64 hex chars = 32 bytes) */
15
+ hashH: string;
16
+ /** CSV timelock in blocks for the HTLC refund path */
17
+ timelockRefund: number;
18
+ /** Amount to peg in (satoshis) */
29
19
  pegInAmount: bigint;
30
- /**
31
- * Amount in satoshis for the depositor's claim output
32
- */
33
- depositorClaimValue: bigint;
34
- /**
35
- * Bitcoin network
36
- */
20
+ /** Fee rate in sat/vB from contract offchain params */
21
+ feeRate: bigint;
22
+ /** Number of local challengers (from contract params) */
23
+ numLocalChallengers: number;
24
+ /** M in M-of-N council multisig (from contract params) */
25
+ councilQuorum: number;
26
+ /** N in M-of-N council multisig (from contract params) */
27
+ councilSize: number;
28
+ /** Bitcoin network */
37
29
  network: Network;
38
30
  }
39
31
  /**
40
- * Result of building an unsigned peg-in PSBT
32
+ * Result of building an unfunded Pre-PegIn transaction
41
33
  */
42
- export interface PeginPsbtResult {
34
+ export interface PrePeginPsbtResult {
43
35
  /**
44
- * Unsigned transaction hex
36
+ * Unfunded transaction hex (no inputs, HTLC output + CPFP anchor).
45
37
  *
46
- * Note: This is an unfunded transaction with no inputs and one output (the pegin output).
47
38
  * The caller is responsible for:
48
- * - Selecting UTXOs to fund the transaction
49
- * - Calculating transaction fees
50
- * - Adding inputs to cover pegInAmount + fees
51
- * - Adding a change output if needed
52
- * - Creating and signing the PSBT via wallet
39
+ * - Selecting UTXOs covering totalOutputValue + network fees
40
+ * - Funding the transaction (add inputs and change output)
41
+ * - Computing the funded transaction's txid
42
+ * - Calling buildPeginTxFromFundedPrePegin() with the funded txid
53
43
  */
54
44
  psbtHex: string;
55
- /**
56
- * Transaction ID (will change after adding inputs and signing)
57
- */
45
+ /** Sum of all unfunded outputs (HTLC + CPFP anchor) — use this for UTXO selection */
46
+ totalOutputValue: bigint;
47
+ /** HTLC output value in satoshis (output 0 only, includes peginAmount + depositorClaimValue + minPeginFee) */
48
+ htlcValue: bigint;
49
+ /** HTLC output scriptPubKey (hex encoded) */
50
+ htlcScriptPubKey: string;
51
+ /** HTLC Taproot address */
52
+ htlcAddress: string;
53
+ /** Pegin amount in satoshis */
54
+ peginAmount: bigint;
55
+ /** Depositor claim value computed by WASM from contract parameters */
56
+ depositorClaimValue: bigint;
57
+ }
58
+ /**
59
+ * Parameters for building the PegIn transaction from a funded Pre-PegIn txid
60
+ */
61
+ export interface BuildPeginTxParams {
62
+ /** Same PrePeginParams used to create the Pre-PegIn transaction */
63
+ prePeginParams: PrePeginParams;
64
+ /** CSV timelock in blocks for the PegIn vault output */
65
+ timelockPegin: number;
66
+ /** Txid of the funded Pre-PegIn transaction (hex, 64 chars) */
67
+ fundedPrePeginTxid: string;
68
+ }
69
+ /**
70
+ * Result of building the PegIn transaction
71
+ */
72
+ export interface PeginTxResult {
73
+ /** PegIn transaction hex (1 input spending HTLC, 1 vault output) */
74
+ txHex: string;
75
+ /** PegIn transaction ID */
58
76
  txid: string;
59
- /**
60
- * Vault script pubkey hex
61
- */
77
+ /** Vault output scriptPubKey (hex encoded) */
62
78
  vaultScriptPubKey: string;
63
- /**
64
- * Vault output value (in satoshis)
65
- */
79
+ /** Vault output value in satoshis */
66
80
  vaultValue: bigint;
67
81
  }
68
82
  /**
69
- * Build unsigned peg-in PSBT using WASM.
83
+ * Build unfunded Pre-PegIn transaction using WASM.
70
84
  *
71
- * This is a pure function that wraps the Rust WASM implementation.
72
- * It creates an unfunded Bitcoin transaction with no inputs and one output
73
- * (the peg-in output to the vault address).
85
+ * Creates a Bitcoin transaction template with no inputs, an HTLC output, and a
86
+ * CPFP anchor output. The HTLC value is computed internally from the contract
87
+ * parameters — the caller does not need to compute depositorClaimValue separately.
74
88
  *
75
- * The returned transaction must be funded by the caller by:
76
- * 1. Selecting appropriate UTXOs from the wallet
77
- * 2. Calculating transaction fees based on selected inputs
78
- * 3. Adding inputs to cover pegInAmount + fees
79
- * 4. Adding a change output if the input value exceeds pegInAmount + fees
80
- * 5. Creating a PSBT and signing it via the wallet
89
+ * @param params - Pre-PegIn parameters
90
+ * @returns Unfunded Pre-PegIn transaction details with HTLC output information
91
+ * @throws If WASM initialization fails or parameters are invalid
92
+ */
93
+ export declare function buildPrePeginPsbt(params: PrePeginParams): Promise<PrePeginPsbtResult>;
94
+ /**
95
+ * Build the PegIn transaction from a funded Pre-PegIn txid.
81
96
  *
82
- * @param params - Peg-in parameters
83
- * @returns Unsigned PSBT and transaction details
97
+ * The PegIn transaction spends Pre-PegIn output 0 via the HTLC hashlock leaf (leaf 0).
98
+ * Since Pre-PegIn inputs must be SegWit/Taproot, the txid is stable after funding.
84
99
  *
100
+ * @param params - Build parameters including Pre-PegIn params and funded txid
101
+ * @returns PegIn transaction details
85
102
  * @throws If WASM initialization fails or parameters are invalid
86
103
  */
87
- export declare function buildPeginPsbt(params: PeginParams): Promise<PeginPsbtResult>;
104
+ export declare function buildPeginTxFromFundedPrePegin(params: BuildPeginTxParams): Promise<PeginTxResult>;
88
105
  //# sourceMappingURL=pegin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pegin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/pegin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,OAAO,EACb,MAAM,uCAAuC,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,kBAAkB,EAAE,MA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T
4
+ */
5
+ export interface BuildPeginInputPsbtParams {
6
+ /**
7
+ * PegIn transaction hex (1 input spending Pre-PegIn HTLC output 0).
8
+ * Returned by buildPeginTxFromFundedPrePegin().
9
+ */
10
+ peginTxHex: string;
11
+ /**
12
+ * Funded Pre-PegIn transaction hex.
13
+ * Used to look up the HTLC output that the PegIn input spends.
14
+ */
15
+ fundedPrePeginTxHex: string;
16
+ /** Depositor's BTC public key (x-only, 64-char hex) */
17
+ depositorPubkey: string;
18
+ /** Vault provider's BTC public key (x-only, 64-char hex) */
19
+ vaultProviderPubkey: string;
20
+ /** Vault keeper BTC public keys (x-only, 64-char hex) */
21
+ vaultKeeperPubkeys: string[];
22
+ /** Universal challenger BTC public keys (x-only, 64-char hex) */
23
+ universalChallengerPubkeys: string[];
24
+ /** SHA256 hash commitment (64 hex chars = 32 bytes) */
25
+ hashH: string;
26
+ /** CSV timelock in blocks for the HTLC refund path */
27
+ timelockRefund: number;
28
+ /** Bitcoin network */
29
+ network: Network;
30
+ }
31
+ /**
32
+ * Result of building the PegIn input PSBT
33
+ */
34
+ export interface BuildPeginInputPsbtResult {
35
+ /** PSBT hex for the depositor to sign */
36
+ psbtHex: string;
37
+ }
38
+ /**
39
+ * Build PSBT for depositor to sign the PegIn transaction's HTLC leaf 0 input.
40
+ *
41
+ * The PegIn transaction spends the Pre-PegIn HTLC output (output 0) via the
42
+ * hashlock + all-party script (leaf 0). The depositor provides one of the required
43
+ * signatures; the vault provider and keepers provide theirs separately via the
44
+ * signPeginInput RPC.
45
+ *
46
+ * The PSBT uses Taproot script-path spending:
47
+ * - witnessUtxo: the Pre-PegIn HTLC output
48
+ * - tapLeafScript: hashlock leaf script + control block
49
+ * - tapInternalKey: NUMS unspendable key (BIP-341 nothing-up-my-sleeve)
50
+ *
51
+ * @param params - PegIn input PSBT parameters
52
+ * @returns PSBT hex ready for depositor signing
53
+ * @throws If PegIn tx does not have exactly 1 input
54
+ * @throws If PegIn input does not reference the Pre-PegIn HTLC output
55
+ * @throws If Pre-PegIn tx output 0 is not found
56
+ */
57
+ export declare function buildPeginInputPsbt(params: BuildPeginInputPsbtParams): Promise<BuildPeginInputPsbtResult>;
58
+ /**
59
+ * Extract the depositor's Schnorr signature from a signed PegIn input PSBT.
60
+ *
61
+ * Supports both non-finalized PSBTs (tapScriptSig) and finalized PSBTs (witness).
62
+ *
63
+ * @param signedPsbtHex - Signed PSBT hex
64
+ * @param depositorPubkey - Depositor's x-only public key (64-char hex)
65
+ * @returns 64-byte Schnorr signature (128 hex chars, no sighash flag)
66
+ * @throws If no signature is found for the depositor's key
67
+ */
68
+ export declare function extractPeginInputSignature(signedPsbtHex: string, depositorPubkey: string): string;
69
+ //# sourceMappingURL=peginInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peginInput.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/peginInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,uCAAuC,CAAC;AAK/C;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,iEAAiE;IACjE,0BAA0B,EAAE,MAAM,EAAE,CAAC;IACrC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,yBAAyB,CAAC,CAkFpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,GACtB,MAAM,CAuCR"}
@@ -1,5 +1,6 @@
1
1
  import { networks } from 'bitcoinjs-lib';
2
2
  import { Network } from '@babylonlabs-io/babylon-tbv-rust-wasm';
3
+ import { Hex } from 'viem';
3
4
  /**
4
5
  * Strip "0x" prefix from hex string if present.
5
6
  *
@@ -10,6 +11,16 @@ import { Network } from '@babylonlabs-io/babylon-tbv-rust-wasm';
10
11
  * @returns Hex string without "0x" prefix
11
12
  */
12
13
  export declare function stripHexPrefix(hex: string): string;
14
+ /**
15
+ * Ensure "0x" prefix on a hex string, returning viem's Hex type.
16
+ *
17
+ * Ethereum/viem APIs expect `0x`-prefixed hex, but Bitcoin tooling
18
+ * typically omits the prefix. This normalises either form.
19
+ *
20
+ * @param hex - Hex string with or without "0x" prefix
21
+ * @returns `0x`-prefixed hex string typed as viem Hex
22
+ */
23
+ export declare function ensureHexPrefix(hex: string): Hex;
13
24
  /**
14
25
  * Convert hex string to Uint8Array.
15
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/utils/bitcoin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAc,QAAQ,EAAY,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAErE;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAUvD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE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,MAAM,EACpB,OAAO,EAAE,OAAO,GACf,MAAM,CAiBR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAgCT"}
@@ -5,5 +5,5 @@
5
5
  *
6
6
  * @module primitives/utils
7
7
  */
8
- export { hexToUint8Array, isValidHex, processPublicKeyToXOnly, stripHexPrefix, toXOnly, uint8ArrayToHex, validateWalletPubkey, type WalletPubkeyValidationResult, } from './bitcoin';
8
+ export { ensureHexPrefix, hexToUint8Array, isValidHex, processPublicKeyToXOnly, stripHexPrefix, toXOnly, uint8ArrayToHex, validateWalletPubkey, type WalletPubkeyValidationResult, } from './bitcoin';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,EACf,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,KAAK,4BAA4B,GAClC,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EACf,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,KAAK,4BAA4B,GAClC,MAAM,WAAW,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),t=require("../challengeAssert-34HqeVFH.cjs"),e=require("../PayoutManager-DZ7EIcAJ.cjs");Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});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.SPLIT_TX_FEE_SAFETY_MULTIPLIER=e.SPLIT_TX_FEE_SAFETY_MULTIPLIER;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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@babylonlabs-io/babylon-tbv-rust-wasm"),e=require("../challengeAssert-DOa5L0kv.cjs"),t=require("../PayoutManager-CzKMN6xT.cjs");Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>r.computeMinClaimValue});exports.BTC_DUST_SAT=e.BTC_DUST_SAT;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.P2TR_INPUT_SIZE=e.P2TR_INPUT_SIZE;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=e.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=e.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=e.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.buildChallengeAssertPsbt=e.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=e.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=e.buildNoPayoutPsbt;exports.buildPayoutPsbt=e.buildPayoutPsbt;exports.buildPeginInputPsbt=e.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=e.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=e.buildPrePeginPsbt;exports.createPayoutScript=e.createPayoutScript;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.extractPayoutSignature=e.extractPayoutSignature;exports.extractPeginInputSignature=e.extractPeginInputSignature;exports.fundPeginTransaction=e.fundPeginTransaction;exports.getNetwork=e.getNetwork;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.parseUnfundedWasmTransaction=e.parseUnfundedWasmTransaction;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.rateBasedTxBufferFee=e.rateBasedTxBufferFee;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;exports.BTCVaultsManagerABI=t.BTCVaultsManagerABI;exports.BitcoinScriptType=t.BitcoinScriptType;exports.CONTRACT_ERRORS=t.CONTRACT_ERRORS;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.PayoutManager=t.PayoutManager;exports.PeginManager=t.PeginManager;exports.calculateBtcTxHash=t.calculateBtcTxHash;exports.createSplitTransaction=t.createSplitTransaction;exports.createSplitTransactionPsbt=t.createSplitTransactionPsbt;exports.extractErrorData=t.extractErrorData;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getContractErrorMessage=t.getContractErrorMessage;exports.getDustThreshold=t.getDustThreshold;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getPsbtInputFields=t.getPsbtInputFields;exports.getScriptType=t.getScriptType;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.handleContractError=t.handleContractError;exports.isKnownContractError=t.isKnownContractError;exports.pushTx=t.pushTx;exports.selectUtxosForPegin=t.selectUtxosForPegin;exports.shouldAddChangeOutput=t.shouldAddChangeOutput;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/tbv/index.js CHANGED
@@ -1,63 +1,67 @@
1
1
  import { computeMinClaimValue as e } from "@babylonlabs-io/babylon-tbv-rust-wasm";
2
- import { f as r, c as o, d as i, a as T, b as n, g as d, h as l, i as u, e as E, m as P, j as _, k as A, l as c, p as g, s as p, t as S, u as x, v as b } from "../challengeAssert-DVErOd8l.js";
3
- import { x as y, B as U, e as C, C as F, D as I, F as O, L, M, v as f, P as h, k as m, j as B, S as H, T as N, W as D, c as v, b as k, d as w, y as W, f as X, l as Y, m as V, z as K, 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-BkOfdb2_.js";
2
+ import { B as r, D as o, F as i, L as n, M as T, P as u, S as P, T as d, W as l, i as g, g as E, h as _, d as c, c as A, a as p, b as x, j as S, k as b, l as F, p as I, f as R, e as y, x as U, y as C, m as M, n as O, o as f, w as L, q as h, r as m, s as B, t as H, u as N, v as D } from "../challengeAssert-Dvcg38_y.js";
3
+ import { q as k, B as w, C as W, M as X, h as Y, P as V, c as K, b as Z, d as j, r as q, i as G, j as z, t as J, g as Q, k as $, l as aa, f as sa, e as ea, m as ta, n as ra, o as oa, v as ia, u as na, p as Ta, s as ua, a as Pa } from "../PayoutManager-BK1jKgL5.js";
4
4
  export {
5
- y as BTCVaultsManagerABI,
6
- U as BTC_DUST_SAT,
7
- C as BitcoinScriptType,
8
- F as CONTRACT_ERRORS,
9
- I as DUST_THRESHOLD,
10
- O as FEE_SAFETY_MARGIN,
11
- L as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
12
- M as MAX_NON_LEGACY_OUTPUT_SIZE,
13
- f as MEMPOOL_API_URLS,
14
- h as P2TR_INPUT_SIZE,
15
- m as PayoutManager,
16
- B as PeginManager,
17
- H as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
18
- N as TX_BUFFER_SIZE_OVERHEAD,
19
- D as WALLET_RELAY_FEE_RATE_THRESHOLD,
20
- r as buildChallengeAssertPsbt,
21
- o as buildDepositorPayoutPsbt,
22
- i as buildNoPayoutPsbt,
23
- T as buildPayoutPsbt,
24
- n as buildPeginPsbt,
25
- v as calculateBtcTxHash,
5
+ k as BTCVaultsManagerABI,
6
+ r as BTC_DUST_SAT,
7
+ w as BitcoinScriptType,
8
+ W as CONTRACT_ERRORS,
9
+ o as DUST_THRESHOLD,
10
+ i as FEE_SAFETY_MARGIN,
11
+ n as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
12
+ T as MAX_NON_LEGACY_OUTPUT_SIZE,
13
+ X as MEMPOOL_API_URLS,
14
+ u as P2TR_INPUT_SIZE,
15
+ Y as PayoutManager,
16
+ V as PeginManager,
17
+ P as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
18
+ d as TX_BUFFER_SIZE_OVERHEAD,
19
+ l as WALLET_RELAY_FEE_RATE_THRESHOLD,
20
+ g as buildChallengeAssertPsbt,
21
+ E as buildDepositorPayoutPsbt,
22
+ _ as buildNoPayoutPsbt,
23
+ c as buildPayoutPsbt,
24
+ A as buildPeginInputPsbt,
25
+ p as buildPeginTxFromFundedPrePegin,
26
+ x as buildPrePeginPsbt,
27
+ K as calculateBtcTxHash,
26
28
  e as computeMinClaimValue,
27
- d as createPayoutScript,
28
- k as createSplitTransaction,
29
- w as createSplitTransactionPsbt,
30
- l as deriveNativeSegwitAddress,
31
- u as deriveTaprootAddress,
32
- W as extractErrorData,
33
- E as extractPayoutSignature,
34
- X as fundPeginTransaction,
35
- Y as getAddressTxs,
36
- V as getAddressUtxos,
37
- K as getContractErrorMessage,
38
- Z as getDustThreshold,
39
- j as getMempoolApiUrl,
40
- P 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
- _ as hexToUint8Array,
49
- A as isAddressFromPublicKey,
50
- sa as isKnownContractError,
51
- c as isValidHex,
52
- ea as parseUnfundedWasmTransaction,
53
- g as processPublicKeyToXOnly,
54
- ta as pushTx,
55
- ra as rateBasedTxBufferFee,
56
- oa as selectUtxosForPegin,
57
- ia as shouldAddChangeOutput,
58
- p as stripHexPrefix,
59
- S as toXOnly,
60
- x as uint8ArrayToHex,
61
- b as validateWalletPubkey
29
+ S as createPayoutScript,
30
+ Z as createSplitTransaction,
31
+ j as createSplitTransactionPsbt,
32
+ b as deriveNativeSegwitAddress,
33
+ F as deriveTaprootAddress,
34
+ I as ensureHexPrefix,
35
+ q as extractErrorData,
36
+ R as extractPayoutSignature,
37
+ y as extractPeginInputSignature,
38
+ U as fundPeginTransaction,
39
+ G as getAddressTxs,
40
+ z as getAddressUtxos,
41
+ J as getContractErrorMessage,
42
+ Q as getDustThreshold,
43
+ $ as getMempoolApiUrl,
44
+ C as getNetwork,
45
+ aa as getNetworkFees,
46
+ sa as getPsbtInputFields,
47
+ ea as getScriptType,
48
+ ta as getTxHex,
49
+ ra as getTxInfo,
50
+ oa as getUtxoInfo,
51
+ ia as handleContractError,
52
+ M as hexToUint8Array,
53
+ O as isAddressFromPublicKey,
54
+ na as isKnownContractError,
55
+ f as isValidHex,
56
+ L as parseUnfundedWasmTransaction,
57
+ h as processPublicKeyToXOnly,
58
+ Ta as pushTx,
59
+ m as rateBasedTxBufferFee,
60
+ ua as selectUtxosForPegin,
61
+ Pa as shouldAddChangeOutput,
62
+ B as stripHexPrefix,
63
+ H as toXOnly,
64
+ N as uint8ArrayToHex,
65
+ D as validateWalletPubkey
62
66
  };
63
67
  //# sourceMappingURL=index.js.map
@@ -221,7 +221,7 @@ declare const _default: [
221
221
  "internalType": "bytes32"
222
222
  },
223
223
  {
224
- "name": "unsignedPegInTx",
224
+ "name": "depositorSignedPeginTx",
225
225
  "type": "bytes",
226
226
  "internalType": "bytes"
227
227
  },
@@ -260,6 +260,11 @@ declare const _default: [
260
260
  "type": "uint16",
261
261
  "internalType": "uint16"
262
262
  },
263
+ {
264
+ "name": "vkVersion",
265
+ "type": "uint16",
266
+ "internalType": "uint16"
267
+ },
263
268
  {
264
269
  "name": "createdAt",
265
270
  "type": "uint256",
@@ -269,6 +274,16 @@ declare const _default: [
269
274
  "name": "verifiedAt",
270
275
  "type": "uint256",
271
276
  "internalType": "uint256"
277
+ },
278
+ {
279
+ "name": "depositorLamportPkHash",
280
+ "type": "bytes32",
281
+ "internalType": "bytes32"
282
+ },
283
+ {
284
+ "name": "hashlock",
285
+ "type": "bytes32",
286
+ "internalType": "bytes32"
272
287
  }
273
288
  ]
274
289
  }