Execute your swap or call

We allow you to execute any on-chain or cross-chain swap and bridging process and a combination of both.

Executing a route requires a signer to be set up. How to set up a signer.

executeRoute

Type: Types

const tx = await squid.executeRoute({ signer, route, executionSettings })

const txReceipt = await tx.wait()

executionSettings

In addition to the first two parameters, executeRoute takes an optional executionSettings object as a third parameter.

type executionSettings?: {
    infiniteApproval?: boolean;
    setGasPrice: boolean;
};

infiniteApproval defaults totrue if not set by the user. This will set the SquidRouter contract's allowance of fromToken to max.

When infiniteApproval is false, the Squid SDK will approve only the amount necessary for this trade.

On some chains, you may need to set setGasPrice to true, since gas estimation is different across different EVMs.

Example code snippet

Last updated