How It Works
When you withdraw liquidity, collect fees, or rebalance positions, you can retain the funds in a pool-level free balance instead of receiving a Spark transfer. These retained funds can then fund future operations like adding liquidity, all without leaving the pool.Benefits
- Reduced latency: No waiting for Spark transfer confirmations when redeploying capital
- Lower overhead: Eliminates transfer fees for funds that stay in the pool
- Atomic availability: Retained funds are immediately usable for the next operation
- Simplified workflows: Compound fees or rebalance without capital leaving the system
Retaining Funds
On Decrease Liquidity
On Collect Fees
On Rebalance
Using Free Balances
Add Liquidity from Balance
UseuseFreeBalanceA and useFreeBalanceB to fund operations from your retained balance:
Retain Excess on Add
When adding liquidity, any unused tokens (refunds) can be retained instead of returned via Spark:Checking Balances
Single Pool
All Pools
Withdrawing Balances
To move funds from your free balance to your Spark wallet:Amount Options
| Value | Behavior |
|---|---|
"500000" | Withdraw specific amount |
"max" or "0" | Withdraw entire balance |
| Empty string | Skip this asset |
Common Workflows
Fee Compounding
Reinvest earned fees without Spark transfers:Zero-Transfer Rebalancing
Rebalance positions without any Spark overhead:Market Maker Loop
High-frequency position management:Response Fields
All V3 liquidity operations include balance information when using free balance features:| Field | Type | Description |
|---|---|---|
retainedInBalance | boolean | Whether funds were retained in balance |
currentBalance | object | Updated balance after operation (balanceA, balanceB) |
amountARefund | string | Excess asset A returned (increase liquidity) |
amountBRefund | string | Excess asset B returned (increase liquidity) |
Balance States
| State | Description |
|---|---|
balance | Total funds in your free balance |
available | Amount you can use (total minus locked) |
locked | Funds in pending operations |
Next Steps
- Pool Creation - Create new V3 pools
- Managing Positions - Position lifecycle operations
- Error Handling - Handle failures gracefully