Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/1inch/cross-chain-sdk/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The 1inch Cross-Chain SDK supports two distinct order types based on the source chain: EvmCrossChainOrder for EVM-compatible chains and SvmCrossChainOrder for Solana. Each has unique structures and behaviors optimized for their respective blockchain architectures.

EvmCrossChainOrder

Orders originating from EVM-compatible chains (Ethereum, Polygon, Arbitrum, etc.).

Class Definition

class EvmCrossChainOrder extends BaseOrder<EvmAddress, LimitOrderV4Struct>

Key Properties

maker
EvmAddress
The order creator’s address on the source chain
makerAsset
EvmAddress
Source token address (ERC-20 or wrapped native)
takerAsset
AddressLike
Destination token address (can be EVM or Solana)
makingAmount
bigint
Amount of source tokens to swap
takingAmount
bigint
Minimum amount of destination tokens to receive
receiver
AddressLike
Destination chain receiver address (defaults to maker if not set)
dstChainId
SupportedChain
Destination chain identifier
extension
Extension
Encoded extension containing escrow and auction data
escrowExtension
EscrowExtension
Detailed escrow parameters including:
  • Hash lock information
  • Time locks
  • Safety deposits
  • Auction details
  • Whitelist configuration
hashLock
HashLock
Hash lock for the escrow mechanism
timeLocks
TimeLocks
Time-based constraints for escrow operations
srcSafetyDeposit
bigint
Safety deposit amount on the source chain
dstSafetyDeposit
bigint
Safety deposit amount on the destination chain
auctionStartTime
bigint
Unix timestamp in seconds when the auction begins
auctionEndTime
bigint
Unix timestamp in seconds when the auction ends
deadline
bigint
Order expiration timestamp in seconds
nonce
bigint
Unique nonce for the maker
salt
bigint
Random salt for order uniqueness
partialFillAllowed
boolean
Whether partial fills are permitted
multipleFillsAllowed
boolean
Whether multiple separate fills are permitted

Creating EVM Orders

import { EvmCrossChainOrder, EvmAddress, HashLock } from '@1inch/cross-chain-sdk'

const order = EvmCrossChainOrder.new(
  escrowFactory,
  {
    maker: EvmAddress.fromString('0xMaker...'),
    makerAsset: EvmAddress.fromString('0xUSDC...'),
    takerAsset: EvmAddress.fromString('0xUSDT...'),
    makingAmount: 1000000n, // 1 USDC
    takingAmount: 990000n,  // 0.99 USDT minimum
    receiver: EvmAddress.fromString('0xReceiver...')
  },
  {
    srcChainId: 1,      // Ethereum
    dstChainId: 137,    // Polygon
    hashLock: HashLock.forMultipleFills(secrets),
    srcSafetyDeposit: 10000n,
    dstSafetyDeposit: 10000n,
    timeLocks: TimeLocks.new(...)
  },
  {
    auction: auctionDetails,
    whitelist: [],
    fees: {...}
  },
  {
    nonce: 1n,
    allowMultipleFills: true
  }
)

Key Methods

// Build order structure for submission
const orderStruct: LimitOrderV4Struct = order.build()

// Get order hash
const hash: string = order.getOrderHash(srcChainId)

// Get EIP-712 typed data for signing
const typedData = order.getTypedData(srcChainId)

// Check if address is exclusive resolver
const isExclusive: boolean = order.isExclusiveResolver(resolverAddress)

// Check if in exclusivity period
const inPeriod: boolean = order.isExclusivityPeriod(timestamp)

// Calculate resolver fee
const fee: bigint = order.getResolverFee(takerAddress, timestamp)

// Get auction calculator
const calculator = order.getCalculator()

SvmCrossChainOrder

Orders originating from Solana (SVM - Solana Virtual Machine).

Class Definition

class SvmCrossChainOrder extends BaseOrder<SolanaAddress, SolanaOrderJSON>

Key Properties

maker
SolanaAddress
The order creator’s Solana address
makerAsset
SolanaAddress
Source token mint address (SPL token or wrapped SOL)
takerAsset
EvmAddress
Destination EVM token address
makingAmount
bigint
Amount of source tokens (u64 range)
takingAmount
bigint
Minimum amount of destination tokens (u256)
receiver
EvmAddress
EVM receiver address (required for Solana orders)
dstChainId
SupportedChain
Destination EVM chain ID
auction
AuctionDetails
Auction configuration with start time, duration, and rate curve
hashLock
HashLock
Hash lock for escrow
timeLocks
TimeLocks
Time lock configuration
srcSafetyDeposit
bigint
Safety deposit in lamports (u64)
dstSafetyDeposit
bigint
Safety deposit in wei (u64)
deadline
bigint
Order expiration (u32 timestamp)
salt
bigint
Unique salt (u64)
srcAssetIsNative
boolean
Whether the source asset is native SOL
resolverCancellationConfig
ResolverCancellationConfig
Configuration for resolver-based cancellations:
  • maxCancellationPremium: Maximum premium for cancellation
  • cancellationAuctionDuration: Duration of cancellation auction
