Function: estimateReceiveExecution()
estimateReceiveExecution(
opts:EstimateReceiveExecutionOpts):Promise<number>
Defined in: gas.ts:82
Estimate CCIP gasLimit needed to execute a request on a contract receiver.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | EstimateReceiveExecutionOpts | EstimateReceiveExecutionOpts for estimation |
Returns
Promise<number>
Estimated gasLimit
Throws
CCIPMethodUnsupportedError if dest chain doesn't support estimation
Throws
CCIPContractTypeInvalidError if routerOrRamp is not a valid contract type
Throws
CCIPTokenDecimalsInsufficientError if dest token has insufficient decimals
Example
TypeScript
import { estimateReceiveExecution, EVMChain } from '@chainlink/ccip-sdk'
const source = await EVMChain.fromUrl('https://rpc.sepolia.org')
const dest = await EVMChain.fromUrl('https://rpc.fuji.avax.network')
const gasLimit = await estimateReceiveExecution({
source,
dest,
routerOrRamp: '0xRouter...',
message: {
sender: '0x...',
receiver: '0x...',
data: '0x...',
tokenAmounts: [],
},
})
console.log('Estimated gas:', gasLimit)