Manually approve a route

Usually, the squid sdk will handle approvals, but if you want to manually approve the Squid smart contracts to use tokens for a route, you can use the below command that execute the approveRoute method with ApproveRoute object as argument and return a boolean.

const isApproved = await squid.approveRoute({ signer, route })

This will approve amount or infiniteAmount of fromToken required to do the transfer. Once the tokens are approved, you can execute the route.

Checking route approval

You can also check if the route has been approved using the following method that retrieves an object with isApproved and message properties

const { isApproved, message } = await squid.isRouteApproved({ sender, route })

Last updated