> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerzero.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Stellar SDK

> Use the LayerZero Stellar TypeScript packages to interact with protocol, OFT, and SAC Manager contracts.

LayerZero's Stellar TypeScript bindings are split across three packages:

* `@layerzerolabs/lz-v2-stellar-sdk` provides clients for protocol, worker, and view contracts.
* `@layerzerolabs/oft-stellar-types` provides the standard OFT client and its OApp methods.
* `@layerzerolabs/sac-manager-stellar-types` provides the standard SAC Manager client.

Each generated `Client` extends `ContractClient` from `@stellar/stellar-sdk/contract`, providing typed methods for the corresponding Soroban contract.

> [!WARNING]
>
> Import clients only from the package roots shown below. The `generated/*` deep imports are not public package exports, and the core SDK no longer exports the OFT or SAC Manager clients.

## Installation

```bash wrap theme={null}
npm install @layerzerolabs/lz-v2-stellar-sdk @stellar/stellar-sdk
```

Install the application-specific bindings you use:

```bash wrap theme={null}
npm install @layerzerolabs/oft-stellar-types @layerzerolabs/sac-manager-stellar-types
```

## Client Initialization

All generated clients use the same initialization options, but their import styles differ. The protocol SDK exposes each contract as a namespace, while the OFT and SAC Manager packages export `Client` directly:

```typescript wrap theme={null}
import { Client as OFTClient } from '@layerzerolabs/oft-stellar-types';
import { endpoint } from '@layerzerolabs/lz-v2-stellar-sdk';
import { Keypair, Networks } from '@stellar/stellar-sdk';
import { basicNodeSigner } from '@stellar/stellar-sdk/contract';

const keypair = Keypair.fromSecret('S...');
const clientOptions = {
  networkPassphrase: Networks.TESTNET,
  rpcUrl: 'https://soroban-testnet.stellar.org',
  publicKey: keypair.publicKey(),
  ...basicNodeSigner(keypair, Networks.TESTNET),
};

const endpointClient = new endpoint.Client({
  ...clientOptions,
  contractId: 'C...ENDPOINT_CONTRACT_ID',
});

const oftClient = new OFTClient({
  ...clientOptions,
  contractId: 'C...OFT_CONTRACT_ID',
});
```

All generated clients accept the same `ContractClientOptions`:

| Parameter | Type | Description |
| - | - | - |
| `contractId` | `string` | The deployed Soroban contract address |
| `networkPassphrase` | `string` | Network identifier (`Networks.TESTNET` or `Networks.PUBLIC`) |
| `rpcUrl` | `string` | Stellar Soroban RPC endpoint URL |
| `publicKey` | `string` | Signer's Stellar public key |
| `signTransaction` | `function` | Transaction signing callback |
| `signAuthEntry` | `function` | Authorization entry signing callback |

> [!NOTE]
>
> The `basicNodeSigner(keypair, networkPassphrase)` helper from `@stellar/stellar-sdk/contract` provides both `signTransaction` and `signAuthEntry`. For custom signing flows (e.g., hardware wallets), provide these fields directly.

## Available Clients

| Export | Package | Description |
| - | - | - |
| `endpoint` | `@layerzerolabs/lz-v2-stellar-sdk` | Endpoint V2 messaging, nonce management, library configuration, and compose |
| `uln302` | `@layerzerolabs/lz-v2-stellar-sdk` | ULN-302 configuration, verification, and commit |
| `dvn` | `@layerzerolabs/lz-v2-stellar-sdk` | DVN worker management, verification, and fee calculation |
| `executor` | `@layerzerolabs/lz-v2-stellar-sdk` | Executor worker management, execution, and fee calculation |
| `priceFeed` | `@layerzerolabs/lz-v2-stellar-sdk` | Price data used for fee calculation |
| `layerzeroView` | `@layerzerolabs/lz-v2-stellar-sdk` | Read-only protocol state queries |
| `OFT Client` | `@layerzerolabs/oft-stellar-types` | OFT transfers, quoting, OApp configuration, rate limiting, fees, and pausing |
| `SAC Manager Client` | `@layerzerolabs/sac-manager-stellar-types` | SAC Manager RBAC and Stellar Asset Contract management |

Import protocol clients by their namespace export:

```typescript wrap theme={null}
import { endpoint, uln302 } from '@layerzerolabs/lz-v2-stellar-sdk';

const endpointClient = new endpoint.Client({ ...options });
const uln302Client = new uln302.Client({ ...options });
```

## Core Methods Reference

### OFT Client

The OFT client provides methods for crosschain token transfers and OFT management.

#### Token Operations

| Method | Parameters | Description |
| - | - | - |
| `send` | `from`, `send_param`, `fee`, `refund_address` | Send tokens crosschain |
| `quote_send` | `from`, `send_param`, `pay_in_zro` | Quote the messaging fee for a send |
| `quote_oft` | `from`, `send_param` | Quote OFT token conversion amounts |

