@babylonlabs-io/ts-sdk 0.3.0 → 0.4.1-rc.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 (57) hide show
  1. package/dist/{PayoutManager-BkOfdb2_.js → PayoutManager-B8vLG1dE.js} +414 -373
  2. package/dist/PayoutManager-B8vLG1dE.js.map +1 -0
  3. package/dist/PayoutManager-Shw7TY5P.cjs +2 -0
  4. package/dist/PayoutManager-Shw7TY5P.cjs.map +1 -0
  5. package/dist/challengeAssert-ClJYoKxJ.cjs +2 -0
  6. package/dist/challengeAssert-ClJYoKxJ.cjs.map +1 -0
  7. package/dist/challengeAssert-ZXE00zkT.js +617 -0
  8. package/dist/challengeAssert-ZXE00zkT.js.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +70 -63
  14. package/dist/index.js.map +1 -1
  15. package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts +50 -4
  16. package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts.map +1 -1
  17. package/dist/tbv/core/index.cjs +1 -1
  18. package/dist/tbv/core/index.js +65 -60
  19. package/dist/tbv/core/managers/PeginManager.d.ts +92 -49
  20. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  21. package/dist/tbv/core/managers/__tests__/PeginManager.test.d.ts +1 -1
  22. package/dist/tbv/core/managers/index.d.ts +4 -4
  23. package/dist/tbv/core/managers/index.d.ts.map +1 -1
  24. package/dist/tbv/core/primitives/__tests__/challengers.test.d.ts +2 -0
  25. package/dist/tbv/core/primitives/__tests__/challengers.test.d.ts.map +1 -0
  26. package/dist/tbv/core/primitives/challengers.d.ts +23 -0
  27. package/dist/tbv/core/primitives/challengers.d.ts.map +1 -0
  28. package/dist/tbv/core/primitives/index.cjs +1 -1
  29. package/dist/tbv/core/primitives/index.d.ts +9 -3
  30. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  31. package/dist/tbv/core/primitives/index.js +23 -18
  32. package/dist/tbv/core/primitives/psbt/__tests__/pegin.test.d.ts +1 -1
  33. package/dist/tbv/core/primitives/psbt/index.d.ts +8 -3
  34. package/dist/tbv/core/primitives/psbt/index.d.ts.map +1 -1
  35. package/dist/tbv/core/primitives/psbt/pegin.d.ts +76 -59
  36. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  37. package/dist/tbv/core/primitives/psbt/peginInput.d.ts +69 -0
  38. package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -0
  39. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +11 -0
  40. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  41. package/dist/tbv/core/primitives/utils/index.d.ts +1 -1
  42. package/dist/tbv/core/primitives/utils/index.d.ts.map +1 -1
  43. package/dist/tbv/index.cjs +1 -1
  44. package/dist/tbv/index.js +65 -60
  45. package/dist/tbv/integrations/aave/clients/abis/AaveIntegrationController.abi.json.d.ts +16 -1
  46. package/dist/tbv/integrations/aave/index.cjs +1 -1
  47. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  48. package/dist/tbv/integrations/aave/index.js +3 -3
  49. package/package.json +20 -20
  50. package/LICENSE +0 -169
  51. package/dist/PayoutManager-BkOfdb2_.js.map +0 -1
  52. package/dist/PayoutManager-DZ7EIcAJ.cjs +0 -2
  53. package/dist/PayoutManager-DZ7EIcAJ.cjs.map +0 -1
  54. package/dist/challengeAssert-34HqeVFH.cjs +0 -2
  55. package/dist/challengeAssert-34HqeVFH.cjs.map +0 -1
  56. package/dist/challengeAssert-DVErOd8l.js +0 -423
  57. package/dist/challengeAssert-DVErOd8l.js.map +0 -1
