Skip to main content
Version: 0.96.0

Class: EVMChain

Defined in: evm/index.ts:182

EVM chain implementation supporting Ethereum-compatible networks.

Provides methods for sending CCIP cross-chain messages, querying message status, fetching fee quotes, and manually executing pending messages on Ethereum Virtual Machine compatible chains.

Examples

TypeScript
import { EVMChain } from '@chainlink/ccip-sdk'

const chain = await EVMChain.fromUrl('https://rpc.sepolia.org')
console.log(`Connected to: ${chain.network.name}`)
TypeScript
const requests = await chain.getMessagesInTx('0xabc123...')
for (const req of requests) {
console.log(`Message ID: ${req.message.messageId}`)
}

Extends

Indexable

[key: symbol]: () => string

Constructors

Constructor

new EVMChain(provider: JsonRpcApiProvider, network: NetworkInfo, ctx?: ChainContext): EVMChain

Defined in: evm/index.ts:199

Creates a new EVMChain instance.

Parameters

ParameterTypeDescription
providerJsonRpcApiProviderJSON-RPC provider for the EVM network.
networkNetworkInfoNetwork information for this chain.
ctx?ChainContext-

Returns

EVMChain

Overrides

Chain<typeof ChainFamily.EVM>.constructor

Properties

apiClient

readonly apiClient: CCIPAPIClient | null

Defined in: chain.ts:326

CCIP API client (null if opted out)

Inherited from

Chain.apiClient


apiRetryConfig

readonly apiRetryConfig: Required<ApiRetryConfig> | null

Defined in: chain.ts:328

Retry configuration for API fallback operations (null if API client is disabled)

Inherited from

Chain.apiRetryConfig


destroy$

readonly destroy$: Promise<void>

Defined in: evm/index.ts:190


logger

logger: Logger

Defined in: chain.ts:324

Inherited from

Chain.logger


network

readonly network: NetworkInfo<"EVM">

Defined in: chain.ts:323

Inherited from

Chain.network


nonces

nonces: Record<string, number>

Defined in: evm/index.ts:192


provider

provider: JsonRpcApiProvider

Defined in: evm/index.ts:189


decimals

readonly static decimals: 18 = 18

Defined in: evm/index.ts:187


family

readonly static family: "EVM" = ChainFamily.EVM

Defined in: evm/index.ts:186

Methods

_getSomeOnRampFor()

_getSomeOnRampFor(router: string): Promise<string>

Defined in: evm/index.ts:877

Gets any available OnRamp for the given router.

Parameters

ParameterTypeDescription
routerstringRouter contract address.

Returns

Promise<string>

OnRamp contract address.


destroy()?

optional destroy(): void | Promise<void>

Defined in: chain.ts:362

Cleanup method to release resources (e.g., close connections).

Returns

void | Promise<void>

Inherited from

Chain.destroy


estimateReceiveExecution()

estimateReceiveExecution(opts: { message: { data?: BytesLike; destTokenAmounts?: readonly { amount: bigint; token: string; }[]; messageId: string; sender?: string; sourceChainSelector: bigint; }; offRamp: string; receiver: string; }): Promise<number>

Defined in: evm/index.ts:1507

Estimate ccipReceive execution cost (gas, computeUnits) for this dest

Parameters

ParameterTypeDescription
opts{ message: { data?: BytesLike; destTokenAmounts?: readonly { amount: bigint; token: string; }[]; messageId: string; sender?: string; sourceChainSelector: bigint; }; offRamp: string; receiver: string; }estimation options
opts.message{ data?: BytesLike; destTokenAmounts?: readonly { amount: bigint; token: string; }[]; messageId: string; sender?: string; sourceChainSelector: bigint; }-
opts.message.data?BytesLike-
opts.message.destTokenAmounts?readonly { amount: bigint; token: string; }[]-
opts.message.messageIdstring-
opts.message.sender?string-
opts.message.sourceChainSelectorbigint-
opts.offRampstring-
opts.receiverstring-

Returns

Promise<number>

estimated execution cost (gas or computeUnits)

Overrides

Chain.estimateReceiveExecution


executeReport()

executeReport(opts: ExecuteReportOpts & { wallet: unknown; }): Promise<CCIPExecution>

Defined in: evm/index.ts:1228

Execute messages in report in an offRamp.

Parameters

ParameterTypeDescription
optsExecuteReportOpts & { wallet: unknown; }ExecuteReportOpts with chain-specific wallet to sign and send tx

Returns

Promise<CCIPExecution>

Promise resolving to transaction of the execution

