跳转到主要内容
Simulation API 允许您模拟交易并获取成功执行该交易所需的预计 gas 用量。 在请求中设置 estimate_gas: true 即可获取 gas 估算。
注意:您可以使用 tenderly_estimateGastenderly_estimateGasBundle RPC 方法获取 100% 精确的 gas 估算。
示例 请务必将访问密钥安全地存储在 .env 文件中。
example.ts
此操作会计算交易所需的最大 gas 用量。模拟成功后,请检查 transaction 结构中的 gas_used 字段。 结果
example.json