@babylonlabs-io/ts-sdk 0.15.3 → 0.16.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/{errors-UqmtfBtv.js → errors-BEUjAw2k.js} +363 -453
- package/dist/errors-BEUjAw2k.js.map +1 -0
- package/dist/errors-DnMc1lLU.cjs +2 -0
- package/dist/errors-DnMc1lLU.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +31 -33
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +33 -35
- package/dist/tbv/core/utils/transaction/index.d.ts +0 -1
- package/dist/tbv/core/utils/transaction/index.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +33 -35
- package/dist/tbv/integrations/aave/clients/abis/AaveSpoke.abi.json.d.ts +15 -25
- package/dist/tbv/integrations/aave/clients/index.d.ts +1 -1
- package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/clients/spoke.d.ts +59 -26
- package/dist/tbv/integrations/aave/clients/spoke.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/constants.d.ts +0 -35
- package/dist/tbv/integrations/aave/constants.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/index.cjs +1 -1
- package/dist/tbv/integrations/aave/index.cjs.map +1 -1
- package/dist/tbv/integrations/aave/index.d.ts +2 -2
- package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
- package/dist/tbv/integrations/aave/index.js +201 -190
- package/dist/tbv/integrations/aave/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/errors-BZc3Urez.cjs +0 -2
- package/dist/errors-BZc3Urez.cjs.map +0 -1
- package/dist/errors-UqmtfBtv.js.map +0 -1
- package/dist/tbv/core/utils/transaction/__tests__/createSplitTransaction.test.d.ts +0 -5
- package/dist/tbv/core/utils/transaction/__tests__/createSplitTransaction.test.d.ts.map +0 -1
- package/dist/tbv/core/utils/transaction/createSplitTransaction.d.ts +0 -106
- package/dist/tbv/core/utils/transaction/createSplitTransaction.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createSplitTransaction.test.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/utils/transaction/__tests__/createSplitTransaction.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
import { Network } from '../../primitives';
|
|
3
|
-
import { UTXO } from '../utxo/selectUtxos';
|
|
4
|
-
/**
|
|
5
|
-
* Output specification for split transaction.
|
|
6
|
-
*/
|
|
7
|
-
export interface SplitOutput {
|
|
8
|
-
/** Amount in satoshis */
|
|
9
|
-
amount: bigint;
|
|
10
|
-
/** Bitcoin address to send to */
|
|
11
|
-
address: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Result of creating a split transaction.
|
|
15
|
-
*/
|
|
16
|
-
export interface SplitTransactionResult {
|
|
17
|
-
/** Unsigned transaction hex */
|
|
18
|
-
txHex: string;
|
|
19
|
-
/** Transaction ID (deterministic, calculated before signing) */
|
|
20
|
-
txid: string;
|
|
21
|
-
/** Output UTXOs that will be created when transaction is broadcast */
|
|
22
|
-
outputs: Array<{
|
|
23
|
-
/** Transaction ID of this output */
|
|
24
|
-
txid: string;
|
|
25
|
-
/** Output index */
|
|
26
|
-
vout: number;
|
|
27
|
-
/** Amount in satoshis */
|
|
28
|
-
value: number;
|
|
29
|
-
/** Script pubkey hex */
|
|
30
|
-
scriptPubKey: string;
|
|
31
|
-
}>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Create a UTXO split transaction.
|
|
35
|
-
*
|
|
36
|
-
* This function creates a Bitcoin transaction that takes input UTXOs
|
|
37
|
-
* and splits them into multiple outputs with specified amounts.
|
|
38
|
-
*
|
|
39
|
-
* The transaction is returned unsigned. The caller must:
|
|
40
|
-
* 1. Sign the transaction using a Bitcoin wallet
|
|
41
|
-
* 2. Broadcast it to the Bitcoin network
|
|
42
|
-
* 3. Use the output UTXOs for subsequent peg-in transactions
|
|
43
|
-
*
|
|
44
|
-
* @param inputs - Input UTXOs to split
|
|
45
|
-
* @param outputs - Desired output amounts and addresses
|
|
46
|
-
* @param network - Bitcoin network (mainnet, testnet, signet, regtest)
|
|
47
|
-
* @returns Unsigned transaction hex, txid, and output UTXO references
|
|
48
|
-
* @throws Error if inputs or outputs are empty
|
|
49
|
-
* @throws Error if address decoding fails (invalid address for network)
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* const result = createSplitTransaction(
|
|
54
|
-
* [{ txid: "abc...", vout: 0, value: 100000, scriptPubKey: "..." }],
|
|
55
|
-
* [
|
|
56
|
-
* { amount: 50000n, address: "tb1p..." },
|
|
57
|
-
* { amount: 45000n, address: "tb1p..." }
|
|
58
|
-
* ],
|
|
59
|
-
* "testnet"
|
|
60
|
-
* );
|
|
61
|
-
* // result.txHex → unsigned transaction
|
|
62
|
-
* // result.txid → deterministic transaction ID
|
|
63
|
-
* // result.outputs → UTXO references for pegin creation
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export declare function createSplitTransaction(inputs: UTXO[], outputs: SplitOutput[], network: Network): SplitTransactionResult;
|
|
67
|
-
/**
|
|
68
|
-
* Create a PSBT for signing a split transaction with Taproot inputs.
|
|
69
|
-
*
|
|
70
|
-
* IMPORTANT: This function assumes ALL inputs are P2TR (Taproot) addresses.
|
|
71
|
-
* It unconditionally adds tapInternalKey for Taproot signing. Using non-P2TR
|
|
72
|
-
* inputs will cause wallet signing failures.
|
|
73
|
-
*
|
|
74
|
-
* This function takes an unsigned split transaction and creates a PSBT
|
|
75
|
-
* that is intended to be signed by a Bitcoin wallet; this function does not
|
|
76
|
-
* perform any signing itself.
|
|
77
|
-
*
|
|
78
|
-
* The PSBT includes:
|
|
79
|
-
* - witnessUtxo: Script and value for each input (required for segwit)
|
|
80
|
-
* - tapInternalKey: Depositor's x-only pubkey (required for P2TR signing)
|
|
81
|
-
*
|
|
82
|
-
* Technical Note:
|
|
83
|
-
* For P2TR (Taproot) inputs, we need the witnessUtxo and tapInternalKey.
|
|
84
|
-
* This is different from legacy inputs which would need the full previous transaction.
|
|
85
|
-
*
|
|
86
|
-
* @param unsignedTxHex - Unsigned transaction hex from createSplitTransaction
|
|
87
|
-
* @param inputs - Input UTXOs with full data for PSBT
|
|
88
|
-
* @param publicKeyNoCoord - Depositor's public key (x-only, 32 bytes) for P2TR signing
|
|
89
|
-
* @returns PSBT hex ready for wallet signing
|
|
90
|
-
* @throws Error if publicKeyNoCoord is not a 32-byte Buffer
|
|
91
|
-
* @throws Error if UTXO count doesn't match transaction inputs
|
|
92
|
-
* @throws Error if any input is not P2TR format
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* ```typescript
|
|
96
|
-
* const psbtHex = createSplitTransactionPsbt(
|
|
97
|
-
* result.txHex,
|
|
98
|
-
* inputUtxos,
|
|
99
|
-
* Buffer.from(depositorPubkeyXOnly, "hex")
|
|
100
|
-
* );
|
|
101
|
-
* // Sign via wallet
|
|
102
|
-
* const signedPsbtHex = await wallet.signPsbt(psbtHex);
|
|
103
|
-
* ```
|
|
104
|
-
*/
|
|
105
|
-
export declare function createSplitTransactionPsbt(unsignedTxHex: string, inputs: UTXO[], publicKeyNoCoord: Buffer): string;
|
|
106
|
-
//# sourceMappingURL=createSplitTransaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createSplitTransaction.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/utils/transaction/createSplitTransaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,OAAO,EAAE,KAAK,CAAC;QACb,oCAAoC;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,mBAAmB;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,yBAAyB;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,wBAAwB;QACxB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,IAAI,EAAE,EACd,OAAO,EAAE,WAAW,EAAE,EACtB,OAAO,EAAE,OAAO,GACf,sBAAsB,CAgFxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,IAAI,EAAE,EACd,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAyFR"}
|