@bolt-liquidity-hq/cosmwasm-client
Prerequisites
- Node.js 18+
- Archway-compatible wallet (Keplr, Leap, or equivalent)
- RPC endpoint (defaults provided for mainnet and testnet)
| Network | Default RPC Endpoint |
|---|---|
| Mainnet | https://rpc.mainnet.archway.io |
| Testnet | https://rpc.constantine.archway.io |
Installation
- npm
- yarn
- pnpm
Quick start
Install the package
Choose your package manager above and install
@bolt-liquidity-hq/cosmwasm-client.Advanced initialization
The client supports full customization for non-standard environments, custom chain configs, or pre-existing signer instances.Custom configuration options
Custom configuration options
customOverride are optional. Use them when you need to point the client at a custom deployment or pass in your own RPC/signer instances.API Reference
Oracle methods
The oracle is the pricing backbone of every Bolt swap. These methods give you access to the deterministic reference prices that the Outpost validates against.- getOracleConfig()
- getPrice()
- getAllPrices()
Returns the oracle contract configuration.Returns:
OracleConfig| Field | Type | Description |
|---|---|---|
| admin | Address | Oracle admin address |
| priceThresholdRatio | string | Max deviation ratio before rejection |
| priceExpireTime | Duration or null | Staleness window ({secs, nanos}) |
Asset methods
Query which assets are supported on the Outpost and their oracle configurations.- getAssets()
- getAllOracleAssetPairs()
Returns all supported assets with metadata.Returns:
Asset[]| Field | Type | Description |
|---|---|---|
| symbol | string | Trading symbol (e.g., "ARCH") |
| name | string | Full asset name |
| chainId | string | Blockchain identifier |
| denom | string | Chain-specific denomination (IBC or native) |
| decimals | number | Decimal precision |
| logo | string? | Optional logo URL |
| coingeckoId | string? | Optional CoinGecko identifier |
Router and pool methods
Inspect the Router configuration and Outpost pool state. The Router is the entry-point contract unique to the Archway deployment.- getRouterConfig()
- getAllPools()
- getPoolConfig()
- getPoolConfigByDenom()
- Liquidity queries
Returns the Router’s default configuration.Returns:
RouterConfig| Field | Type | Description |
|---|---|---|
| admin | string | Router admin address |
| defaultPriceOracleContract | string | Default oracle contract |
| defaultProtocolFeeRecipient | string | Fee destination |
| defaultProtocolFee | string | Default protocol fee rate |
| defaultLpFee | string | Default LP fee rate |
Swap methods
Simulate swaps off-chain for quoting, then execute on-chain when ready.- simulateSwap()
- swap()
Simulates a swap without executing it. Returns the expected output, fee breakdown, and settling pool address.Returns:
SimulateSwapResult| Field | Type | Description |
|---|---|---|
| poolAddress | string | Pool that would settle this trade |
| amountOut | string | Expected output amount |
| assetOut | string | Output asset denomination |
| protocolFee | string | Protocol fee component |
| lpFee | string | LP fee component |
| dynamicFeePercentage | string? | Dynamic fee if applicable |
| totalFees | string | Combined fees |
Bolt quotes are deterministic. Given the same pool state and oracle price,
simulateSwap() returns identical results whether called off-chain or on-chain.Type definitions
Asset
Asset
SwapParams
SwapParams
Use
minimumAmountOut rather than a slippage percentage. Calculate it from your simulateSwap() result: amountOut * (1 - tolerance).Pool and PoolConfig
Pool and PoolConfig
Price types
Price types
Oracle and Router config
Oracle and Router config
Swap results
Swap results
Error handling
The SDK provides typed error classes for all failure modes. Wrap SDK calls in try-catch blocks and handle each type appropriately.| Error | Cause | Fix |
|---|---|---|
| NotFoundError | Asset, pool, or oracle not found | Verify denoms and pool addresses |
| InvalidParameterError | Bad address or negative amount | Validate inputs before calling |
| InvalidObjectError | Object does not exist on-chain | Confirm addresses and network |
| InvalidTypeError | Type mismatch in params | Ensure denoms and amounts are strings |
| MissingParameterError | Required field omitted | Provide all non-optional fields |
| TransactionFailedError | On-chain execution failed | Check gas, inventory, oracle freshness |
| ParseError | Failed to deserialize data | Retry or switch RPC endpoint |
Archway 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.