#### Configuration

| Method | Parameters | Description |
| - | - | - |
| `set_peer` | `eid`, `peer`, `operator` | Set trusted peer address for a destination chain |
| `set_delegate` | `delegate`, `operator` | Set the delegate address for Endpoint admin operations |
| `set_enforced_options` | `options`, `operator` | Set minimum execution options (array of `EnforcedOptionParam`) |
| `set_msg_inspector` | `inspector`, `operator` | Set the message inspector contract address |

#### Rate Limiting

| Method | Parameters | Description |
| - | - | - |
| `set_rate_limit` | `direction`, `eid`, `config`, `operator` | Configure rate limit for a pathway |
| `rate_limit_config` | `direction`, `eid` | Get rate limit configuration |
| `rate_limit_capacity` | `direction`, `eid` | Get remaining capacity in current window |
| `rate_limit_in_flight` | `direction`, `eid` | Get amount currently in-flight |

#### Fee Management

| Method | Parameters | Description |
| - | - | - |
| `set_default_fee_bps` | `default_fee_bps`, `operator` | Set the default fee rate in basis points |
| `set_fee_bps` | `dst_eid`, `fee_bps`, `operator` | Set a pathway-specific fee rate |
| `set_fee_deposit_address` | `fee_deposit_address`, `operator` | Set the fee recipient address |
| `default_fee_bps` | -- | Get the default fee rate |
| `fee_bps` | `dst_eid` | Get the fee rate for a specific pathway |
| `effective_fee_bps` | `dst_eid` | Get the effective fee (pathway-specific or default) |
| `fee_deposit_address` | -- | Get the current fee recipient |

#### Pause Control

| Method | Parameters | Description |
| - | - | - |
| `pause` | `operator` | Pause the OFT (requires PAUSER\_ROLE) |
| `unpause` | `operator` | Unpause the OFT (requires UNPAUSER\_ROLE) |
| `is_paused` | -- | Check whether the OFT is paused |

#### Ownership

| Method | Parameters | Description |
| - | - | - |
| `transfer_ownership` | `new_owner` | Transfer ownership immediately |
| `begin_ownership_transfer` | `new_owner`, `ttl` | Begin a two-step ownership transfer |
| `accept_ownership` | -- | Accept a pending ownership transfer |
| `renounce_ownership` | -- | Renounce ownership permanently |

#### Queries

| Method | Parameters | Description |
| - | - | - |
| `token` | -- | Get the token contract address |
| `shared_decimals` | -- | Get the shared decimal precision |
| `decimal_conversion_rate` | -- | Get the local-to-shared decimal conversion rate |
| `oft_type` | -- | Get the OFT type |
| `oft_version` | -- | Get the OFT interface version |
| `peer` | `eid` | Get the peer address for a destination chain |
| `enforced_options` | `eid`, `msg_type` | Get enforced options for a pathway |
| `msg_inspector` | -- | Get the message inspector address |

#### TTL Management

| Method | Parameters | Description |
| - | - | - |
| `extend_instance_ttl` | `threshold`, `extend_to` | Extend the contract instance TTL |
| `set_ttl_configs` | `instance`, `persistent` | Set TTL configuration parameters |
| `ttl_configs` | -- | Get current TTL configuration |
| `freeze_ttl_configs` | -- | Freeze TTL configs to prevent further changes |

### Endpoint Client

The Endpoint client provides core LayerZero messaging functionality.

#### Messaging

| Method | Parameters | Description |
| - | - | - |
| `send` | `sender`, `params`, `refund_address` | Send a crosschain message |
| `quote` | `sender`, `params` | Quote the messaging fee |
| `verify` | `receive_lib`, `origin`, `receiver`, `payload_hash` | Verify a received message |
| `lz_receive_alert` | `executor`, `origin`, `receiver`, `guid`, `gas`, `value`, `message`, `extra_data`, `reason` | Alert about lz\_receive execution result |
| `clear` | `caller`, `origin`, `receiver`, `guid`, `message` | Clear a verified message without executing |
| `skip` | `caller`, `receiver`, `src_eid`, `sender`, `nonce` | Skip a message nonce |
| `nilify` | `caller`, `receiver`, `src_eid`, `sender`, `nonce`, `payload_hash` | Nilify a pending message |
| `burn` | `caller`, `receiver`, `src_eid`, `sender`, `nonce`, `payload_hash` | Burn a nilified message |

#### Compose

| Method | Parameters | Description |
| - | - | - |
| `send_compose` | `from`, `to`, `guid`, `index`, `message` | Send a compose message |
| `clear_compose` | `composer`, `from`, `guid`, `index`, `message` | Clear a compose message |
| `lz_compose_alert` | `executor`, `from`, `to`, `guid`, `index`, `gas`, `value`, `message`, `extra_data`, `reason` | Alert about compose execution result |
| `compose_queue` | `from`, `to`, `guid`, `index` | Get compose queue status |

