Prerequisites & Basics

Dependencies, commonly used URLs, contract addresses and useful methods

Prerequisites

Before executing scripts, ensure you have Stellar SDK installed:

  • Python 3.7+: The script is written in Python and requires Python version 3.7 or higher.

  • Stellar SDK: Install via pip:

pip install 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/v1"

For Testnet

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 (e.g. TESTNET).

Get Pool Contract ID and Pool Hash

To interact with an Aquarius pool (e.g. 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.

In order to receive this information programmatically, please refer to detailed description in the "Get Pools Info" section.

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