Estimate Fee

POST /wallets/{walletId}/payment-fees

status: stable

Estimate fee for the transaction. The estimate is made by assembling multiple transactions and analyzing the distribution of their fees. The estimated_max is the highest fee observed, and the estimated_min is the fee which is lower than at least 90% of the fees observed.

Path parameters

  • walletId string(hex) Required

    Minimum length is 40, maximum length is 40.

application/json

Body object Required

One of:

Responses

  • 415 application/json

    Unsupported Media Type

    Hide response attributes Show response attributes object
    • message string Required

      May occur when providing an invalid 'Content-Type' header.

    • code string Required

      Value is unsupported_media_type.

  • 406 application/json

    Not Acceptable

    Hide response attributes Show response attributes object
    • message string Required

      May occur when providing an invalid 'Accept' header.

    • code string Required

      Value is not_acceptable.

  • 404 application/json

    Not Found

    Hide response attributes Show response attributes object
    • message string Required

      May occur when a given walletId does not match with any known wallets (because it has been deleted, or has never existed).

    • code string Required

      Value is no_such_wallet.

    • info object
      Hide info attribute Show info attribute object
      • wallet_id string(hex) Required

        A unique identifier for the wallet

        Minimum length is 40, maximum length is 40.

  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • message string Required

      May occur when a request is not well-formed; that is, it fails to parse successfully. This could be the case when some required parameters are missing or, when malformed values are provided.

    • code string Required

      Value is bad_request.

  • 403 application/json

    Forbidden

    One of:
  • 202 application/json

    Accepted

    Hide response attributes Show response attributes object
    • estimated_min object Required

      Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

      Hide estimated_min attributes Show estimated_min attributes object
      • quantity integer Required

        Minimum value is 0.

      • unit string Required

        Value is lovelace.

    • estimated_max object Required

      Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

      Hide estimated_max attributes Show estimated_max attributes object
      • quantity integer Required

        Minimum value is 0.

      • unit string Required

        Value is lovelace.

    • minimum_coins array[object] Required

      A list of minimum coin values that each output in a payment must satisfy. The values themselves depends on two things:

      • (a) Some updatable protocol parameters fixed by the network.
      • (b) The nature of the outputs (i.e. the kind of assets it includes).

      The list is a direct 1:1 mapping of the requested outputs. Said differently, it has the same number of items and items are ordered in the same way as requested outputs are ordered. In the case where there's no explicitly requested outputs (e.g. when calculating fee for delegation), this list is empty.

      For example, an output containing only Ada may require to be of at least 1 Ada. An output containing only an hypothetical AppleCoin may require to also carry a minimum of 1.2 Ada. Note that no matter what, a minimum coin value is always given in Lovelace / Ada.

      ℹ️ This mechanism is used by the protocol to protect against flooding of the network with worthless assets. By requiring a minimum coin value to every UTxO, they are given an intrinsic value indexed itself on the value of Ada.

      At least 0 elements.

      Hide minimum_coins attributes Show minimum_coins attributes object
      • quantity integer Required

        Minimum value is 0.

      • unit string Required

        Value is lovelace.

    • deposit object Required

      Coins, in Lovelace. Only relates to 'Ada'. Refer to assets for multi-assets wallets instead.

      Hide deposit attributes Show deposit attributes object
      • quantity integer Required

        Minimum value is 0.

      • unit string Required

        Value is lovelace.

POST /wallets/{walletId}/payment-fees
curl \
 --request POST https://localhost:8090/v2/wallets/{walletId}/payment-fees \
 --header "Content-Type: application/json" \
 --data '{"payments":[{"address":"addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g","amount":{"quantity":42000000,"unit":"lovelace"},"assets":[{"policy_id":"65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b","asset_name":"string","quantity":42}]}],"withdrawal":"self","metadata":{"0":{"string":"cardano"},"1":{"int":14},"2":{"bytes":"2512a00e9653fe49a44a5886202e24d77eeb998f"},"3":{"list":[{"int":14},{"int":42},{"string":"1337"}]},"4":{"map":[{"k":{"string":"key"},"v":{"string":"value"}},{"k":{"int":14},"v":{"int":42}}]}},"time_to_live":{"quantity":10.0,"unit":"second"}}'
