zks_estimateGasL1ToL2
Returns an estimate of the gas required for a layer 1 (L1) to layer 2 (L2) transaction.
Parameters
from
: [Required] Address from which the transaction is sent.to
: [Required] Address to which the transaction is addressed.data
: Data associated with the transaction.
Response
The estimate of the gas required for a L1 to L2 transaction.
Example
Replace <YOUR-API-KEY>
with an API key from your Infura dashboard.
Request
- cURL
- WSS
curl https://zksync-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id":2, "method": "zks_estimateGasL1ToL2", "params": [ { "from": "0x1111111111111111111111111111111111111111", "to":"0x2222222222222222222222222222222222222222", "data": "0xffffffff" } ] }'
wscat -c wss://zksync-mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc":"2.0", "id":2, "method": "zks_estimateGasL1ToL2", "params": [ { "from": "0x1111111111111111111111111111111111111111", "to":"0x2222222222222222222222222222222222222222", "data": "0xffffffff" } ] }'
Response
- JSON
{
"jsonrpc": "2.0",
"result": "0x25f64db",
"id": 2
}