Skip to content
LayerHop

Cross-chain swaps for your product, without running a bridge.

One API in front of Jupiter, Relay, deBridge, 0x, KyberSwap, LI.FI and Across, across 71 chains. Your users sign from their own wallets, and you get typed responses, stable error codes and signed webhooks. Taking payments? Checkout settles USDC or USDT straight to your wallet.

Everything here is live (deposit addresses and destination calls are in beta). The SDKs install from npm, PyPI, crates.io and pkg.go.dev, with Swift, Kotlin and C# setup in the docs. Try any endpoint in the API playground.

Dashboard and API keys

Sign in with an EVM or Solana wallet. No email, no password. Create keys, then watch usage, request logs and orders as they come in.

  • API keys you can create, name and revoke
  • Usage charts, request logs and payment analytics
  • Orders with live status
  • Webhook endpoints, test sends and replays
  • Partner profile, earnings, payouts and CSV statements
  • Payment links, invoices, subscriptions and refunds
  • Deposit addresses with QR codes and recent deposits
  • Test mode switch with lh_test_ keys
  • Wallet sign-in for EVM and Solana

Quotes work without a key. API requests carry a 0.10% LayerHop fee, shown on every quote.

Open the dashboard (opens in a new tab)

SDKs

Typed clients for TypeScript, React, React Native, Python, Go, Rust, Swift, Kotlin and C#, plus a CLI. Each one quotes, builds the unsigned transaction and watches the order. None of them ever touch keys.

import { LayerHop } from "@layerhop/sdk";

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

const { best } = await lh.quote({
  srcChain: "base", srcToken: "USDC", amount: "100000000",
  dstChain: "solana", dstToken: "SOL", sender, recipient,
});
const tx = await lh.buildTx(best.quoteId); // your user signs it
Install
npm install @layerhop/sdk        # TypeScript
npm install @layerhop/react      # React hooks
npx expo install @layerhop/react-native react-native-webview   # React Native / Expo
pip install layerhop             # Python
go get github.com/layerhop/layerhop-go   # Go
cargo add layerhop               # Rust
npm install -g @layerhop/cli     # layerhop quote …

Swift, Kotlin and C#: async clients with typed models and webhook verification. Install steps are in each guide. React Native & Expo guide

TypeScript quickstart

Quote, build the transaction, have the user sign it, then watch the order until it's final. Works in Node and the browser.

import { LayerHop, LayerHopApiError } from "@layerhop/sdk";

const lh = new LayerHop({ baseUrl: "https://api.layerhop.com" });

try {
  // 100 USDC on Base to SOL on Solana. Amounts are integer strings in base units.
  const { best, quotes, errors } = await lh.quote({
    srcChain: "base", srcToken: "USDC", amount: "100000000",
    dstChain: "solana", dstToken: "SOL",
    sender: "0xYourEvmAddress", recipient: "YourSolanaAddress",
    slippageBps: 50,
  });
  console.log(best.provider, best.dstAmount, best.fees.ourFeeBps);

  // EVM: { vm: "evm", to, data, value, approval? }. Solana: { vm: "svm", serializedTx }.
  const tx = await lh.buildTx(best.quoteId);
  const srcTxHash = await signAndSend(tx); // your wallet code

  for await (const status of lh.watch(best.provider, srcTxHash)) {
    console.log(status.state); // pending, filled, refunded or failed
  }
} catch (e) {
  if (e instanceof LayerHopApiError) console.error(e.code, e.message);
}

Wallets

Turn a quote into a confirmed transaction in any wallet stack. @layerhop/wagmi covers EVM chains through wagmi or a viem wallet client, and @layerhop/solana covers Solana wallets. Neither holds keys.

import { useExecuteQuote, useLayerHopQuote } from "@layerhop/wagmi";

const quote = useLayerHopQuote(params);
const exec = useExecuteQuote();

// EIP-5792 wallets: approve + swap in one confirmation. Others: sequential.
exec.execute({ quote: quote.data.best });
  • EIP-5792: approve, swap and extra calls in one confirmation
  • Sequential fallback for wallets that can't batch
  • Approvals only when the allowance is short, never unlimited
  • @layerhop/solana: wallet adapter, Wallet Standard and embedded wallets
  • Reports the hash so order tracking and webhooks work
  • Test keys never reach the wallet

Wallets guide · snippets for wagmi and Reown AppKit, Privy, Dynamic, thirdweb and Coinbase Smart Wallet

