latestOpenAPI 3.0.32026-08-224982,0272.8 MB

e445c15e5bee

Wallet

Consolidate unspents (advanced)

Build a transaction to consolidate unspents in a wallet. Once built, you must sign and sent the transaction. Consolidating unspents is only for UTXO-based assets.

post/api/v2/{coin}/wallet/{walletId}/consolidateUnspents

Path parameters

coinstring required

A cryptocurrency or token ticker symbol.

Example:btc
walletIdstring required
Example:59cd72485007a239fb00282ed480da1f

The wallet ID.

Request body

maxFeePercentageinteger

Maximum relative portion that can be spent towards fees

feeTxConfirmTargetinteger

Block target for fee estimation

bulkboolean

Build multiple transactions at the same time. This enables you to increase the maximum number of unspents on the limit parameter up to 2,000. If true, you must pass the txFormat as psbt and you can't pass the targetAddress or numUnspentsToMake parameters.

minHeightinteger

Minimum height of unspents on the block chain to use

minConfirmsinteger

Minimum confirmation threshold for external inputs

enforceMinConfirmsForChangeboolean

Flag for enforcing minConfirms for change inputs

limitinteger

Maximum number of unspents to use in the transaction

numUnspentsToMakeinteger

Number of new unspents to make

targetAddressstring

address to use for generated outputs. Must be wallet address.

txFormat'legacy' | 'psbt' | 'psbt-lite'

[UTXO only] Format of the returned transaction hex serialization. legacy for serialized transaction in custom bitcoinjs-lib format. psbt for BIP174 serialized transaction

Example request

{
  "feeRate": 10000,
  "maxFeeRate": 20000,
  "minValue": "2000000",
  "maxValue": "2000000",
  "txFormat": "psbt"
}

Response

OK

Example response

{
  "txHex": "01000000000101d58f82d996dd872012675adadf4606734906b25a413f6e2ee535c0c10aef96020000000000ffffffff028de888000000000017a914c91aa24f65827eecec775037d886f2952b73cbe48740420f000000000017a9149304d18497b9bfe9532778a0f06d9fff3b3befaf870500473044022023d7210ba6d8bbd7a28b8af226f40f7235caab79156f93f9c9969fc459ea7f73022050fbdca788fba3de686b66b3501853695ff9d6f375867470207d233b099576e001000069522103d4788cda52f91c1f6c82eb91491ca76108c9c5f0839bc4f02eccc55fedb3311c210391bcef9dcc89570a79ba3c7514e65cd48e766a8868eca2769fa9242fdcc796662102ef3c5ebac4b54df70dea1bb2655126368be10ca0462382fcb730e55cddd2dd6a53aec8b11400",
  "txInfo": {
    "changeAddresses": [
      "2MvrwRYBAuRtPTiZ5MyKg42Ke55W3fZJfZS"
    ],
    "nOutputs": 2,
    "nSegwitInputs": 1,
    "unspents": [
      {
        "id": "003f688cc349f1fca8ac5ffa21671ca911b6ef351085c60733ed8c2ebf162cb8:2",
        "address": "2MsKxhhkDo5WaLaYRGA9Cr3iSQPyXsu6Fi2",
        "valueString": "2000000",
        "date": "2017-03-25T23:01:40.248Z",
        "wallet": "59cd72485007a239fb00282ed480da1f",
        "fromWallet": "59cd72485007a239fb00282ed480da1f",
        "redeemScript": "522102f1e990044d2a8be43d5b500bbdcb36277b97a4b07e01c5101ae8ec1568bfd6532103dab7dc82f2fc8c28200c1bdeca9c4cf181e0ca257395829cbd599395048afb57210205422e711827d8356f2fb75334d863941dd7eb45bd5788fa231dc5fa755135b653ae",
        "witnessScript": "52210351311cd81144e6cbdba561d24dfc22644cb02d053339d4beace03231b3be4f372103a8d0c1a375b9ee1a2411f9f8e18373be7f228b18260f63bbfca48809170ed08b2103c3bd8bd074657bbe9ee6714b31a4a54b6fd5b5cda0e1030122f9bf46b5034f6b53ae"
      }
    ],
    "walletAddressDetails": {
      "id": "59cd72485007a239fb00282ed480da1f",
      "address": "2MvrwRYBAuRtPTiZ5MyKg42Ke55W3fZJfZS",
      "chain": 1,
      "wallet": "59cd72485007a239fb00282ed480da1f",
      "coinSpecific": {
        "xlm": {
          "memoId": "1",
          "rootAddress": "GCTTCPH4IIDK7P72FFAEJ3ZFN6WDHJH6GGMRPHPM56ZWGIQ7B3XTIJAM"
        },
        "txlm": {
          "memoId": "1",
          "rootAddress": "GCTTCPH4IIDK7P72FFAEJ3ZFN6WDHJH6GGMRPHPM56ZWGIQ7B3XTIJAM"
        }
      },
      "balance": {
        "balance": 50000,
        "balanceString": "50000",
        "confirmedBalanceString": "40000",
        "spendableBalanceString": "40000"
      },
      "label": "Bob's Hot Wallet Address",
      "addressType": "p2sh"
    }
  },
  "feeInfo": {
    "size": 776,
    "fee": 38800,
    "feeRate": 10000
  }
}