Throws

CCIPWalletInvalidError if wallet is not a valid Signer

Throws

CCIPExecTxNotConfirmedError if execution transaction fails to confirm

Throws

CCIPExecTxRevertedError if execution transaction reverts

Overrides

Chain.executeReport


generateUnsignedExecuteReport()

generateUnsignedExecuteReport(__namedParameters: ExecuteReportOpts & { payer: string; }): Promise<UnsignedEVMTx>

Defined in: evm/index.ts:1105

Generate unsigned tx to manuallyExecute a message.

Parameters

ParameterTypeDescription
__namedParametersExecuteReportOpts & { payer: string; }ExecuteReportOpts with payer address which will send the exec tx

Returns

Promise<UnsignedEVMTx>

Promise resolving to chain-family specific unsigned txs

Throws

CCIPVersionUnsupportedError if OffRamp version is not supported

Overrides

Chain.generateUnsignedExecuteReport


generateUnsignedSendMessage()

generateUnsignedSendMessage(opts: SendMessageOpts & { sender: string; }): Promise<UnsignedEVMTx>

Defined in: evm/index.ts:977

Generate unsigned txs for ccipSend'ing a message.

Parameters

ParameterTypeDescription
optsSendMessageOpts & { sender: string; }SendMessageOpts with sender address

Returns

Promise<UnsignedEVMTx>

Promise resolving to chain-family specific unsigned txs

Overrides

Chain.generateUnsignedSendMessage


getBalance()

getBalance(opts: GetBalanceOpts): Promise<bigint>

Defined in: evm/index.ts:832

Query token balance for an address.

Parameters

ParameterTypeDescription
optsGetBalanceOptsBalance query options

Returns

Promise<bigint>

Token balance information including raw and formatted values

Overrides

Chain.getBalance


getBlockTimestamp()

getBlockTimestamp(block: number | "finalized"): Promise<number>

Defined in: evm/index.ts:319

Fetch the timestamp of a given block.

Parameters

ParameterTypeDescription
blocknumber | "finalized"Positive block number, negative finality depth, or 'finalized' tag

Returns

Promise<number>

Promise resolving to timestamp of the block, in seconds

Overrides

Chain.getBlockTimestamp


getCommitReport()

getCommitReport(opts: { commitStore: string; request: { lane: Lane<CCIPVersion>; message: { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; }; tx: { timestamp: number; }; }; } & Pick<LogFilter, "startBlock" | "watch" | "page">): Promise<CCIPCommit>

Defined in: chain.ts:968

Look for a CommitReport at dest for given CCIP request. May be specialized by some subclasses.

Parameters

ParameterTypeDescription
opts{ commitStore: string; request: { lane: Lane<CCIPVersion>; message: { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; }; tx: { timestamp: number; }; }; } & Pick<LogFilter, "startBlock" | "watch" | "page">getCommitReport options

Returns

Promise<CCIPCommit>

CCIPCommit info

Throws

CCIPCommitNotFoundError if no commit found for the request (transient)

Example

TypeScript
const commit = await dest.getCommitReport({
commitStore: offRampAddress, // v1.6+
request,
})
console.log(`Committed at block: ${commit.log.blockNumber}`)

Inherited from

Chain.getCommitReport


getCommitStoreForOffRamp()

getCommitStoreForOffRamp(offRamp: string): Promise<string>

Defined in: evm/index.ts:781

Fetch the CommitStore set in OffRamp config (CCIP v1.5 and earlier). For CCIP v1.6 and later, it should return the offRamp address.

Parameters

ParameterTypeDescription
offRampstringOffRamp contract address

Returns

Promise<string>

Promise resolving to CommitStore address

Throws

CCIPVersionUnsupportedError if OffRamp version is not supported

Overrides

Chain.getCommitStoreForOffRamp


getExecutionReceipts()

getExecutionReceipts(opts: { commit?: CCIPCommit; messageId?: string; offRamp: string; sourceChainSelector?: bigint; } & Pick<LogFilter, "startBlock" | "startTime" | "watch" | "page">): AsyncIterableIterator<CCIPExecution>

Defined in: evm/index.ts:1474

Default/generic implementation of getExecutionReceipts. Yields execution receipts for a given offRamp.

Parameters

ParameterTypeDescription
opts{ commit?: CCIPCommit; messageId?: string; offRamp: string; sourceChainSelector?: bigint; } & Pick<LogFilter, "startBlock" | "startTime" | "watch" | "page">getExecutionReceipts options

Returns

