Skip to content
LayerHop

LayerHop for developers · Solana swap API

A Solana swap API: swap and bridge between Solana and EVM chains

The LayerHop API swaps and bridges between Solana and EVM chains with the same four calls as any other route. Request GET /v1/quote with srcChain=solana (or dstChain=solana), build it with POST /v1/orders, and the user's Solana wallet signs the returned base64 VersionedTransaction. Solana-source routes are quoted by deBridge and LI.FI, EVM to Solana routes also by Relay, and Jupiter serves same-chain Solana swaps. LayerHop never holds keys and never signs.

Base URL and SDK
https://api.layerhop.com/v1
npm install @layerhop/sdk   # or: pip install layerhop

How to swap SOL to an EVM token with the API

  1. 1

    Quote with Solana as the source

    GET /v1/quote with srcChain=solana, srcToken=SOL (or a mint address), amount in lamports or token base units, the destination chain and token, a Solana sender and an EVM recipient (0x…). For a Solana destination, use a base58 recipient.

  2. 2

    Build the transaction

    POST /v1/orders with the quoteId. For a Solana source the answer is an SvmTx whose serializedTx is a base64 VersionedTransaction, already holding a recent blockhash.

  3. 3

    Sign it in the user's Solana wallet

    Deserialize it, sign it with wallet-adapter, Wallet Standard or an embedded wallet, then send it promptly: blockhashes expire after about a minute. When submitViaApi is true, send the signed bytes to POST /v1/orders/submit instead of an RPC node.

  4. 4

    Report and track

    Otherwise broadcast it yourself and POST /v1/orders/{quoteId}/submitted with the signature. GET /v1/orders/{provider}/{id} (or the SDK's watch) follows it to filled, refunded or failed; webhooks push the same events.

Code

Copy, then replace the addresses and the key.

Quote 2 SOL into USDC on Arbitrum
curl "https://api.layerhop.com/v1/quote?srcChain=solana&srcToken=SOL&amount=2000000000&dstChain=arbitrum&dstToken=USDC&sender=YourSolanaAddress&recipient=0xYourEvmAddress"
# amount is in lamports (9 decimals): 2 SOL = "2000000000".
# best and quotes list the providers that answered; errors lists the ones that could not.
Quote, build and check the transaction type with the TypeScript SDK
import { LayerHop } from "@layerhop/sdk";

const lh = new LayerHop({ apiKey: process.env.LAYERHOP_API_KEY });

const { best } = await lh.quote({
  srcChain: "solana", srcToken: "SOL", amount: "2000000000",   // 2 SOL
  dstChain: "arbitrum", dstToken: "USDC",
  sender: solanaAddress, recipient: evmAddress,
});

const tx = await lh.buildTx(best.quoteId);
if (tx.vm !== "svm") throw new Error("expected a Solana transaction");
// tx.serializedTx is a base64 VersionedTransaction: sign it with the user's Solana wallet.

What works today, and what doesn't

So you know before you build.

Works today

  • Solana to EVM chains (deBridge and LI.FI) and EVM chains to Solana (Relay, deBridge, LI.FI), ranked in one quote call
  • Same-chain Solana swaps through Jupiter, with SOL and SPL tokens addressed by symbol or mint
  • Gas on arrival for routes into an EVM chain, exact-output quotes, signed webhooks and test-mode keys
  • One order flow for both chain families: the transaction type (EvmTx or SvmTx) tells you how to sign

Good to know

  • It never signs or broadcasts: the user's Solana wallet signs, and some providers need the order on chain within about 30 seconds of building
  • Relay does not quote Solana as a source today; Solana-source routes come from deBridge and LI.FI
  • Gas on arrival does not apply to Solana destinations
  • Keep a small SOL buffer on top of the amount for network fees and any token accounts the transaction creates

Questions

Do I need an API key?

Not to try it: requests without a key work under a per-IP rate limit. For production, sign in to the dashboard with a wallet and create a key (lh_live_…, sent in the x-api-key header). A key gets its own rate limit, shows your usage and logs, and lets your orders trigger webhooks. lh_test_ keys give sandbox quotes and simulated orders.

What does it cost?

LayerHop's fee on a trade made through the API channel is 0.10% of the input amount, reported on every quote as fees.ourFeeBps next to the provider's fees and gas. Partners can add their own fee on top.

Does it hold keys or sign transactions?

No. It returns unsigned transactions and your own wallet library (viem, ethers, web3.py, go-ethereum, alloy, a Solana wallet, a KMS) signs and broadcasts them. LayerHop never holds funds or keys.

Which providers route from Solana?

Solana to EVM routes are quoted by deBridge and LI.FI. EVM to Solana routes are quoted by Relay, deBridge and LI.FI, and Jupiter handles swaps within Solana. GET /v1/chains and the quote's errors list show what answers for a given pair.

What are Solana amounts measured in?

Integer strings in the token's base units: 1 SOL is "1000000000" lamports and 100 USDC (6 decimals) is "100000000".