amountIn to amountOut offchain without issuing repeated onchain quote calls, and get identical results to what the Outpost would return onchain.
Offchain 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 offchain quoting works
Unlike traditional AMMs where price depends on pool depth and changes with every trade, Bolt’s convergence pricing is independent of pool depth. The Convergence Engine builds a price from cross-venue data, and a quote remains valid as long as that price and pool inventory are unchanged. No bonding curve, no price impact, no quote staleness between trades.1
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.
The TypeScript SDK does not currently expose QuoteAssetReserve queries. Offchain quoting requires direct onchain state indexing. Book a call with the team for guidance on querying pool reserves directly.
2
Fetch the current oracle price
Query the Bolt Oracle for the live reference price. This is the authoritative price used for all settlement math.
3
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 onchain Outpost would return.Book a call with the team to obtain the latest contract math formulas and reference test vectors. These must always match the current onchain implementation.
4
Evaluate inventory and execute
Confirm that pool inventory is sufficient to settle the requested amount. If inventory is available, submit the swap onchain with confidence that the quote matches.
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 onchain by the Outpost or offchain 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 Convergence Engine sets the price from cross-venue data, so trade size does not affect the quoted price. A 100 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. Offchain quoting enables batch route evaluation without repeated RPC calls.
1
Cache pool state for all Bolt pools
2
Compute quotes for all possible routes in parallel
3
Select the route with the best amountOut
4
Submit a single onchain settlement
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 onchain submission. Pool state can change between your simulation and the transaction landing onchain. 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 offchain implementation. These must always match the current onchain 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.