Request examples
{
  "payments": [
    {
      "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
      "amount": {
        "quantity": 42000000,
        "unit": "lovelace"
      },
      "assets": [
        {
          "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
          "asset_name": "string",
          "quantity": 42
        }
      ]
    }
  ],
  "withdrawal": "self",
  "metadata": {
    "0": {
      "string": "cardano"
    },
    "1": {
      "int": 14
    },
    "2": {
      "bytes": "2512a00e9653fe49a44a5886202e24d77eeb998f"
    },
    "3": {
      "list": [
        {
          "int": 14
        },
        {
          "int": 42
        },
        {
          "string": "1337"
        }
      ]
    },
    "4": {
      "map": [
        {
          "k": {
            "string": "key"
          },
          "v": {
            "string": "value"
          }
        },
        {
          "k": {
            "int": 14
          },
          "v": {
            "int": 42
          }
        }
      ]
    }
  },
  "time_to_live": {
    "quantity": 10.0,
    "unit": "second"
  }
}
{
  "payments": [
    {
      "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
      "amount": {
        "quantity": 42000000,
        "unit": "lovelace"
      },
      "assets": [
        {
          "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
          "asset_name": "string",
          "quantity": 42
        }
      ]
    }
  ],
  "withdrawal": [
    "squirrel",
    "material",
    "silly",
    "twice",
    "direct",
    "slush",
    "pistol",
    "razor",
    "become",
    "junk",
    "kingdom",
    "flee",
    "squirrel",
    "silly",
    "twice"
  ]
}
Response examples (415)
{
  "message": "string",
  "code": "unsupported_media_type"
}
Response examples (406)
{
  "message": "string",
  "code": "not_acceptable"
}
Response examples (404)
{
  "message": "string",
  "code": "no_such_wallet",
  "info": {
    "wallet_id": "2512a00e9653fe49a44a5886202e24d77eeb998f"
  }
}
Response examples (400)
{
  "message": "string",
  "code": "bad_request"
}
{
  "message": "string",
  "code": "invalid_wallet_type"
}
{
  "message": "string",
  "code": "already_withdrawing"
}
{
  "message": "string",
  "code": "utxo_too_small",
  "info": {
    "tx_output_index": 42,
    "tx_output_lovelace_specified": {
      "quantity": 42000000,
      "unit": "lovelace"
    },
    "tx_output_lovelace_required_minimum": {
      "quantity": 42000000,
      "unit": "lovelace"
    }
  }
}
{
  "message": "string",
  "code": "cannot_cover_fee"
}
{
  "message": "string",
  "code": "no_utxos_available"
}
{
  "message": "string",
  "code": "not_enough_money",
  "info": {
    "shortfall": {
      "ada": {
        "quantity": 42000000,
        "unit": "lovelace"
      },
      "assets": [
        {
          "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
          "asset_name": "string",
          "quantity": 42
        }
      ]
    }
  }
}
{
  "message": "string",
  "code": "insufficient_collateral"
}
{
  "message": "string",
  "code": "inputs_depleted"
}
{
  "message": "string",
  "code": "invalid_coin_selection"
}
{
  "message": "string",
  "code": "output_token_quantity_exceeds_limit",
  "info": {
    "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
    "policy_id": "65ab82542b0ca20391caaf66a4d4d7897d281f9c136cd3513136945b",
    "asset_name": "string",
    "quantity": 42,
    "max_quantity": 42
  }
}
{
  "message": "string",
  "code": "output_token_bundle_size_exceeds_limit",
  "info": {
    "address": "addr1sjck9mdmfyhzvjhydcjllgj9vjvl522w0573ncustrrr2rg7h9azg4cyqd36yyd48t5ut72hgld0fg2xfvz82xgwh7wal6g2xt8n996s3xvu5g",
    "bundle_size": 42
  }
}
{
  "message": "string",
  "code": "transaction_is_too_big"
}
Response examples (202)
{
  "estimated_min": {
    "quantity": 42000000,
    "unit": "lovelace"
  },
  "estimated_max": {
    "quantity": 42000000,
    "unit": "lovelace"
  },
  "minimum_coins": [
    {
      "quantity": 42000000,
      "unit": "lovelace"
    }
  ],
  "deposit": {
    "quantity": 42000000,
    "unit": "lovelace"
  }
}