REST API

Prefer plain HTTP? Every SDK call maps to a versioned endpoint under /v1. Failed requests return an error code and a request id.

curl "https://api.layerhop.com/v1/quote\
?srcChain=base&srcToken=USDC&amount=100000000\
&dstChain=solana&dstToken=SOL\
&sender=0xYourEvmAddress&recipient=YourSolanaAddress\
&slippageBps=50"

# { "best": { "quoteId", "provider", "dstAmount", "dstAmountMin",
#             "estimatedSeconds", "fees": { "ourFeeBps", ... }, "expiresAt" },
#   "quotes": [ ... every route that answered ... ],
#   "errors": [ ... routes that couldn't quote, with a code ... ] }

API reference · Status page · Fee index data (JSON, CSV)

Test mode and playground

Build and test your whole integration without real funds. A test key (lh_test_…) gets sandbox quotes priced from live prices and placeholder transactions that can't move funds; reported orders fill in about 10 seconds and send test webhooks.

export LAYERHOP_API_KEY=lh_test_…   # from the dashboard, with Test mode on

curl -H "x-api-key: $LAYERHOP_API_KEY" "https://api.layerhop.com/v1/quote\
?srcChain=base&srcToken=USDC&amount=100004001\
&dstChain=solana&dstToken=SOL&sender=0x…&recipient=…"
# → provider "sandbox", quoteId "q_test_…"; this amount ends in 4001, so the order will refund
  • Same API and SDKs: only the key changes
  • Amounts ending in 4001 refund, 4002 fail, 4004 have no route
  • Test webhooks go to test endpoints only
  • Never counts towards volume or partner earnings

API playground · Test mode guide

Local development and CI

Build and test offline with no account, key or funds. layerhop dev runs a mock API with the same JSON shapes as api.layerhop.com, so the SDKs, the CLI and your own HTTP code work against it unchanged.

npx @layerhop/cli dev --webhook-url http://localhost:3000/webhooks
# LayerHop mock API on http://127.0.0.1:8787

export LAYERHOP_API_URL=http://127.0.0.1:8787   # the SDKs and CLI use it unchanged
  • Quote, build, report and status with fixed prices
  • Amounts ending in 4001 refund, 4002 fail, 4004 have no route
  • Signed order.* webhooks to your local URL
  • Optional Anvil forks of EVM chains with --fork
  • setup-layerhop GitHub Action starts it in CI
  • Postman collection, also for Insomnia and Bruno

Local development guide · Postman collection

Deposit addresses

Let users swap or bridge just by sending tokens to an address, from any wallet or exchange. No wallet connection or signing in your app. Fits exchanges, games, payroll and “deposit from any chain” buttons.

const da = await lh.depositAddresses.create({
  srcChain: "base", srcToken: "USDC",
  dstChain: "arbitrum", dstToken: "USDC",
  recipient: "0xUserAddressOnArbitrum",
  refundTo: "0xUserAddressOnBase",   // never an exchange deposit address
  label: "user-4821",
});

showToUser(da.address); // send USDC on Base here, from any wallet or exchange
// Each deposit becomes an order: order.submitted, then order.filled.
  • Reusable per user (any amount, same route) or one-time for an exact amount
  • Refunds go to your user's refundTo address
  • Non-custodial: the address belongs to the liquidity provider
  • Usual order.* webhooks, matched by depositAddressId
  • TypeScript SDK, CLI (layerhop deposit-address) and MCP tools
  • A dashboard page with QR codes and recent deposits

Beta: works with every test key today, and live mode is available on request. The API channel fee applies, plus your partner fee.

Deposit address guide

Gas on arrival and Hyperliquid

Deliver a little native gas with a cross-chain swap to an EVM chain, so the recipient can transact right away. Or set Hyperliquid as the destination to fund a perps account from an EVM chain.

const { best } = await lh.quote({
  srcChain: "base", srcToken: "USDC", amount: "20000000", // 20 USDC
  dstChain: "arbitrum", dstToken: "USDC",
  sender: address, recipient: address,
  gasOnArrival: true,               // $2 of ETH on Arbitrum, or a USD amount from 0.5 to 20
});

