post https://api.infstones.com/starknet/mainnet/
Estimates the resources required by transactions when applied on a given state.
Parameters
Invoke transaction V0
: invokes a specific function in the desired contract (not necessarily an account) ORInvoke transaction V1
: initiates a transaction from a given account
Invoke transaction version 0 is deprecated and will be removed in a future release of Starknet.
V0
Key | Required | Detail | Type |
---|---|---|---|
contract_address | ✅ | Address the transaction is sent from. | String |
entry_point_selector | ✅ | Smart contract entry points | Array of string |
call_data | ✅ | Hash of method signature and encoded parameters. | String |
V1
Key | Required | Detail | Type |
---|---|---|---|
sender_address | ✅ | A field element. represented by at most 63 hex digits | String |
calldata | ✅ | The data expected by the account's execute function (in most use cases, this includes the called contract address and a function selector) | Array |
- Type:
INVOKE
- Broadcasted transaction common properties
Key | Required | Detail | Type |
---|---|---|---|
max_fee | ✅ | The maximal fee that can be charged for including the transaction | String |
version | ✅ | Version of the transaction scheme | String |
signature | ✅ | Array of strings | Array |
nonce | ✅ | A field element. represented by at most 63 hex digits | String |
"params": {
"request": [{
"type": "INVOKE",
"max_fee": "0x28ed6103d0000",
"version": "0x1",
"signature": [
"0x42527ffe9912b338983cbed67e139cfcc26a4d8cf1d1c2a85e4125fdf5f59ed", "0x636147d06fefd02ed37984b752556d4b9aefdac1a50b3df0528ec7c201ad84b"
],
"sender_address": "0x13e3ca9a377084c37dc7eacbd1d9f8c3e3733935bcbad887c32a0e213cd6fe0",
"calldata": [
"0x2",
"0x57c4b510d66eb1188a7173f31cccee47b9736d40185da8144377b896d5ff3",
"0x2f0b3c5710379609eb5495f1ecd348cb28167711b73609fe565a72734550354",
"0x0",
"0x1",
"0x57c4b510d66eb1188a7173f31cccee47b9736d40185da8144377b896d5ff3",
"0x2f0b3c5710379609eb5495f1ecd348cb28167711b73609fe565a72734550354",
"0x1",
"0x1",
"0x2",
"0x0",
"0x1"
],
"nonce": "0x1"
}],
"block_id": {
"block_number": 59999
}
}
Result
The fee estimations
Example
Request
curl <your-endpoint> \
-X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "starknet_estimateFee",
"params": {
"request": [{
"type": "INVOKE",
"max_fee": "0x28ed6103d0000",
"version": "0x1",
"signature": [
"0x42527ffe9912b338983cbed67e139cfcc26a4d8cf1d1c2a85e4125fdf5f59ed", "0x636147d06fefd02ed37984b752556d4b9aefdac1a50b3df0528ec7c201ad84b"
],
"sender_address": "0x13e3ca9a377084c37dc7eacbd1d9f8c3e3733935bcbad887c32a0e213cd6fe0",
"calldata": [
"0x2",
"0x57c4b510d66eb1188a7173f31cccee47b9736d40185da8144377b896d5ff3",
"0x2f0b3c5710379609eb5495f1ecd348cb28167711b73609fe565a72734550354",
"0x0",
"0x1",
"0x57c4b510d66eb1188a7173f31cccee47b9736d40185da8144377b896d5ff3",
"0x2f0b3c5710379609eb5495f1ecd348cb28167711b73609fe565a72734550354",
"0x1",
"0x1",
"0x2",
"0x0",
"0x1"
],
"nonce": "0x1"
}],
"block_id": {
"block_number": 59999
}
}
}'
Return
{
"jsonrpc": "2.0",
"result": [
{
"gas_consumed": "0x4d3b",
"gas_price": "0x67edb4f57",
"overall_fee": "0x1f5a73368740d"
}
],
"id": "0"
}