Skip to main content
POST
/
v1
/
w3s
/
transactions
/
contractExecution
/
estimateFee
Estimate fee for a contract execution transaction
curl --request POST \
  --url https://api.circle.com/v1/w3s/transactions/contractExecution/estimateFee \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "abiFunctionSignature": "burn(uint256)",
  "abiParameters": [
    "100",
    "1"
  ],
  "callData": "0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001",
  "amount": "1.0",
  "blockchain": "MATIC-AMOY",
  "contractAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "sourceAddress": "0x1bf9ad0cc2ad298c69a2995aa806ee832788218c",
  "walletId": "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"
}'
{
  "data": {
    "high": {
      "gasLimit": "21000",
      "gasPrice": "<string>",
      "maxFee": "5.935224468",
      "priorityFee": "1.022783914",
      "baseFee": "1.022783914",
      "networkFee": "0.0001246397138",
      "networkFeeRaw": "0.0001246397138"
    },
    "low": {
      "gasLimit": "21000",
      "gasPrice": "<string>",
      "maxFee": "5.935224468",
      "priorityFee": "1.022783914",
      "baseFee": "1.022783914",
      "networkFee": "0.0001246397138",
      "networkFeeRaw": "0.0001246397138"
    },
    "medium": {
      "gasLimit": "21000",
      "gasPrice": "<string>",
      "maxFee": "5.935224468",
      "priorityFee": "1.022783914",
      "baseFee": "1.022783914",
      "networkFee": "0.0001246397138",
      "networkFeeRaw": "0.0001246397138"
    },
    "callGasLimit": "69222",
    "verificationGasLimit": "56863",
    "preVerificationGas": "44112"
  }
}

Authorizations

Authorization
string
header
required

Circle's API Keys are formatted in the following structure "PREFIX:ID:SECRET". All three parts are requred to make a successful request.

Headers

X-Request-Id
string

Developer-provided parameter used to identify this request. Useful when communicating with Circle Support.

Example:

"2adba88e-9d63-44bc-b975-9b6ae3440dde"

Body

application/json

Estimate transaction fee request

contractAddress
string
required

The blockchain address of the contract to be executed.

Example:

"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"

abiFunctionSignature
string

The contract ABI function signature or callData field is required for interacting with the smart contract. The ABI function signature cannot be used simultaneously with callData. e.g. burn(uint256)

Example:

"burn(uint256)"

abiParameters
AbiParameters · array

The contract ABI function signature parameters for executing the contract interaction. Supported parameter types include string, integer, boolean, and array. These parameters should be used exclusively with the abiFunctionSignature and cannot be used with callData.

Example:
["100", "1"]
callData
string

The raw transaction data, must be an even-length hexadecimal string with the 0x prefix, to be executed. It is important to note that the usage of callData is mutually exclusive with the abiFunctionSignature and abiParameters. Therefore, callData cannot be utilized simultaneously with either abiFunctionSignature or abiParameters.

Example:

"0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"

amount
string

The amount of native token that will be sent to the contract abi execution. Optional field for payable api only, if not provided, no native token will be sent.

Example:

"1.0"

blockchain
enum<string>

Blockchain associated with the transaction. Required along with sourceAddress if you don't provide walletId. The blockchain and walletId fields are mutually exclusive.

Available options:
ETH,
ETH-SEPOLIA,
AVAX,
AVAX-FUJI,
MATIC,
MATIC-AMOY,
ARB,
ARB-SEPOLIA,
UNI,
UNI-SEPOLIA,
BASE,
BASE-SEPOLIA,
OP,
OP-SEPOLIA
Example:

"MATIC-AMOY"

sourceAddress
string

Source address of the transaction. Required along with blockchain if walletId is not provided. The sourceAddress and walletId fields are mutually exclusive.

Example:

"0x1bf9ad0cc2ad298c69a2995aa806ee832788218c"

walletId
string<uuid>

Unique system generated identifier of the wallet. Required when sourceAddress and blockchain are not provided. Mutually exclusive with sourceAddress and blockchain. For contract deploys this wallet ID will be used as the source.

Example:

"a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"

Response

Transaction fee estimated

data
object
required
I