GasEstimatesResource
Access via urblock.gasEstimates.
Estimate gas costs before submitting blockchain operations. Useful for cost forecasting, UI display, and ensuring sufficient wallet balance.
Methods
estimate(params)
Estimate gas cost for an operation.
| Parameter | Type | Required | Description |
|---|---|---|---|
operation | string | Yes | Operation type: mint, transfer, burn, approve, deploy |
token_id | string | Yes | Token ID |
to | string | Conditional | Recipient address (required for mint/transfer) |
amount | string | Conditional | Amount in smallest unit (required for mint/transfer/burn) |
from | string | Conditional | Sender address (required for transfer/burn) |
const estimate = await urblock.gasEstimates.estimate({
operation: "mint",
token_id: "tok_abc123",
to: "0x...",
amount: "1000000000000000000",
});
console.log(estimate.gas_limit); // "21000"
console.log(estimate.gas_price_gwei); // "30"
console.log(estimate.estimated_cost_wei); // "630000000000000"
console.log(estimate.estimated_cost_eth); // "0.00063"
Returns: GasEstimateResponse
| Field | Type | Description |
|---|---|---|
gas_limit | string | Estimated gas units |
gas_price_gwei | string | Current gas price in Gwei |
estimated_cost_wei | string | Estimated cost in wei |
estimated_cost_eth | string | Estimated cost in ETH/MATIC |
See Also
- Gas Estimates API — full endpoint reference
- Gas Optimization Guide — reduce gas costs