AsyncIterableIterator<CCIPExecution>

Async generator of CCIPExecution receipts

Overrides

Chain.getExecutionReceipts


getFee()

getFee(__namedParameters: Omit<SendMessageOpts, "approveMax">): Promise<bigint>

Defined in: evm/index.ts:950

Fetch the current fee for a given intended message.

Parameters

ParameterTypeDescription
__namedParametersOmit<SendMessageOpts, "approveMax">SendMessageOpts without approveMax

Returns

Promise<bigint>

Fee amount in the feeToken's smallest units

Overrides

Chain.getFee


getFeeTokens()

getFeeTokens(router: string): Promise<{[k: string]: { decimals: number; name: string; symbol: string; }; }>

Defined in: evm/index.ts:1421

Fetch list and info of supported feeTokens.

Parameters

ParameterTypeDescription
routerstringRouter address on this chain

Returns

Promise<{[k: string]: { decimals: number; name: string; symbol: string; }; }>

Promise resolving to mapping of token addresses to TokenInfo objects

Throws

CCIPVersionUnsupportedError if OnRamp version is not supported

Overrides

Chain.getFeeTokens


getLaneForOnRamp()

getLaneForOnRamp(onRamp: string): Promise<Lane<CCIPVersion>>

Defined in: evm/index.ts:621

Gets lane configuration from an OnRamp contract.

Parameters

ParameterTypeDescription
onRampstringOnRamp contract address.

Returns

Promise<Lane<CCIPVersion>>

Lane configuration.

Throws

CCIPContractTypeInvalidError if contract doesn't have destChainSelector


getLaneLatency()

getLaneLatency(destChainSelector: bigint): Promise<LaneLatencyResponse>

Defined in: chain.ts:1013

Fetches estimated lane latency to a destination chain. Uses this chain's selector as the source.

Parameters

ParameterTypeDescription
destChainSelectorbigintDestination CCIP chain selector (bigint)

Returns

Promise<LaneLatencyResponse>

Promise resolving to LaneLatencyResponse containing:

  • lane.sourceNetworkInfo - Source chain metadata (name, selector, chainId)
  • lane.destNetworkInfo - Destination chain metadata
  • lane.routerAddress - Router contract address on source chain
  • totalMs - Estimated delivery time in milliseconds

Throws

CCIPApiClientNotAvailableError if apiClient was disabled (set to null)

Throws

CCIPHttpError if API request fails (network error, 4xx, 5xx status)

Remarks

Each call makes a fresh API request. Consider caching results if making frequent calls for the same lane.

Example

TypeScript
const chain = await EVMChain.fromUrl('https://eth-mainnet.example.com')
try {
const latency = await chain.getLaneLatency(4949039107694359620n) // Arbitrum
console.log(`Estimated delivery: ${Math.round(latency.totalMs / 60000)} minutes`)
console.log(`Router: ${latency.lane.routerAddress}`)
} catch (err) {
if (err instanceof CCIPHttpError) {
console.error(`API error: ${err.context.apiErrorCode}`)
}
}

Inherited from

Chain.getLaneLatency


getLogs()

getLogs(filter: LogFilter & { onlyFallback?: boolean; }): AsyncIterableIterator<Log>

Defined in: evm/index.ts:341

An async generator that yields logs based on the provided options.

Parameters

ParameterTypeDescription
filterLogFilter & { onlyFallback?: boolean; }Options object containing: - startBlock: if provided, fetch and generate logs forward starting from this block; otherwise, returns logs backwards in time from endBlock; optionally, startTime may be provided to fetch logs forward starting from this time - startTime: instead of a startBlock, a start timestamp may be provided; if either is provided, fetch logs forward from this starting point; otherwise, backwards - endBlock: if omitted, use latest block; can be a block number, 'latest', 'finalized' or negative finality block depth - endBefore: optional hint signature for end of iteration, instead of endBlock - address: if provided, fetch logs for this address only (may be required in some networks/implementations) - topics: if provided, fetch logs for these topics only; if string[], it's assumed to be a list of topic0s (i.e. string[] or string[][0], event_ids); some networks/implementations may not be able to filter topics other than topic0s, so one may want to assume those are optimization hints, instead of hard filters, and verify results - page: if provided, try to use this page/range for batches - watch: true or cancellation promise, getLogs continuously after initial fetch

Returns

AsyncIterableIterator<Log>

An async iterable iterator of logs.

Overrides

Chain.getLogs


getMessageById()

getMessageById(messageId: string, _opts?: { onRamp?: string; page?: number; }): Promise<CCIPRequest<CCIPVersion>>

