amountIn to amountOut off-chain without issuing repeated on-chain quote calls, and get identical results to what the Outpost would return on-chain.
Off-chain simulation is recommended for applications that require sub-300ms quote latency, route optimization across many liquidity sources, or trade splitting and pathfinding. If you only need a quick quote for a single swap, simulateSwap() in the SDK handles this in one call.
How off-chain quoting works
Unlike traditional AMMs, where price depends on pool depth and changes with every trade, Bolt’s oracle-anchored pricing is independent of pool depth. A quote remains valid as long as the oracle price and pool inventory are unchanged. No bonding curve, no price impact, no quote staleness between trades.Index current pool state
Pull the current inventory, fee parameters, and pool thresholds from the Bolt Outpost. Pool state changes infrequently between swaps, so you can cache it locally.
Fetch the current oracle price
Query the Bolt Oracle for the live reference price. This is the authoritative price used for all settlement math.
Apply the Bolt contract math
Compute
amountOut using the oracle price, fee rates, and inventory constraints. Because pricing is deterministic, the result is identical to what the on-chain Outpost would return.Contact the Bolt team to obtain the latest contract math formulas and reference test vectors. These must always match the current on-chain implementation. Reach out on Telegram or book a call.
Quick path: simulateSwap()
If you don’t need to implement the full contract math locally, the SDK’ssimulateSwap() method performs a deterministic dry run against the current pool state and oracle price with no gas cost.
Determinism guarantees
Same inputs, same outputs
Same inputs, same outputs
Given identical pool state and oracle price, the computed
amountOut is exactly the same whether calculated on-chain by the Outpost or off-chain by your integration. There is no randomness, no auction, and no variable spread.No curve-based slippage
No curve-based slippage
Traditional AMMs derive price from a bonding curve where every trade moves the price. Bolt’s prop-AMM references an external oracle, so trade size does not affect the quoted price. A 10 USDC swap and a 1,000 USDC swap receive the same rate per unit.
Quote stability across trades
Quote stability across trades
Because pricing is oracle-anchored rather than inventory-derived, quotes remain valid across multiple consecutive trades as long as the oracle price and pool inventory are unchanged. This eliminates the “quote goes stale the moment someone else trades” problem.
Use cases
- DEX Aggregators
- DApp Builders
Aggregators evaluate multiple routes simultaneously by simulating swaps across all available pools. Off-chain quoting enables batch route evaluation without repeated RPC calls.
Handling state freshness
When to refresh pool state
When to refresh pool state
Pool state changes when swaps execute or when pool parameters are updated. For most integrations, refreshing every 10 to 15 seconds provides a good balance between accuracy and RPC efficiency. For high-frequency applications, use WebSocket subscriptions to the Outpost contract if your RPC provider supports them.
Checking oracle price expiry
Checking oracle price expiry
Every oracle price includes an
expiryTime field (Unix timestamp in nanoseconds). Always check that the price has not expired before using it in your local math. The SDK’s getOracleConfig() method returns the priceExpireTime setting so you can anticipate refresh intervals.Re-validating before submission
Re-validating before submission
For high-value trades, re-check pool inventory immediately before on-chain submission. Pool state can change between your simulation and the transaction landing on-chain. Setting
minimumAmountOut on the swap call provides an additional safety net.Reference materials
Bolt provides swap math formulas, worked examples, and reference test vectors for off-chain implementation. These must always match the current on-chain contracts.Contract Math
Oracle-anchored pricing formulas and fee calculations.
Pool State Indexing
How to index and subscribe to Outpost state changes.
Sui TypeScript SDK
Full API reference including simulateSwap() and pool queries.
Sui Outpost Addresses
Contract addresses for mainnet and testnet.