@@ -12,57 +12,86 @@ export const ConsolidateUnspentsRequestParams = {
1212
1313/**
1414 * Request body for consolidating unspents in a wallet
15+ *
16+ * Parameters match SDK's ConsolidateUnspentsOptions interface.
17+ * Handler passes request body directly to wallet.consolidateUnspents().
1518 */
1619export const ConsolidateUnspentsRequestBody = {
1720 /** The wallet passphrase to decrypt the user key */
1821 walletPassphrase : optional ( t . string ) ,
1922 /** The extended private key (alternative to walletPassphrase) */
2023 xprv : optional ( t . string ) ,
21- /** Whether to validate addresses (defaults to true) */
22- validate : optional ( t . boolean ) ,
23- /** Target number of unspents to maintain (defaults to 1) */
24- target : optional ( t . number ) ,
25- /** Minimum size of unspents to consolidate */
26- minSize : optional ( t . union ( [ t . number , t . string ] ) ) ,
27- /** Maximum size of unspents to consolidate */
28- maxSize : optional ( t . union ( [ t . number , t . string ] ) ) ,
29- /** Maximum number of inputs per consolidation transaction (defaults to 200, must be ≥ 2) */
30- maxInputCountPerConsolidation : optional ( t . number ) ,
31- /** Maximum number of consolidation iterations (defaults to -1) */
32- maxIterationCount : optional ( t . number ) ,
33- /** Minimum number of confirmations needed for an unspent to be included (defaults to 1) */
34- minConfirms : optional ( t . number ) ,
3524 /** Custom fee rate in satoshis per kilobyte */
3625 feeRate : optional ( t . number ) ,
26+ /** Upper limit for fee rate in satoshis per kilobyte */
27+ maxFeeRate : optional ( t . number ) ,
28+ /** Maximum relative portion willing to spend on fees (as decimal, e.g., 0.1 for 10%) */
29+ maxFeePercentage : optional ( t . number ) ,
30+ /** Target number of blocks for fee estimation */
31+ feeTxConfirmTarget : optional ( t . number ) ,
32+ /** Minimum value of unspents to consolidate (in base units) */
33+ minValue : optional ( t . union ( [ t . number , t . string ] ) ) ,
34+ /** Maximum value of unspents to consolidate (in base units) */
35+ maxValue : optional ( t . union ( [ t . number , t . string ] ) ) ,
36+ /** Minimum blockchain height for unspents to be included */
37+ minHeight : optional ( t . number ) ,
38+ /** Minimum number of confirmations needed for an unspent (defaults to 1) */
39+ minConfirms : optional ( t . number ) ,
40+ /** Whether minConfirms also applies to change outputs */
41+ enforceMinConfirmsForChange : optional ( t . boolean ) ,
42+ /** Maximum number of unspents to use in a single transaction */
43+ limit : optional ( t . number ) ,
44+ /** Number of new unspents to create */
45+ numUnspentsToMake : optional ( t . number ) ,
46+ /** Target address for consolidated funds */
47+ targetAddress : optional ( t . string ) ,
48+ /** Transaction format type */
49+ txFormat : optional ( t . union ( [ t . literal ( 'legacy' ) , t . literal ( 'psbt' ) , t . literal ( 'psbt-lite' ) ] ) ) ,
50+ /** Enable bulk consolidation (creates multiple transactions if needed) */
51+ bulk : optional ( t . boolean ) ,
52+ /** Transaction comment */
53+ comment : optional ( t . string ) ,
54+ /** One-time password for additional security */
55+ otp : optional ( t . string ) ,
3756} ;
3857
58+ /**
59+ * Single transaction response object
60+ */
61+ const ConsolidateUnspentsSingleTxResponse = t . type ( {
62+ /** The status of the transaction ('accepted', 'pendingApproval', or 'otp') */
63+ status : t . string ,
64+ /** The transaction hex */
65+ tx : t . string ,
66+ /** The transaction hash/ID */
67+ hash : t . string ,
68+ /** Whether the transaction is instant */
69+ instant : t . boolean ,
70+ /** The instant ID (if applicable) */
71+ instantId : optional ( t . string ) ,
72+ /** The fee amount in base units */
73+ fee : t . number ,
74+ /** The fee rate in base units per kilobyte */
75+ feeRate : t . number ,
76+ /** Travel rule information */
77+ travelInfos : t . unknown ,
78+ /** BitGo fee information (if applicable) */
79+ bitgoFee : optional ( t . unknown ) ,
80+ /** Travel rule result (if applicable) */
81+ travelResult : optional ( t . unknown ) ,
82+ } ) ;
83+
3984/**
4085 * Response for consolidating unspents in a wallet
86+ *
87+ * SDK returns a single transaction object when consolidating normally,
88+ * or an array of transaction objects when bulk consolidation is used.
89+ * Handler returns SDK result directly without transformation.
4190 */
42- export const ConsolidateUnspentsResponse = t . array (
43- t . type ( {
44- /** The status of the transaction ('accepted', 'pendingApproval', or 'otp') */
45- status : t . string ,
46- /** The transaction hex */
47- tx : t . string ,
48- /** The transaction hash/ID */
49- hash : t . string ,
50- /** Whether the transaction is instant */
51- instant : t . boolean ,
52- /** The instant ID (if applicable) */
53- instantId : optional ( t . string ) ,
54- /** The fee amount in satoshis */
55- fee : t . number ,
56- /** The fee rate in satoshis per kilobyte */
57- feeRate : t . number ,
58- /** Travel rule information */
59- travelInfos : t . unknown ,
60- /** BitGo fee information (if applicable) */
61- bitgoFee : optional ( t . unknown ) ,
62- /** Travel rule result (if applicable) */
63- travelResult : optional ( t . unknown ) ,
64- } )
65- ) ;
91+ export const ConsolidateUnspentsResponse = t . union ( [
92+ ConsolidateUnspentsSingleTxResponse , // Single transaction
93+ t . array ( ConsolidateUnspentsSingleTxResponse ) , // Multiple transactions (bulk mode)
94+ ] ) ;
6695
6796/**
6897 * Consolidate unspents in a wallet
0 commit comments