Skip to main content
POST
/
transactions
/
estimate_fee
import cobo_waas2
from cobo_waas2.models.estimate_fee_params import EstimateFeeParams
from cobo_waas2.models.estimated_fee import EstimatedFee
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.TransactionsApi(api_client)
    estimate_fee_params = cobo_waas2.EstimateFeeParams(
        cobo_waas2.EstimateTransferFeeParams(
            request_type="Transfer",
            source=cobo_waas2.TransferSource(
                cobo_waas2.CustodialTransferSource(
                    source_type="Asset",
                    wallet_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
                )
            ),
            token_id="TRON_USDT",
            destination = cobo_waas2.TransferDestination(
                cobo_waas2.AddressTransferDestination(
                    destination_type = "Address",
                    account_output = cobo_waas2.AddressTransferDestinationAccountOutput(
                        address = "19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku",
                        amount = "1.5"
                    )
                )
            ),
            fee_type = "Fixed"
        )
    )

    try:
        # Estimate transaction fee
        api_response = api_instance.estimate_fee(
            estimate_fee_params=estimate_fee_params
        )
        print("The response of TransactionsApi->estimate_fee:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling TransactionsApi->estimate_fee: %s\n" % e)

{
  "fee_type": "EVM_EIP_1559",
  "token_id": "TRON",
  "is_loop": false,
  "fee_amount": "0.1"
}
import cobo_waas2
from cobo_waas2.models.estimate_fee_params import EstimateFeeParams
from cobo_waas2.models.estimated_fee import EstimatedFee
from cobo_waas2.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
    # Replace `<YOUR_PRIVATE_KEY>` with your private key
    api_private_key="<YOUR_PRIVATE_KEY>",
    # Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
    host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cobo_waas2.TransactionsApi(api_client)
    estimate_fee_params = cobo_waas2.EstimateFeeParams(
        cobo_waas2.EstimateTransferFeeParams(
            request_type="Transfer",
            source=cobo_waas2.TransferSource(
                cobo_waas2.CustodialTransferSource(
                    source_type="Asset",
                    wallet_id="f47ac10b-58cc-4372-a567-0e02b2c3d479",
                )
            ),
            token_id="TRON_USDT",
            destination = cobo_waas2.TransferDestination(
                cobo_waas2.AddressTransferDestination(
                    destination_type = "Address",
                    account_output = cobo_waas2.AddressTransferDestinationAccountOutput(
                        address = "19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku",
                        amount = "1.5"
                    )
                )
            ),
            fee_type = "Fixed"
        )
    )

    try:
        # Estimate transaction fee
        api_response = api_instance.estimate_fee(
            estimate_fee_params=estimate_fee_params
        )
        print("The response of TransactionsApi->estimate_fee:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling TransactionsApi->estimate_fee: %s\n" % e)

Authorizations

BIZ-API-KEY
string
header
required

The API key. For more details, refer to API key.

In the API playground, enter your API secret, and your API key will be accordingly calculated.

Body

application/json

The request body to estimate the transaction fee of a token transfer or a contract call.

  • Transfer
  • ContractCall

The information about a token transfer.

request_type
enum<string>
required

The request type. Possible values include:

  • Transfer: A request to transfer tokens.
  • ContractCall: A request to interact with a smart contract.
Available options:
Transfer,
ContractCall
Example:

"Transfer"

source
object
required

The information about the transaction source types Asset. Refer to Transaction sources and destinations for a detailed introduction about the supported sources and destinations for each transaction type.

Switch between the tabs to display the properties for different transaction sources.

  • Asset
  • Web3
  • Org-Controlled/User-Controlled
  • Safe{Wallet}
  • Main/Sub
token_id
string
required

The token ID of the transferred token. You can retrieve the IDs of all the tokens you can use by calling List enabled tokens.

Example:

"ETH_USDT"

request_id
string

The request ID that is used to track a transaction request.

Example:

"f47ac10b-58cc-4372-a567-0e02b2c3d479"

destination
object

The information about the transaction destination type Address. Refer to Transaction sources and destinations for a detailed introduction about the supported sources and destinations for each transaction type.

You need to specify either the account_output property or the utxo_outputs property.

You can transfer tokens to multiple addresses only if you use MPC Wallets as the transaction source. To do this, you should use the utxo_outputs property to specify the destination addresses.

Switch between the tabs to display the properties for different transaction destinations.

  • Address
  • CustodialWallet
  • ExchangeWallet
fee_type
enum<string>
default:EVM_EIP_1559

The fee model. Possible values include:

  • Fixed: The fixed fee model.
  • EVM_EIP_1559: The EIP-1559 fee model.
  • EVM_Legacy: The legacy fee model.
  • UTXO: The fee model used in UTXO-based blockchains, such as Bitcoin.
  • SOL: The fee model used in Solana.
  • FIL: The fee model used in Filecoin.

Each fee model requires a different set of properties. Switch between the above tabs for details.

To learn more about the fee models, refer to Fee models.

Available options:
Fixed,
EVM_EIP_1559,
EVM_Legacy,
UTXO,
SOL,
FIL
Example:

"EVM_EIP_1559"

replaced_transaction_id
string<uuid>

The ID of the transaction that this transaction replaced.

Example:

"aff0e1cb-15b2-4e1f-9b9d-a9133715986f"

Response

The request was successful.

  • Fixed
  • EVM_EIP_1559
  • EVM_Legacy
  • UTXO
  • SOL
  • FIL

The estimated transaction fee based on the fixed fee model.

For more details about the fixed fee model, see Fee models.

The transaction fee.

fee_type
enum<string>
default:EVM_EIP_1559
required

The fee model. Possible values include:

  • Fixed: The fixed fee model.
  • EVM_EIP_1559: The EIP-1559 fee model.
  • EVM_Legacy: The legacy fee model.
  • UTXO: The fee model used in UTXO-based blockchains, such as Bitcoin.
  • SOL: The fee model used in Solana.
  • FIL: The fee model used in Filecoin.

Each fee model requires a different set of properties. Switch between the above tabs for details.

To learn more about the fee models, refer to Fee models.

Available options:
Fixed,
EVM_EIP_1559,
EVM_Legacy,
UTXO,
SOL,
FIL
Example:

"EVM_EIP_1559"

token_id
string
required

The token used to pay the transaction fee.

Example:

"TRON"

fee_amount
string
required

The transaction fee that you need to pay for the transaction.

Example:

"0.1"

is_loop
boolean

Whether the transaction was executed as a Cobo Loop transfer.

  • true: The transaction was executed as a Cobo Loop transfer.
  • false: The transaction was not executed as a Cobo Loop transfer.
Example:

false