import type { Simplify } from 'type-fest'; import type { Chain } from './chain.ts'; import type { CCIPMessage_V2_0 } from './evm/messages.ts'; import type { CCIPMessage_V1_6_Solana } from './solana/types.ts'; import type { CCIPMessage, MessageInput } from './types.ts'; /** * A subset of {@link MessageInput} for estimating receive execution gas. */ export type EstimateMessageInput = Simplify & Partial> & Partial> & Partial> & { /** * optional tokenAmounts; `amount` with either source `token` (as in MessageInput) or * `{ sourceTokenAddress?, sourcePoolAddress, destTokenAddress }` (as in v1.5..v2.0 tokenAmounts) * can be provided */ tokenAmounts?: readonly ({ amount: bigint; } & ({ token: string; } | { sourceTokenAddress?: string; sourcePoolAddress: string; destTokenAddress: string; extraData?: string; }))[]; }>; /** * Options for {@link estimateReceiveExecution} function. */ export type EstimateReceiveExecutionOpts = { /** Source chain instance (for token data retrieval) */ source: Chain; /** Dest chain instance (for token and execution simulation) */ dest: Chain; /** source router or onRamp, or dest offRamp contract address */ routerOrRamp: string; /** message to be simulated */ message: Omit; }; /** * Estimate CCIP gasLimit needed to execute a request on a contract receiver. * * @param opts - {@link EstimateReceiveExecutionOpts} for estimation * @returns Estimated execution gas (base transaction cost subtracted) * * @throws {@link CCIPMethodUnsupportedError} if dest chain doesn't support estimation * @throws {@link CCIPContractTypeInvalidError} if routerOrRamp is not a valid contract type * @throws {@link CCIPTokenDecimalsInsufficientError} if dest token has insufficient decimals * @throws {@link CCIPOnRampRequiredError} if no OnRamp found for the given OffRamp and source chain * * @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) * ``` */ export declare function estimateReceiveExecution({ source, dest, routerOrRamp, message, }: EstimateReceiveExecutionOpts): Promise; //# sourceMappingURL=gas.d.ts.map