@@ -1,63 +1,68 @@
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";
1
+ import { B as e, D as t, F as r, L as o, M as i, P as n, S as T, T as u, W as P, j as l, h as d, i as g, f as E, d as c, a as _, b as A, c as p, k as x, l as S, m as b, q as F, g as I, e as R, y, z as C, n as U, o as L, p as M, x as O, r as f, w as m, s as h, t as B, u as H, v as N } from "../../challengeAssert-ZXE00zkT.js";
2
+ import { computeMinClaimValue as v } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
+ import { q as w, B as W, C as X, M as Y, h as V, P as K, c as Z, b as j, d as q, r as G, i as z, j as J, t as Q, g as $, k as aa, l as sa, f as ea, e as ta, m as ra, n as oa, o as ia, v as na, u as Ta, p as ua, s as Pa, a as la } from "../../PayoutManager-B8vLG1dE.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,
26
- 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
5
+ w as BTCVaultsManagerABI,
6
+ e as BTC_DUST_SAT,
7
+ W as BitcoinScriptType,
8
+ X as CONTRACT_ERRORS,
9
+ t as DUST_THRESHOLD,
10
+ r as FEE_SAFETY_MARGIN,
11
+ o as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
12
+ i as MAX_NON_LEGACY_OUTPUT_SIZE,
13
+ Y as MEMPOOL_API_URLS,
14
+ n as P2TR_INPUT_SIZE,
15
+ V as PayoutManager,
16
+ K as PeginManager,
17
+ T as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
18
+ u as TX_BUFFER_SIZE_OVERHEAD,
19
+ P as WALLET_RELAY_FEE_RATE_THRESHOLD,
20
+ l as buildChallengeAssertPsbt,
21
+ d as buildDepositorPayoutPsbt,
22
+ g as buildNoPayoutPsbt,
23
+ E as buildPayoutPsbt,
24
+ c as buildPeginInputPsbt,
25
+ _ as buildPeginTxFromFundedPrePegin,
26
+ A as buildPrePeginPsbt,
27
+ Z as calculateBtcTxHash,
28
+ v as computeMinClaimValue,
29
+ p as computeNumLocalChallengers,
30
+ x as createPayoutScript,
31
+ j as createSplitTransaction,
32
+ q as createSplitTransactionPsbt,
33
+ S as deriveNativeSegwitAddress,
34
+ b as deriveTaprootAddress,
35
+ F as ensureHexPrefix,
36
+ G as extractErrorData,
37
+ I as extractPayoutSignature,
38
+ R as extractPeginInputSignature,
39
+ y as fundPeginTransaction,
40
+ z as getAddressTxs,
41
+ J as getAddressUtxos,
42
+ Q as getContractErrorMessage,
43
+ $ as getDustThreshold,
44
+ aa as getMempoolApiUrl,
45
+ C as getNetwork,
46
+ sa as getNetworkFees,
47
+ ea as getPsbtInputFields,
48
+ ta as getScriptType,
49
+ ra as getTxHex,
50
+ oa as getTxInfo,
51
+ ia as getUtxoInfo,
52
+ na as handleContractError,
53
+ U as hexToUint8Array,
54
+ L as isAddressFromPublicKey,
55
+ Ta as isKnownContractError,
56
+ M as isValidHex,
57
+ O as parseUnfundedWasmTransaction,
58
+ f as processPublicKeyToXOnly,
59
+ ua as pushTx,
60
+ m as rateBasedTxBufferFee,
61
+ Pa as selectUtxosForPegin,
62
+ la as shouldAddChangeOutput,
63
+ h as stripHexPrefix,
64
+ B as toXOnly,
65
+ H as uint8ArrayToHex,
66
+ N as validateWalletPubkey
62
67
  };
63
68
  //# sourceMappingURL=index.js.map
@@ -42,17 +42,13 @@ export interface PeginManagerConfig {
42
42
  mempoolApiUrl: string;
43
43
  }
44
44
  /**
45
- * Parameters for creating a peg-in transaction.
45
+ * Parameters for the atomic swap pegin flow (pre-pegin + pegin transactions).
46
46
  */