Defined in: chain.ts:568

Fetch a CCIP message by its unique message ID.

Parameters

ParameterTypeDescription
messageIdstringThe unique message ID (0x + 64 hex chars)
_opts?{ onRamp?: string; page?: number; }Optional: onRamp hint for non-EVM chains
_opts.onRamp?string-
_opts.page?number-

Returns

Promise<CCIPRequest<CCIPVersion>>

CCIPRequest with metadata populated from API

Remarks

Uses the CCIP API to retrieve message details. The returned request includes a metadata field with API-specific information.

Example

TypeScript
const request = await chain.getMessageById(messageId)
console.log(`Sender: ${request.message.sender}`)

if (request.metadata) {
console.log(`Status: ${request.metadata.status}`)
if (request.metadata.deliveryTime) {
console.log(`Delivered in ${request.metadata.deliveryTime}ms`)
}
}

Throws

CCIPApiClientNotAvailableError if API disabled

Throws

CCIPMessageIdNotFoundError if message not found

Throws

CCIPOnRampRequiredError if onRamp is required but not provided

Throws

CCIPHttpError if API request fails

Inherited from

Chain.getMessageById


getMessagesInBatch()

getMessagesInBatch<R>(request: R, commit: Pick<CommitReport, "minSeqNr" | "maxSeqNr">, opts?: { page?: number; }): Promise<R["message"][]>

Defined in: evm/index.ts:348

Fetches all CCIP messages contained in a given commit batch.

Type Parameters

Type ParameterDescription
R extends { lane: Lane<CCIPVersion>; log: { } & { } & { }; message: { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; } | { sequenceNumber: bigint; }; }

Parameters

ParameterTypeDescription
requestRCCIPRequest to fetch batch for
commitPick<CommitReport, "minSeqNr" | "maxSeqNr">CommitReport range (min, max)
opts?{ page?: number; }Optional parameters (e.g., page for pagination width)
opts.page?number-

Returns

Promise<R["message"][]>

Array of messages in the batch

Overrides

Chain.getMessagesInBatch


getMessagesInTx()

getMessagesInTx(tx: string | ChainTransaction): Promise<CCIPRequest<CCIPVersion>[]>

Defined in: chain.ts:512

Fetch all CCIP requests in a transaction.

Parameters

ParameterTypeDescription
txstring | ChainTransactionChainTransaction or txHash to fetch requests from

Returns

Promise<CCIPRequest<CCIPVersion>[]>

Promise resolving to CCIP messages in the transaction (at least one)

Throws

CCIPTransactionNotFoundError if transaction does not exist

Throws

CCIPMessageNotFoundInTxError if no CCIPSendRequested events in tx

Example

TypeScript
const chain = await EVMChain.fromUrl('https://eth-mainnet.example.com')
const requests = await chain.getMessagesInTx('0xabc123...')
for (const req of requests) {
console.log(`Message ID: ${req.message.messageId}`)
}

Inherited from

Chain.getMessagesInTx


getNativeTokenForRouter()

getNativeTokenForRouter(router: string): Promise<string>

Defined in: evm/index.ts:709

Get the native token address for a Router.

Parameters

ParameterTypeDescription
routerstringRouter contract address

Returns

Promise<string>

Promise resolving to native token address (usually wrapped)

Overrides

Chain.getNativeTokenForRouter


getOffchainTokenData()

getOffchainTokenData(request: CCIPRequest): Promise<OffchainTokenData[]>

Defined in: evm/index.ts:1096

Fetch supported offchain token data for a request from this network.

Parameters

ParameterTypeDescription
requestCCIPRequestCCIP request, with tx, logs and message

Returns

Promise<OffchainTokenData[]>

Promise resolving to array with one offchain token data for each token transfer

Overrides

Chain.getOffchainTokenData


getOffRampsForRouter()

getOffRampsForRouter(router: string, sourceChainSelector: bigint): Promise<string[]>

Defined in: evm/index.ts:719

Fetch the OffRamps allowlisted in a Router. Used to discover OffRamp connected to an OnRamp.

Parameters

ParameterTypeDescription
routerstringRouter contract address
sourceChainSelectorbigintSource chain selector

Returns

Promise<string[]>

Promise resolving to array of OffRamp addresses

Overrides

Chain.getOffRampsForRouter


getOnRampForOffRamp()

getOnRampForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string>

Defined in: evm/index.ts:745

Fetch the OnRamp address set in OffRamp config. Used to discover OffRamp connected to an OnRamp.

