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
The order creator’s address on the source chain
Source token address (ERC-20 or wrapped native)
Destination token address (can be EVM or Solana)
Amount of source tokens to swap
Minimum amount of destination tokens to receive
Destination chain receiver address (defaults to maker if not set)
Destination chain identifier
Encoded extension containing escrow and auction data
Detailed escrow parameters including:
- Hash lock information
- Time locks
- Safety deposits
- Auction details
- Whitelist configuration
Hash lock for the escrow mechanism
Time-based constraints for escrow operations
Safety deposit amount on the source chain
Safety deposit amount on the destination chain
Unix timestamp in seconds when the auction begins
Unix timestamp in seconds when the auction ends
Order expiration timestamp in seconds
Unique nonce for the maker
Random salt for order uniqueness
Whether partial fills are permitted
Whether multiple separate fills are permitted
Creating EVM Orders
Standard Order
Native Asset Order
From Existing Data
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
}
)
import { EvmCrossChainOrder, ProxyFactory } from '@1inch/cross-chain-sdk'
// Create order from native ETH
const nativeOrder = EvmCrossChainOrder.fromNative(
1, // Ethereum chainId
ethOrdersFactory,
escrowFactory,
{
maker: EvmAddress.fromString('0xMaker...'),
// makerAsset omitted - will use WETH
takerAsset: EvmAddress.fromString('0xUSDC...'),
makingAmount: parseEther('1'), // 1 ETH
takingAmount: 3000000000n // 3000 USDC
},
details,
escrowParams
)
// Native orders require on-chain submission
// await nativeOrderFactory.create(order, signature)
// Reconstruct order from on-chain or API data
const order = EvmCrossChainOrder.fromDataAndExtension(
orderStruct,
extension
)
console.log('Maker:', order.maker.toString())
console.log('Making amount:', order.makingAmount)
console.log('Auction start:', order.auctionStartTime)
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
The order creator’s Solana address
Source token mint address (SPL token or wrapped SOL)
Destination EVM token address
Amount of source tokens (u64 range)
Minimum amount of destination tokens (u256)
EVM receiver address (required for Solana orders)
Auction configuration with start time, duration, and rate curve
Safety deposit in lamports (u64)
Safety deposit in wei (u64)
Order expiration (u32 timestamp)
Whether the source asset is native SOL
resolverCancellationConfig
ResolverCancellationConfig
Configuration for resolver-based cancellations:
maxCancellationPremium: Maximum premium for cancellation
cancellationAuctionDuration: Duration of cancellation auction
Whether multiple fills are allowed
Creating Solana Orders
Standard Order
From JSON
From Contract
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'
}
)
// Reconstruct from API response
const order = SvmCrossChainOrder.fromJSON(orderJSON)
console.log('Maker:', order.maker.toString())
console.log('Order hash (base58):', order.getOrderHash())
// Parse from on-chain data
const order = SvmCrossChainOrder.fromContractOrder(
parsedInstructionData,
auctionDetails
)
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
| Feature | EvmCrossChainOrder | SvmCrossChainOrder |
|---|
| Source Chain | EVM chains | Solana |
| Address Type | EvmAddress | SolanaAddress |
| Order Hash | Hex string (0x…) | Base58 string |
| Data Structure | LimitOrderV4Struct | SolanaOrderJSON |
| Extension | Encoded in Extension | Stored in auction field |
| Signature | EIP-712 typed data | Not required (submitted on-chain first) |
| Receiver | Optional (defaults to maker) | Required |
| Native Assets | Via fromNative() | Via srcAssetIsNative flag |
| Amount Limits | u256 | u64 for source, u256 for dest |
| Cancellation | Standard | Resolver cancellation config |
| Announcement | Not required | Required 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
Check Order Type
Access Common Properties
Calculate Auction Price
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')
}
// Both order types share common interface
function logOrderInfo(order: EvmCrossChainOrder | SvmCrossChainOrder) {
console.log('Maker:', order.maker.toString())
console.log('Making amount:', order.makingAmount.toString())
console.log('Taking amount:', order.takingAmount.toString())
console.log('Destination chain:', order.dstChainId)
console.log('Hash lock:', order.hashLock.toString())
console.log('Auction start:', order.auctionStartTime.toString())
console.log('Multiple fills:', order.multipleFillsAllowed)
}
// Works for both order types
const calculator = order.getCalculator()
const currentTime = BigInt(Math.floor(Date.now() / 1000))
const currentRate = calculator.getRateBump(currentTime)
console.log('Current auction rate:', currentRate)
// Calculate taking amount at current time
const takingAmount = calculator.calcTakingAmount(
order.makingAmount,
currentTime
)
console.log('Current taking amount:', takingAmount.toString())
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