Guides
Solana → EVM swap
Move SOL or USDC from Solana to an EVM chain — sign the base64 VersionedTransaction with a Solana wallet and track the order.
Solana → EVM routes are served by deBridge and LI.FI today. (Relay quotes EVM-source routes only.)
1. Quote#
TypeScript
const { best: quote } = await lh.quote({
srcChain: "solana",
srcToken: "SOL", // native SOL — the wrapped-SOL mint So111…112
amount: "2000000000", // 2 SOL, 9 decimals
dstChain: "arbitrum",
dstToken: "USDC",
sender: solanaAddress,
recipient: evmAddress,
});2. Build and sign#
The source is Solana, so you get an SvmTx with a base64 serialized VersionedTransaction.
TSX
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
import { VersionedTransaction } from "@solana/web3.js";
const { connection } = useConnection();
const { signTransaction } = useWallet();
const tx = await lh.buildTx(quote.quoteId);
if (tx.vm !== "svm") throw new Error("expected a Solana transaction");
const unsigned = VersionedTransaction.deserialize(base64ToBytes(tx.serializedTx));
const signed = await signTransaction!(unsigned);
let signature: string;
if (tx.submitViaApi) {
signature = await lh.submit(quote.quoteId, bytesToBase64(signed.serialize()));
} else {
signature = await connection.sendRawTransaction(signed.serialize(), { maxRetries: 3 });
}
await connection.confirmTransaction(signature, "confirmed");Browser-safe base64 helpers (no Buffer needed):
TypeScript
const base64ToBytes = (b64: string) => Uint8Array.from(atob(b64), (c) => c.charCodeAt(0));
const bytesToBase64 = (bytes: Uint8Array) => btoa(String.fromCharCode(...bytes));Note
The transaction already contains a recent blockhash chosen by the provider. Sign and send it promptly — Solana blockhashes expire after roughly a minute, and deBridge asks for orders to be submitted within about 30 seconds of building.
3. Track#
TypeScript
for await (const s of lh.watch(quote.provider, signature)) console.log(s.state);For deBridge and LI.FI the id is the Solana transaction signature.
Common issues#
- Insufficient SOL for fees and rent. Solana-source swaps need some SOL on top of the amount for the network fee and any token accounts the transaction creates. Keep a small buffer when selling SOL.
Blockhash not found/ expired. Too much time passed between build and send. Build again (re-quote if the quote expired).- Simulation failure in the wallet. Usually a price move beyond
slippageBps. Re-quote.