VmId: evm, solana,
alt-vm
(any non-named VM - e.g., Bitcoin, Ripple).
Create a swap transaction
Configure the transaction request
The
recipient should only be different from the sender if you are:- Swapping across VMs that use incompatible key formats or cryptographic curves (e.g.,
EVM <> Solana) - Sending funds to another address
Generate the transaction
Please visit the Get Action API reference for type definitions, including the
ActionRequest and ActionResponse. This API endpoint will return a transaction object we will use to actually execute this transaction.Broadcast on EVM
In this step, we will broadcast the transaction we generated above on Base. This method will work for any EVM chain. View the EVM transaction type here.Import the recommended libraries
This example uses Wagmi; however, you can use your preferred provider. The transaction we’ll generate is compatible with any library.
Broadcast on Solana
Let’s assume we set Solana as the source chain in theactionRequest used to generate our transaction. Let’s see how we can broadcast it on Solana.
View the Solana transaction type here.
Import the recommended libraries
We’ll use
@solana/web3.js, which is the standard SDK for interacting with the Solana blockchain.Broadcast on Alt VMs
Let’s assume we set Bitcoin as the source chain in theactionRequest used to generate our transaction. Let’s see how we can broadcast it on Bitcoin.
View the alt VM transaction type here.
Alt VM transactions are all deposits: the transaction will transfer funds from
the sender to the to field specified in the AltVmTransaction response.
This transfer triggers the swap transaction and funds will ultimately be
delivered to the recipient.
Broadcast on HyperCore
Let’s assume we set HyperCore as the source chain in theactionRequest used to generate our transaction. Let’s see how we can broadcast it on HyperCore.
View the HyperCore transaction type here.