multipleFillsAllowed
boolean
Whether multiple fills are allowed

Creating Solana Orders

import { SvmCrossChainOrder, SolanaAddress, EvmAddress } from '@1inch/cross-chain-sdk'

const order = SvmCrossChainOrder.new(
  {
    maker: SolanaAddress.fromString('MakerAddress...'),
    srcToken: SolanaAddress.fromString('TokenMint...'),
    dstToken: EvmAddress.fromString('0xUSDC...'),
    srcAmount: 1000000n,
    minDstAmount: 990000n,
    receiver: EvmAddress.fromString('0xReceiver...')
  },
  {
    srcChainId: NetworkEnum.SOLANA,
    dstChainId: 1, // Ethereum
    hashLock: HashLock.forMultipleFills(secrets),
    srcSafetyDeposit: 10000000n,  // lamports
    dstSafetyDeposit: 10000n,      // wei
    timeLocks: TimeLocks.new(...)
  },
  {
    auction: auctionDetails
  },
  {
    allowMultipleFills: true,
    source: 'my-dapp'
  }
)

Key Methods

// Get order hash (base58 encoded)
const hash: string = order.getOrderHash(NetworkEnum.SOLANA)

// Get order hash as buffer
const hashBuffer: Buffer = order.getOrderHashBuffer()

// Get order account address
const account: SolanaAddress = order.getOrderAccount(programId)

// Get escrow address
const escrow: SolanaAddress = order.getSrcEscrowAddress(
  programId,
  takerAddress,
  hashLock,
  fillAmount
)

// Get escrow ATA (Associated Token Account)
const ata: SolanaAddress = order.getSrcEscrowATA({
  programId,
  taker: takerAddress,
  tokenProgramId
})

// Convert to JSON
const json: SolanaOrderJSON = order.toJSON()

// Get auction calculator
const calculator = order.getCalculator()

Structure Differences

FeatureEvmCrossChainOrderSvmCrossChainOrder
Source ChainEVM chainsSolana
Address TypeEvmAddressSolanaAddress
Order HashHex string (0x…)Base58 string
Data StructureLimitOrderV4StructSolanaOrderJSON
ExtensionEncoded in ExtensionStored in auction field
SignatureEIP-712 typed dataNot required (submitted on-chain first)
ReceiverOptional (defaults to maker)Required
Native AssetsVia fromNative()Via srcAssetIsNative flag
Amount Limitsu256u64 for source, u256 for dest
CancellationStandardResolver cancellation config
AnnouncementNot requiredRequired via announceOrder()

Extension and Auction Details

EVM Extension Structure

The EscrowExtension contains:
class EscrowExtension {
  escrowFactory: EvmAddress
  auctionDetails: AuctionDetails
  whitelist: Whitelist
  hashLockInfo: HashLock
  dstChainId: SupportedChain
  dstToken: AddressLike
  srcSafetyDeposit: bigint
  dstSafetyDeposit: bigint
  timeLocks: TimeLocks
  dstAddressFirstPart: AddressComplement
  makerPermit?: Interaction
  fees?: Fees
}

Auction Details

Both order types include auction configuration:
type AuctionDetails = {
  startTime: bigint        // Unix timestamp in seconds
  duration: bigint         // Auction duration in seconds
  initialRateBump: number  // Initial price improvement %
  points: AuctionPoint[]   // Price curve points
}

type AuctionPoint = {
  delay: bigint      // Time offset from start
  coefficient: number // Price multiplier
}

Time Locks

class TimeLocks {
  // Deadline for source escrow withdrawal by resolver
  srcWithdrawal: bigint
  
  // Deadline for source escrow public cancellation
  srcPublicWithdrawal: bigint
  
  // Deadline for destination escrow cancellation
  dstWithdrawal: bigint
  
  // Deadline for destination escrow public cancellation
  dstPublicWithdrawal: bigint
  
  // Build into u256 format
  build(): bigint
}

Usage Examples

const { order } = sdk.createOrder(quote, params)

if (order instanceof EvmCrossChainOrder) {
  console.log('EVM order')
  console.log('Extension:', order.extension.encode())
  console.log('Can sign with wallet')
} else if (order instanceof SvmCrossChainOrder) {
  console.log('Solana order')
  console.log('Auction hash:', order.auction.hashForSolana())
  console.log('Must announce before on-chain creation')
}

Notes

  • EVM orders support both EVM and Solana as destination chains
  • Solana orders currently only support EVM chains as destinations
  • Order hash format differs: use appropriate comparison methods
  • Solana orders must be announced to the relayer before on-chain creation
  • EVM native orders require special handling via fromNative() and submitNativeOrder()
  • Amount ranges differ: Solana is limited to u64 for source amounts
  • Extension encoding is specific to EVM orders
  • Both types support the same hash lock and escrow mechanisms