Execute the route
SDK
API
Widgets
// Execute the swap and deposit transaction
const tx = (await squid.executeRoute({
signer,
route,
})) as unknown as ethers.providers.TransactionResponse;
const txReceipt = await tx.wait();
If you want to execute yourself, manually. You can get all the data needed for execution from
route.transactionRequest
. Including calldata, target address, value to send and gas recommendations.
const transactionRequest = route.transactionRequest;
// Execute the swap transaction
const contract = new ethers.Contract(
transactionRequest.targetAddress,
[],
signer
);
const tx = await contract.send(transactionRequest.data, {
value: transactionRequest.value,
gasPrice: await provider.getGasPrice(),
gasLimit: transactionRequest.gasLimit,
});
const txReceipt = await tx.wait();
All widgets allow the user to submit once they have entered all required inputs and connected their wallet(s).
All routes require gas in the user's account on source chain only. The widgets will show a warning when the amount of gas needed is higher than their balance.
Last modified 1mo ago