Skip to main content
The Bolt TypeScript SDK provides a comprehensive, type-safe interface for integrating with Bolt’s zero slippage execution layer on Sui. Query oracle prices, inspect pools, simulate swaps off-chain, and execute trades programmatically.

Quickstart

1

Prerequisites

Before using the SDK, make sure you have:☑️ Node.js 18+ installed☑️ A Sui-compatible wallet (Sui Wallet, Suiet, etc.) for signing transactions☑️ Access to SUI RPC endpoints: The client uses
https://fullnode.mainnet.sui.io:443 for mainnet and https://fullnode.testnet.sui.io:443 for testnet by default
2

Installation

3

Initialize the Bolt client

The SDK supports different environments:
4

Query all assets

5

Execute a swap


API

Client initialization

Environment configurationOverride chain configurationOverride Bolt package IDOverride Outpost contract addressOverride assets configuration
Override SUI client

Get oracle config

getOracleConfig()Retrieves the current configuration settings from the Bolt Oracle smart contract on Sui. This configuration governs how price feeds are managed, including update thresholds, expiration times, and administrative settings.
Usage example

Query prices and assets

getAssets() Retrieves all unique assets available in the Bolt execution layer by querying oracle asset pairs and enriching them with additional metadata from the client’s asset configuration.
Usage example

getAllOracleAssetPairs()Queries the oracle smart contract to retrieve all supported asset pairs with automatic pagination. Each asset pair represents a base/quote relationship that can be used for price queries and swaps.
Usage example

getAllPrices() Queries the oracle smart contract to retrieve all available price feeds with automatic pagination. More efficient than making multiple individual price queries when you need prices for multiple pairs.
Usage example

getPrice() Queries the oracle smart contract to retrieve the current price for a specific asset pair. Fetches the latest price feed that is updated by authorised price feeders and validated against configured thresholds.
Usage example

Verify pool liquidity

getPoolBaseLiquidity() Queries the router smart contract to retrieve the total base asset liquidity for a specific pool. Fetches current liquidity levels for the base asset in the specified pool.
Usage example

getAllBaseAssetsLiquidity() Queries the router smart contract to retrieve the base asset liquidity across all pools. Fetches current liquidity levels for all the base assets in their respective pools.
Usage example

Get liquidity pools information

getAllPools() Queries the router smart contract to retrieve information about all deployed pools with automatic pagination. Fetches a comprehensive list of all pools in the Bolt execution layer.
Usage example

getPoolConfig() Retrieves the configuration settings of a liquidity pool contract. Queries the contract to fetch its current configuration parameters, including fees, LP settings, and oracle integration.
Usage example

getPoolByDenom() Queries the router smart contract to retrieve pool information for a specific base/quote asset pair on Sui. Fetches pool details for the pool matching the provided asset denominations.
Usage example

getPoolConfigByDenom() Retrieves pool configuration by base/quote asset pair. This is a convenience function that combines pool lookup and configuration retrieval.
Usage example

Simulate a swap

simulateSwap() Simulates a swap operation to calculate the expected output amount without executing the transaction. Performs a dry run taking into account current pool conditions, oracle prices, and fees. Use this for accurate estimates before executing.
Usage example

Execute a swap

swap() Executes a token swap transaction on the Bolt execution layer through the router contract. It performs a “swap exact in” operation where you specify exactly how much of the input asset to swap, and receive a variable amount of the output asset based on current pool conditions.

Usage examples


Best practices


Error Handling

Sui Outpost Addresses

Contract addresses for mainnet and testnet.

Off-Chain Quoting

Build price discovery using deterministic quoting.

Contract Math

Understand the pricing formula behind simulateSwap().

Pool State Indexing

Index pool state for real-time integration.