// Hyperliquid: USDC lands in the recipient's perps balance
await lh.quote({ ...params, dstChain: "hyperliquid", dstToken: "USDC" });
  • $2 of native gas by default, or $0.50 to $20
  • Cross-chain routes to EVM chains whose output isn't the native coin
  • Paid out of the swap; the quote shows what was added
  • A “Get gas on arrival” switch in the swap app and widget
  • Hyperliquid (id 1337) as a destination: USDC in the perps balance
  • Fund Hyperliquid with a swap or a deposit address

Gas on arrival guide · Deposit to Hyperliquid

Destination calls (beta)

Bridge, then run contract calls on the destination chain with the output, in the same user action: supply to Aave, buy an item or top up a contract. The user signs once on the source chain.

curl -X POST "https://api.layerhop.com/v1/quote" \
  -H "content-type: application/json" -H "x-api-key: $LAYERHOP_KEY" \
  -d '{
    "srcChain": "base", "srcToken": "USDC",
    "dstChain": "arbitrum", "dstToken": "USDC", "dstAmount": "10000000",
    "sender": "0xYourUser", "recipient": "0xYourUser",
    "action": { "type": "aave-v3-supply" }
  }'
# → a quote with srcAmount and calls.simulation; the user signs once on Base
  • Every call simulated against mainnet state before you get a quote
  • A call that would revert fails with CALLS_REVERTED, naming the call
  • Raw calls or presets such as aave-v3-supply
  • 1 to 8 calls on EVM destinations, cross-chain
  • If a call reverts at fill time, the sender is refunded
  • Calls that move someone else's assets are blocked

Beta: test keys work today, and live mode is being switched on. Read the trust model in the guide before you design a target contract.

Destination calls guide

Checkout: pay with any token

Get paid in USDC or USDT while your customer pays with any token on any chain. Create a session, send the customer to the hosted page, and fulfil when the checkout.session.completed webhook arrives.

import { LayerHop } from "@layerhop/sdk";

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

const session = await lh.checkout.create({
  amount: "49000000",            // 49 USDC
  settleChain: "base",
  settleToken: "USDC",
  recipient: "0xYourPayoutAddress",
  description: "Pro plan, 1 month",
  reference: "order_1042",
  successUrl: "https://shop.example.com/thanks",
});

redirect(session.url); // https://layerhop.com/pay/cs_…
// Fulfil order_1042 on the checkout.session.completed webhook.
  • USDC or USDT on Ethereum, Arbitrum, Base, Optimism, BNB Chain, Polygon or Solana
  • Your payout address is fixed by the session; the payer can't change it
  • Paid only after the delivery is verified on chain
  • Same token on the same chain is a direct transfer: 0.25% LayerHop fee on top, you receive the full amount
  • Invoices by email, paid on a hosted page, with PDF receipts
  • Full or partial refunds, signed from your own wallet

Payments overview and fees · Invoices guide · Refunds guide · Payment analytics

Subscriptions

Recurring billing in USDC or USDT, every day, week, month or year. A wallet can't be charged automatically, so LayerHop emails an invoice each period and your customer pays it with any token on any chain.

const sub = await lh.subscriptions.create({
  customerEmail: "ada@example.com",
  amount: "49000000", // 49 USDC per month
  settleChain: "base",
  settleToken: "USDC",
  recipient: "0xYourPayoutAddress",
  interval: "month",
});
// An invoice is emailed every period; unpaid ones get reminders.
  • Any interval: daily, weekly, monthly, yearly or every n of them
  • Reminders 1 and 3 days after the due date, canceled after 7
  • Pause, resume, or cancel now or at period end
  • subscription.created, renewed, past_due and canceled webhooks
  • Bill a product you already defined with its productId
  • Managed under Payments → Subscriptions in the dashboard

Subscriptions guide

Accept payments on your site

Keep customers on your page: open checkout in a modal or render it inline, with a no-code button, one JavaScript call or a React component. Wallets connect inside the checkout, and it never redirects your page.

Payment button: one script tag, no code
<script src="https://layerhop.com/checkout.js" async></script>

<button data-layerhop-product="prod_…">Pay with crypto</button>
JavaScript: open the checkout from your own button
// sessionId from your server (lh.checkout.create), or productId: "prod_…"
LayerHopCheckout.open({
  sessionId,
  onPaid: (session) => showReceipt(session.id),
});
React: inline checkout from @layerhop/widget
import { LayerHopCheckout } from "@layerhop/widget/react";

<LayerHopCheckout
  productId="prod_…"
  reference="order_1042"
  onPaid={(session) => router.push(`/thanks?session=${session.id}`)}
