Skip to main content

Pay attention to named vs. alt VMs

We classify chains by their execution environment. Our routing and transaction tracking primarily differs based on whether chains in your quote request include named vs. alt VMs. The /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:
  1. Use the /getPaths endpoint to validate your destination token andj source token swap amount (reference).
  2. Register your transaction after broadcasting to initiate tracking (reference).

Cache available paths

The /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.

Manage permissioned functions

Some smart contracts include permissioned functions that resolve based on the wallet address sending the transaction. Often, you will see a check based on the 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