Parameters

ParameterTypeDescription
offRampstringOffRamp contract address
sourceChainSelectorbigintSource chain selector

Returns

Promise<string>

Promise resolving to OnRamp address

Throws

CCIPVersionUnsupportedError if OffRamp version is not supported

Overrides

Chain.getOnRampForOffRamp


getOnRampForRouter()

getOnRampForRouter(router: string, destChainSelector: bigint): Promise<string>

Defined in: evm/index.ts:732

Fetch the OnRamp registered in a Router for a destination chain.

Parameters

ParameterTypeDescription
routerstringRouter contract address
destChainSelectorbigintDestination chain selector

Returns

Promise<string>

Promise resolving to OnRamp address

Overrides

Chain.getOnRampForRouter


getRegistryTokenConfig()

getRegistryTokenConfig(registry: string, token: string): Promise<{ administrator: string; pendingAdministrator?: string; tokenPool?: string; }>

Defined in: evm/index.ts:1285

Fetch token configuration from a TokenAdminRegistry.

Parameters

ParameterTypeDescription
registrystringTokenAdminRegistry contract address.
tokenstringToken address to query.

Returns

Promise<{ administrator: string; pendingAdministrator?: string; tokenPool?: string; }>

RegistryTokenConfig containing administrator and pool information.

Remarks

The TokenAdminRegistry is a contract that tracks token administrators and their associated pools. Each token has an administrator who can update pool configurations.

Throws

CCIPTokenNotConfiguredError if token is not configured in registry

Overrides

Chain.getRegistryTokenConfig


getRouterForOffRamp()

getRouterForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string>

Defined in: evm/index.ts:675

Fetch the Router address set in OffRamp config.

Parameters

ParameterTypeDescription
offRampstringOffRamp contract address
sourceChainSelectorbigintSource chain selector

Returns

Promise<string>

Promise resolving to Router address

Throws

CCIPVersionUnsupportedError if OffRamp version is not supported

Overrides

Chain.getRouterForOffRamp


getRouterForOnRamp()

getRouterForOnRamp(onRamp: string, destChainSelector: bigint): Promise<string>

Defined in: evm/index.ts:643

Fetch the Router address set in OnRamp config. Used to discover OffRamp connected to OnRamp.

Parameters

ParameterTypeDescription
onRampstringOnRamp contract address
destChainSelectorbigintDestination chain selector

Returns

Promise<string>

Promise resolving to Router address

Throws

CCIPVersionUnsupportedError if OnRamp version is not supported

Overrides

Chain.getRouterForOnRamp


getSupportedTokens()

getSupportedTokens(registry: string, opts?: { page?: number; }): Promise<string[]>

Defined in: evm/index.ts:1264

Get the supported tokens for a given contract address.

Parameters

ParameterTypeDescription
registrystringRouter, OnRamp, OffRamp or TokenAdminRegistry contract address.
opts?{ page?: number; }Optional parameters.
opts.page?number-

Returns

Promise<string[]>

An array of supported token addresses.

Overrides

Chain.getSupportedTokens


getTokenAdminRegistryFor()

getTokenAdminRegistryFor(address: string): Promise<string>

Defined in: evm/index.ts:894

Fetch TokenAdminRegistry configured in a given OnRamp, Router, etc. Needed to map a source token to its dest counterparts.

Parameters

ParameterTypeDescription
addressstringContract address (OnRamp, Router, etc.)

Returns

Promise<string>

Promise resolving to TokenAdminRegistry address

Throws

CCIPContractNotRouterError if address is not a Router, OnRamp, or OffRamp

Overrides

Chain.getTokenAdminRegistryFor


getTokenForTokenPool()

getTokenForTokenPool(tokenPool: string): Promise<string>

Defined in: evm/index.ts:807

Fetch the TokenPool's token/mint.

Parameters

ParameterTypeDescription
tokenPoolstringTokenPool address

Returns

Promise<string>

Promise resolving to token or mint address

Overrides

Chain.getTokenForTokenPool


getTokenInfo()

getTokenInfo(token: string): Promise<{ decimals: number; name: string; symbol: string; }>

Defined in: evm/index.ts:817

Fetch token metadata.

Parameters

ParameterTypeDescription
tokenstringToken address

Returns

Promise<{ decimals: number; name: string; symbol: string; }>

Promise resolving to token symbol, decimals, and optionally name

Overrides

Chain.getTokenInfo


getTokenPoolConfig()

getTokenPoolConfig(tokenPool: string): Promise<{ router: string; token: string; typeAndVersion: string; }>

