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:
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:
- TypeScript
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:
- TypeScript
3
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.4
Track transfer status
Poll the status endpoint until the transfer completes. The API returns the current status and explorer link.Status values:
- TypeScript
Complete example
Key differences from EVM
Next steps
- EVM Example — Transfer tokens between EVM chains
- API Reference — Explore all endpoints