Prerequisites & basics
Dependencies, commonly used URLs, contract addresses and useful methods
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-sdkNode 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-sdkor
yarn add @stellar/stellar-sdkConstants
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
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:

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