Skip to content

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.

typescript
type RPCcluster = 'devnet' | 'testnet' | 'public'

AlulaClientConfig ​

typescript
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 ​

ConstantValue
TESTNET_RPC_URLhttps://horizon-testnet.stellar.org
PUBLIC_RPC_URLhttps://horizon.stellar.org
SOROBAN_TESTNET_RPC_URLhttps://soroban-testnet.stellar.org
SOROBAN_PUBLIC_RPC_URLhttps://rpc.alula.finance

RPC_URLS and SOROBAN_RPC_URLS map each cluster name to its Horizon and Soroban endpoint respectively.

Market contract IDs ​

NetworkConstant
TestnetTESTNET_MARKET_CONTRACT_ID
PublicPUBLIC_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 ​

ConstantMeaning
MAX_I128The maximum i128 value, used by the withBuffer "max out" pattern
DEFAULT_ORACLE_DECIMALSOracle price precision fallback (14) when a contract is not supplied

Utilities ​

Exported helpers for converting between human-readable and on-chain amounts:

typescript
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 error

Re-exported contract types ​

The SDK surfaces these types from @alula/market-sdk. See Data Types and Request & Response Types for full field definitions.

TypeUsed by
ObligationKeyEvery user-scoped operation
ObligationgetUserObligation
PoolMarket read methods
PoolDataMultiply previews
WithdrawResultsimulateWithdraw
RequestBatched multiply and swap operations