Skip to main content
Version: Endpoint V2 Docs

LayerZero V2 Solana OFT SDK

You can use the Solana OFT SDK - @layerzerolabs/oft-v2-solana-sdk library to interact with your Solana OFT.

Setting up a project using the LayerZero CLI would have given you scripts under the tasks/solana folder that utilizes the Solana OFT SDK. You can refer to tasks/solana/sendOFT.ts for the example usage.

Using the Solana OFT SDK in the Frontend

The Solana OFT SDK has been updated to be browser-compatible. Versions prior to 3.0.71 required more additional configurations via your bundling tool.

For Next projects, no additional configurations are required to use the Solana OFT SDK.

Requirements

  • @layerzerolabs/oft-v2-solana-sdk@^3.0.71
  • @layerzerolabs/lz-v2-utilities@^3.0.71
  • @layerzerolabs/lz-definitions@^3.0.71
  • @metaplex-foundation/umi@^0.9.2
  • @metaplex-foundation/umi-bundle-defaults@^0.9.2
  • @metaplex-foundation/umi-signer-wallet-adapters@^0.9.2
  • @solana/web3.js@^1.98.0

In package.json add the following resolutions / overrides:

"overrides": {
"@solana/web3.js": "~1.98.0"
}

Compatibility with @solana/web3.js

Under the hood, uses @metaplex-foundation/umi, which is an alternative to @solana/web3.js.

If your project is using @solana/web3.js, you can utilize adapters for @solana/web3.js.

Troubleshooting

Invalid Connection

This can occur when you are using @solana/web3.js v2, which is not compatible with @metaplex-foundation/umi@^0.9.2. Ensure your package.json specifies @solana/web3.js@^1.98.0 and rerun your package manager install command.