Types & Constants
This page collects the configuration types, network constants, and re-exported contract types the SDK surfaces. Contract and provider addresses change between networks — the Deployed Contracts page is the canonical source; the values below are the SDK's built-in convenience constants.
Configuration types
RPCcluster
Selects the network. Every service is scoped to one cluster.
type RPCcluster = 'devnet' | 'testnet' | 'public'AlulaClientConfig
interface AlulaClientConfig {
publicKey?: string // connected wallet address
marketContractId?: string // market contract for the target network
opts: AlulaClientOptions
}
type AlulaClientOptions = {
rpc: RPCcluster
horizonRpcUrl?: string // override the default Horizon endpoint
sorobanRpcUrl?: string // override the default Soroban RPC endpoint
}When the RPC URLs are omitted, the SDK falls back to the built-in endpoints for the selected cluster.
Network constants
Exported from the package for convenience.
RPC endpoints
| Constant | Value |
|---|---|
TESTNET_RPC_URL | https://horizon-testnet.stellar.org |
PUBLIC_RPC_URL | https://horizon.stellar.org |
SOROBAN_TESTNET_RPC_URL | https://soroban-testnet.stellar.org |
SOROBAN_PUBLIC_RPC_URL | https://rpc.alula.finance |
RPC_URLS and SOROBAN_RPC_URLS map each cluster name to its Horizon and Soroban endpoint respectively.
Market contract IDs
| Network | Constant |
|---|---|
| Testnet | TESTNET_MARKET_CONTRACT_ID |
| Public | PUBLIC_MARKET_CONTRACT_ID |
CONTRACT_ID maps each cluster name to its market contract address. Always confirm the current address against Deployed Contracts.
Swap providers
SOROSWAP_PROVIDER_ADDRESS and AQUA_PROVIDER_ADDRESS map each cluster to its provider contract address, and SWAP_PROVIDERS groups both by name. BRIDGE_TOKEN_ADDRESSES lists the intermediate tokens used when quoting routes for pairs without a direct pool.
Other
| Constant | Meaning |
|---|---|
MAX_I128 | The maximum i128 value, used by the withBuffer "max out" pattern |
DEFAULT_ORACLE_DECIMALS | Oracle price precision fallback (14) when a contract is not supplied |
Utilities
Exported helpers for converting between human-readable and on-chain amounts:
import { amountToBigInt, bigintToNumber, bpsToNumber, getErrorMessage } from '@alula/client-sdk'
amountToBigInt('100', 7) // 1000000000n
bigintToNumber(1000000000n, 7) // '100'
bpsToNumber(150) // 0.015
getErrorMessage(err) // human-readable message for a contract errorRe-exported contract types
The SDK surfaces these types from @alula/market-sdk. See Data Types and Request & Response Types for full field definitions.
| Type | Used by |
|---|---|
ObligationKey | Every user-scoped operation |
Obligation | getUserObligation |
Pool | Market read methods |
PoolData | Multiply previews |
WithdrawResult | simulateWithdraw |
Request | Batched multiply and swap operations |