Skip to main content
This example demonstrates a complete cross-chain transfer from Solana to Arbitrum using TypeScript and the Solana Web3.js library.

Prerequisites

  • Node.js 18+
  • An API key from LayerZero
  • A funded Solana wallet with the token you want to transfer

Installation

Environment setup

Create a .env file in your project root:

1

Validate transfer path

Before requesting a quote, verify that the destination token is reachable from your source token.Query the tokens endpoint with filters to check if your destination exists in the list of transferrable tokens:
Why validate first? Validating the transfer path before requesting quotes prevents unnecessary API calls and provides immediate feedback if a route doesn’t exist.
2

Get quotes

Request a quote for your cross-chain transfer. The API returns available routes with fees, estimated duration, and quote ID.
Quote response structure:
3

Build and execute user steps

For Solana transfers, call /build-user-steps to get fresh transaction data, then sign and submit the transaction.

Build user steps

Solana transactions have short blockhash validity, so you must generate transaction data immediately before signing:
User steps response:

Execute the transaction

Deserialize, sign, and submit the transaction using Solana Web3.js:
Solana requires build-user-steps: Unlike EVM chains where userSteps are included in the quote response, Solana requires calling /build-user-steps to generate fresh transaction data with a valid blockhash.
4

Track transfer status

Poll the status endpoint until the transfer completes. The API returns the current status and explorer link.
Status values:

Complete example

Key differences from EVM

Next steps