Deposit liquidity
Provide liquidity to an Aquarius pool with the official SDK — discover the pool, deposit with a simulation-derived guard, and read the minted shares.
Deposit tokens into a pool and receive pool share tokens in return. The SDK discovers the pool, orders the tokens, derives the minted-shares guard from a simulation of your exact deposit, and returns what actually happened on-chain.
1. Set up the client
The account needs a balance of every token it deposits. Everything below works identically on testnet with network="testnet" and the testnet AQUA issuer.
from stellar_sdk import Keypair
from aquarius import AquariusClient, Asset, XLM
AQUA = Asset.classic("AQUA", "GBNZILSTVQZ4R7IKQDGHYGY2QXL5QOFJYQMXPKWRRM5PAV7Y4M67AQUA")
aqua = AquariusClient(network="mainnet", signer=Keypair.from_secret("S..."))import { Keypair } from "@stellar/stellar-sdk";
import { AquariusClient, Asset, XLM } from "@aquariusdefi/sdk";
const AQUA = Asset.classic("AQUA", "GBNZILSTVQZ4R7IKQDGHYGY2QXL5QOFJYQMXPKWRRM5PAV7Y4M67AQUA");
const aqua = new AquariusClient({ network: "mainnet", signer: Keypair.fromSecret("S...") });2. Find the pool
A pair can have several pools — different types and fee tiers. pools_for_pair returns all of them, sorted by type and fee:
pools = aqua.pools_for_pair(XLM, AQUA)
# [Pool(type='volatile', fee_bps=10, ...), Pool(type='volatile', fee_bps=30, ...), ...]
pool = next(p for p in pools if p.type == "volatile" and p.fee_bps == 30)const pools = await aqua.pools.forPair(XLM, AQUA);
// [Pool { type: 'volatile', feeBps: 10, ... }, Pool { type: 'volatile', feeBps: 30, ... }, ...]
const pool = pools.find(p => p.type === "volatile" && p.feeBps === 30);3. Deposit
Amounts are keyed by asset, in base units (stroops); the SDK handles the contract's token ordering. Volatile pools take the two tokens at the current reserve ratio — anything beyond that ratio stays in your account:
The slippage guard works like a swap's: the SDK simulates your exact deposit, takes the estimated shares, and submits with a minimum reduced by slippage (default 1%). If pool state moves past that guard between simulation and inclusion, the transaction fails with a SlippageError instead of minting fewer shares than you saw.
Next steps
Withdraw liquidity — burn the shares for the underlying tokens.
Claim LP rewards — collect the AQUA the position accrues.
Get pools info — reserves, share totals, and positions, no signer required.
Last updated