Saltar para o conteúdo principal
POST
/
v1
/
wallets
/
{walletId}
/
contracts
/
network-fee
Master Wallet Network Fee
curl --request POST \
  --url https://api.blockradar.co/v1/wallets/{walletId}/contracts/network-fee \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "calls": [
    {
      "abi": [
        {
          "constant": false,
          "inputs": [
            {
              "name": "_to",
              "type": "address"
            },
            {
              "name": "_value",
              "type": "uint256"
            }
          ],
          "name": "transfer",
          "outputs": [],
          "payable": false,
          "stateMutability": "nonpayable",
          "type": "function"
        }
      ],
      "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
      "method": "transfer",
      "parameters": [
        "0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
        "10000"
      ]
    },
    {
      "abi": [
        {
          "constant": false,
          "inputs": [
            {
              "name": "_to",
              "type": "address"
            },
            {
              "name": "_value",
              "type": "uint256"
            }
          ],
          "name": "transfer",
          "outputs": [],
          "payable": false,
          "stateMutability": "nonpayable",
          "type": "function"
        }
      ],
      "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
      "method": "transfer",
      "parameters": [
        "0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
        "10000"
      ]
    }
  ]
}
'
{
"data": {
"balance": "1.012299726305777896",
"fee": "0.00422709309982132"
},
"message": "Network fee retrieved successfully",
"statusCode": 200
}

Batch Operations

This endpoint supports batch operations, allowing you to estimate network fees for multiple contract operations in a single API call.

Batch Request Format

To estimate fees for multiple operations, use the calls array:
{
  "calls": [
    {
      "address": "0xTokenContract...",
      "method": "approve",
      "parameters": ["0xSpender...", "1000000000000000000"],
      "abi": [...]
    },
    {
      "address": "0xProtocolContract...",
      "method": "deposit",
      "parameters": ["1000000000000000000"],
      "abi": [...]
    }
  ]
}

Batch Response Format

Returns individual fees plus totals:
{
  "message": "Batch network fee retrieved (2/2 successful)",
  "statusCode": 200,
  "data": {
    "fees": [
      {
        "index": 0,
        "method": "approve",
        "fee": "0.00001247904",
        "networkFee": "0.00001247904",
        "networkFeeInUSD": "0.01",
        "nativeBalance": "0.5",
        "nativeBalanceInUSD": "450.00",
        "estimatedArrivalTime": 30,
        "transactionFee": "0"
      },
      {
        "index": 1,
        "method": "deposit",
        "fee": "0.00000504",
        "networkFee": "0.00000504",
        "networkFeeInUSD": "0.005",
        "nativeBalance": "0.5",
        "nativeBalanceInUSD": "450.00",
        "estimatedArrivalTime": 30,
        "transactionFee": "0"
      }
    ],
    "totalFee": "0.00001751904",
    "estimatedArrivalTime": 60,
    "errors": []
  }
}

Response Fields

FieldDescription
feesArray of individual fee estimates
totalFeeSum of all network fees
estimatedArrivalTimeTotal time (sum of individual times, 30s each)
errorsArray of any failed estimations

Validation Rules

RuleValue
Max batch size20 operations
Min batch size1 operation

Use Cases

  • Fee estimation: Calculate total cost before executing batch operations
  • Gas optimization: Compare fees across different operation orderings
  • Budget planning: Estimate costs for multi-step DeFi transactions

Autorizações

x-api-key
string
header
obrigatório

Parâmetros de caminho

walletId
string
obrigatório
Exemplo:

"YOUR_WALLET_ID"

Corpo

application/json
calls
object[]
Exemplo:
[
{
"abi": [
{
"constant": false,
"inputs": [
{ "name": "_to", "type": "address" },
{ "name": "_value", "type": "uint256" }
],
"name": "transfer",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
"method": "transfer",
"parameters": [
"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
"10000"
]
},
{
"abi": [
{
"constant": false,
"inputs": [
{ "name": "_to", "type": "address" },
{ "name": "_value", "type": "uint256" }
],
"name": "transfer",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
"method": "transfer",
"parameters": [
"0x2455eC6700092991Ce0782365A89d5Cd89c8Fa22",
"10000"
]
}
]

Resposta

200 - application/json

Ethereum / Tron / Ethereum (Batch) / Tron (Batch)

data
object
message
string
Exemplo:

"Network fee retrieved successfully"

statusCode
number
Exemplo:

200