47
- export interface CreatePeginParams {
47
+ export interface CreateAtomicPeginParams {
48
48
  /**
49
49
  * Amount to peg in (in satoshis).
50
50
  */
51
51
  amount: bigint;
52
- /**
53
- * Vault provider's Ethereum address.
54
- */
55
- vaultProvider: Address;
56
52
  /**
57
53
  * Vault provider's BTC public key (x-only, 64-char hex).
58
54
  * Can be provided with or without "0x" prefix (will be stripped automatically).
@@ -62,54 +58,94 @@ export interface CreatePeginParams {
62
58
  * Vault keeper BTC public keys (x-only, 64-char hex).
63
59
  * Can be provided with or without "0x" prefix (will be stripped automatically).
64
60
  */
65
- vaultKeeperBtcPubkeys: string[];
61
+ vaultKeeperBtcPubkeys: readonly string[];
66
62
  /**
67
63
  * Universal challenger BTC public keys (x-only, 64-char hex).
68
64
  * Can be provided with or without "0x" prefix (will be stripped automatically).
69
65
  */
70
- universalChallengerBtcPubkeys: string[];
66
+ universalChallengerBtcPubkeys: readonly string[];
71
67
  /**
72
- * CSV timelock in blocks for the PegIn output.
68
+ * CSV timelock in blocks for the PegIn vault output.
73
69
  */
74
70
  timelockPegin: number;
75
71
  /**
76
- * Amount in satoshis for the depositor's claim output.
72
+ * CSV timelock in blocks for the Pre-PegIn HTLC refund path.
73
+ */
74
+ timelockRefund: number;
75
+ /**
76
+ * SHA256 hash commitment for the HTLC (64 hex chars = 32 bytes).
77
+ * Generated by the depositor as H = SHA256(secret).
78
+ */
79
+ hashH: string;
80
+ /**
81
+ * Protocol fee rate in sat/vB from the contract offchain params.
82
+ * Used by WASM for computing depositorClaimValue and min pegin fee.
83
+ */
84
+ protocolFeeRate: bigint;
85
+ /**
86
+ * Mempool fee rate in sat/vB for funding the Pre-PegIn transaction.
87
+ * Used for UTXO selection and change calculation.
77
88
  */
78
- depositorClaimValue: bigint;
89
+ mempoolFeeRate: number;
79
90
  /**
80
- * Available UTXOs from the depositor's wallet for funding the transaction.
91
+ * M in M-of-N council multisig (from contract params).
81
92
  */
82
- availableUTXOs: UTXO[];
93
+ councilQuorum: number;
83
94
  /**
84
- * Fee rate in satoshis per vbyte for the transaction.
95
+ * N in M-of-N council multisig (from contract params).
85
96
  */
86
- feeRate: number;
97
+ councilSize: number;
87
98
  /**
88
- * Bitcoin address for receiving change from the transaction.
99
+ * Available UTXOs from the depositor's wallet for funding the Pre-PegIn transaction.
100
+ */
101
+ availableUTXOs: readonly UTXO[];
102
+ /**
103
+ * Bitcoin address for receiving change from the Pre-PegIn transaction.
89
104
  */
90
105
  changeAddress: string;
91
106
  }
92
107
  /**
93
- * Result of a peg-in preparation.
108
+ * Result of preparing an atomic swap pegin.
94
109
  */
95
- export interface PeginResult {
110
+ export interface AtomicPeginResult {
111
+ /**
112
+ * Funded but unsigned Pre-PegIn transaction hex.
113
+ * Sign and broadcast this AFTER registering on Ethereum.
114
+ */
115
+ fundedPrePeginTxHex: string;
96
116
  /**
97
- * Bitcoin transaction hash (without 0x prefix).
98
- * This is the hash of the unsigned transaction and will NOT change after signing.
99
- * Used as the unique vault identifier in the contract.
117
+ * Pre-PegIn HTLC value in satoshis (amount the UTXOs cover).
100
118
  */
101
- btcTxHash: string;
119
+ htlcValue: bigint;
102
120
  /**
103
- * Funded but unsigned transaction hex.
104
- * This transaction has inputs and outputs but is not yet signed.
121
+ * PegIn transaction hex with depositor's HTLC leaf 0 signature embedded in the PSBT.
122
+ * Submit the extracted signature to the vault provider.
105
123
  */
106
- fundedTxHex: string;
124
+ signedPeginInputPsbtHex: string;
107
125
  /**
108
- * Vault script pubkey hex.
126
+ * Depositor's Schnorr signature over PegIn input 0 (HTLC leaf 0), 128 hex chars.
127
+ * This is submitted to the contract via the VP's signPeginInput batch.
128
+ */
129
+ peginInputSignature: string;
130
+ /**
131
+ * Vault script pubkey hex — used in the ETH registration call.
109
132
  */
110
133
  vaultScriptPubKey: string;
111
134
  /**
112
- * UTXOs selected for funding the transaction.
135
+ * Funded Pre-PegIn transaction ID.
136
+ */
137
+ prePeginTxid: string;
138
+ /**
139
+ * PegIn transaction hex. Pass to registerPeginOnChain as `depositorSignedPeginTx`
140
+ * so the contract computes the correct vault ID from the pegin txid.
141
+ */
142
+ peginTxHex: string;
143
+ /**
144
+ * PegIn transaction ID (stable — signing does not change it).
145
+ */
146
+ peginTxid: string;
147
+ /**
148
+ * UTXOs selected to fund the Pre-PegIn transaction.
113
149
  */
114
150
  selectedUTXOs: UTXO[];
115
151
  /**
@@ -120,20 +156,15 @@ export interface PeginResult {
120
156
  * Change amount in satoshis (if any).
121
157
  */
122
158
  changeAmount: bigint;
123
- /**
124
- * Ethereum transaction hash (peg-in registration).
125
- * Will be null until registerPeginOnChain is called.
126
- */
127
- ethTxHash: Hash | null;
128
159
  }
129
160
  /**
130
161
  * Parameters for signing and broadcasting a transaction.
131
162
  */
132
163
  export interface SignAndBroadcastParams {
133
164
  /**
134
- * Funded transaction hex from preparePegin().
165
+ * Funded Pre-PegIn transaction hex from prepareAtomicPegin().
135
166
  */
136
- fundedTxHex: string;
167
+ fundedPrePeginTxHex: string;
137
168
  /**
138
169
  * Depositor's BTC public key (x-only, 64-char hex).
139
170
  * Can be provided with or without "0x" prefix.
@@ -151,13 +182,21 @@ export interface RegisterPeginParams {
151
182
  */
152
183
  depositorBtcPubkey: string;
153
184
  /**
154
- * Funded but unsigned BTC transaction hex.
185
+ * Unsigned Pre-PegIn transaction hex (submitted to contract for data availability).
155
186
  */
156
- unsignedBtcTx: string;
187
+ unsignedPrePeginTx: string;
188
+ /**
189
+ * Depositor-signed PegIn transaction hex (submitted to contract; vault ID derived from this).
190
+ */
191
+ depositorSignedPeginTx: string;
157
192
  /**
158
193
  * Vault provider's Ethereum address.
159
194
  */
160
195
  vaultProvider: Address;
196
+ /**
197
+ * SHA256 hashlock for atomic swap activation (bytes32 hex with 0x prefix).
198
+ */
199
+ hashlock: Hex;
161
200
  /**
162
201
  * Optional callback invoked after PoP signing completes but before ETH transaction.
163
202
  */
@@ -212,14 +251,14 @@ export interface RegisterPeginResult {
212
251
  * by coordinating between SDK primitives, utilities, and wallet interfaces.
213
252
  *
214
253
  * @remarks
215
- * The complete peg-in flow consists of 4 steps:
254
+ * The complete atomic swap peg-in flow consists of 4 steps:
216
255
  *
217
256
  * | Step | Method | Description |
218
257
  * |------|--------|-------------|
219
- * | 1 | {@link preparePegin} | Build and fund the transaction |
258
+ * | 1 | {@link prepareAtomicPegin} | Build Pre-PegIn HTLC, fund it, sign PegIn input |
220
259
  * | 2 | {@link registerPeginOnChain} | Submit to Ethereum contract with PoP |
221
260
  * | 3 | {@link PayoutManager} | Sign BOTH payout authorizations |
222
- * | 4 | {@link signAndBroadcast} | Sign and broadcast to Bitcoin network |
261
+ * | 4 | {@link signAndBroadcast} | Sign and broadcast Pre-PegIn tx to Bitcoin network |
223
262
  *
224
263
  * **Important:** Step 3 uses {@link PayoutManager}, not this class. After step 2,
225
264
  * the vault provider prepares 3 transactions per claimer:
@@ -233,7 +272,7 @@ export interface RegisterPeginResult {
233
272
  * Submit all signatures to the vault provider before proceeding to step 4.
234
273
  *
235
274
  * @see {@link PayoutManager} - Required for Step 3 (payout authorization)
236
- * @see {@link buildPeginPsbt} - Lower-level primitive for custom implementations
275
+ * @see {@link buildPrePeginPsbt} - Lower-level primitive for custom implementations
237
276
  * @see {@link https://github.com/babylonlabs-io/babylon-toolkit/blob/main/packages/babylon-ts-sdk/docs/quickstart/managers.md | Managers Quickstart}
238
277
  */
239
278
  export declare class PeginManager {
@@ -245,22 +284,26 @@ export declare class PeginManager {
245
284
  */
246
285
  constructor(config: PeginManagerConfig);
247
286
  /**
248
- * Prepares a peg-in transaction by building and funding it.
287
+ * Prepares an atomic swap peg-in by building the Pre-PegIn HTLC transaction,
288
+ * funding it, constructing the PegIn transaction, and signing the PegIn input.
249
289
  *
250
290
  * This method orchestrates the following steps:
251
291
  * 1. Get depositor BTC public key from wallet
252
- * 2. Build unfunded PSBT using primitives
253
- * 3. Select UTXOs using iterative fee calculation
254
- * 4. Fund transaction by adding inputs and change output
292
+ * 2. Build unfunded Pre-PegIn transaction (HTLC output) using primitives
293
+ * 3. Select UTXOs to cover the HTLC value
294
+ * 4. Fund the Pre-PegIn transaction
295
+ * 5. Derive the PegIn transaction from the funded Pre-PegIn txid
296
+ * 6. Build PSBT for signing the PegIn input (HTLC leaf 0)
297
+ * 7. Sign via BTC wallet and extract depositor signature
255
298
  *
256
- * The returned transaction is funded but unsigned. Use `signAndBroadcast()`
257
- * to complete the Bitcoin side, and `registerPeginOnChain()` for Ethereum.
299
+ * The returned `fundedPrePeginTxHex` is funded but unsigned (inputs unsigned).
300
+ * Use `signAndBroadcast()` AFTER registering on Ethereum to broadcast it.
258
301
  *
259
- * @param params - Peg-in parameters including amount, provider, UTXOs, and fee rate
260
- * @returns Peg-in result with funded transaction and selection details
302
+ * @param params - Atomic pegin parameters including amount, HTLC params, UTXOs
303
+ * @returns Atomic pegin result with funded Pre-PegIn tx, signed PegIn input, and signatures
261
304
  * @throws Error if wallet operations fail or insufficient funds
262
305
  */
263
- preparePegin(params: CreatePeginParams): Promise<PeginResult>;
306
+ prepareAtomicPegin(params: CreateAtomicPeginParams): Promise<AtomicPeginResult>;
264
307
  /**
265
308
  * Signs and broadcasts a funded peg-in transaction to the Bitcoin network.
266
309
  *
@@ -1 +1 @@
1
- {"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mDAAmD,CAAC;AAG9E,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAK7D,OAAO,EAML,KAAK,IAAI,EACV,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,aAAa,CAAC;IAEzB;;;OAGG;IACH,SAAS,EAAE,YAAY,CAAC;IAExB;;;OAGG;IACH,QA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1
+ {"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mDAAmD,CAAC;AAG9E,OAAO,EAML,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AAMvB,OAAO,EAML,KAAK,IAAI,EACV,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,SAAS,EAAE,aAAa,CAAC;IAEzB;;;OAGG;IACH,SAAS,EAAE,YAAY,CAAC;IAExB;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC;IAEhB;;OAEG;IACH,cAAc,EAAE;QACd;;WAEG;QACH,gBAAgB,EAAE,OAAO,CAAC;KAC3B,CAAC;IAEF;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAEzC;;;OAGG;IACH,6BAA6B,EAAE,SAAS,MAAM,EAAE,CAAC;IAEjD;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;OAGG;IAC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CAAC;IAEzC;;;;;;OAMG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC,qEAAqE;IACrE,sBAAsB,EAAE,GAAG,CAAC;IAE5B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,GAAG,CAAC;IAE/B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,GAAG,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;OAIG;IACH,OAAO,EAAE,GAAG,CAAC;IAEb;;;OAGG;IACH,eAAe,EAAE,GAAG,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAE5C;;;;OAIG;gBACS,MAAM,EAAE,kBAAkB;IAItC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,kBAAkB,CACtB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,iBAAiB,CAAC;IAmH7B;;;;;;;;;;;;;;OAcG;IACG,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IA2GvE;;;;;;;;;;;;;;;;OAgBG;IACG,oBAAoB,CACxB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IAgI/B;;;;;OAKG;YACW,gBAAgB;IAuB9B;;;;;;OAMG;YACW,yBAAyB;IAmCvC;;;;;OAKG;YACW,mBAAmB;IAwBjC;;;;OAIG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;OAIG;IACH,uBAAuB,IAAI,OAAO;CAGnC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Tests for PeginManager
3
3
  *
4
- * Tests the manager's ability to orchestrate peg-in operations
4
+ * Tests the manager's ability to orchestrate atomic swap peg-in operations
5
5
  * using primitives, utilities, and mock wallets.
6
6
  */
7
7
  export {};
@@ -35,8 +35,8 @@
35
35
  * ## Available Managers
36
36
  *
37
37
  * ### {@link PeginManager}
38
- * Orchestrates the peg-in deposit flow:
39
- * - {@link PeginManager.preparePegin | preparePegin()} - Build and fund transaction
38
+ * Orchestrates the atomic swap peg-in flow:
39
+ * - {@link PeginManager.prepareAtomicPegin | prepareAtomicPegin()} - Build Pre-PegIn HTLC and sign PegIn input
40
40
  * - {@link PeginManager.registerPeginOnChain | registerPeginOnChain()} - Submit to Ethereum
41
41
  * - {@link PeginManager.signAndBroadcast | signAndBroadcast()} - Broadcast to Bitcoin
42
42
  *
@@ -50,7 +50,7 @@
50
50
  *
51
51
  * | Step | Manager | Method |
52
52
  * |------|---------|--------|
53
- * | 1 | PeginManager | `preparePegin()` |
53
+ * | 1 | PeginManager | `prepareAtomicPegin()` |
54
54
  * | 2 | PeginManager | `registerPeginOnChain()` |
55
55
  * | 3 | PayoutManager | `signPayoutTransaction()` |
56
56
  * | 4 | PeginManager | `signAndBroadcast()` |
@@ -67,7 +67,7 @@
67
67
  * @module managers
68
68
  */
69
69
  export { PeginManager } from './PeginManager';
70
- export type { CreatePeginParams, PeginManagerConfig, PeginResult, RegisterPeginParams, RegisterPeginResult, SignAndBroadcastParams, } from './PeginManager';
70
+ export type { AtomicPeginResult, CreateAtomicPeginParams, PeginManagerConfig, RegisterPeginParams, RegisterPeginResult, SignAndBroadcastParams, } from './PeginManager';
71
71
  export { PayoutManager } from './PayoutManager';
72
72
  export type { PayoutManagerConfig, PayoutSignatureResult, SignPayoutParams, } from './PayoutManager';
73
73
  export type { UTXO } from '../utils/utxo/selectUtxos';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACtD,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,kDAAkD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACtD,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,kDAAkD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=challengers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"challengers.test.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/__tests__/challengers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Challenger counting utilities.
3
+ *
4
+ * Used for UI-level validation (e.g. computing minimum deposit amounts)
5
+ * where the depositor's identity is known. The transaction builders use
6
+ * `vaultKeeperBtcPubkeys.length` to match the VP's current validation.
7
+ */
8
+ /**
9
+ * Compute the number of local challengers for a vault.
10
+ *
11
+ * Mirrors the VP's `compute_num_challengers()` logic:
12
+ * local challengers = {vault_provider} ∪ {vault_keepers} − {depositor}
13
+ *
14
+ * Keys are normalized to x-only lowercase hex before comparison, so
15
+ * `0x`-prefixed, compressed, or mixed-case keys are handled correctly.
16
+ *
17
+ * @param vaultProviderPubkey - Vault provider BTC public key
18
+ * @param vaultKeeperPubkeys - Vault keeper BTC public keys
19
+ * @param depositorPubkey - Depositor (claimer) BTC public key
20
+ * @returns Number of local challengers
21
+ */
22
+ export declare function computeNumLocalChallengers(vaultProviderPubkey: string, vaultKeeperPubkeys: string[], depositorPubkey: string): number;
23
+ //# sourceMappingURL=challengers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"challengers.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/primitives/challengers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,EAAE,MAAM,EAAE,EAC5B,eAAe,EAAE,MAAM,GACtB,MAAM,CAQR"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@babylonlabs-io/babylon-tbv-rust-wasm"),e=require("../../../challengeAssert-34HqeVFH.cjs");Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>t.computeMinClaimValue});exports.buildChallengeAssertPsbt=e.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=e.buildDepositorPayoutPsbt;exports.buildNoPayoutPsbt=e.buildNoPayoutPsbt;exports.buildPayoutPsbt=e.buildPayoutPsbt;exports.buildPeginPsbt=e.buildPeginPsbt;exports.createPayoutScript=e.createPayoutScript;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.extractPayoutSignature=e.extractPayoutSignature;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../challengeAssert-ClJYoKxJ.cjs"),t=require("@babylonlabs-io/babylon-tbv-rust-wasm");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.computeNumLocalChallengers=e.computeNumLocalChallengers;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.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>t.computeMinClaimValue});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -49,6 +49,9 @@
49
49
  * ### Script Generators
50
50
  * - {@link createPayoutScript} - Generate taproot payout script
51
51
  *
52
+ * ### Challenger Counting
53
+ * - {@link computeNumLocalChallengers} - Compute number of local challengers for a vault
54
+ *
52
55
  * ### WASM Functions
53
56
  * - {@link computeMinClaimValue} - Compute the minimum claim value accepted by the vault provider
54
57
  *
@@ -68,11 +71,14 @@
68
71
  *
69
72
  * @module primitives
70
73
  */
74
+ export { computeNumLocalChallengers } from './challengers';
71
75
  export type { Network } from '@babylonlabs-io/babylon-tbv-rust-wasm';
72
76
  export { computeMinClaimValue } from '@babylonlabs-io/babylon-tbv-rust-wasm';
73
77
  export type { AssertPayoutNoPayoutConnectorParams, ChallengeAssertConnectorParams, PayoutConnectorParams, } from '@babylonlabs-io/babylon-tbv-rust-wasm';
74
- export { buildPeginPsbt } from './psbt/pegin';
75
- export type { PeginParams, PeginPsbtResult } from './psbt/pegin';
78
+ export { buildPrePeginPsbt, buildPeginTxFromFundedPrePegin } from './psbt/pegin';
79
+ export type { PrePeginParams, PrePeginPsbtResult, BuildPeginTxParams, PeginTxResult, } from './psbt/pegin';
80
+ export { buildPeginInputPsbt, extractPeginInputSignature } from './psbt/peginInput';
81
+ export type { BuildPeginInputPsbtParams, BuildPeginInputPsbtResult, } from './psbt/peginInput';
76
82
  export { buildPayoutPsbt, extractPayoutSignature } from './psbt/payout';
77
83
  export type { PayoutParams, PayoutPsbtResult } from './psbt/payout';
78
84
  export { buildDepositorPayoutPsbt } from './psbt/depositorPayout';
@@ -83,5 +89,5 @@ export { buildChallengeAssertPsbt } from './psbt/challengeAssert';
83
89
  export type { ChallengeAssertParams } from './psbt/challengeAssert';
84
90
  export { createPayoutScript } from './scripts/payout';
85
91
  export type { PayoutScriptParams, PayoutScriptResult } from './scripts/payout';
86
- export { deriveNativeSegwitAddress, deriveTaprootAddress, hexToUint8Array, isAddressFromPublicKey, isValidHex, processPublicKeyToXOnly, stripHexPrefix, toXOnly, uint8ArrayToHex, validateWalletPubkey, type WalletPubkeyValidationResult, } from './utils/bitcoin';
92
+ export { deriveNativeSegwitAddress, deriveTaprootAddress, hexToUint8Array, isAddressFromPublicKey, isValidHex, ensureHexPrefix, processPublicKeyToXOnly, stripHexPrefix, toXOnly, uint8ArrayToHex, validateWalletPubkey, type WalletPubkeyValidationResult, } from './utils/bitcoin';
87
93
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/primitives/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAGH,YAAY,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,YAAY,EACV,mCAAmC,EACnC,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBA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EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG/E,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,KAAK,4BAA4B,GAClC,MAAM,iBAAiB,CAAC"}
@@ -1,23 +1,28 @@
1
- import { computeMinClaimValue as e } from "@babylonlabs-io/babylon-tbv-rust-wasm";
2
- import { f as i, c as r, d as o, a as l, b as u, g as d, h as P, i as b, e as y, j as p, k as c, l as n, p as x, s as A, t as g, u as m, v } from "../../../challengeAssert-DVErOd8l.js";
1
+ import { j as s, h as t, i, f as r, d as u, a as o, b as l, c as P, k as d, l as n, m as b, q as p, g as x, e as y, n as c, o as g, p as m, r as A, s as f, t as v, u as T, v as h } from "../../../challengeAssert-ZXE00zkT.js";
2
+ import { computeMinClaimValue as S } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
3
  export {
4
- i as buildChallengeAssertPsbt,
5
- r as buildDepositorPayoutPsbt,
6
- o as buildNoPayoutPsbt,
7
- l as buildPayoutPsbt,
8
- u as buildPeginPsbt,
9
- e as computeMinClaimValue,
4
+ s as buildChallengeAssertPsbt,
5
+ t as buildDepositorPayoutPsbt,
6
+ i as buildNoPayoutPsbt,
7
+ r as buildPayoutPsbt,
8
+ u as buildPeginInputPsbt,
9
+ o as buildPeginTxFromFundedPrePegin,
10
+ l as buildPrePeginPsbt,
11
+ S as computeMinClaimValue,
12
+ P as computeNumLocalChallengers,
10
13
  d as createPayoutScript,
11
- P as deriveNativeSegwitAddress,
14
+ n as deriveNativeSegwitAddress,
12
15
  b as deriveTaprootAddress,
13
- y as extractPayoutSignature,
14
- p as hexToUint8Array,
15
- c as isAddressFromPublicKey,
16
- n as isValidHex,
17
- x as processPublicKeyToXOnly,
18
- A as stripHexPrefix,
19
- g as toXOnly,
20
- m as uint8ArrayToHex,
21
- v as validateWalletPubkey
16
+ p as ensureHexPrefix,
17
+ x as extractPayoutSignature,
18
+ y as extractPeginInputSignature,
19
+ c as hexToUint8Array,
20
+ g as isAddressFromPublicKey,
21
+ m as isValidHex,
22
+ A as processPublicKeyToXOnly,
23
+ f as stripHexPrefix,
24
+ v as toXOnly,
25
+ T as uint8ArrayToHex,
26
+ h as validateWalletPubkey
22
27
  };
23
28
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tests for buildPeginPsbt primitive function
2
+ * Tests for buildPrePeginPsbt and buildPeginTxFromFundedPrePegin primitives
3
3
  */
4
4
  export {};
5
5
  //# sourceMappingURL=pegin.test.d.ts.map
@@ -5,7 +5,10 @@
5
5
  * These functions wrap the WASM implementation with a clean TypeScript API.
6
6
  *
7
7
  * Exports:
8
- * - {@link buildPeginPsbt} - Create unfunded peg-in transaction
8
+ * - {@link buildPrePeginPsbt} - Create unfunded Pre-PegIn transaction (HTLC output)
9
+ * - {@link buildPeginTxFromFundedPrePegin} - Derive PegIn tx from funded Pre-PegIn txid
10
+ * - {@link buildPeginInputPsbt} - Create PSBT for depositor to sign PegIn HTLC leaf 0 input
11
+ * - {@link extractPeginInputSignature} - Extract depositor signature from signed PegIn input PSBT
9
12
  * - {@link buildPayoutPsbt} - Create payout PSBT for signing
10
13
  * - {@link extractPayoutSignature} - Extract Schnorr signature from signed PSBT
11
14
  * - {@link buildDepositorPayoutPsbt} - Create depositor's own Payout PSBT (depositor-as-claimer path)
@@ -14,8 +17,10 @@
14
17
  *
15
18
  * @module primitives/psbt
16
19
  */
17
- export { buildPeginPsbt } from './pegin';
18
- export type { PeginParams, PeginPsbtResult } from './pegin';
20
+ export { buildPrePeginPsbt, buildPeginTxFromFundedPrePegin } from './pegin';
21
+ export type { PrePeginParams, PrePeginPsbtResult, BuildPeginTxParams, PeginTxResult, } from './pegin';
22
+ export { buildPeginInputPsbt, extractPeginInputSignature } from './peginInput';
23
+ export type { BuildPeginInputPsbtParams, BuildPeginInputPsbtResult, } from './peginInput';
19
24
  export { buildPayoutPsbt, extractPayoutSignature } from './payout';
20
25
  export type { PayoutParams, PayoutPsbtResult } from './payout';
21
26
  export { buildDepositorPayoutPsbt } from './depositorPayout';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACnE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/index.ts"],"names":[],"mappings":"AAAA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