Estimate Fee
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 is40
.
Body
object
Required
-
payments
array[object] Required A list of target outputs with amounts specified.
When creating a new transaction, the wallet software ensures that all user-specified transaction outputs have ada amounts that satisfy the ledger minimum UTxO rule:
If a user-specified transaction output has an ada
amount
that is zero, the wallet software will automatically assign a minimal amount of ada to the output so that it satisfies the ledger minimum UTxO rule.If a user-specified transaction output has an ada
amount
that is non-zero, the wallet software will verify that the specified amount is large enough to satisfy the ledger minimum UTxO rule. If the amount is not large enough, the wallet software will return autxo_too_small
error, together with a revised ada amount that does satisfy the minimum UTxO rule.
At least
0
elements. -
withdrawal
string When provided, instruments the server to automatically withdraw rewards from the source wallet when they are deemed sufficient (i.e. they contribute to the balance for at least as much as they cost).
As a consequence, the resulting transaction may or may not have a withdrawal object. Summarizing:
withdrawal field reward balance result null
too small ✓ no withdrawals generated null
big enough ✓ no withdrawals generated "self"
too small ✓ no withdrawals generated "self"
big enough ✓ withdrawal generated Value is
self
. metadata
object | null ⚠️ WARNING ⚠️
Please note that metadata provided in a transaction will be stored on the blockchain forever. Make sure not to include any sensitive data, in particular personally identifiable information (PII).
Extra application data attached to the transaction.
Cardano allows users and developers to embed their own authenticated metadata when submitting transactions. Metadata can be expressed as a JSON object with some restrictions:
All top-level keys must be integers between
0
and2^64 - 1
.Each metadata value is tagged with its type.
Strings must be at most 64 bytes when UTF-8 encoded.
Bytestrings are hex-encoded, with a maximum length of 64 bytes.
Metadata aren't stored as JSON on the Cardano blockchain but are instead stored using a compact binary encoding (CBOR).
The binary encoding of metadata values supports three simple types:
- Integers in the range
-(2^64 - 1)
to2^64 - 1
- Strings (UTF-8 encoded)
- Bytestrings
And two compound types:
- Lists of metadata values
- Mappings from metadata values to metadata values
It is possible to transform any JSON object into this schema.
However, if your application uses floating point values, they will need to be converted somehow, according to your requirements. Likewise for
null
orbool
values. When reading metadata from chain, be aware that integers may exceed the javascript numeric range, and may need special "bigint" parsing.-
time_to_live
object The TTL (time to live) is the time period in which the transaction will be accepted into node mempools.
After the TTL has lapsed, the transaction is considered expired. At this point, nodes will give up on broadcasting the transaction, and the wallet will release the funds allocated to the transaction so they can be used for other payments.
The TTL should be long enough that the transaction has time to be propagated through the network and confirmed, but short enough so that - in the event of failures - UTxO are returned to the wallet in a timely manner.
The TTL value is given in seconds. It will be converted to a slot number internally.
If the TTL is not provided for a payment, a reasonable default value will be used.
Additional properties are allowed.
Responses
-
415 application/json
Unsupported Media Type
-
406 application/json
Not Acceptable
-
404 application/json
Not Found
-
400 application/json
Bad Request
-
403 application/json
Forbidden
One of: invalid_wallet_typeobject already_withdrawingobject utxo_too_smallobject cannot_cover_feeobject no_utxos_availableobject not_enough_moneyobject insufficient_collateralobject inputs_depletedobject invalid_coin_selectionobject output_token_quantity_exceeds_limitobject output_token_bundle_size_exceeds_limitobject transaction_is_too_bigobject -
202 application/json
Accepted
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"}}'
{
"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"
]
}
{
"message": "string",
"code": "unsupported_media_type"
}
{
"message": "string",
"code": "not_acceptable"
}
{
"message": "string",
"code": "no_such_wallet",
"info": {
"wallet_id": "2512a00e9653fe49a44a5886202e24d77eeb998f"
}
}
{
"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"
}
{
"estimated_min": {
"quantity": 42000000,
"unit": "lovelace"
},
"estimated_max": {
"quantity": 42000000,
"unit": "lovelace"
},
"minimum_coins": [
{
"quantity": 42000000,
"unit": "lovelace"
}
],
"deposit": {
"quantity": 42000000,
"unit": "lovelace"
}
}