post https://{network}.unifra.io/v1/
Check if a user's balance is enough to send a transaction with the specified gas and storage limits to the specified contract.
Parameters
- BASE32, account address
- BASE32, contract address
- QUANTITY, gas limit
- QUANTITY, gas price
- QUANTITY, storage limit
- QUANTITY|TAG, (optional, default: "latest_state") Integer epoch number, or the string "latest_state", "latest_confirmed", "latest_checkpoint" or "earliest", see the epoch number parameter.
Returns
- isBalanceEnough: Boolean - Indicate balance is enough for gas fee and collateral storage
- willPayCollateral: Boolean - False if the transaction is eligible for storage collateral sponsorship, true otherwise.
- willPayTxFee: Boolean - False if the transaction is eligible for gas sponsorship, true otherwise.
Example
Request
curl --location --request POST 'https://cfx-core.unifra.io/v1/your-api-key' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "cfx_checkBalanceAgainstTransaction",
"params": [
"cfx:aatmuv92xj87ptxg6mr11c5amug2kv6ra21g7pbbrp",
"cfx:achc8nxj7r451c223m18w2dwjnmhkd6rxawrvkvsy2",
"0x26882",
"0x1",
"0x80"
],
"id": 0
}'
Result
{
"jsonrpc": "2.0",
"result": {
"isBalanceEnough": true,
"willPayCollateral": false,
"willPayTxFee": false
},
"id": 0
}