Get the most out of Swaps with our multi-chain development best practices.
/getAction
response includes a vmId
field that informs you which routing strategy will applies to your quote. You can also find this information on the Supported Chains page.
When the vmId
is alt-vm
, please note that you must:
/getPaths
endpoint to validate your destination token andj source token swap amount (reference)./getPaths
endpoint returns all available destinations for a given source token and set of filters. For alternative VMs, there may be minimum or maximum transfer amounts, or only a subset of the total tokens available on a network may be supported. We recommend caching available paths with ~15 minute expiries and checking against it as part of the quoting process to ensure your requests are executable.
For named VMs, it is safe to assume any token in any size is available.
msg.sender
.
Cross-chain transactions are executed from relayer accounts, not directly from the user’s wallet. As a result, a msg.sender
check will fail even if it actually is the authorized wallet address sending the source chain transaction.
msg.sender
checks are typically impractical in a multi-chain context. Instead, we recommend a signature-based approach to authentication.
For example, the Songcamp team wanted users to mint NFTs without metadata and then send a permissioned function to write metadata to the NFT based on certain traits of the user’s wallet address.
To enable cross-chain execution while still authenticating wallets, Songcamp included a hash of the user’s wallet address in the transaction calldata and recovered the singer’s address as follows:
View full contract