🔑Local Accounts - Request an order
How to create orders and send them to the auctioneer.
Requesting an intent
Once you have configured your blockchain client, you can create and send cross-chain swap orders using the createAndSendOrder({ ... })
method. This method handles the entire process of creating an intent, preparing it for the specific blockchain, and submitting it to the auctioneer network.
Consideration: The intent may not be fulfilled if input parameters are incorrect. Common issues include setting an unreasonably short deadline timeframe that causes order expiration, or providing invalid addresses that don't correspond to their designated chain IDs. Ensure all parameters are validated before submission to maximize fulfillment success.
const baseTokenAddress = '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2' // USDT on Base
const arbitrumTokenAddress = '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9' // USDT on Arbitrum
const destinationAddress = '0x2b7Aa410B79aB7D22EEdAEc66deB3416A106F3ae'
const tokenAmount = 8000n // Amount in big int units (e.g., 6 Decimals for USDT)
const deadline = Math.floor(Date.now() / 1000) + 3600 // One hour from now
const response = await baseEvmClient.createAndSendOrder({
deadline,
destinationAddress,
destinationChainId: ChainID.Arbitrum,
destinationTokenAddress: arbitrumTokenAddress,
sourceChainId: ChainID.Base,
sourceTokenAddress: baseTokenAddress,
sourceTokenAmount: tokenAmount,
destinationTokenMinAmount: 1n, // Optional: Minimum tokens to receive
minStablecoinAmount: 1n, // Optional: Minimum stablecoin amount for the swap
})
Last updated