Skip to main content
The LayerZero IOTA L1 OFT SDK provides TypeScript utilities for interacting with OFT contracts on the IOTA L1 blockchain, enabling seamless crosschain token transfers.

Installation

Install both the core IOTA SDK and the OFT-specific SDK:
Or with yarn:

Setup

Initialize the SDKs

The recommended pattern uses automatic address fetching from the protocol SDK:
Critical Notes:
  • First parameter: Use your OFT package ID (where your code is deployed)
  • SDK automatic addresses: No need to hardcode LayerZero protocol addresses
  • Optional parameters: Can be undefined initially and set later
  • After initialization: Update oft.oftObjectId = newObjectId
Getting OApp Instance (for peer/DVN configuration):
Do NOT manually instantiate new OApp(...) - this will fail to find your OApp in the registry. Always use sdk.getOApp(packageId).

SDK Architecture

The IOTA OFT SDK consists of two complementary SDKs:

Base SDK (@layerzerolabs/lz-iotal1-sdk-v2)

Provides core LayerZero protocol functionality:
  • OApp operations: Peer configuration, messaging, registration
  • Endpoint interaction: Channel initialization, library configuration
  • DVN/Executor configuration: Security stack setup
  • Protocol address exports: All deployed contract addresses
When to use: For OApp configuration, peer setup, DVN configuration, and general protocol interactions.

OFT SDK (@layerzerolabs/lz-iotal1-oft-sdk-v2)

Extends the base SDK with OFT-specific functionality:
  • OFT initialization: initOftMoveCall(), initOftAdapterMoveCall()
  • Registration: registerOAppMoveCall() (auto-generates lz_receive_info)
  • Rate limiting: Per-pathway token flow limits
  • Fee management: Crosschain fee configuration
  • Pause control: Emergency pause functionality
When to use: For OFT deployment, token-specific operations, and OFT lifecycle management.

Relationship

SDK Address Exports

The SDK provides address exports for all protocol contracts, eliminating hardcoded values:
Benefits:
  • Network switching: Toggle between mainnet/testnet via Stage enum
  • SDK updates: Address changes handled automatically
  • No magic numbers: Self-documenting configuration
  • Type safety: TypeScript ensures correct usage
Available exports:

Complete Working Example

Reference Implementation

All examples on this page are based on proven mainnet deployments. The complete reference implementation demonstrating these patterns is available in the LayerZero test repository at test-repo/iota-oft-complete/deploy_with_oft_sdk.mjs.
Based on proven mainnet deployment:
Key SDK Methods Used:
  • oft.initOftMoveCall() - Initialize OFT with treasury
  • oft.registerOAppMoveCall() - Register and auto-generate lz_receive_info
  • sdk.getOApp() - Get OApp instance for configuration
  • oapp.setPeerMoveCall() - Configure peer addresses
  • oapp.setConfigMoveCall() - Configure DVNs/executors

Available SDK Methods

Base SDK (OApp Operations)

The base SDK provides methods for OApp configuration through sdk.getOApp(packageId):

OFT SDK Methods

The OFT SDK provides token-specific operations:

Core Methods

quote()

Get a fee quote for sending tokens crosschain:

send()

Send tokens crosschain:

getOFTConfig()

Read OFT configuration:

getPeer()

Get peer OFT address for a specific chain:

Building Execution Options

Use the Options helper from the core SDK:

Gas Limits by Destination

msg.value Considerations

When sending to IOTA, you may need to include msg.value for:
  • Creating a new coin object for the recipient
  • Storage rent for the new object
Calculate rent based on object size (typically ~0.002 IOTA).

Complete Example

Sending Tokens from IOTA to Ethereum

Reading Token Balances

Check OFT token balances using the IOTA client:

Integration with Core SDK

The OFT SDK builds on the core IOTA SDK:

Error Handling

Common errors and how to handle them:

Admin Functions

The SDK provides admin functions for OFT management (requires AdminCap):

Pause/Unpause

Fee Configuration

Rate Limiting

Peer Configuration

Best Practices

  1. Always Quote First: Get fee estimates before sending
  2. Set Slippage: Use minAmountLD to protect against dust/precision loss
  3. Check Balances: Verify sufficient tokens and IOTA for gas
  4. Use TypeScript: Leverage type safety for parameter validation
  5. Test on Testnet: Always test on testnet before mainnet deployments
  6. Monitor Rate Limits: Configure appropriate limits for production
  7. Secure Admin Cap: Use multisig or hardware wallet for admin operations

Next Steps