Defined in: evm/index.ts:1314

Fetch configuration of a token pool.

Parameters

ParameterTypeDescription
tokenPoolstringToken pool contract address.

Returns

Promise<{ router: string; token: string; typeAndVersion: string; }>

TokenPoolConfig containing token, router, and version info.

Remarks

Return type varies by chain:

  • EVM: typeAndVersion is always present (required)
  • Solana: Includes extra tokenPoolProgram field
  • Aptos: Standard fields only
  • Sui/TON: Throws CCIPNotImplementedError

Overrides

Chain.getTokenPoolConfig


getTokenPoolRemote()

getTokenPoolRemote(tokenPool: string, remoteChainSelector: bigint): Promise<TokenPoolRemote>

Defined in: chain.ts:1238

Fetch remote chain configuration for a token pool for a specific destination.

Parameters

ParameterTypeDescription
tokenPoolstringToken pool address on the current chain.
remoteChainSelectorbigintChain selector of the desired remote chain.

Returns

Promise<TokenPoolRemote>

TokenPoolRemote config for the specified remote chain.

Remarks

Convenience wrapper around getTokenPoolRemotes that returns a single configuration instead of a Record. Use this when you need configuration for a specific destination chain.

Example

TypeScript
const arbitrumSelector = 4949039107694359620n
const remote = await chain.getTokenPoolRemote(poolAddress, arbitrumSelector)
console.log(`Remote token: ${remote.remoteToken}`)
console.log(`Remote pools: ${remote.remotePools.join(', ')}`)

Throws

CCIPTokenPoolChainConfigNotFoundError if no configuration found for the specified remote chain.

Inherited from

Chain.getTokenPoolRemote


getTokenPoolRemotes()

getTokenPoolRemotes(tokenPool: string, remoteChainSelector?: bigint): Promise<Record<string, TokenPoolRemote>>

Defined in: evm/index.ts:1339

Fetch remote chain configurations for a token pool.

Parameters

ParameterTypeDescription
tokenPoolstringToken pool address on the current chain.
remoteChainSelector?bigintOptional chain selector to filter results to a single destination.

Returns

Promise<Record<string, TokenPoolRemote>>

Record where keys are chain names (e.g., "ethereum-mainnet") and values are TokenPoolRemote configs.

Remarks

A token pool maintains configurations for each destination chain it supports. The returned Record maps chain names to their respective configurations.

Overrides

Chain.getTokenPoolRemotes


getTransaction()

getTransaction(hash: string | TransactionReceipt): Promise<ChainTransaction>

Defined in: evm/index.ts:326

Fetch a transaction by its hash.

Parameters

ParameterTypeDescription
hashstring | TransactionReceiptTransaction hash

Returns

Promise<ChainTransaction>

Promise resolving to generic transaction details

Overrides

Chain.getTransaction


listAccounts()

listAccounts(): Promise<string[]>

Defined in: evm/index.ts:240

Expose ethers provider's listAccounts, if provider supports it

Returns

Promise<string[]>


nextNonce()

nextNonce(address: string): Promise<number>

Defined in: evm/index.ts:245

Get the next nonce for a sender address and bump internal count

Parameters

ParameterType
addressstring

Returns

Promise<number>


sendMessage()

sendMessage(opts: SendMessageOpts & { wallet: unknown; }): Promise<CCIPRequest<CCIPVersion>>

Defined in: evm/index.ts:1052

Send a CCIP message through a router using provided wallet.

Parameters

ParameterTypeDescription
optsSendMessageOpts & { wallet: unknown; }SendMessageOpts with chain-specific wallet for signing

Returns

Promise<CCIPRequest<CCIPVersion>>

Promise resolving to CCIP request with message details

Throws

CCIPWalletInvalidError if wallet is not a valid Signer

Overrides

Chain.sendMessage


typeAndVersion()

typeAndVersion(address: string): Promise<[string, string, string, string]>

Defined in: evm/index.ts:370

Fetch typeAndVersion for a given CCIP contract address.

Parameters

ParameterTypeDescription
addressstringCCIP contract address

Returns

Promise<[string, string, string, string]>

Promise resolving to tuple:

  • type - Parsed type of the contract, e.g. OnRamp
  • version - Parsed version of the contract, e.g. 1.6.0
  • typeAndVersion - Original (unparsed) typeAndVersion() string
  • suffix - Suffix of the version, if any (e.g. -dev)

Overrides

Chain.typeAndVersion


waitFinalized()

