Skip to main content

Core Types

Complex data structures used throughout the Metalayer SDK for transaction execution, order tracking, and cross-chain operations.

Chain

Comprehensive blockchain network information including configuration and metadata.
PropertyTypeDescription
identifierChainIdentifierUnique identifier for the blockchain network
namestringHuman-readable name of the blockchain (e.g., “Ethereum”, “Arbitrum One”)
isTestnetbooleanWhether this is a testnet chain used for development and testing
imageUrlstringURL to the chain’s logo or icon image
parentChainChainIdentifierParent chain identifier with both ID and architecture
stackRollupStackStack used by this chain (Nitro, ZkSync, Optimism)
nativeCurrencyNativeCurrencyNative currency information for this chain
defaultRpcChainRpcDefault RPC for this chain
alternativeRpcsChainRpc[]Alternative RPCs for this chain
blockExplorerChainBlockExplorerBlock explorer information for this chain
contractsRecord<string, ChainContract>Known deployed contracts on this chain
lastUpdatedAtDateTimestamp for when this chain was last updated

ChainIdentifier

Minimal chain identifier containing ID and architecture information.
PropertyTypeDescription
idnumberUnique numerical identifier for the blockchain network
architectureChainArchitectureBlockchain architecture (Ethereum, Solana)

ExecutionStep

A transaction execution step containing the specific action data for EVM transactions, EIP-712 signatures, or Solana transactions.
PropertyTypeDescription
actionExecutionStepActionUnion type containing the specific action to execute

ExecutionStepAction

The action property is a union type with case and value properties:
PropertyTypeDescription
case"transactionRequest" | "eip712Data" | "solanaTransaction"Discriminator indicating which type of action this is
valueTransactionRequest | EIP712Data | SolanaTransactionThe actual action data based on the case

Action Types

CaseValue TypeDescription
"transactionRequest"TransactionRequestStandard EVM transactions
"eip712Data"EIP712DataEIP-712 typed data for gasless transactions
"solanaTransaction"SolanaTransactionSolana blockchain transactions
// Example: Processing ExecutionStep
for (const step of quote.steps) {
  switch (step.action.case) {
    case 'transactionRequest':
      // Handle EVM transaction
      const txRequest = step.action.value;
      break;
    case 'eip712Data':
      // Handle EIP-712 signature
      const typedData = step.action.value;
      break;
    case 'solanaTransaction':
      // Handle Solana transaction
      const solanaTransaction = step.action.value;
      break;
  }
}

TransactionRequest

Standard EVM transaction request for on-chain operations.
PropertyTypeDescription
tostringTarget contract address
datastringEncoded function call data
valuestringETH value in wei
chainIdnumberExecution chain ID
typeTransactionTypeTransaction type (ERC20_APPROVAL, CONTRACT_WRITE, TRANSFER)

EIP712Data

EIP-712 typed data structure for gasless transactions and meta-transactions.
PropertyTypeDescription
accountstringAccount address that will sign this typed data
domainEIP712DomainDomain separator information for signature verification
typesRecord<string, EIP712TypeDefinition>Type definitions for structured data
primaryTypestringPrimary type name being signed
messageobjectThe structured data to be signed

SolanaTransaction

Solana blockchain transaction containing multiple instructions.
PropertyTypeDescription
instructionsInstruction[]List of instructions to execute atomically

Instruction

Individual instruction within a Solana transaction.
PropertyTypeDescription
accountsAccountMeta[]Accounts involved with their access permissions
programIdstringPublic key of the Solana program to invoke
datastringEncoded instruction data specific to the program

AccountMeta

Account metadata specifying permissions for Solana transactions.
PropertyTypeDescription
pubkeystringPublic key of the account
isSignerbooleanWhether this account must sign the transaction
isWritablebooleanWhether this account’s data may be modified

Token

Token information including metadata and chain-specific details.
PropertyTypeDescription
addressstringContract address of the token
symbolstringToken symbol (e.g., “ETH”, “USDC”)
namestringFull token name (e.g., “Ethereum”, “USD Coin”)
decimalsnumberNumber of decimal places for the token
chainIdnumberChain ID where this token exists
imageUrlstringURL to the token’s logo or icon

TokenList

Container for a list of tokens on a specific chain.
PropertyTypeDescription
tokensToken[]Array of tokens available on the chain

Quote

Bridge quote containing execution steps and fee information.
PropertyTypeDescription
quoteIdstringUnique identifier for tracking
stepsExecutionStep[]Transaction steps to execute
amountOutbigintExpected output amount
totalFeesbigintTotal fees in source token
providerQuoteProviderBridge provider
estimatedFillTimeSecsnumberCompletion time (seconds)
deadlineDateQuote expiration time
feesTokenFee[]Detailed fee breakdown by token and chain

Order

A cross-chain bridge order that tracks transaction status and details.
PropertyTypeDescription
quoteIdstringUnique identifier linking this order to the original quote
providerQuoteProviderProvider that processed this order
statusOrderStatusCurrent status of the cross-chain order
sourceTransactionHashstringTransaction hash on the source chain
destinationTransactionHashstringTransaction hash on the destination chain
sourceChainChainIdentifierSource chain with id and architecture
destinationChainChainIdentifierDestination chain with id and architecture
senderAddressstringAddress that initiated the order
receiverAddressstringAddress that will receive the tokens
amountInstringInput amount sent in source token’s smallest unit
amountOutstringOutput amount received in destination token’s smallest unit
sourceTokenAddressstringContract address of the source token
destinationTokenAddressstringContract address of the destination token
timestampDateBlock timestamp of the source transaction
lastUpdatedDateBlock timestamp of the last update to the order
nextStepsExecutionStep[]Required user actions to complete the order
deadlineDate | undefinedExpiration time when the order becomes eligible for refund

Enums

Enumeration types that define specific sets of values used across the SDK.

ChainArchitecture

Blockchain architecture types supported by the Metalayer SDK.
ArchitectureDescription
UNSPECIFIEDUnspecified architecture
ETHEREUMEthereum and EVM-compatible chains
SOLANASolana blockchain

QuoteProvider

Bridge providers that can process cross-chain transactions.
ProviderDescription
UNSPECIFIEDUnspecified provider
NITRO_BRIDGEArbitrum Nitro native bridge
BEDROCK_BRIDGEOP Stack native bridge
ZKSYNC_BRIDGEzkSync native bridge
ACROSSAcross protocol bridge
ECOEco protocol bridge
RELAYRelay protocol bridge
METATOKENMetaToken bridge
LAYER_ZERO_OFTLayerZero OFT bridge
HYPERLANE_WARP_ROUTESHyperlane Warp Routes bridge

OrderStatus

Order status values indicating the current state of a cross-chain transaction.
StatusDescription
PENDINGOrder is in progress, waiting for completion
WAITING_TO_PROVEWithdrawal is waiting for proof submission (native bridges)
WITHDRAWAL_PROVENWithdrawal proof has been submitted
FULFILLEDOrder completed successfully
REFUNDEDOrder was refunded to the source address
FAILEDOrder failed and cannot be completed
READY_TO_REFUNDOrder deadline passed, eligible for refund
import { OrderStatus } from '@metalayer/sdk';

const { order } = await client.getOrder({
  sourceTransactionHash: '0xTxHash',
  sourceChainId: 1,
});

// Check specific status
if (order.status === OrderStatus.FULFILLED) {
  console.log('Bridge transaction completed!');
}