#### Library Management

| Method | Parameters | Description |
| - | - | - |
| `set_send_library` | `caller`, `sender`, `dst_eid`, `new_lib` | Set the send library for a pathway |
| `set_receive_library` | `caller`, `receiver`, `src_eid`, `new_lib`, `grace_period` | Set the receive library for a pathway |
| `set_config` | `caller`, `oapp`, `lib`, `params` | Set library-level configuration |
| `set_delegate` | `oapp`, `new_delegate` | Set the delegate address |
| `get_config` | `oapp`, `lib`, `eid`, `config_type` | Get library-level configuration |

#### Nonce and State

| Method | Parameters | Description |
| - | - | - |
| `outbound_nonce` | `sender`, `dst_eid`, `receiver` | Get the outbound nonce |
| `inbound_nonce` | `receiver`, `src_eid`, `sender` | Get the inbound nonce |
| `next_guid` | `sender`, `dst_eid`, `receiver` | Get the next message GUID |
| `inbound_payload_hash` | `receiver`, `src_eid`, `sender`, `nonce` | Get the inbound payload hash |

#### Library Registration

| Method | Parameters | Description |
| - | - | - |
| `register_library` | `new_lib` | Register a new message library |
| `is_registered_library` | `lib` | Check if a library is registered |
| `get_registered_libraries` | `start`, `max_count` | Get registered libraries (paginated) |
| `default_send_library` | `dst_eid` | Get the default send library |
| `default_receive_library` | `src_eid` | Get the default receive library |
| `get_send_library` | `sender`, `dst_eid` | Get the effective send library for an OApp |
| `get_receive_library` | `receiver`, `src_eid` | Get the effective receive library for an OApp |

### ULN-302 Client

The ULN-302 client configures the Ultra Light Node message verification library.

#### Send Configuration

| Method | Parameters | Description |
| - | - | - |
| `set_default_send_uln_configs` | `params` | Set default send ULN configs (admin) |
| `default_send_uln_config` | `dst_eid` | Get default send ULN config |
| `oapp_send_uln_config` | `sender`, `dst_eid` | Get OApp-specific send ULN config |
| `effective_send_uln_config` | `sender`, `dst_eid` | Get the effective send config (OApp override or default) |

#### Receive Configuration

| Method | Parameters | Description |
| - | - | - |
| `set_default_receive_uln_configs` | `params` | Set default receive ULN configs (admin) |
| `default_receive_uln_config` | `src_eid` | Get default receive ULN config |
| `oapp_receive_uln_config` | `receiver`, `src_eid` | Get OApp-specific receive ULN config |
| `effective_receive_uln_config` | `receiver`, `src_eid` | Get the effective receive config |

#### Executor Configuration

| Method | Parameters | Description |
| - | - | - |
| `set_default_executor_configs` | `params` | Set default executor configs (admin) |
| `default_executor_config` | `dst_eid` | Get default executor config |
| `oapp_executor_config` | `sender`, `dst_eid` | Get OApp-specific executor config |
| `effective_executor_config` | `sender`, `dst_eid` | Get the effective executor config |

#### Verification

| Method | Parameters | Description |
| - | - | - |
| `verify` | `dvn`, `packet_header`, `payload_hash`, `confirmations` | Submit a DVN verification |
| `commit_verification` | `packet_header`, `payload_hash` | Commit a fully verified message |
| `confirmations` | `dvn`, `header_hash`, `payload_hash` | Get the confirmation count for a verification |
| `verifiable` | `packet_header`, `payload_hash` | Check if a message can be committed |

#### Queries

| Method | Parameters | Description |
| - | - | - |
| `set_config` | `oapp`, `params` | Set library-level configuration |
| `get_config` | `eid`, `oapp`, `config_type` | Get library-level configuration |
| `is_supported_eid` | `eid` | Check if an endpoint ID is supported |
| `version` | -- | Get the library version |
| `message_lib_type` | -- | Get the message library type |
| `quote` | `packet`, `options`, `pay_in_zro` | Quote verification fees |
| `send` | `packet`, `options`, `pay_in_zro` | Send a message through the library |

## Next Steps

* [OFT Overview](https://docs.layerzero.network/v2/developers/stellar/oft/overview.md) -- OFT architecture and deployment guide
* [OApp Overview](https://docs.layerzero.network/v2/developers/stellar/oapp/overview.md) -- Base messaging standard
* [DVN/Executor Config](https://docs.layerzero.network/v2/developers/stellar/configuration/dvn-executor-config.md) -- Security stack configuration
* [Technical Overview](https://docs.layerzero.network/v2/developers/stellar/technical-overview.md) -- Stellar architecture fundamentals