waitFinalized(opts: { cancel$?: Promise<unknown>; finality?: number | "finalized"; request: { log: { } & { } & { } & { } & { tx?: { timestamp: number; }; }; tx?: { timestamp: number; }; }; }): Promise<true>

Defined in: chain.ts:428

Confirm a log tx is finalized or wait for it to be finalized.

Parameters

ParameterTypeDescription
opts{ cancel$?: Promise<unknown>; finality?: number | "finalized"; request: { log: { } & { } & { } & { } & { tx?: { timestamp: number; }; }; tx?: { timestamp: number; }; }; }Options containing the request, finality level, and optional cancel promise
opts.cancel$?Promise<unknown>-
opts.finality?number | "finalized"-
opts.request{ log: { } & { } & { } & { } & { tx?: { timestamp: number; }; }; tx?: { timestamp: number; }; }-
opts.request.log{ } & { } & { } & { } & { tx?: { timestamp: number; }; }Log event from the OnRamp.
opts.request.tx?{ timestamp: number; }Transaction that emitted the request.
opts.request.tx.timestampnumberUnix timestamp of the block.

Returns

Promise<true>

true when the transaction is finalized

Throws

CCIPTransactionNotFinalizedError if the transaction is not included (e.g., due to a reorg)

Example

TypeScript
const request = await source.getMessagesInTx(txHash)
try {
await source.waitFinalized({ request: request[0] })
console.log('Transaction finalized')
} catch (err) {
if (err instanceof CCIPTransactionNotFinalizedError) {
console.log('Transaction not yet finalized')
}
}

Inherited from

Chain.waitFinalized


_getProvider()

static _getProvider(url: string): Promise<JsonRpcApiProvider>

Defined in: evm/index.ts:260

Creates a JSON-RPC provider from a URL.

Parameters

