API Version: v1.6.0

CCIP v1.6.0 Client Library API Reference

Client

A library that provides core data structures and utilities for building and handling cross-chain messages in CCIP.

Git Source

Structs

Any2EVMMessage

Structure representing a message received from any chain to an EVM chain.

struct Any2EVMMessage {
  bytes32 messageId;
  uint64 sourceChainSelector;
  bytes sender;
  bytes data;
  EVMTokenAmount[] destTokenAmounts;
}

Properties

NameTypeDescription
messageIdbytes32Message ID corresponding to ccipSend on source
sourceChainSelectoruint64Identifier of the source chain
senderbytesSender address (use abi.decode if from EVM chain)
databytesCustom payload from the original message
destTokenAmountsEVMTokenAmount[]Token amounts in destination chain representation

EVM2AnyMessage

Structure for sending a message from an EVM chain to any supported chain.

struct EVM2AnyMessage {
  bytes receiver;
  bytes data;
  EVMTokenAmount[] tokenAmounts;
  address feeToken;
  bytes extraArgs;
}

Properties

NameTypeDescription
receiverbytesEncoded receiver address for destination EVM chains
databytesCustom payload to send
tokenAmountsEVMTokenAmount[]Tokens and amounts to transfer
feeTokenaddressToken used for fees (address(0) for native tokens)
extraArgsbytesAdditional arguments encoded with _argsToBytes

EVMExtraArgsV1

Structure for V1 extra arguments in cross-chain messages.

struct EVMExtraArgsV1 {
  uint256 gasLimit;
}

Properties

NameTypeDescription
gasLimituint256Gas limit for execution on destination chain

GenericExtraArgsV2

Structure for V2 extra arguments in cross-chain messages.

struct GenericExtraArgsV2 {
  uint256 gasLimit;
  bool allowOutOfOrderExecution;
}

Properties

NameTypeDescription
gasLimituint256Gas limit for execution on destination chain
allowOutOfOrderExecutionboolWhether messages can be executed in any order

SVMExtraArgsV1

Structure for V1 extra arguments specific to Solana VM-based chains.

struct SVMExtraArgsV1 {
  uint32 computeUnits;
  uint64 accountIsWritableBitmap;
  bool allowOutOfOrderExecution;
  bytes32 tokenReceiver;
  bytes32[] accounts;
}

Properties

NameTypeDescription
computeUnitsuint32Compute units for execution on Solana
accountIsWritableBitmapuint64Bitmap indicating which accounts are writable
allowOutOfOrderExecutionboolWhether messages can be executed in any order
tokenReceiverbytes32Address of the token receiver
accountsbytes32[]Additional accounts needed for CCIP receiver execution

EVMTokenAmount

Structure representing token amounts in CCIP messages.

struct EVMTokenAmount {
  address token;
  uint256 amount;
}

Properties

NameTypeDescription
tokenaddressToken address on the local chain
amountuint256Amount of tokens to transfer

State Variables

EVM_EXTRA_ARGS_V1_TAG

bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9;

GENERIC_EXTRA_ARGS_V2_TAG

bytes4 public constant GENERIC_EXTRA_ARGS_V2_TAG = 0x181dcf10;

SVM_EXTRA_ARGS_V1_TAG

bytes4 public constant SVM_EXTRA_ARGS_V1_TAG = 0x1f3b3aba;

SVM_EXTRA_ARGS_MAX_ACCOUNTS

uint256 public constant SVM_EXTRA_ARGS_MAX_ACCOUNTS = 64;

SVM_TOKEN_TRANSFER_DATA_OVERHEAD

uint256 public constant SVM_TOKEN_TRANSFER_DATA_OVERHEAD = (4 + 32) // source_pool
  + 32 // token_address
  + 4 // gas_amount
  + 4 // extra_data overhead
  + 32 // amount
  + 32 // size of the token lookup table account
  + 32 // token-related accounts in the lookup table, over-estimated to 32, typically between 11 - 13
  + 32 // token account belonging to the token receiver, e.g ATA, not included in the token lookup table
  + 32 // per-chain token pool config, not included in the token lookup table
  + 32 // per-chain token billing config, not always included in the token lookup table
  + 32; // OffRamp pool signer PDA, not included in the token lookup table

SVM_MESSAGING_ACCOUNTS_OVERHEAD

uint256 public constant SVM_MESSAGING_ACCOUNTS_OVERHEAD = 2;

SVM_ACCOUNT_BYTE_SIZE

uint256 public constant SVM_ACCOUNT_BYTE_SIZE = 32;

Functions

_argsToBytes (V1)

Encodes EVMExtraArgsV1 into bytes for message transmission.

function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts);

Parameters

NameTypeDescription
extraArgsEVMExtraArgsV1The V1 extra arguments to encode

Returns

TypeDescription
bytesThe encoded extra arguments with tag

_argsToBytes (V2)

Encodes GenericExtraArgsV2 into bytes for message transmission.

function _argsToBytes(GenericExtraArgsV2 memory extraArgs) internal pure returns (bytes memory bts);

Parameters

NameTypeDescription
extraArgsGenericExtraArgsV2The V2 generic extra arguments to encode

Returns

TypeDescription
bytesThe encoded extra arguments with tag

_svmArgsToBytes

Encodes SVMExtraArgsV1 into bytes for message transmission.

function _svmArgsToBytes(SVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts);

Parameters

NameTypeDescription
extraArgsSVMExtraArgsV1The SVM extra arguments to encode

Returns

TypeDescription
bytesThe encoded extra arguments with tag

Get the latest Chainlink content straight to your inbox.