/>
  • Products give you a fixed price and a /buy link, no server needed
  • Modal on desktop, full-height sheet on phones
  • Your page gets paid, cancel and status events
  • Fulfil on the checkout.session.completed webhook as usual

Payment buttons guide · Embedded checkout guide · WordPress & WooCommerce plugin (download · GitHub)

Webhooks

Add an HTTPS endpoint in the dashboard and get a signed POST for every order and payment change. Failed deliveries retry for up to 24 hours, and you can replay or resend any of them.

Events

Verify the signature
import { verifyWebhookSignature } from "@layerhop/shared";

app.post("/layerhop/webhook", async (c) => {
  const raw = await c.req.text(); // the raw body, before JSON.parse
  const ok = await verifyWebhookSignature(secret, c.req.header("LayerHop-Signature"), raw);
  if (!ok) return c.text("bad signature", 400);
  const event = JSON.parse(raw); // order.submitted | order.filled | order.refunded | order.failed
  // deduplicate on event.id: retries resend the same id
  return c.text("ok");
});
Develop locally: no tunnel, no public URL
export LAYERHOP_API_KEY=lh_test_…
npx @layerhop/cli listen --forward-to http://localhost:3000/webhooks

# in another terminal
npx @layerhop/cli trigger order.filled
  • Send a realistic sample of any event type
  • Rotate secrets with a grace period, zero downtime
  • Every delivery's request, response and latency
  • Event log with resend, and endpoint health

Webhook guide

Live order status

Show users exactly where their swap or payment is, without polling. One request streams the order now and every change until it's final, over standard Server-Sent Events.

await lh.reportSubmitted(quoteId, txHash);

for await (const order of lh.streamOrder(quoteId)) {
  render(order.status); // submitted → pending → filled, the moment each happens
}

Live status guide · works with EventSource, curl and the useOrderStream React hook

AI agents

The LayerHop MCP server lets Claude, ChatGPT, Cursor and other agents list chains and tokens, quote with every fee spelled out and hand back a prefilled swap link. Building your own agent? The same tools come as packages for the major agent frameworks. Nothing holds keys: tools return quotes and unsigned transactions for a wallet you control.

MCP server
# Claude Code, hosted server (nothing to install)
claude mcp add --transport http layerhop https://mcp.layerhop.com/mcp

# Any stdio client: Claude Desktop, Cursor, …
npx -y @layerhop/mcp
Agent frameworks: Vercel AI SDK shown
import { generateText, stepCountIs } from "ai";
import { createVercelTools, AGENT_INSTRUCTIONS } from "@layerhop/ai/vercel";

const { text } = await generateText({
  model,
  system: AGENT_INSTRUCTIONS,
  tools: createVercelTools({ integrator: "myapp" }), // quotes and unsigned transactions only
  stopWhen: stepCountIs(5),
  prompt: "Quote 100 USDC on Base to SOL for 0x… / 9WzD…",
});
  • Vercel AI SDK@layerhop/ai
  • LangChain / LangGraph@layerhop/ai
  • OpenAI Agents SDK@layerhop/ai
  • ElizaOS@layerhop/plugin-elizaos
  • Coinbase AgentKit@layerhop/agentkit
  • GOAT@layerhop/goat

Agent frameworks guide · MCP setup guide · Docs for LLMs: llms.txt

Partner program

Earn your own fee on top of LayerHop's 0.15% on every swap you send through the widget, deep links or the API. It is included in the fees users see before they sign and named in the fee details, and payouts go to your wallet. Partners go live at once with a cap of 0.50% to start.

  1. 1. Go live at once. Apply in the dashboard with a partner id and your EVM or Solana payout address. Your profile is active straight away, so set your fee and start earning.
  2. 2. Send swaps. Pass integrator on the widget, deep links or SDK, use your partner API key server-side to set a fee per request, or link your partner id in the Telegram bot and share your invite link.
  3. 3. Get paid. The dashboard shows per token what you earned, what was paid and what is owed, every payout with its transaction hash, and a CSV statement to download.
Quote, as your user sees itintegrator=myapp
Fees
One total, before signing
LayerHop fee
0.15%
Partner fee (myapp)
Your rate
Provider fees, gas
When reported

Your share is recorded on every swap and paid out to your wallet.

https://layerhop.com/embed?dstChain=base&dstToken=USDC&integrator=myapp