ParameterTypeDescription
urlstringWebSocket (wss://) or HTTP (https://) endpoint URL.

Returns

Promise<JsonRpcApiProvider>

A ready JSON-RPC provider.


buildMessageForDest()

static buildMessageForDest(message: MessageInput): AnyMessage

Defined in: chain.ts:1268

ChainStatic.buildMessageForDest

Parameters

ParameterType
messageMessageInput

Returns

AnyMessage

Inherited from

Chain.buildMessageForDest


decodeCommits()

static decodeCommits(log: { data: unknown; topics?: readonly string[]; }, lane?: Omit<Lane<CCIPVersion>, "destChainSelector">): { maxSeqNr: bigint; merkleRoot: string; minSeqNr: bigint; onRampAddress: string; sourceChainSelector: bigint; }[] | undefined

Defined in: evm/index.ts:489

Decodes commit reports from a log event.

Parameters

ParameterTypeDescription
log{ data: unknown; topics?: readonly string[]; }Log event with topics and data.
log.dataunknown-
log.topics?readonly string[]-
lane?Omit<Lane<CCIPVersion>, "destChainSelector">Lane info (required for CCIP v1.5 and earlier).

Returns

{ maxSeqNr: bigint; merkleRoot: string; minSeqNr: bigint; onRampAddress: string; sourceChainSelector: bigint; }[] | undefined

Array of CommitReport or undefined if not a valid commit event.

Throws

CCIPLogDataInvalidError if log data is not valid bytes

Throws

CCIPVersionRequiresLaneError if CCIP v1.5 event but no lane provided


decodeExtraArgs()

static decodeExtraArgs(extraArgs: BytesLike): EVMExtraArgsV1 & { _tag: "EVMExtraArgsV1"; } | EVMExtraArgsV1 & { allowOutOfOrderExecution: boolean; } & { _tag: "EVMExtraArgsV2"; } | GenericExtraArgsV3 & { _tag: "GenericExtraArgsV3"; } | SVMExtraArgsV1 & { _tag: "SVMExtraArgsV1"; } | EVMExtraArgsV1 & { allowOutOfOrderExecution: boolean; } & { receiverObjectIds: string[]; tokenReceiver: string; } & { _tag: "SuiExtraArgsV1"; } | undefined

Defined in: evm/index.ts:575

Decodes extra arguments from a CCIP message.

Parameters

ParameterTypeDescription
extraArgsBytesLikeEncoded extra arguments bytes.

Returns

EVMExtraArgsV1 & { _tag: "EVMExtraArgsV1"; }

EVMExtraArgsV1 & { allowOutOfOrderExecution: boolean; } & { _tag: "EVMExtraArgsV2"; }

GenericExtraArgsV3 & { _tag: "GenericExtraArgsV3"; }

SVMExtraArgsV1 & { _tag: "SVMExtraArgsV1"; }

EVMExtraArgsV1 & { allowOutOfOrderExecution: boolean; } & { receiverObjectIds: string[]; tokenReceiver: string; } & { _tag: "SuiExtraArgsV1"; }

undefined

Decoded extra arguments with tag, or undefined if unknown format.


decodeMessage()

static decodeMessage(log: { data: unknown; topics?: readonly string[]; }): CCIPMessage | undefined

Defined in: evm/index.ts:386

Decodes a CCIP message from a log event.

Parameters

ParameterTypeDescription
log{ data: unknown; topics?: readonly string[]; }Log event with topics and data.
log.dataunknown-
log.topics?readonly string[]-

Returns

CCIPMessage | undefined

Decoded CCIPMessage or undefined if not a valid CCIP message.

Throws

CCIPLogDataInvalidError if log data is not valid bytes

Throws

CCIPMessageDecodeError if message cannot be decoded


decodeReceipt()

static decodeReceipt(log: { data: unknown; topics?: readonly string[]; }): ExecutionReceipt | undefined

Defined in: evm/index.ts:545

Decodes an execution receipt from a log event.

Parameters

ParameterTypeDescription
log{ data: unknown; topics?: readonly string[]; }Log event with topics and data.
log.dataunknown-
log.topics?readonly string[]-

Returns

ExecutionReceipt | undefined

ExecutionReceipt or undefined if not a valid execution event.

Throws

CCIPLogDataInvalidError if log data is not valid bytes


encodeExtraArgs()

static encodeExtraArgs(args: ExtraArgs | undefined): string

Defined in: evm/index.ts:584

Encodes extra arguments for a CCIP message.

Parameters

ParameterTypeDescription
argsExtraArgs | undefinedExtra arguments to encode.

Returns

string

Encoded extra arguments as hex string.


fromProvider()

static fromProvider(provider: JsonRpcApiProvider, ctx?: ChainContext): Promise<EVMChain>

Defined in: evm/index.ts:288

Creates an EVMChain instance from an existing provider.

Parameters

ParameterTypeDescription
providerJsonRpcApiProviderJSON-RPC provider instance.
ctx?ChainContextcontext containing logger.

Returns

Promise<EVMChain>

A new EVMChain instance.


fromUrl()

static fromUrl(url: string, ctx?: ChainContext): Promise<EVMChain>

Defined in: evm/index.ts:314

Creates an EVMChain instance from an RPC URL.

Parameters

ParameterTypeDescription
urlstringWebSocket (wss://) or HTTP (https://) endpoint URL.
ctx?ChainContextOptional context containing logger and API client configuration.

Returns

Promise<EVMChain>

A new EVMChain instance connected to the specified network.

Throws

CCIPChainNotFoundError if chain cannot be identified from chainId

Example

TypeScript
// HTTP connection
const chain = await EVMChain.fromUrl('https://rpc.sepolia.org')

// With custom logger
const chain = await EVMChain.fromUrl(url, { logger: customLogger })

getAddress()

static getAddress(bytes: BytesLike): string

Defined in: evm/index.ts:594

Converts bytes to a checksummed EVM address.

Parameters

ParameterTypeDescription
bytesBytesLikeBytes to convert (must be 20 bytes or 32 bytes with leading zeros).

Returns

string

Checksummed EVM address.

Throws

CCIPAddressInvalidEvmError if bytes cannot be converted to a valid EVM address


getDestLeafHasher()

static getDestLeafHasher(lane: Lane, ctx?: WithLogger): LeafHasher

Defined in: evm/index.ts:855

Gets the leaf hasher for computing Merkle proofs on the destination chain.

Parameters

ParameterTypeDescription
laneLaneLane configuration.
ctx?WithLoggerContext object containing logger.

Returns

LeafHasher

Leaf hasher function.

Throws

CCIPSourceChainUnsupportedError if source chain is not EVM for v1.2/v1.5

Throws

CCIPHasherVersionUnsupportedError if lane version is not supported


isTxHash()

static isTxHash(v: unknown): v is `0x${string}`

Defined in: evm/index.ts:611

Validates a transaction hash format for EVM

Parameters

ParameterType
vunknown

Returns

v is `0x${string}`


parse()

static parse(data: unknown): Record<string, unknown> | undefined

Defined in: evm/index.ts:1254

Parses raw data into typed structures.

Parameters

ParameterTypeDescription
dataunknownRaw data to parse.

Returns

Record<string, unknown> | undefined

Parsed data.