Prerequisites
- Node.js 18+
- An API key from LayerZero
- A funded Solana wallet with the token you want to transfer
Installation
- pnpm
- npm
- yarn
Environment setup
Create a.env file in your project root:
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:
- TypeScript
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:
- TypeScript
Build and execute user steps
For Solana transfers, call User steps response:
/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:- TypeScript
Execute the transaction
Deserialize, sign, and submit the transaction using Solana Web3.js:- TypeScript
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.Track transfer status
Poll the status endpoint until the transfer completes. The API returns the current status and explorer link.Status values:
- TypeScript
| Status | Description |
|---|---|
PENDING | Transfer initiated, waiting for confirmation |
PROCESSING | Transfer in progress across chains |
SUCCEEDED | Transfer completed successfully |
FAILED | Transfer failed |
UNKNOWN | Status cannot be determined |
Complete example
Key differences from EVM
| Aspect | EVM | Solana |
|---|---|---|
| Transaction format | JSON with to, data, value | Base64-encoded versioned transaction |
| User steps | Included in quote response | Requires /build-user-steps call |
| Signing | EIP-191 or EIP-712 | Ed25519 |
| Confirmation | waitForTransactionReceipt | confirmTransaction with blockhash |
Next steps
- EVM Example — Transfer tokens between EVM chains
- API Reference — Explore all endpoints