For the complete documentation index, see llms.txt. This page is also available as Markdown.

Prerequisites & basics

Dependencies, commonly used URLs, contract addresses and useful methods

The official SDKs bundle the constants and helpers on this page — integrations in Python or JavaScript can start from the Quickstart instead. This page serves integrations that call the API and contracts directly.

Prerequisites

Before executing scripts, ensure you have Stellar SDK installed:

  • Python 3.10+: The script is written in Python and requires Python version 3.10 or higher (required by current stellar-sdk releases).

  • Stellar SDK: Install via pip:

pip install stellar-sdk
  • Node 24: Run the JavaScript examples with Node version 24.

  • Stellar SDK (v15 or newer — the same major version the Aquarius app runs on): Install via npm or yarn.

npm install @stellar/stellar-sdk

or

yarn add @stellar/stellar-sdk

Constants

Below are some API endpoints and contract addresses that will be used in other code examples.

For mainnet

# The contract ID of the Aquarius AMM contract
router_contract_id = "CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK"
# Soroban RPC server address
soroban_rpc_server = "https://mainnet.sorobanrpc.com"
# Horizon server address
horizon_server = "https://horizon.stellar.org"
# Aquarius backend API URL
base_api = "https://amm-api.aqua.network/api/external/v2"
// The contract ID of the Aquarius AMM contract
const routerContractId = "CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK";
// Soroban RPC server address
const sorobanRpcServer = "https://mainnet.sorobanrpc.com";
// Horizon server address
const horizonServer = "https://horizon.stellar.org";
// Aquarius backend API URL
const baseApi = "https://amm-api.aqua.network/api/external/v2";

For testnet

API versions: use v2. Version v1 remains available and is identical except for one endpoint — v2's find-path-strict-receive correctly accounts for provider fees in the required input amount. No API key is currently required.

Transaction fees

The fee passed to TransactionBuilder is your inclusion-fee bid in stroops — the resource fees for Soroban execution are calculated during simulation and added automatically by prepare_transaction / prepareTransaction. Any bid at or above the network minimum (100 stroops) is accepted; the examples use higher values, which helps transactions get included during network surge pricing without changing what you pay in quiet conditions.

Helper functions

Common utility methods that will be used in other code examples.

Get asset contract ID

To interact with any Soroban assets, you need their smart contract address.

This code snippet demonstrates how to retrieve the contract address of an asset on the Stellar network. The code uses the PUBLIC network by default, but you can switch to the desired network (for example, TESTNET).

Get pool contract ID and pool hash

To interact with an Aquarius pool (for example, make deposits or direct swaps), you need the address of the pool contract.

One option to find the pool address is to refer to the pool page on Aquarius website, please see below:

Example of pool contract address, click to copy.

To retrieve this information programmatically, see Get pools info.

Order tokens IDs

Most of the time, if an array of token IDs needs to be passed as arguments in a contract call, they should be sorted.

Data conversion utilities

Here are methods and code snippets for converting data between basic types and ScVal (Smart Contract Value).

Last updated