@bolt-liquidity-hq/cosmwasm-client 0.1.0-beta.2 → 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/lib/client.ts","../src/common/errors.ts","../src/common/helpers/asset.ts","../src/common/lib/client.ts","../src/common/types/chain.ts","../src/config/archway-mainnet.json","../src/config/archway-testnet.json","../src/lib/oracle/get-asset-pairs.ts","../src/lib/helpers/parse.ts","../src/lib/helpers/transactions.ts","../src/lib/oracle/get-oracle-config.ts","../src/lib/oracle/get-price.ts","../src/lib/oracle/get-prices.ts","../src/lib/router/get-all-base-liquidity.ts","../src/lib/router/get-all-quotes-for-user.ts","../src/lib/router/get-pool-for-base.ts","../src/lib/router/get-pools.ts","../src/lib/router/get-router-config.ts","../src/lib/constants/events.ts","../src/lib/router/swap.ts","../src/types/client.ts"],"sourcesContent":["export { BoltCosmWasmClient } from './lib/client';\n\nexport * from './common/errors';\nexport * from './common/types';\n\nexport * from './types';\n","import { ArchwayClient, SigningArchwayClient } from '@archwayhq/arch3.js';\nimport {\n CosmWasmClient,\n type ExecuteResult,\n SigningCosmWasmClient,\n} from '@cosmjs/cosmwasm-stargate';\nimport type { OfflineSigner } from '@cosmjs/proto-signing';\n\nimport type {\n Address,\n Coin,\n InvertiblePrice,\n Pool,\n OracleAssetPair,\n OracleConfig,\n Price,\n RouterConfig,\n SwapParams,\n SwapResult,\n} from '../common';\nimport { BaseClient, Environment, InvalidTypeError, MissingParameterError } from '../common';\nimport ArchwayMainnet from '../config/archway-mainnet.json';\nimport ArchwayTestnet from '../config/archway-testnet.json';\nimport {\n getAssetPairs,\n getOracleConfig,\n getPrice as getOraclePrice,\n getPrices as getOraclePrices,\n} from './oracle';\nimport {\n getAllBaseLiquidity,\n getAllQuotesForUser,\n getPoolForBase,\n getPools,\n getRouterConfig,\n swapExactIn,\n} from './router';\n\nimport { CosmWasmChain, type CosmWasmClientConfig } from '../types';\n\n/**\n * Client implementation for interacting with the Bolt Liquidity Outpost on CosmWasm-based blockchains.\n *\n * This class extends the abstract {@link BaseClient} to provide CosmWasm-specific functionality\n * for querying and executing transactions on Bolt Protocol's oracle and router smart contracts.\n *\n * @extends {BaseClient<OfflineSigner>}\n *\n * @group Bolt API Clients\n *\n * @example\n * ```typescript\n * // Create a client for Archway mainnet\n * const client = new BoltCosmWasmClient({\n * environment: Environment.Mainnet,\n * chain: CosmWasmChain.Archway\n * });\n *\n * // Query oracle prices\n * const price = await client.getPrice(\"aarch\", \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\");\n *\n * // Execute a swap (requires signer)\n * const signer = await DirectSecp256k1HdWallet.fromMnemonic(\"my mnemonic goes here\", {\n * prefix: 'archway',\n * });\n * const result = await client.swap(signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000\",\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\"\n * });\n * ```\n */\nexport class BoltCosmWasmClient extends BaseClient<OfflineSigner> {\n /**\n * Cached instance of the CosmWasm client for read-only operations\n * @private\n */\n private _cosmWasmClient?: CosmWasmClient | ArchwayClient;\n\n /**\n * Cached instance of the signing CosmWasm client for transaction execution\n * @private\n */\n private _signingCosmWasmClient?: SigningCosmWasmClient | SigningArchwayClient;\n\n /**\n * The specific CosmWasm chain this client is connected to\n */\n public chain: CosmWasmChain;\n\n /**\n * Creates a new instance of the BoltCosmWasmClient.\n *\n * The client automatically configures itself based on the specified chain and environment,\n * loading the appropriate contract addresses and RPC endpoints from configuration files.\n *\n * @param config - (Optional) Configuration for the client\n * @param config.environment - (Optional) The deployment environment (Mainnet or Testnet). Defaults to Mainnet\n * @param config.chain - (Optional) The specific CosmWasm chain to connect to. Defaults to Archway\n * @param config.override - (Optional) Overrides for RPC endpoint and contract addresses\n * @param config.override.rpcEndpoint - (Optional) Custom RPC endpoint URL\n * @param config.override.contracts - (Optional) Custom contract addresses\n * @param config.override.contracts.oracle - (Optional) Custom oracle contract address\n * @param config.override.contracts.router - (Optional) Custom router contract address\n *\n * @throws {InvalidTypeError} Thrown when an unsupported chain is specified\n *\n * @example\n * ```typescript\n * // Use default configuration (Archway mainnet)\n * const client = new BoltCosmWasmClient();\n *\n * // Use testnet configuration\n * const testnetClient = new BoltCosmWasmClient({\n * environment: Environment.Testnet\n * });\n *\n * // Use custom RPC endpoint\n * const customClient = new BoltCosmWasmClient({\n * override: {\n * rpcEndpoint: 'https://custom-rpc.example.com'\n * }\n * });\n * ```\n */\n constructor(config?: CosmWasmClientConfig) {\n const {\n environment = Environment.Mainnet,\n chain = CosmWasmChain.Archway,\n override,\n } = config ?? {};\n\n let configJson;\n\n switch (chain) {\n case CosmWasmChain.Archway:\n configJson = environment === Environment.Mainnet ? ArchwayMainnet : ArchwayTestnet;\n break;\n default:\n throw new InvalidTypeError('A valid value of CosmWasmChain', chain);\n }\n\n super({\n override: {\n rpcEndpoint: override?.rpcEndpoint ?? configJson.chain.rpcEndpoint,\n contracts: {\n oracle: override?.contracts?.oracle ?? configJson.contracts.oracle,\n router: override?.contracts?.router ?? configJson.contracts.router,\n },\n },\n });\n\n this.chain = chain;\n }\n\n /**\n * Gets or creates a CosmWasm client instance for read-only blockchain operations.\n *\n * This method implements lazy initialization and caching of the client instance.\n * The appropriate client type (ArchwayClient or generic CosmWasmClient) is selected\n * based on the configured chain.\n *\n * @returns A promise that resolves to the CosmWasm client instance\n *\n * @example\n * ```typescript\n * const client = await boltClient.getCosmWasmClient();\n * const chainId = await client.getChainId();\n * const height = await client.getHeight();\n * ```\n */\n public async getCosmWasmClient(): Promise<CosmWasmClient | ArchwayClient> {\n if (!this._cosmWasmClient) {\n this._cosmWasmClient = await (\n this.chain === CosmWasmChain.Archway ? ArchwayClient : CosmWasmClient\n ).connect(this.rpcEndpoint);\n }\n\n return this._cosmWasmClient;\n }\n\n /**\n * Gets or creates a signing CosmWasm client instance for transaction execution.\n *\n * This method implements lazy initialization and caching of the signing client.\n * A signer must be provided either on first call or to replace the cached instance.\n * The appropriate client type is selected based on the configured chain.\n *\n * @param signer - Optional offline signer for transaction signing. Required on first call\n * or to replace the existing signer\n *\n * @returns A promise that resolves to the signing CosmWasm client instance\n *\n * @throws {MissingParameterError} Thrown when no signer is provided and no cached client exists\n *\n * @example\n * ```typescript\n * // First call requires a signer\n * const signer = await DirectSecp256k1HdWallet.fromMnemonic(\"my mnemonic goes here\", {\n * prefix: 'archway',\n * });\n * const signingClient = await boltClient.getSigningCosmWasmClient(signer);\n *\n * // Subsequent calls can reuse the cached client\n * const cachedClient = await boltClient.getSigningCosmWasmClient();\n * ```\n */\n public async getSigningCosmWasmClient(\n signer?: OfflineSigner\n ): Promise<SigningCosmWasmClient | SigningArchwayClient> {\n if (!this._signingCosmWasmClient || signer) {\n if (!signer) {\n throw new MissingParameterError('signer');\n }\n\n this._signingCosmWasmClient = await (\n this.chain === CosmWasmChain.Archway ? SigningArchwayClient : SigningCosmWasmClient\n ).connectWithSigner(this.rpcEndpoint, signer);\n }\n\n return this._signingCosmWasmClient;\n }\n\n // The following methods inherit their documentation from BaseClient\n // Only add documentation here if you need to override or add implementation-specific details\n\n /** @inheritdoc */\n public async getOracleConfig(): Promise<OracleConfig> {\n return await getOracleConfig(this);\n }\n\n /** @inheritdoc */\n async getAllOracleAssetPairs(): Promise<OracleAssetPair[]> {\n return await getAssetPairs(this);\n }\n\n /** @inheritdoc */\n async getPrice(baseAssetSymbol: string, quoteAssetSymbol: string): Promise<InvertiblePrice> {\n return await getOraclePrice(this, baseAssetSymbol, quoteAssetSymbol);\n }\n\n /** @inheritdoc */\n async getAllPrices(): Promise<Price[]> {\n return await getOraclePrices(this);\n }\n\n /** @inheritdoc */\n async getRouterConfig(): Promise<RouterConfig> {\n return await getRouterConfig(this);\n }\n\n /** @inheritdoc */\n async getAllBaseAssetsLiquidity(): Promise<Record<Address, Coin>> {\n return await getAllBaseLiquidity(this);\n }\n\n /** @inheritdoc */\n async getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>> {\n return await getAllQuotesForUser(this, address);\n }\n\n /** @inheritdoc */\n async getPoolByBaseAsset(baseAssetSymbol: string): Promise<Pool> {\n return getPoolForBase(this, baseAssetSymbol);\n }\n\n /** @inheritdoc */\n async getAllPools(): Promise<Pool[]> {\n return await getPools(this);\n }\n\n /**\n * @inheritdoc\n *\n * @example\n * ```typescript\n * // Get signer (e.g., from Keplr wallet)\n * const signer = await window.keplr.getOfflineSignerAuto(chainId);\n *\n * // Execute swap: 1 ARCH for USDC\n * const result = await client.swap(signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH (18 decimals)\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * minimumAmountOut: \"1950000000\", // Minimum 1950 USDC expected\n * receiver: \"archway1...\" // Optional custom receiver\n * });\n *\n * console.log(`Swap successful!`);\n * console.log(`Transaction hash: ${result.txHash}`);\n * console.log(`Received: ${result.amountOut} ${result.assetOut}`);\n * console.log(`Gas used: ${result.gasUsed}`);\n * ```\n */\n async swapExactIn(signer: OfflineSigner, params: SwapParams): Promise<SwapResult<ExecuteResult>> {\n return await swapExactIn(this, signer, params);\n }\n}\n","/**\n * Error codes used throughout the Bolt SDK to categorize different types of errors.\n *\n * These codes help in programmatic error handling and provide a consistent way\n * to identify error types across the SDK.\n *\n * @enum {number}\n * @group Errors\n * @category Error Types\n *\n * @example\n * ```typescript\n * import { BoltSdkErrorCode, BoltSdkError } from '@bolt-liquidity-hq/cosmwasm-client';\n *\n * try {\n * await client.swapExactIn(signer, params);\n * } catch (error) {\n * if (error instanceof BoltSdkError) {\n * switch (error.code) {\n * case BoltSdkErrorCode.INVALID_ADDRESS:\n * console.error(\"Invalid address format\");\n * break;\n * case BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND:\n * console.error(\"Transaction event not found\");\n * break;\n * default:\n * console.error(\"Operation failed:\", error.message);\n * }\n * }\n * }\n * ```\n */\nexport enum BoltSdkErrorCode {\n // Resource & Data Errors\n /** Resource not found (pools, assets, configurations) */\n NOT_FOUND,\n /** Invalid object structure or missing required fields */\n INVALID_OBJECT,\n /** Type mismatch or invalid type provided */\n INVALID_TYPE,\n\n // Blockchain Transaction Errors\n /** Insufficient balance to perform the operation */\n INSUFFICIENT_FUNDS,\n /** Invalid blockchain address format */\n INVALID_ADDRESS,\n /** Transaction reverted or failed on-chain */\n TRANSACTION_FAILED,\n /** Expected transaction event not found in logs */\n TRANSACTION_EVENT_NOT_FOUND,\n\n // Infrastructure & Network Errors\n /** Network connectivity or RPC communication failure */\n NETWORK_ERROR,\n\n // Validation & Input Errors\n /** Invalid parameter provided to a method */\n INVALID_PARAMETER,\n /** Required parameter is missing */\n MISSING_PARAMETER,\n /** Numeric value outside acceptable range */\n PARAMETER_OUT_OF_RANGE,\n}\n\n/**\n * Base interface for all Bolt SDK errors.\n *\n * All custom errors in the SDK implement this interface, providing\n * a consistent error structure with error codes for easy handling.\n *\n * @interface\n * @group Errors\n * @category Error Types\n */\nexport interface BoltSdkError extends Error {\n /** The error code categorizing this error */\n code: BoltSdkErrorCode;\n}\n\n/**\n * Base class for all custom errors in the Bolt SDK.\n *\n * This abstract base class provides common functionality for all SDK errors,\n * including error code assignment and proper error name setting.\n *\n * @abstract\n * @group Errors\n * @category Error Classes\n */\nexport class BoltSdkErrorBase extends Error implements BoltSdkError {\n /**\n * Creates a new BoltSdkErrorBase instance.\n *\n * @param code - The error code categorizing this error\n * @param message - Human-readable error message\n */\n constructor(\n public code: BoltSdkErrorCode,\n message: string\n ) {\n super(message);\n this.name = this.constructor.name; // Set the error name to the class name\n }\n}\n\n// Resource & Data Errors\n\n/**\n * Error thrown when a requested resource cannot be found.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class NotFoundError extends BoltSdkErrorBase {\n /**\n * Creates a new NotFoundError instance.\n *\n * @param resource - The type of resource that was not found\n * @param details - Optional additional details about what was searched for\n */\n constructor(resource: string, details?: string) {\n super(\n BoltSdkErrorCode.NOT_FOUND,\n `Resource not found: ${resource}.${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when an object doesn't have the expected structure.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidObjectError extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidObjectError instance.\n *\n * @param details - Optional description of what is invalid about the object\n */\n constructor(details?: string) {\n super(\n BoltSdkErrorCode.INVALID_OBJECT,\n `Invalid object or data structure!${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when an unexpected type is encountered.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidTypeError extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidTypeError instance.\n *\n * @param expectedType - The type that was expected\n * @param receivedType - The actual type that was received\n */\n constructor(expectedType: string, receivedType: string) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Invalid object type! Expected: ${expectedType}, Received: ${receivedType}`\n );\n }\n}\n\n// Blockchain Transaction Errors\n\n/**\n * Error thrown when an account has insufficient funds for an operation.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InsufficientFundsError extends BoltSdkErrorBase {\n /**\n * Creates a new InsufficientFundsError instance.\n *\n * @param required - The amount required for the operation\n * @param available - The amount available in the account\n */\n constructor(required: number, available: number) {\n super(\n BoltSdkErrorCode.INSUFFICIENT_FUNDS,\n `Insufficient funds to complete the transaction! Required: ${required}, Available: ${available}`\n );\n }\n}\n\n/**\n * Error thrown when an invalid blockchain address is provided.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidAddressError extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidAddressError instance.\n *\n * @param address - The invalid address that was provided\n */\n constructor(address: string) {\n super(BoltSdkErrorCode.INVALID_ADDRESS, `Invalid blockchain address provided: ${address}`);\n }\n}\n\n/**\n * Error thrown when a blockchain transaction fails or is reverted.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class TransactionFailedError extends BoltSdkErrorBase {\n /**\n * Creates a new TransactionFailedError instance.\n *\n * @param transactionId - The transaction hash or identifier\n * @param details - Optional details about why the transaction failed\n */\n constructor(transactionId: string, details?: string) {\n super(\n BoltSdkErrorCode.TRANSACTION_FAILED,\n `Transaction failed or was reverted! Transaction ID: ${transactionId}.${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when an expected transaction event is not found in the logs.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class TransactionEventNotFoundError extends BoltSdkErrorBase {\n /**\n * Creates a new TransactionEventNotFoundError instance.\n *\n * @param eventName - The name of the event that was expected\n * @param details - Optional details about the context\n */\n constructor(eventName: string, details?: string) {\n super(\n BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND,\n `Transaction Event not found: ${eventName}.${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n// Infrastructure & Network Errors\n\n/**\n * Error thrown when network communication fails.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class NetworkError extends BoltSdkErrorBase {\n /**\n * Creates a new NetworkError instance.\n *\n * @param details - Optional details about the network failure\n */\n constructor(details?: string) {\n super(\n BoltSdkErrorCode.NETWORK_ERROR,\n `Network error occurred!${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n// Validation & Input Errors\n\n/**\n * Error thrown when an invalid parameter is provided to a method.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidParameterError<T = unknown> extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidParameterError instance.\n *\n * @param parameterName - The name of the invalid parameter\n * @param expected - Description of what was expected\n * @param receivedValue - The actual value that was provided\n * @param details - Optional additional details or constraints\n *\n * @template T - The type of the received value\n */\n constructor(parameterName: string, expected: string, receivedValue: T, details?: string) {\n super(\n BoltSdkErrorCode.INVALID_PARAMETER,\n `Invalid parameter '${parameterName}': expected ${expected}, received ${typeof receivedValue}${\n details ? `. ${details}` : ''\n }`\n );\n }\n}\n\n/**\n * Error thrown when a required parameter is missing.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class MissingParameterError extends BoltSdkErrorBase {\n /**\n * Creates a new MissingParameterError instance.\n *\n * @param parameterName - The name of the missing parameter\n * @param context - Optional context about where the parameter was expected\n */\n constructor(parameterName: string, context?: string) {\n super(\n BoltSdkErrorCode.MISSING_PARAMETER,\n `Required parameter '${parameterName}' is missing${context ? ` in ${context}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when a numeric parameter is outside the acceptable range.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class ParameterOutOfRangeError extends BoltSdkErrorBase {\n /**\n * Creates a new ParameterOutOfRangeError instance.\n *\n * @param parameterName - The name of the parameter that's out of range\n * @param value - The actual value that was provided\n * @param min - Optional minimum acceptable value (inclusive)\n * @param max - Optional maximum acceptable value (inclusive)\n * @param details - Optional additional details about the constraint\n */\n constructor(\n parameterName: string,\n value: number | bigint,\n min?: number | bigint,\n max?: number | bigint,\n details?: string\n ) {\n let rangeMessage = '';\n if (min !== undefined && max !== undefined) {\n rangeMessage = ` Expected value between ${min} and ${max}, but received ${value}`;\n } else if (min !== undefined) {\n rangeMessage = ` Expected value >= ${min}, but received ${value}`;\n } else if (max !== undefined) {\n rangeMessage = ` Expected value <= ${max}, but received ${value}`;\n }\n\n super(\n BoltSdkErrorCode.PARAMETER_OUT_OF_RANGE,\n `Parameter '${parameterName}' is out of range.${rangeMessage}${details ? `. ${details}` : ''}`\n );\n }\n}\n","import { InvalidParameterError } from '../errors';\n\nimport type { Coin } from '../types';\n\n/**\n * Parses a coin string containing both amount and denomination into a structured Coin object.\n *\n * This utility function extracts the numeric amount and denomination from a concatenated string\n * where amounts are represented as a single string\n * (e.g., \"1000000uatom\", \"500000000aarch\").\n *\n * @param amountWithDenom - A string containing the amount immediately followed by the denomination,\n * with no spaces or separators. The amount must be a positive integer\n * (no decimals or scientific notation).\n *\n * @returns A Coin object containing:\n * - amount: The numeric portion as a string\n * - denom: The denomination portion as a string\n *\n * @throws {InvalidParameterError} Thrown when the input string doesn't match the expected format\n * or when the amount or denomination cannot be extracted\n *\n * @example\n * ```typescript\n * // Parse a standard Cosmos coin string\n * const coin = getCoinFromAmountWithDenomString(\"1000000uatom\");\n * console.log(coin); // { amount: \"1000000\", denom: \"uatom\" }\n *\n * // Parse an IBC token\n * const ibcCoin = getCoinFromAmountWithDenomString(\"500000000ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\");\n * console.log(ibcCoin); // { amount: \"500000000\", denom: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\" }\n *\n * // Parse a custom token\n * const customCoin = getCoinFromAmountWithDenomString(\"123456789aarch\");\n * console.log(customCoin); // { amount: \"123456789\", denom: \"aarch\" }\n * ```\n *\n * @example\n * ```typescript\n * // Invalid formats that will throw errors\n * try {\n * getCoinFromAmountWithDenomString(\"1000000\"); // Missing denom\n * } catch (error) {\n * console.error(\"No denomination found\");\n * }\n *\n * try {\n * getCoinFromAmountWithDenomString(\"uatom\"); // Missing amount\n * } catch (error) {\n * console.error(\"No amount found\");\n * }\n *\n * try {\n * getCoinFromAmountWithDenomString(\"1000000 uatom\"); // Contains space\n * } catch (error) {\n * console.error(\"Invalid format\");\n * }\n * ```\n */\nexport const getCoinFromAmountWithDenomString = (amountWithDenom: string): Coin => {\n const match = amountWithDenom.match(/^(\\d+)(.+)$/);\n if (!match || !match[1] || !match[2]) {\n throw new InvalidParameterError(\n 'amountWithDenom',\n 'a string with the amount followed by the denom',\n amountWithDenom\n );\n }\n\n return { amount: match[1], denom: match[2] };\n};\n","import { InvalidObjectError } from '../errors';\nimport type {\n Address,\n ClientConfig,\n Coin,\n Contracts,\n InvertiblePrice,\n Pool,\n OracleAssetPair,\n OracleConfig,\n Price,\n RouterConfig,\n SwapParams,\n SwapResult,\n} from '../types';\n\n/**\n * Abstract base client for all implementations of the Bolt SDK for different chains/networks.\n *\n * This class provides the foundation for blockchain-specific implementations,\n * defining the core interface for interacting with oracle and router contracts.\n *\n * @template TSigner - The type of the transaction signer specific to the blockchain implementation\n *\n * @example\n * ```typescript\n * class BoltCosmWasmClient extends BaseClient<OfflineSigner> {\n * // Implementation specific to CosmWasm\n * }\n * ```\n */\nexport abstract class BaseClient<TSigner = unknown> {\n /**\n * The RPC endpoint URL for connecting to the blockchain network\n */\n public rpcEndpoint: Address;\n\n /**\n * Smart contract addresses for making Bolt queries and transactions in the blockchain\n */\n public contracts: Contracts;\n\n /**\n * Creates a new instance of the BaseClient.\n *\n * @param config - Optional configuration object for the client\n * @param config.override - Override configuration for RPC endpoint and contract addresses\n * @param config.override.rpcEndpoint - The RPC endpoint URL for the blockchain network\n * @param config.override.contracts - Contract addresses for oracle and router\n * @param config.override.contracts.oracle - Address of the price oracle contract\n * @param config.override.contracts.router - Address of the swap router contract\n *\n * @throws {InvalidObjectError} Thrown when required configuration fields are missing\n *\n * @example\n * ```typescript\n * const client = new ConcreteClient({\n * override: {\n * rpcEndpoint: 'https://rpc.example.com',\n * contracts: {\n * oracle: 'archway1...',\n * router: 'archway1...'\n * }\n * }\n * });\n * ```\n */\n constructor(config?: ClientConfig) {\n const { override: { rpcEndpoint, contracts } = {} } = config ?? {};\n\n if (!rpcEndpoint || !contracts?.oracle || !contracts.router) {\n throw new InvalidObjectError('ClientConfig is missing fields');\n }\n\n this.rpcEndpoint = rpcEndpoint;\n this.contracts = {\n oracle: contracts.oracle,\n router: contracts.router,\n };\n }\n\n /**\n * Fetches the oracle configuration from the blockchain.\n *\n * @returns A promise that resolves to the oracle configuration containing\n * settings such as price expiration time and threshold ratio\n *\n * @example\n * ```typescript\n * const oracleConfig = await client.getOracleConfig();\n * console.log(`Price expiration: ${oracleConfig.priceExpireTime} seconds`);\n * ```\n */\n abstract getOracleConfig(): Promise<OracleConfig>;\n\n /**\n * Fetches all asset pairs supported by the oracle.\n *\n * @returns A promise that resolves to an array of oracle asset pairs,\n * each containing base and quote asset information with name, symbol and precision\n *\n * @example\n * ```typescript\n * const pairs = await client.getAllOracleAssetPairs();\n * pairs.forEach(pair => {\n * console.log(`${pair.base.symbol}/${pair.quote.symbol}`);\n * console.log(` Base: ${pair.base.name}`);\n * console.log(` Quote: ${pair.quote.name}`);\n * });\n * ```\n */\n abstract getAllOracleAssetPairs(): Promise<OracleAssetPair[]>;\n\n /**\n * Fetches the current price for a specific base/quote asset pair.\n *\n * @param baseAssetSymbol - The chain symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteAssetSymbol - The chain symbol of the quote asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to an invertible price object containing\n * the current price from the oracle\n *\n * @example\n * ```typescript\n * // Get price of ARCH in terms of USDC\n * const priceResult = await client.getPrice(\"aarch\", \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\");\n * console.log(`1 ARCH = ${priceResult.price} USDC`);\n * ```\n */\n abstract getPrice(baseAssetSymbol: string, quoteAssetSymbol: string): Promise<InvertiblePrice>;\n\n /**\n * Fetches all available prices from the oracle.\n *\n * @returns A promise that resolves to an array of all current prices\n * available in the oracle with their respective asset pairs\n *\n * @example\n * ```typescript\n * const prices = await client.getAllPrices();\n * prices.forEach(priceData => {\n * console.log(`${priceData.assetPair}: ${priceData.price}`);\n * console.log(` Expires on: ${priceData.expiryTime}`);\n * });\n * ```\n */\n abstract getAllPrices(): Promise<Price[]>;\n\n /**\n * Fetches the router configuration from the blockchain.\n *\n * @returns A promise that resolves to the router configuration containing\n * settings such as default protocol fees, LP fees, and oracle configuration\n *\n * @example\n * ```typescript\n * const routerConfig = await client.getRouterConfig();\n * console.log(`Default protocol fee: ${routerConfig.defaultProtocolFee * 100}%`);\n * console.log(`Default LP fee: ${routerConfig.defaultLpFee * 100}%`);\n * ```\n */\n abstract getRouterConfig(): Promise<RouterConfig>;\n\n /**\n * Fetches the total liquidity for all base assets across all pools.\n *\n * @returns A promise that resolves to a record mapping pool addresses\n * to their respective base asset liquidity amounts\n *\n * @example\n * ```typescript\n * const liquidity = await client.getAllBaseAssetsLiquidity();\n * Object.entries(liquidity).forEach(([poolAddress, coin]) => {\n * console.log(`Pool ${poolAddress}: ${coin.amount} ${coin.denom}`);\n * });\n * ```\n */\n abstract getAllBaseAssetsLiquidity(): Promise<Record<Address, Coin>>;\n\n /**\n * Fetches all withdrawable quote assets for a specific user or liquidity provider.\n *\n * @param address - The blockchain address of the user or liquidity provider\n *\n * @returns A promise that resolves to a record mapping pool addresses\n * to arrays of withdrawable quote asset coins\n *\n * @example\n * ```typescript\n * const quotes = await client.getAllQuotesByUser(\"archway1...\");\n * Object.entries(quotes).forEach(([poolAddress, coins]) => {\n * console.log(`Pool ${poolAddress}:`);\n * coins.forEach(coin => {\n * console.log(` ${coin.amount} ${coin.symbol}`);\n * });\n * });\n * ```\n */\n abstract getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>>;\n\n /**\n * Fetches pool information for a specific base asset.\n *\n * @param baseAssetSymbol - The symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to the pool information for the specified asset\n *\n * @example\n * ```typescript\n * const pool = await client.getPoolByBaseAsset(\"aarch\");\n * console.log(`Pool address: ${pool.poolAddress}`);\n * console.log(`Base asset: ${pool.baseAssetSymbol}`);\n * console.log('Available quote assets:');\n * pool.quoteAssetsSymbols.forEach(symbol => {\n * console.log(` - ${symbol}`);\n * });\n * ```\n */\n abstract getPoolByBaseAsset(baseAssetSymbol: string): Promise<Pool>;\n\n /**\n * Fetches information for all available pools.\n *\n * @returns A promise that resolves to an array containing all pool information\n *\n * @example\n * ```typescript\n * const pools = await client.getAllPools();\n * pools.forEach(pool => {\n * console.log(`Pool ${pool.poolAddress}:`);\n * console.log(` Base: ${pool.baseAssetSymbol}`);\n * console.log(` Quotes: ${pool.quoteAssetsSymbols.join(', ')}`);\n * });\n * ```\n */\n abstract getAllPools(): Promise<Pool[]>;\n\n /**\n * Executes a \"swap exact in\" operation on the blockchain from one asset to another.\n *\n * This method performs a swap where the exact input amount is specified, and the output\n * amount varies based on current pool conditions and fees. The transaction includes\n * slippage protection through the optional minimumAmountOut parameter.\n *\n * @param signer - The transaction signer that will authorize the swap operation.\n * Must have sufficient balance of the input asset.\n * @param params - The swap configuration parameters\n * @param params.assetIn - The denom of the asset being sold (e.g., \"aarch\", \"ibc/...\")\n * @param params.amountIn - The exact amount of input asset to swap (in minimal denomination)\n * @param params.assetOut - The denom of the asset being bought (e.g., \"aarch\", \"ibc/...\")\n * @param params.minimumAmountOut - Optional minimum acceptable amount of output asset.\n * Transaction will fail if actual output would be less.\n * @param params.receiver - Optional recipient address for the swapped assets.\n * If not provided, defaults to the signer's address.\n *\n * @returns A promise that resolves to the swap result containing transaction\n * details and the actual amount of output asset received\n *\n * @throws Will throw an error if the swap fails due to insufficient balance,\n * slippage exceeding tolerance, or other transaction errors\n *\n * @example\n * ```typescript\n * // Swap exactly 1 ARCH for USDC (output amount varies)\n * const result = await client.swapExactIn(signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // Exactly 1 ARCH (18 decimals)\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * minimumAmountOut: \"1950000000\", // Accept no less than 1950 USDC\n * receiver: \"archway1...\" // Optional custom receiver\n * });\n *\n * console.log(`Swapped exactly 1 ARCH`);\n * console.log(`Received: ${result.amountOut} USDC`);\n * console.log(`Transaction: ${result.txHash}`);\n * ```\n *\n * @remarks\n * This is a \"swap exact in\" operation where:\n * - The input amount is exactly what you specify\n * - The output amount depends on pool conditions\n * - Fees are deducted from the output\n * - Use minimumAmountOut to protect against excessive slippage\n */\n abstract swapExactIn(signer: TSigner, params: SwapParams): Promise<SwapResult>;\n}\n","export enum Environment {\n Mainnet = 'mainnet',\n Testnet = 'testnet',\n}\n","{\n \"chain\": {\n \"name\": \"Archway\",\n \"rpcEndpoint\": \"https://rpc.mainnet.archway.io\",\n \"restEndpoint\": \"https://api.mainnet.archway.io\"\n },\n \"contracts\": {\n \"oracle\": \"archway1...\",\n \"router\": \"archway1...\"\n }\n}\n","{\n \"chain\": {\n \"name\": \"Archway Testnet\",\n \"rpcEndpoint\": \"https://rpc.constantine.archway.io\",\n \"restEndpoint\": \"https://api.constantine.archway.io\"\n },\n \"contracts\": {\n \"oracle\": \"archway1r3ug542dq4arzxsjz4kmpvpez2z830rl0u66k00ft3zrugs8k98qwyxgda\",\n \"router\": \"archway1pjs6d2eqevm05eg2538gz0v6qxr9jtmfwuneacn99mqaj2lv5f4s3u5uwz\"\n }\n}\n","import type { BoltCosmWasmClient } from '../client';\nimport type { OracleAssetPair } from '../../common';\nimport type { QueryAssetPairsResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve all supported asset pairs.\n *\n * This function fetches the complete list of trading pairs that the oracle contract\n * supports for price feeds. Each asset pair represents a base/quote relationship\n * that can be used for price queries and swaps within the Bolt protocol.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n *\n * @returns A promise that resolves to an array of OracleAssetPair objects, each containing:\n * - base: Information about the base asset (name, symbol, precision)\n * - quote: Information about the quote asset (name, symbol, precision)\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The oracle contract is not properly initialized\n * - The response format is invalid\n */\nexport const getAssetPairs = async (client: BoltCosmWasmClient): Promise<OracleAssetPair[]> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n asset_pairs: {},\n })) as QueryAssetPairsResponse;\n\n return response.list;\n};\n","import type { InvertiblePrice, Pool, OracleConfig, Price, RouterConfig } from '../../common';\nimport type {\n InvertiblePriceRepresentation,\n MarketRepresentation,\n PriceRepresentation,\n QueryMarketsResponse,\n QueryOracleConfigResponse,\n QueryPriceResponse,\n QueryPricesResponse,\n QueryRouterConfigResponse,\n} from '../../types';\n\n/**\n * Parses a raw oracle configuration response from the blockchain into a structured OracleConfig object.\n *\n * This function transforms the snake_case properties from the CosmWasm contract response\n * into camelCase properties following TypeScript conventions.\n *\n * @param response - The raw oracle configuration response from the contract query\n *\n * @returns A parsed OracleConfig object with:\n * - admin: The admin address of the oracle contract\n * - priceThresholdRatio: The threshold ratio for price updates\n * - priceExpireTime: Unix timestamp in nanoseconds when the price expires\n *\n * @example\n * ```typescript\n * const rawResponse = {\n * admin: \"archway1...\",\n * price_threshold_ratio: \"0.01\",\n * price_expire_time: \"1752059586581821725\"\n * };\n *\n * const config = parseQueryOracleConfigResponse(rawResponse);\n * console.log(config.priceThresholdRatio); // 0.01\n * ```\n */\nexport const parseQueryOracleConfigResponse = (\n response: QueryOracleConfigResponse\n): OracleConfig => {\n return {\n admin: response.admin,\n priceThresholdRatio: response.price_threshold_ratio,\n priceExpireTime: response.price_expire_time,\n };\n};\n\n/**\n * Parses a raw price representation from the blockchain into a structured Price object.\n *\n * Transforms snake_case properties to camelCase for consistency with TypeScript conventions.\n *\n * @param priceRepresentation - The raw price data from the contract\n *\n * @returns A parsed Price object containing:\n * - assetPair: The trading pair (e.g., \"ARCH/USDC\")\n * - price: The current price as a string\n * - expiryTime: Unix timestamp in nanoseconds when the price expires\n *\n * @example\n * ```typescript\n * const rawPrice = {\n * asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * price: \"250\",\n * expiry_time: \"1752059586581821725\"\n * };\n *\n * const price = parsePrice(rawPrice);\n * console.log(`${price.assetPair}: ${price.price}`); // \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D: 250\"\n * ```\n */\nexport const parsePriceRepresentation = (priceRepresentation: PriceRepresentation): Price => {\n return {\n assetPair: priceRepresentation.asset_pair,\n price: priceRepresentation.price,\n expiryTime: priceRepresentation.expiry_time,\n };\n};\n\n/**\n * Parses a raw invertible price representation into a structured InvertiblePrice object.\n *\n * An invertible price includes all standard price information plus a flag indicating\n * whether the price has been inverted from its original pair order.\n *\n * @param invertiblePriceRepresentation - The raw invertible price data from the contract\n *\n * @returns A parsed InvertiblePrice object containing all Price properties plus:\n * - isInverse: Boolean indicating if the price is inverted from the original pair\n *\n * @example\n * ```typescript\n * const rawInvertiblePrice = {\n * asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * price: \"40\",\n * expiry_time: \"1752059586581821725\",\n * is_inverse: true\n * };\n *\n * const invertiblePrice = parseInvertiblePrice(rawInvertiblePrice);\n * console.log(invertiblePrice.isInverse); // true (price was inverted)\n * ```\n */\nexport const parseInvertiblePrice = (\n invertiblePriceRepresentation: InvertiblePriceRepresentation\n): InvertiblePrice => {\n return {\n ...parsePriceRepresentation(invertiblePriceRepresentation),\n isInverse: invertiblePriceRepresentation.is_inverse,\n };\n};\n\n/**\n * Parses a query price response from the oracle contract into an InvertiblePrice object.\n *\n * This function extracts the pair data from the response and delegates to parseInvertiblePrice.\n *\n * @param response - The raw response from the oracle's price query\n *\n * @returns A parsed InvertiblePrice object\n *\n * @example\n * ```typescript\n * const response = {\n * pair_data: {\n * asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * price: \"250\",\n * expiry_time: \"1752059586581821725\",\n * is_inverse: false\n * }\n * };\n *\n * const price = parseQueryPriceResponse(response);\n * console.log(price.price); // \"250\"\n * ```\n */\nexport const parseQueryPriceResponse = (response: QueryPriceResponse): InvertiblePrice => {\n return parseInvertiblePrice(response.pair_data);\n};\n\n/**\n * Parses a query prices response containing multiple prices into an array of Price objects.\n *\n * @param response - The raw response from the oracle's all prices query\n *\n * @returns An array of parsed Price objects\n *\n * @example\n * ```typescript\n * const response = {\n * prices: [\n * { asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", price: \"250\", expiry_time: \"1752059586581821725\" },\n * { asset_pair: \"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", price: \"075\", expiry_time: \"1752059586581821736\" }\n * ]\n * };\n *\n * const prices = parseQueryPricesResponse(response);\n * console.log(prices.length); // 2\n * prices.forEach(p => console.log(`${p.assetPair}: ${p.price}`));\n * ```\n */\nexport const parseQueryPricesResponse = (response: QueryPricesResponse): Price[] => {\n return response.prices.map((item) => parsePriceRepresentation(item));\n};\n\n/**\n * Parses a raw pool/market representation from the blockchain into a structured Pool object.\n *\n * Transforms snake_case properties to camelCase and organizes pool information.\n *\n * @param marketRepresentation - The raw pool data from the contract\n *\n * @returns A parsed Pool object containing:\n * - poolAddress: The contract address of the pool\n * - baseAssetSymbol: The symbol of the base asset\n * - quoteAssetsSymbols: Array of available quote asset symbols\n *\n * @example\n * ```typescript\n * const rawPoolOrMarket = {\n * market_address: \"archway1xyz...\",\n * base_asset_symbol: \"aarch\",\n * quote_assets_symbols: [\"ibc/ABC123...\", \"ibc/DEF456...\"]\n * };\n *\n * const pool = parsePoolRepresentation(rawPool);\n * console.log(pool.baseAssetSymbol); // \"aarch\"\n * console.log(pool.quoteAssetsSymbols); // [\"ibc/ABC123...\", \"ibc/DEF456...\"]\n * ```\n */\nexport const parseMarketRepresentation = (marketRepresentation: MarketRepresentation): Pool => {\n return {\n poolAddress: marketRepresentation.market_address,\n baseAssetSymbol: marketRepresentation.base_asset_symbol,\n quoteAssetsSymbols: marketRepresentation.quote_assets_symbols,\n };\n};\n\n/**\n * Parses a query markets response containing all available pools into an array of Pool objects.\n *\n * @param response - The raw response from the router's pools query\n *\n * @returns An array of parsed Pool objects\n *\n * @example\n * ```typescript\n * const response = {\n * pools: [\n * {\n * pool_address: \"archway1abc...\",\n * base_asset_symbol: \"aarch\",\n * quote_assets_symbols: [\"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\"]\n * },\n * {\n * pool_address: \"archway1def...\",\n * base_asset_symbol: \"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2\",\n * quote_assets_symbols: [\"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", \"aarch\"]\n * }\n * ]\n * };\n *\n * const pools = parseQueryMarketsResponse(response);\n * console.log(pools.length); // 2\n * pools.forEach(m => {\n * console.log(`Pool for ${m.baseAssetSymbol} at ${m.poolAddress}`);\n * });\n * ```\n */\nexport const parseQueryMarketsResponse = (response: QueryMarketsResponse): Pool[] => {\n return response.markets.map((item) => parseMarketRepresentation(item));\n};\n\n/**\n * Parses a raw router configuration response from the blockchain into a structured RouterConfig object.\n *\n * This function transforms the snake_case properties from the CosmWasm contract response\n * into camelCase properties following TypeScript conventions.\n *\n * @param response - The raw router configuration response from the contract query\n *\n * @returns A parsed RouterConfig object with:\n * - admin: The admin address of the router contract\n * - defaultPriceOracleContract: Address of the default price oracle\n * - defaultProtocolFeeRecipient: Address that receives protocol fees\n * - defaultProtocolFee: The default protocol fee percentage (as decimal string)\n * - defaultLpFee: The default liquidity provider fee percentage (as decimal string)\n * - settlementCodeId: Code ID for settlement contract instantiation\n *\n * @example\n * ```typescript\n * const rawResponse = {\n * admin: \"archway1admin...\",\n * default_price_oracle_contract: \"archway1oracle...\",\n * default_protocol_fee_recipient: \"archway1treasury...\",\n * default_protocol_fee: \"0.003\",\n * default_lp_fee: \"0.002\",\n * settlement_code_id: 123\n * };\n *\n * const config = parseQueryRouterConfigResponse(rawResponse);\n * console.log(config.defaultProtocolFee); // \"0.003\" (0.3%)\n * console.log(config.settlementCodeId); // 123\n * ```\n */\nexport const parseQueryRouterConfigResponse = (\n response: QueryRouterConfigResponse\n): RouterConfig => {\n return {\n admin: response.admin,\n defaultPriceOracleContract: response.default_price_oracle_contract,\n defaultProtocolFeeRecipient: response.default_protocol_fee_recipient,\n defaultProtocolFee: response.default_protocol_fee,\n defaultLpFee: response.default_lp_fee,\n settlementCodeId: response.settlement_code_id,\n };\n};\n","import type { OfflineSigner } from '@cosmjs/proto-signing';\n\nimport { NotFoundError } from '../../common';\n\n/**\n * Extracts the primary address from a CosmJS offline signer.\n *\n * This utility function retrieves the first account's address from an OfflineSigner,\n * which is typically the main account used for signing transactions. This is commonly\n * needed when you need to know the address that will be signing a transaction or\n * when setting default values like the receiver address in a swap operation.\n *\n * @param signer - The CosmJS OfflineSigner instance (e.g., from Keplr, Leap, or other Cosmos wallets)\n *\n * @returns A promise that resolves to the address string of the first account in the signer\n *\n * @throws {NotFoundError} Thrown when the signer has no accounts or the accounts array is empty.\n * This can happen if the wallet is locked or no accounts are available.\n *\n * @example\n * ```typescript\n * // Using with Keplr wallet\n * const chainId = \"archway-1\";\n * const signer = await window.keplr.getOfflineSignerAuto(chainId);\n *\n * try {\n * const address = await getSignerAddress(signer);\n * console.log(\"Signer address:\", address); // \"archway1abc...\"\n * } catch (error) {\n * console.error(\"No accounts found in signer\");\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using with a mnemonic-based signer\n * import { DirectSecp256k1HdWallet } from \"@cosmjs/proto-signing\";\n *\n * const wallet = await DirectSecp256k1HdWallet.fromMnemonic(\n * \"your mnemonic phrase here\",\n * { prefix: \"archway\" }\n * );\n *\n * const address = await getSignerAddress(wallet);\n * console.log(\"Wallet address:\", address); // \"archway1...\"\n * ```\n * ```\n */\nexport const getSignerAddress = async (signer: OfflineSigner): Promise<string> => {\n const accounts = await signer.getAccounts();\n\n if (!accounts?.[0]) {\n throw new NotFoundError(\"Signer account's address\");\n }\n\n return accounts[0].address;\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { OracleConfig } from '../../common';\nimport { parseQueryOracleConfigResponse } from '../helpers';\nimport type { QueryOracleConfigResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve its current configuration settings.\n *\n * This function fetches the oracle's configuration parameters which govern how\n * price feeds are managed, including expiration times, update thresholds, and\n * administrative settings. The raw response is automatically parsed into a\n * structured format for easier consumption.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n *\n * @returns A promise that resolves to an OracleConfig object containing:\n * - admin: The admin address that can update oracle settings\n * - priceThresholdRatio: The minimum price change ratio required for updates (as decimal string)\n * - priceExpireTime: Unix timestamp in nanoseconds indicating price validity duration\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The oracle contract is not found at the configured address\n * - The response cannot be parsed into the expected format\n */\nexport const getOracleConfig = async (client: BoltCosmWasmClient): Promise<OracleConfig> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n config: {},\n })) as QueryOracleConfigResponse;\n\n return parseQueryOracleConfigResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { InvertiblePrice } from '../../common';\nimport { parseQueryPriceResponse } from '../helpers';\nimport type { QueryPriceResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve the current price for a specific asset pair.\n *\n * This function fetches the latest price feed for a given base/quote asset combination.\n * The oracle may return the price in either direction (base/quote or quote/base) and\n * will indicate if the price has been inverted via the `isInverse` flag in the response.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n * @param baseAssetSymbol - The symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteAssetSymbol - The symbol of the quote asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to an InvertiblePrice object containing:\n * - assetPair: The trading pair in format \"base:quote\" (e.g., \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\")\n * - price: The current price as a string (typically an integer representation)\n * - expiryTime: Unix timestamp in nanoseconds when this price expires\n * - isInverse: Boolean indicating if the price was inverted from the stored pair\n *\n * @throws Will throw an error if:\n * - The asset pair is not supported by the oracle\n * - Either asset symbol is invalid or not recognized\n * - The contract query fails due to network issues\n */\nexport const getPrice = async (\n client: BoltCosmWasmClient,\n baseAssetSymbol: string,\n quoteAssetSymbol: string\n): Promise<InvertiblePrice> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n get_price: { base_asset_symbol: baseAssetSymbol, quote_asset_symbol: quoteAssetSymbol },\n })) as QueryPriceResponse;\n\n return parseQueryPriceResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Price } from '../../common';\nimport { parseQueryPricesResponse } from '../helpers';\nimport type { QueryPricesResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve all available price feeds at once.\n *\n * This function fetches the current prices for all asset pairs supported by the oracle\n * in a single query. This is more efficient than making multiple individual price\n * queries when you need prices for multiple pairs. Each price includes its expiration\n * time, allowing you to determine if the data is still fresh.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n *\n * @returns A promise that resolves to an array of Price objects, each containing:\n * - assetPair: The trading pair in format \"base:quote\" (e.g., \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\")\n * - price: The current price as a string (integer representation)\n * - expiryTime: Unix timestamp in nanoseconds when this price expires\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The oracle contract is not properly initialized\n * - The response cannot be parsed into the expected format\n */\nexport const getPrices = async (client: BoltCosmWasmClient): Promise<Price[]> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n get_prices: {},\n })) as QueryPricesResponse;\n\n return parseQueryPricesResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Address, Coin } from '../../common';\nimport type { QueryBaseLiquidityAllResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve the total base asset liquidity across all pools.\n *\n * This function fetches the current liquidity levels for all base assets in their respective\n * pools. Each pool in the Bolt protocol handles swaps for a specific base asset against\n * multiple quote assets, and this query returns how much of each base asset is currently\n * available in its pool for trading.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n *\n * @returns A promise that resolves to a Record mapping pool addresses to Coin objects.\n * Each entry represents:\n * - Key: The pool contract address\n * - Value: A Coin object containing:\n * - amount: The quantity of base asset liquidity (as string)\n * - denom: The denomination of the base asset\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The router contract is not properly initialized\n */\nexport const getAllBaseLiquidity = async (\n client: BoltCosmWasmClient\n): Promise<Record<Address, Coin>> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n base_liquidity_all: {},\n })) as QueryBaseLiquidityAllResponse;\n\n return response.liquidity;\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Address, Coin } from '../../common';\nimport type { QueryQuotesForUserAllResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve all quote asset positions for a specific liquidity provider.\n *\n * This function fetches all withdrawable quote assets that a liquidity provider (LP) has\n * deposited across all pools in the Bolt protocol. LPs provide quote assets (like USDC)\n * to pools, enabling traders to swap base assets for these quote assets. This query\n * returns what quote assets the LP can withdraw from each pool.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n * @param lpAddress - The blockchain address of the liquidity provider to query\n *\n * @returns A promise that resolves to a Record mapping pool addresses to arrays of Coin objects.\n * Each entry represents:\n * - Key: The pool contract address\n * - Value: An array of Coin objects, each containing:\n * - amount: The withdrawable quantity of quote asset (as string)\n * - denom: The denomination of the quote asset\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The provided address is invalid\n * - The router contract is not properly initialized\n */\nexport const getAllQuotesForUser = async (\n client: BoltCosmWasmClient,\n lpAddress: Address\n): Promise<Record<Address, Coin[]>> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n quotes_for_user_all: { lp_address: lpAddress },\n })) as QueryQuotesForUserAllResponse;\n\n return response.quotes;\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Pool } from '../../common';\nimport { parseMarketRepresentation } from '../helpers';\nimport type { MarketRepresentation } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve pool information for a specific base asset.\n *\n * This function fetches the pool details for a given base asset symbol. In the Bolt protocol,\n * each pool is dedicated to trading one base asset against multiple quote assets. This query\n * returns the pool address and available quote assets for the specified base asset.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n * @param baseAssetSymbol - The symbol of the base asset to query (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to a Pool object containing:\n * - poolAddress: The contract address of the pool\n * - baseAssetSymbol: The symbol of the base asset (echoes the input)\n * - quoteAssetsSymbols: Array of symbols for available quote assets\n *\n * @throws Will throw an error if:\n * - No pool exists for the specified base asset\n * - The base asset symbol is invalid or not recognized\n * - The contract query fails due to network issues\n */\nexport const getPoolForBase = async (\n client: BoltCosmWasmClient,\n baseAssetSymbol: string\n): Promise<Pool> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n market_for_base: { base_asset: baseAssetSymbol },\n })) as MarketRepresentation;\n\n return parseMarketRepresentation(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Pool } from '../../common';\nimport { parseQueryMarketsResponse } from '../helpers';\nimport type { QueryMarketsResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve information about all deployed pools.\n *\n * This function fetches a comprehensive list of all pools in the Bolt protocol,\n * including their addresses, base assets, and available quote assets. This provides\n * a complete overview of all trading possibilities within the protocol at once,\n * making it more efficient than querying individual pools.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n *\n * @returns A promise that resolves to an array of Pool objects, each containing:\n * - poolAddress: The contract address of the pool\n * - baseAssetSymbol: The symbol of the base asset for this pool\n * - quoteAssetsSymbols: Array of symbols for available quote assets\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The router contract is not properly initialized\n * - The response cannot be parsed into the expected format\n */\nexport const getPools = async (client: BoltCosmWasmClient): Promise<Pool[]> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n markets: {},\n })) as QueryMarketsResponse;\n\n return parseQueryMarketsResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { RouterConfig } from '../../common';\nimport { parseQueryRouterConfigResponse } from '../helpers';\nimport type { QueryRouterConfigResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve its current configuration settings.\n *\n * This function fetches the router's configuration parameters which govern how\n * swaps are executed, fees are collected, and new pools are deployed. The router\n * is the central contract that coordinates all trading activities in the Bolt protocol.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n *\n * @returns A promise that resolves to a RouterConfig object containing:\n * - admin: The admin address that can update router settings\n * - defaultPriceOracleContract: Address of the default price oracle used by pools\n * - defaultProtocolFeeRecipient: Address that receives protocol fees\n * - defaultProtocolFee: Protocol fee percentage as a decimal string (e.g., \"0.003\" = 0.3%)\n * - defaultLpFee: Liquidity provider fee percentage as a decimal string (e.g., \"0.002\" = 0.2%)\n * - settlementCodeId: Code ID used for instantiating new pool contracts\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The router contract is not found at the configured address\n * - The response cannot be parsed into the expected format\n */\nexport const getRouterConfig = async (client: BoltCosmWasmClient): Promise<RouterConfig> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n config: {},\n })) as QueryRouterConfigResponse;\n\n return parseQueryRouterConfigResponse(response);\n};\n","export const BOLT_SWAP_EVENT_TYPE = 'wasm-bolt_swap';\nexport const BOLT_COIN_RECEIVED_EVENT_TYPE = 'coin_received';\nexport const BOLT_COIN_RECEIVED_EVENT_AMOUNT_KEY = 'amount';\n","import type { ExecuteResult } from '@cosmjs/cosmwasm-stargate';\nimport type { OfflineSigner } from '@cosmjs/proto-signing';\n\nimport type { BoltCosmWasmClient } from '../client';\nimport {\n type SwapParams,\n type SwapResult,\n TransactionEventNotFoundError,\n getCoinFromAmountWithDenomString,\n} from '../../common';\nimport {\n BOLT_COIN_RECEIVED_EVENT_AMOUNT_KEY,\n BOLT_COIN_RECEIVED_EVENT_TYPE,\n BOLT_SWAP_EVENT_TYPE,\n} from '../constants';\nimport { getSignerAddress } from '../helpers';\n\n/**\n * Executes a token swap transaction on the Bolt protocol through the router contract.\n *\n * This function performs a \"swap exact in\" operation, where the user specifies exactly\n * how much of the input asset they want to swap, and receives a variable amount of the\n * output asset based on current pool conditions. The function handles transaction\n * signing, execution, and parsing of the results to return the actual amount received.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n * @param signer - The offline signer that will authorize the swap transaction.\n * Must have sufficient balance of the input asset\n * @param params - The swap configuration parameters\n * @param params.assetIn - The denomination of the asset being sold (e.g., \"aarch\", \"ibc/...\")\n * @param params.amountIn - The exact amount of input asset to swap (as string, in minimal units)\n * @param params.assetOut - The denomination of the asset being bought (e.g., \"aarch\", \"ibc/...\")\n * @param params.minimumAmountOut - Optional minimum acceptable amount of output asset.\n * Transaction will revert if actual output is less\n * @param params.receiver - Optional recipient address for the swapped assets.\n * If not provided, defaults to the signer's address\n *\n * @returns A promise that resolves to a SwapResult containing:\n * - txOutput: The complete ExecuteResult from CosmWasm\n * - txHash: The transaction hash for tracking\n * - amountOut: The actual amount of output asset received (as string)\n * - assetOut: The output asset denomination (echoes the input parameter)\n *\n * @throws {TransactionEventNotFoundError} Thrown when:\n * - No BOLT_SWAP_EVENT is found in transaction events (swap failed)\n * - No COIN_RECEIVED_EVENT is found after the swap event (output not received)\n * @throws Will also throw if:\n * - Signer has insufficient balance of the input asset\n * - Slippage exceeds minimumAmountOut (transaction reverts)\n * - Pool doesn't exist for the asset pair\n * - Network or contract execution errors occur\n *\n * @example\n * ```typescript\n * // Basic swap: 1 ARCH for USDC\n * const signer = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {\n * prefix: \"archway\"\n * });\n *\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH (18 decimals)\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * });\n *\n * console.log(`Swapped 1 ARCH for ${result.amountOut} USDC`);\n * console.log(`Transaction: ${result.txHash}`);\n * ```\n *\n * @example\n * ```typescript\n * // Swap with slippage protection\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"5000000000000000000\", // 5 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * minimumAmountOut: \"9500000\", // Minimum 9.5 USDC (allowing ~5% slippage)\n * });\n *\n * // Transaction will revert if output would be less than 9.5 USDC\n * console.log(`Received: ${result.amountOut} USDC`);\n * ```\n *\n * @example\n * ```typescript\n * // Swap to a different receiver\n * const recipientAddress = \"archway1recipient...\";\n *\n * const result = await swap(client, signer, {\n * assetIn: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC\n * amountIn: \"10000000\", // 10 USDC (6 decimals)\n * assetOut: \"aarch\",\n * receiver: recipientAddress, // Send output to different address\n * });\n *\n * console.log(`Sent ${result.amountOut} ARCH to ${recipientAddress}`);\n * ```\n *\n * @example\n * ```typescript\n * // Error handling with detailed logging\n * try {\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\",\n * assetOut: \"ibc/UNKNOWN\",\n * });\n * } catch (error) {\n * if (error instanceof TransactionEventNotFoundError) {\n * if (error.message.includes(\"Bolt Swap Event\")) {\n * console.error(\"Swap failed - check if pool exists for this pair\");\n * } else if (error.message.includes(\"Coin Received Event\")) {\n * console.error(\"Swap executed but output not received - check logs\");\n * }\n * } else if (error.message.includes(\"insufficient funds\")) {\n * console.error(\"Insufficient balance for swap\");\n * } else {\n * console.error(\"Swap failed:\", error);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Calculate and display swap details\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * minimumAmountOut: \"1900000\", // Minimum 1.9 USDC\n * });\n *\n * // Parse amounts for display (assuming decimals)\n * const constAmount = BigInt(\"1000000000000000000\") / BigInt(10 ** 18);\n * const usdcAmount = BigInt(result.amountOut) / BigInt(10 ** 6);\n *\n * console.log(`Swap Summary:`);\n * console.log(` Sold: ${constAmount} ARCH`);\n * console.log(` Received: ${usdcAmount} USDC`);\n * console.log(` Rate: ${Number(usdcAmount) / Number(constAmount)} USDC per ARCH`);\n * console.log(` Gas used: ${result.txOutput.gasUsed}`);\n * ```\n *\n * @remarks\n * This function is used internally by the client's `swap()` method.\n *\n * The swap process:\n * 1. Retrieves the signer's address\n * 2. Executes the swap_exact_in message on the router\n * 3. Parses transaction events to find the swap result\n * 4. Extracts the actual amount received from events\n *\n * Important notes:\n * - The function uses \"swap exact in\" semantics - input amount is fixed, output varies\n * - Fees are automatically deducted according to router configuration\n * - The actual output amount comes from parsing transaction events\n * - Failed swaps throw errors rather than returning zero amounts\n * - Gas fees are set to 'auto' for automatic estimation\n *\n * Event parsing:\n * - Looks for BOLT_SWAP_EVENT to confirm swap execution\n * - Finds subsequent COIN_RECEIVED_EVENT to determine output amount\n * - Events must appear in order for successful parsing\n *\n * @see {@link BoltCosmWasmClient.swapExactIn} - The public client method that wraps this function\n * @see {@link SwapParams} - The structure of swap parameters\n * @see {@link SwapResult} - The structure of the return value\n * @see {@link getCoinFromAmountWithDenomString} - Used to parse event amounts\n */\nexport const swapExactIn = async (\n client: BoltCosmWasmClient,\n signer: OfflineSigner,\n { assetIn, amountIn, assetOut, minimumAmountOut, receiver }: SwapParams\n): Promise<SwapResult<ExecuteResult>> => {\n const signingCosmWasmClient = await client.getSigningCosmWasmClient(signer);\n\n const address = await getSignerAddress(signer);\n\n const txOutput = await signingCosmWasmClient.execute(\n address,\n client.contracts.router,\n {\n swap_exact_in: {\n want_out: assetOut,\n minimum_base_out: minimumAmountOut,\n receiver,\n },\n },\n 'auto',\n 'Swap using Bolt Typescript SDK',\n [{ amount: amountIn, denom: assetIn }]\n );\n\n const boltSwapEventIndex = txOutput.events.findIndex(\n (item) => item.type === BOLT_SWAP_EVENT_TYPE\n );\n\n if (boltSwapEventIndex === -1) {\n throw new TransactionEventNotFoundError(\n BOLT_SWAP_EVENT_TYPE,\n 'After the transaction was executed, no successful swap event was emitted, the transaction may have failed'\n );\n }\n\n let amountOut;\n\n for (let i = boltSwapEventIndex + 1; i < txOutput.events.length; i++)\n if (txOutput.events[i]?.type === BOLT_COIN_RECEIVED_EVENT_TYPE) {\n const amountWithDenomOut = txOutput.events[i]?.attributes.find(\n (attr) => attr.key === BOLT_COIN_RECEIVED_EVENT_AMOUNT_KEY\n )?.value;\n\n if (amountWithDenomOut) {\n try {\n amountOut = getCoinFromAmountWithDenomString(amountWithDenomOut).amount;\n break;\n } catch {\n /* empty */\n }\n }\n }\n\n if (!amountOut) {\n throw new TransactionEventNotFoundError(\n BOLT_COIN_RECEIVED_EVENT_TYPE,\n 'After the transaction was executed, no coin received event was emitted, the transaction may have failed'\n );\n }\n\n return {\n txOutput,\n txHash: txOutput.transactionHash,\n amountOut,\n assetOut,\n };\n};\n","import type { ClientConfig } from '../common';\n\nexport interface CosmWasmClientConfig extends ClientConfig {\n chain?: CosmWasmChain;\n}\n\nexport enum CosmWasmChain {\n Archway = 'archway',\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoD;AACpD,+BAIO;;;AC2BA,IAAK,mBAAL,kBAAKA,sBAAL;AAGL,EAA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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAM,YAAY,QAAuB,QAAwD;AAC/F,WAAO,MAAM,YAAY,MAAM,QAAQ,MAAM;AAAA,EAC/C;AACF;","names":["BoltSdkErrorCode","Environment","CosmWasmChain"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/lib/client.ts","../src/common/errors.ts","../src/common/helpers/asset.ts","../src/common/lib/client.ts","../src/common/types/chain.ts","../src/common/types/pool.ts","../src/config/archway-mainnet.json","../src/config/archway-testnet.json","../src/lib/oracle/get-asset-pairs.ts","../src/lib/helpers/parse.ts","../src/lib/helpers/transactions.ts","../src/lib/oracle/get-oracle-config.ts","../src/lib/oracle/get-price.ts","../src/lib/oracle/get-prices.ts","../src/lib/router/get-all-base-liquidity.ts","../src/lib/router/get-all-quotes-for-user.ts","../src/lib/router/get-pool-for-base.ts","../src/lib/router/get-pools.ts","../src/lib/router/get-router-config.ts","../src/lib/constants/events.ts","../src/lib/router/swap.ts","../src/types/client.ts","../src/lib/settlement/get-settlement-config.ts","../src/lib/settlement/get-settlement-config-for-base.ts"],"sourcesContent":["export { BoltCosmWasmClient } from './lib/client';\n\nexport * from './common/lib/client';\nexport * from './common/errors';\nexport * from './common/types';\n\nexport * from './types';\n","import { ArchwayClient, SigningArchwayClient } from '@archwayhq/arch3.js';\nimport {\n CosmWasmClient,\n type ExecuteResult,\n SigningCosmWasmClient,\n} from '@cosmjs/cosmwasm-stargate';\nimport type { OfflineSigner } from '@cosmjs/proto-signing';\n\nimport type {\n Address,\n Coin,\n InvertiblePrice,\n Pool,\n OracleAssetPair,\n OracleConfig,\n Price,\n RouterConfig,\n SwapParams,\n SwapResult,\n PoolConfig,\n} from '../common';\nimport { BaseClient, Environment, InvalidTypeError, MissingParameterError } from '../common';\nimport ArchwayMainnet from '../config/archway-mainnet.json';\nimport ArchwayTestnet from '../config/archway-testnet.json';\nimport {\n getAssetPairs,\n getOracleConfig,\n getPrice as getOraclePrice,\n getPrices as getOraclePrices,\n} from './oracle';\nimport {\n getAllBaseLiquidity,\n getAllQuotesForUser,\n getPoolForBase,\n getPools,\n getRouterConfig,\n swapExactIn,\n} from './router';\n\nimport { CosmWasmChain, type CosmWasmClientConfig } from '../types';\nimport { getSettlementConfig, getSettlementConfigForBase } from './settlement';\n\n/**\n * Client implementation for interacting with the Bolt Liquidity Outpost on CosmWasm-based blockchains.\n *\n * This class extends the abstract {@link BaseClient} to provide CosmWasm-specific functionality\n * for querying and executing transactions on Bolt Protocol's oracle and router smart contracts.\n *\n * @extends {BaseClient<OfflineSigner>}\n *\n * @group Bolt API Clients\n *\n * @example\n * ```typescript\n * // Create a client for Archway mainnet\n * const client = new BoltCosmWasmClient({\n * environment: Environment.Mainnet,\n * chain: CosmWasmChain.Archway\n * });\n *\n * // Query oracle prices\n * const price = await client.getPrice(\"aarch\", \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\");\n *\n * // Execute a swap (requires signer)\n * const signer = await DirectSecp256k1HdWallet.fromMnemonic(\"my mnemonic goes here\", {\n * prefix: 'archway',\n * });\n * const result = await client.swap(signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000\",\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\"\n * });\n * ```\n */\nexport class BoltCosmWasmClient extends BaseClient<OfflineSigner> {\n /**\n * Cached instance of the CosmWasm client for read-only operations\n * @private\n */\n private _cosmWasmClient?: CosmWasmClient | ArchwayClient;\n\n /**\n * Cached instance of the signing CosmWasm client for transaction execution\n * @private\n */\n private _signingCosmWasmClient?: SigningCosmWasmClient | SigningArchwayClient;\n\n /**\n * The specific CosmWasm chain this client is connected to\n */\n public chain: CosmWasmChain;\n\n /**\n * Creates a new instance of the BoltCosmWasmClient.\n *\n * The client automatically configures itself based on the specified chain and environment,\n * loading the appropriate contract addresses and RPC endpoints from configuration files.\n *\n * @param config - (Optional) Configuration for the client\n * @param config.environment - (Optional) The deployment environment (Mainnet or Testnet). Defaults to Mainnet\n * @param config.chain - (Optional) The specific CosmWasm chain to connect to. Defaults to Archway\n * @param config.customOverride - (Optional) Overrides for RPC endpoint and contract addresses\n * @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL\n * @param config.customOverride.contracts - (Optional) Custom contract addresses\n * @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address\n * @param config.customOverride.contracts.router - (Optional) Custom router contract address\n * @param config.customOverride.cosmWasmClient - (Optional) Custom CosmWasmClient to use for blockchain queries\n * @param config.customOverride.signingCosmWasmClient - (Optional) Custom SigningCosmWasmClient to use for blockchain transactions\n *\n * @throws {InvalidTypeError} Thrown when an unsupported chain is specified\n *\n * @example\n * ```typescript\n * // Use default configuration (Archway mainnet)\n * const client = new BoltCosmWasmClient();\n *\n * // Use testnet configuration\n * const testnetClient = new BoltCosmWasmClient({\n * environment: Environment.Testnet\n * });\n *\n * // Use custom RPC endpoint\n * const customClient = new BoltCosmWasmClient({\n * override: {\n * rpcEndpoint: 'https://custom-rpc.example.com'\n * }\n * });\n * ```\n */\n constructor(config?: CosmWasmClientConfig) {\n const {\n environment = Environment.Mainnet,\n chain = CosmWasmChain.Archway,\n customOverride,\n cosmWasmClient,\n signingCosmWasmClient,\n } = config ?? {};\n\n let configJson;\n\n switch (chain) {\n case CosmWasmChain.Archway:\n configJson = environment === Environment.Mainnet ? ArchwayMainnet : ArchwayTestnet;\n break;\n default:\n throw new InvalidTypeError('A valid value of CosmWasmChain', chain);\n }\n\n super({\n customOverride: {\n rpcEndpoint: customOverride?.rpcEndpoint ?? configJson.chain.rpcEndpoint,\n contracts: {\n oracle: customOverride?.contracts?.oracle ?? configJson.contracts.oracle,\n router: customOverride?.contracts?.router ?? configJson.contracts.router,\n },\n },\n });\n\n this.chain = chain;\n this._cosmWasmClient = cosmWasmClient;\n this._signingCosmWasmClient = signingCosmWasmClient;\n }\n\n /**\n * Gets or creates a CosmWasm client instance for read-only blockchain operations.\n *\n * This method implements lazy initialization and caching of the client instance.\n * The appropriate client type (ArchwayClient or generic CosmWasmClient) is selected\n * based on the configured chain.\n *\n * @returns A promise that resolves to the CosmWasm client instance\n *\n * @example\n * ```typescript\n * const client = await boltClient.getCosmWasmClient();\n * const chainId = await client.getChainId();\n * const height = await client.getHeight();\n * ```\n */\n public async getCosmWasmClient(): Promise<CosmWasmClient | ArchwayClient> {\n if (!this._cosmWasmClient) {\n this._cosmWasmClient = await (\n this.chain === CosmWasmChain.Archway ? ArchwayClient : CosmWasmClient\n ).connect(this.rpcEndpoint);\n }\n\n return this._cosmWasmClient;\n }\n\n /**\n * Gets or creates a signing CosmWasm client instance for transaction execution.\n *\n * This method implements lazy initialization and caching of the signing client.\n * A signer must be provided either on first call or to replace the cached instance.\n * The appropriate client type is selected based on the configured chain.\n *\n * @param signer - Optional offline signer for transaction signing. Required on first call\n * or to replace the existing signer\n *\n * @returns A promise that resolves to the signing CosmWasm client instance\n *\n * @throws {MissingParameterError} Thrown when no signer is provided and no cached client exists\n *\n * @example\n * ```typescript\n * // First call requires a signer\n * const signer = await DirectSecp256k1HdWallet.fromMnemonic(\"my mnemonic goes here\", {\n * prefix: 'archway',\n * });\n * const signingClient = await boltClient.getSigningCosmWasmClient(signer);\n *\n * // Subsequent calls can reuse the cached client\n * const cachedClient = await boltClient.getSigningCosmWasmClient();\n * ```\n */\n public async getSigningCosmWasmClient(\n signer?: OfflineSigner\n ): Promise<SigningCosmWasmClient | SigningArchwayClient> {\n if (!this._signingCosmWasmClient || signer) {\n if (!signer) {\n throw new MissingParameterError('signer');\n }\n\n this._signingCosmWasmClient = await (\n this.chain === CosmWasmChain.Archway ? SigningArchwayClient : SigningCosmWasmClient\n ).connectWithSigner(this.rpcEndpoint, signer);\n }\n\n return this._signingCosmWasmClient;\n }\n\n // The following methods inherit their documentation from BaseClient\n // Only add documentation here if you need to override or add implementation-specific details\n\n /** @inheritdoc */\n public async getOracleConfig(): Promise<OracleConfig> {\n return await getOracleConfig(this);\n }\n\n /** @inheritdoc */\n async getAllOracleAssetPairs(): Promise<OracleAssetPair[]> {\n return await getAssetPairs(this);\n }\n\n /** @inheritdoc */\n async getPrice(baseAssetSymbol: string, quoteAssetSymbol: string): Promise<InvertiblePrice> {\n return await getOraclePrice(this, baseAssetSymbol, quoteAssetSymbol);\n }\n\n /** @inheritdoc */\n async getAllPrices(): Promise<Price[]> {\n return await getOraclePrices(this);\n }\n\n /** @inheritdoc */\n async getRouterConfig(): Promise<RouterConfig> {\n return await getRouterConfig(this);\n }\n\n /** @inheritdoc */\n async getAllBaseAssetsLiquidity(): Promise<Record<Address, Coin>> {\n return await getAllBaseLiquidity(this);\n }\n\n /** @inheritdoc */\n async getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>> {\n return await getAllQuotesForUser(this, address);\n }\n\n /** @inheritdoc */\n async getPoolByBaseAsset(baseAssetSymbol: string): Promise<Pool> {\n return await getPoolForBase(this, baseAssetSymbol);\n }\n\n /** @inheritdoc */\n async getAllPools(): Promise<Pool[]> {\n return await getPools(this);\n }\n\n /** @inheritdoc */\n async getPoolConfig(poolContractAddress: Address): Promise<PoolConfig> {\n return await getSettlementConfig(this, poolContractAddress);\n }\n\n /** @inheritdoc */\n async getPoolConfigByBaseAsset(baseAssetSymbol: string): Promise<PoolConfig> {\n return await getSettlementConfigForBase(this, baseAssetSymbol);\n }\n\n /**\n * @inheritdoc\n *\n * @example\n * ```typescript\n * // Get signer (e.g., from Keplr wallet)\n * const signer = await window.keplr.getOfflineSignerAuto(chainId);\n *\n * // Execute swap: 1 ARCH for USDC\n * const result = await client.swap(signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH (18 decimals)\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * minimumAmountOut: \"1950000000\", // Minimum 1950 USDC expected\n * receiver: \"archway1...\" // Optional custom receiver\n * });\n *\n * console.log(`Swap successful!`);\n * console.log(`Transaction hash: ${result.txHash}`);\n * console.log(`Received: ${result.amountOut} ${result.assetOut}`);\n * console.log(`Gas used: ${result.gasUsed}`);\n * ```\n */\n async swapExactIn(signer: OfflineSigner, params: SwapParams): Promise<SwapResult<ExecuteResult>> {\n return await swapExactIn(this, signer, params);\n }\n}\n","/**\n * Error codes used throughout the Bolt SDK to categorize different types of errors.\n *\n * These codes help in programmatic error handling and provide a consistent way\n * to identify error types across the SDK.\n *\n * @enum {number}\n * @group Errors\n * @category Error Types\n *\n * @example\n * ```typescript\n * import { BoltSdkErrorCode, BoltSdkError } from '@bolt-liquidity-hq/cosmwasm-client';\n *\n * try {\n * await client.swapExactIn(signer, params);\n * } catch (error) {\n * if (error instanceof BoltSdkError) {\n * switch (error.code) {\n * case BoltSdkErrorCode.INVALID_ADDRESS:\n * console.error(\"Invalid address format\");\n * break;\n * case BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND:\n * console.error(\"Transaction event not found\");\n * break;\n * default:\n * console.error(\"Operation failed:\", error.message);\n * }\n * }\n * }\n * ```\n */\nexport enum BoltSdkErrorCode {\n // Resource & Data Errors\n /** Resource not found (pools, assets, configurations) */\n NOT_FOUND,\n /** Invalid object structure or missing required fields */\n INVALID_OBJECT,\n /** Type mismatch or invalid type provided */\n INVALID_TYPE,\n\n // Blockchain Transaction Errors\n /** Insufficient balance to perform the operation */\n INSUFFICIENT_FUNDS,\n /** Invalid blockchain address format */\n INVALID_ADDRESS,\n /** Transaction reverted or failed on-chain */\n TRANSACTION_FAILED,\n /** Expected transaction event not found in logs */\n TRANSACTION_EVENT_NOT_FOUND,\n\n // Infrastructure & Network Errors\n /** Network connectivity or RPC communication failure */\n NETWORK_ERROR,\n\n // Validation & Input Errors\n /** Invalid parameter provided to a method */\n INVALID_PARAMETER,\n /** Required parameter is missing */\n MISSING_PARAMETER,\n /** Numeric value outside acceptable range */\n PARAMETER_OUT_OF_RANGE,\n}\n\n/**\n * Base interface for all Bolt SDK errors.\n *\n * All custom errors in the SDK implement this interface, providing\n * a consistent error structure with error codes for easy handling.\n *\n * @interface\n * @group Errors\n * @category Error Types\n */\nexport interface BoltSdkError extends Error {\n /** The error code categorizing this error */\n code: BoltSdkErrorCode;\n}\n\n/**\n * Base class for all custom errors in the Bolt SDK.\n *\n * This abstract base class provides common functionality for all SDK errors,\n * including error code assignment and proper error name setting.\n *\n * @abstract\n * @group Errors\n * @category Error Classes\n */\nexport class BoltSdkErrorBase extends Error implements BoltSdkError {\n /**\n * Creates a new BoltSdkErrorBase instance.\n *\n * @param code - The error code categorizing this error\n * @param message - Human-readable error message\n */\n constructor(\n public code: BoltSdkErrorCode,\n message: string\n ) {\n super(message);\n this.name = this.constructor.name; // Set the error name to the class name\n }\n}\n\n// Resource & Data Errors\n\n/**\n * Error thrown when a requested resource cannot be found.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class NotFoundError extends BoltSdkErrorBase {\n /**\n * Creates a new NotFoundError instance.\n *\n * @param resource - The type of resource that was not found\n * @param details - Optional additional details about what was searched for\n */\n constructor(resource: string, details?: string) {\n super(\n BoltSdkErrorCode.NOT_FOUND,\n `Resource not found: ${resource}.${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when an object doesn't have the expected structure.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidObjectError extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidObjectError instance.\n *\n * @param details - Optional description of what is invalid about the object\n */\n constructor(details?: string) {\n super(\n BoltSdkErrorCode.INVALID_OBJECT,\n `Invalid object or data structure!${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when an unexpected type is encountered.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidTypeError extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidTypeError instance.\n *\n * @param expectedType - The type that was expected\n * @param receivedType - The actual type that was received\n */\n constructor(expectedType: string, receivedType: string) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Invalid object type! Expected: ${expectedType}, Received: ${receivedType}`\n );\n }\n}\n\n// Blockchain Transaction Errors\n\n/**\n * Error thrown when an account has insufficient funds for an operation.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InsufficientFundsError extends BoltSdkErrorBase {\n /**\n * Creates a new InsufficientFundsError instance.\n *\n * @param required - The amount required for the operation\n * @param available - The amount available in the account\n */\n constructor(required: number, available: number) {\n super(\n BoltSdkErrorCode.INSUFFICIENT_FUNDS,\n `Insufficient funds to complete the transaction! Required: ${required}, Available: ${available}`\n );\n }\n}\n\n/**\n * Error thrown when an invalid blockchain address is provided.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidAddressError extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidAddressError instance.\n *\n * @param address - The invalid address that was provided\n */\n constructor(address: string) {\n super(BoltSdkErrorCode.INVALID_ADDRESS, `Invalid blockchain address provided: ${address}`);\n }\n}\n\n/**\n * Error thrown when a blockchain transaction fails or is reverted.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class TransactionFailedError extends BoltSdkErrorBase {\n /**\n * Creates a new TransactionFailedError instance.\n *\n * @param transactionId - The transaction hash or identifier\n * @param details - Optional details about why the transaction failed\n */\n constructor(transactionId: string, details?: string) {\n super(\n BoltSdkErrorCode.TRANSACTION_FAILED,\n `Transaction failed or was reverted! Transaction ID: ${transactionId}.${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when an expected transaction event is not found in the logs.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class TransactionEventNotFoundError extends BoltSdkErrorBase {\n /**\n * Creates a new TransactionEventNotFoundError instance.\n *\n * @param eventName - The name of the event that was expected\n * @param details - Optional details about the context\n */\n constructor(eventName: string, details?: string) {\n super(\n BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND,\n `Transaction Event not found: ${eventName}.${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n// Infrastructure & Network Errors\n\n/**\n * Error thrown when network communication fails.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class NetworkError extends BoltSdkErrorBase {\n /**\n * Creates a new NetworkError instance.\n *\n * @param details - Optional details about the network failure\n */\n constructor(details?: string) {\n super(\n BoltSdkErrorCode.NETWORK_ERROR,\n `Network error occurred!${details ? ` Details: ${details}` : ''}`\n );\n }\n}\n\n// Validation & Input Errors\n\n/**\n * Error thrown when an invalid parameter is provided to a method.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class InvalidParameterError<T = unknown> extends BoltSdkErrorBase {\n /**\n * Creates a new InvalidParameterError instance.\n *\n * @param parameterName - The name of the invalid parameter\n * @param expected - Description of what was expected\n * @param receivedValue - The actual value that was provided\n * @param details - Optional additional details or constraints\n *\n * @template T - The type of the received value\n */\n constructor(parameterName: string, expected: string, receivedValue: T, details?: string) {\n super(\n BoltSdkErrorCode.INVALID_PARAMETER,\n `Invalid parameter '${parameterName}': expected ${expected}, received ${typeof receivedValue}${\n details ? `. ${details}` : ''\n }`\n );\n }\n}\n\n/**\n * Error thrown when a required parameter is missing.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class MissingParameterError extends BoltSdkErrorBase {\n /**\n * Creates a new MissingParameterError instance.\n *\n * @param parameterName - The name of the missing parameter\n * @param context - Optional context about where the parameter was expected\n */\n constructor(parameterName: string, context?: string) {\n super(\n BoltSdkErrorCode.MISSING_PARAMETER,\n `Required parameter '${parameterName}' is missing${context ? ` in ${context}` : ''}`\n );\n }\n}\n\n/**\n * Error thrown when a numeric parameter is outside the acceptable range.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class ParameterOutOfRangeError extends BoltSdkErrorBase {\n /**\n * Creates a new ParameterOutOfRangeError instance.\n *\n * @param parameterName - The name of the parameter that's out of range\n * @param value - The actual value that was provided\n * @param min - Optional minimum acceptable value (inclusive)\n * @param max - Optional maximum acceptable value (inclusive)\n * @param details - Optional additional details about the constraint\n */\n constructor(\n parameterName: string,\n value: number | bigint,\n min?: number | bigint,\n max?: number | bigint,\n details?: string\n ) {\n let rangeMessage = '';\n if (min !== undefined && max !== undefined) {\n rangeMessage = ` Expected value between ${min} and ${max}, but received ${value}`;\n } else if (min !== undefined) {\n rangeMessage = ` Expected value >= ${min}, but received ${value}`;\n } else if (max !== undefined) {\n rangeMessage = ` Expected value <= ${max}, but received ${value}`;\n }\n\n super(\n BoltSdkErrorCode.PARAMETER_OUT_OF_RANGE,\n `Parameter '${parameterName}' is out of range.${rangeMessage}${details ? `. ${details}` : ''}`\n );\n }\n}\n","import { InvalidParameterError } from '../errors';\n\nimport type { Coin } from '../types';\n\n/**\n * Parses a coin string containing both amount and denomination into a structured Coin object.\n *\n * This utility function extracts the numeric amount and denomination from a concatenated string\n * where amounts are represented as a single string\n * (e.g., \"1000000uatom\", \"500000000aarch\").\n *\n * @param amountWithDenom - A string containing the amount immediately followed by the denomination,\n * with no spaces or separators. The amount must be a positive integer\n * (no decimals or scientific notation).\n *\n * @returns A Coin object containing:\n * - amount: The numeric portion as a string\n * - denom: The denomination portion as a string\n *\n * @throws {InvalidParameterError} Thrown when the input string doesn't match the expected format\n * or when the amount or denomination cannot be extracted\n *\n * @example\n * ```typescript\n * // Parse a standard Cosmos coin string\n * const coin = getCoinFromAmountWithDenomString(\"1000000uatom\");\n * console.log(coin); // { amount: \"1000000\", denom: \"uatom\" }\n *\n * // Parse an IBC token\n * const ibcCoin = getCoinFromAmountWithDenomString(\"500000000ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\");\n * console.log(ibcCoin); // { amount: \"500000000\", denom: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\" }\n *\n * // Parse a custom token\n * const customCoin = getCoinFromAmountWithDenomString(\"123456789aarch\");\n * console.log(customCoin); // { amount: \"123456789\", denom: \"aarch\" }\n * ```\n *\n * @example\n * ```typescript\n * // Invalid formats that will throw errors\n * try {\n * getCoinFromAmountWithDenomString(\"1000000\"); // Missing denom\n * } catch (error) {\n * console.error(\"No denomination found\");\n * }\n *\n * try {\n * getCoinFromAmountWithDenomString(\"uatom\"); // Missing amount\n * } catch (error) {\n * console.error(\"No amount found\");\n * }\n *\n * try {\n * getCoinFromAmountWithDenomString(\"1000000 uatom\"); // Contains space\n * } catch (error) {\n * console.error(\"Invalid format\");\n * }\n * ```\n */\nexport const getCoinFromAmountWithDenomString = (amountWithDenom: string): Coin => {\n const match = amountWithDenom.match(/^(\\d+)(.+)$/);\n if (!match || !match[1] || !match[2]) {\n throw new InvalidParameterError(\n 'amountWithDenom',\n 'a string with the amount followed by the denom',\n amountWithDenom\n );\n }\n\n return { amount: match[1], denom: match[2] };\n};\n","import { InvalidObjectError } from '../errors';\nimport type {\n Address,\n ClientConfig,\n Coin,\n Contracts,\n InvertiblePrice,\n Pool,\n OracleAssetPair,\n OracleConfig,\n Price,\n RouterConfig,\n SwapParams,\n SwapResult,\n PoolConfig,\n} from '../types';\n\n/**\n * Abstract base client for all implementations of the Bolt SDK for different chains/networks.\n *\n * This class provides the foundation for blockchain-specific implementations,\n * defining the core interface for interacting with oracle and router contracts.\n *\n * @template TSigner - The type of the transaction signer specific to the blockchain implementation\n *\n * @example\n * ```typescript\n * class BoltCosmWasmClient extends BaseClient<OfflineSigner> {\n * // Implementation specific to CosmWasm\n * }\n * ```\n */\nexport abstract class BaseClient<TSigner = unknown> {\n /**\n * The RPC endpoint URL for connecting to the blockchain network\n */\n public rpcEndpoint: Address;\n\n /**\n * Smart contract addresses for making Bolt queries and transactions in the blockchain\n */\n public contracts: Contracts;\n\n /**\n * Creates a new instance of the BaseClient.\n *\n * @param config - (Optional) Configuration object for the client\n * @param config.customOverride - (Optional) Override configuration for RPC endpoint and contract addresses\n * @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL for the blockchain network\n * @param config.customOverride.contracts - (Optional) Custom contract addresses\n * @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address\n * @param config.customOverride.contracts.router - (Optional) Custom router contract address\n *\n * @throws {InvalidObjectError} Thrown when required configuration fields are missing\n *\n * @example\n * ```typescript\n * const client = new ConcreteClient({\n * override: {\n * rpcEndpoint: 'https://rpc.example.com',\n * contracts: {\n * oracle: 'archway1...',\n * router: 'archway1...'\n * }\n * }\n * });\n * ```\n */\n constructor(config?: ClientConfig) {\n const { customOverride: { rpcEndpoint, contracts } = {} } = config ?? {};\n\n if (!rpcEndpoint || !contracts?.oracle || !contracts.router) {\n throw new InvalidObjectError('ClientConfig is missing fields');\n }\n\n this.rpcEndpoint = rpcEndpoint;\n this.contracts = {\n oracle: contracts.oracle,\n router: contracts.router,\n };\n }\n\n /**\n * Fetches the oracle configuration from the blockchain.\n *\n * @returns A promise that resolves to the oracle configuration containing\n * settings such as price expiration time and threshold ratio\n *\n * @example\n * ```typescript\n * const oracleConfig = await client.getOracleConfig();\n * console.log(`Price expiration: ${oracleConfig.priceExpireTime} seconds`);\n * ```\n */\n abstract getOracleConfig(): Promise<OracleConfig>;\n\n /**\n * Fetches all asset pairs supported by the oracle.\n *\n * @returns A promise that resolves to an array of oracle asset pairs,\n * each containing base and quote asset information with name, symbol and precision\n *\n * @example\n * ```typescript\n * const pairs = await client.getAllOracleAssetPairs();\n * pairs.forEach(pair => {\n * console.log(`${pair.base.symbol}/${pair.quote.symbol}`);\n * console.log(` Base: ${pair.base.name}`);\n * console.log(` Quote: ${pair.quote.name}`);\n * });\n * ```\n */\n abstract getAllOracleAssetPairs(): Promise<OracleAssetPair[]>;\n\n /**\n * Fetches the current price for a specific base/quote asset pair.\n *\n * @param baseAssetSymbol - The chain symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteAssetSymbol - The chain symbol of the quote asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to an invertible price object containing\n * the current price from the oracle\n *\n * @example\n * ```typescript\n * // Get price of ARCH in terms of USDC\n * const priceResult = await client.getPrice(\"aarch\", \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\");\n * console.log(`1 ARCH = ${priceResult.price} USDC`);\n * ```\n */\n abstract getPrice(baseAssetSymbol: string, quoteAssetSymbol: string): Promise<InvertiblePrice>;\n\n /**\n * Fetches all available prices from the oracle.\n *\n * @returns A promise that resolves to an array of all current prices\n * available in the oracle with their respective asset pairs\n *\n * @example\n * ```typescript\n * const prices = await client.getAllPrices();\n * prices.forEach(priceData => {\n * console.log(`${priceData.assetPair}: ${priceData.price}`);\n * console.log(` Expires on: ${priceData.expiryTime}`);\n * });\n * ```\n */\n abstract getAllPrices(): Promise<Price[]>;\n\n /**\n * Fetches the router configuration from the blockchain.\n *\n * @returns A promise that resolves to the router configuration containing\n * settings such as default protocol fees, LP fees, and oracle configuration\n *\n * @example\n * ```typescript\n * const routerConfig = await client.getRouterConfig();\n * console.log(`Default protocol fee: ${routerConfig.defaultProtocolFee * 100}%`);\n * console.log(`Default LP fee: ${routerConfig.defaultLpFee * 100}%`);\n * ```\n */\n abstract getRouterConfig(): Promise<RouterConfig>;\n\n /**\n * Fetches the total liquidity for all base assets across all pools.\n *\n * @returns A promise that resolves to a record mapping pool addresses\n * to their respective base asset liquidity amounts\n *\n * @example\n * ```typescript\n * const liquidity = await client.getAllBaseAssetsLiquidity();\n * Object.entries(liquidity).forEach(([poolAddress, coin]) => {\n * console.log(`Pool ${poolAddress}: ${coin.amount} ${coin.denom}`);\n * });\n * ```\n */\n abstract getAllBaseAssetsLiquidity(): Promise<Record<Address, Coin>>;\n\n /**\n * Fetches all withdrawable quote assets for a specific user or liquidity provider.\n *\n * @param address - The blockchain address of the user or liquidity provider\n *\n * @returns A promise that resolves to a record mapping pool addresses\n * to arrays of withdrawable quote asset coins\n *\n * @example\n * ```typescript\n * const quotes = await client.getAllQuotesByUser(\"archway1...\");\n * Object.entries(quotes).forEach(([poolAddress, coins]) => {\n * console.log(`Pool ${poolAddress}:`);\n * coins.forEach(coin => {\n * console.log(` ${coin.amount} ${coin.symbol}`);\n * });\n * });\n * ```\n */\n abstract getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>>;\n\n /**\n * Fetches pool information for a specific base asset.\n *\n * @param baseAssetSymbol - The symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to the pool information for the specified asset\n *\n * @example\n * ```typescript\n * const pool = await client.getPoolByBaseAsset(\"aarch\");\n * console.log(`Pool address: ${pool.poolAddress}`);\n * console.log(`Base asset: ${pool.baseAssetSymbol}`);\n * console.log('Available quote assets:');\n * pool.quoteAssetsSymbols.forEach(symbol => {\n * console.log(` - ${symbol}`);\n * });\n * ```\n */\n abstract getPoolByBaseAsset(baseAssetSymbol: string): Promise<Pool>;\n\n /**\n * Fetches information for all available pools.\n *\n * @returns A promise that resolves to an array containing all pool information\n *\n * @throws Will throw an error if no pool exists for the specified base asset\n *\n * @example\n * ```typescript\n * const pools = await client.getAllPools();\n * pools.forEach(pool => {\n * console.log(`Pool ${pool.poolAddress}:`);\n * console.log(` Base: ${pool.baseAssetSymbol}`);\n * console.log(` Quotes: ${pool.quoteAssetsSymbols.join(', ')}`);\n * });\n * ```\n */\n abstract getAllPools(): Promise<Pool[]>;\n\n /**\n * Fetches the configuration settings for a specific liquidity pool.\n *\n * This method retrieves detailed configuration parameters for a pool, including\n * fee structures, oracle settings, liquidity provider information, and trading limits.\n *\n * @param poolContractAddress - The blockchain address of the pool contract\n *\n * @returns A promise that resolves to a pool configuration object\n * containing settings such as fees, oracle address, LP addresses, and minimum trade amounts\n *\n * @example\n * ```typescript\n * const poolConfig = await client.getPoolConfig(\"archway1pool...\");\n * console.log(`Oracle: ${poolConfig.priceOracleContract}`);\n * console.log(`Protocol fee: ${poolConfig.protocolFee * 100}%`);\n * console.log(`LP fee: ${poolConfig.lpFee * 100}%`);\n * console.log(`Allowance mode: ${poolConfig.allowanceMode}`);\n * console.log(`LPs: ${poolConfig.lps.join(', ')}`);\n * console.log(`Min base output: ${poolConfig.minBaseOut}`);\n * ```\n */\n abstract getPoolConfig(poolContractAddress: string): Promise<PoolConfig>;\n\n /**\n * Fetches the configuration settings for a pool identified by its base asset symbol.\n *\n * This method retrieves the pool configuration by first looking up the pool\n * associated with the given base asset, then fetching its configuration parameters.\n *\n * @param baseAssetSymbol - The symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to a pool configuration object containing\n * settings such as fees, oracle address, LP addresses, and minimum trade amounts\n *\n * @throws Will throw an error if no pool exists for the specified base asset\n *\n * @example\n * ```typescript\n * // Get pool configuration for ARCH base asset\n * const poolConfig = await client.getPoolConfigByBaseAsset(\"aarch\");\n * console.log(`Oracle: ${poolConfig.priceOracleContract}`);\n * console.log(`Protocol fee: ${poolConfig.protocolFee * 100}%`);\n * console.log(`LP fee: ${poolConfig.lpFee * 100}%`);\n * console.log(`Allowance mode: ${poolConfig.allowanceMode}`);\n * console.log(`Number of LPs: ${poolConfig.lps.length}`);\n * console.log(`Min base output: ${poolConfig.minBaseOut}`);\n * ```\n */\n abstract getPoolConfigByBaseAsset(baseAssetSymbol: string): Promise<PoolConfig>;\n\n /**\n * Executes a \"swap exact in\" operation on the blockchain from one asset to another.\n *\n * This method performs a swap where the exact input amount is specified, and the output\n * amount varies based on current pool conditions and fees. The transaction includes\n * slippage protection through the optional minimumAmountOut parameter.\n *\n * @param signer - The transaction signer that will authorize the swap operation.\n * Must have sufficient balance of the input asset.\n * @param params - The swap configuration parameters\n * @param params.assetIn - The denom of the asset being sold (e.g., \"aarch\", \"ibc/...\")\n * @param params.amountIn - The exact amount of input asset to swap (in minimal denomination)\n * @param params.assetOut - The denom of the asset being bought (e.g., \"aarch\", \"ibc/...\")\n * @param params.minimumAmountOut - Optional minimum acceptable amount of output asset.\n * Transaction will fail if actual output would be less.\n * @param params.receiver - Optional recipient address for the swapped assets.\n * If not provided, defaults to the signer's address.\n *\n * @returns A promise that resolves to the swap result containing transaction\n * details and the actual amount of output asset received\n *\n * @throws Will throw an error if the swap fails due to insufficient balance,\n * slippage exceeding tolerance, or other transaction errors\n *\n * @example\n * ```typescript\n * // Swap exactly 1 ARCH for USDC (output amount varies)\n * const result = await client.swapExactIn(signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // Exactly 1 ARCH (18 decimals)\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * minimumAmountOut: \"1950000000\", // Accept no less than 1950 USDC\n * receiver: \"archway1...\" // Optional custom receiver\n * });\n *\n * console.log(`Swapped exactly 1 ARCH`);\n * console.log(`Received: ${result.amountOut} USDC`);\n * console.log(`Transaction: ${result.txHash}`);\n * ```\n *\n * @remarks\n * This is a \"swap exact in\" operation where:\n * - The input amount is exactly what you specify\n * - The output amount depends on pool conditions\n * - Fees are deducted from the output\n * - Use minimumAmountOut to protect against excessive slippage\n */\n abstract swapExactIn(signer: TSigner, params: SwapParams): Promise<SwapResult>;\n}\n","export enum Environment {\n Mainnet = 'mainnet',\n Testnet = 'testnet',\n}\n","import type { Address } from './common';\n\nexport enum AllowanceMode {\n Allow = 'allow',\n Disallow = 'disallow',\n}\n\nexport interface PoolConfig {\n priceOracleContract: Address;\n protocolFeeRecipient: Address;\n protocolFee: string;\n lpFee: string;\n allowanceMode: AllowanceMode;\n lps: Address[];\n minBaseOut: string;\n}\n","{\n \"chain\": {\n \"name\": \"Archway\",\n \"rpcEndpoint\": \"https://rpc.mainnet.archway.io\",\n \"restEndpoint\": \"https://api.mainnet.archway.io\"\n },\n \"contracts\": {\n \"oracle\": \"archway1cr5l0tvhqsdjfzun4jkwqfzv7fadu598hultcra4jrljgwl639wsksmd28\",\n \"router\": \"archway199r5vm4yzww5hct2z58tz9v3chfcvkpln34sqcav3ldqs7nkwktqc7aeju\"\n }\n}\n","{\n \"chain\": {\n \"name\": \"Archway Testnet\",\n \"rpcEndpoint\": \"https://rpc.constantine.archway.io\",\n \"restEndpoint\": \"https://api.constantine.archway.io\"\n },\n \"contracts\": {\n \"oracle\": \"archway1r3ug542dq4arzxsjz4kmpvpez2z830rl0u66k00ft3zrugs8k98qwyxgda\",\n \"router\": \"archway1h5x6upghew9xkfek85q48let2twdxq33sgsnzze5weshla46xd8sttps44\"\n }\n}\n","import type { BoltCosmWasmClient } from '../client';\nimport type { OracleAssetPair } from '../../common';\nimport type { QueryAssetPairsResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve all supported asset pairs.\n *\n * This function fetches the complete list of trading pairs that the oracle contract\n * supports for price feeds. Each asset pair represents a base/quote relationship\n * that can be used for price queries and swaps within the Bolt protocol.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n *\n * @returns A promise that resolves to an array of OracleAssetPair objects, each containing:\n * - base: Information about the base asset (name, symbol, precision)\n * - quote: Information about the quote asset (name, symbol, precision)\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The oracle contract is not properly initialized\n * - The response format is invalid\n */\nexport const getAssetPairs = async (client: BoltCosmWasmClient): Promise<OracleAssetPair[]> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n asset_pairs: {},\n })) as QueryAssetPairsResponse;\n\n return response.list;\n};\n","import type {\n InvertiblePrice,\n Pool,\n OracleConfig,\n Price,\n RouterConfig,\n PoolConfig,\n} from '../../common';\nimport type {\n InvertiblePriceRepresentation,\n MarketRepresentation,\n PriceRepresentation,\n QueryMarketsResponse,\n QueryOracleConfigResponse,\n QueryPriceResponse,\n QueryPricesResponse,\n QueryRouterConfigResponse,\n QuerySettlementConfigResponse,\n} from '../../types';\n\n/**\n * Parses a raw oracle configuration response from the blockchain into a structured OracleConfig object.\n *\n * This function transforms the snake_case properties from the CosmWasm contract response\n * into camelCase properties following TypeScript conventions.\n *\n * @param response - The raw oracle configuration response from the contract query\n *\n * @returns A parsed OracleConfig object with:\n * - admin: The admin address of the oracle contract\n * - priceThresholdRatio: The threshold ratio for price updates\n * - priceExpireTime: Unix timestamp in nanoseconds when the price expires\n *\n * @example\n * ```typescript\n * const rawResponse = {\n * admin: \"archway1...\",\n * price_threshold_ratio: \"0.01\",\n * price_expire_time: \"1752059586581821725\"\n * };\n *\n * const config = parseQueryOracleConfigResponse(rawResponse);\n * console.log(config.priceThresholdRatio); // 0.01\n * ```\n */\nexport const parseQueryOracleConfigResponse = (\n response: QueryOracleConfigResponse\n): OracleConfig => {\n return {\n admin: response.admin,\n priceThresholdRatio: response.price_threshold_ratio,\n priceExpireTime: response.price_expire_time,\n };\n};\n\n/**\n * Parses a raw price representation from the blockchain into a structured Price object.\n *\n * Transforms snake_case properties to camelCase for consistency with TypeScript conventions.\n *\n * @param priceRepresentation - The raw price data from the contract\n *\n * @returns A parsed Price object containing:\n * - assetPair: The trading pair (e.g., \"ARCH/USDC\")\n * - price: The current price as a string\n * - expiryTime: Unix timestamp in nanoseconds when the price expires\n *\n * @example\n * ```typescript\n * const rawPrice = {\n * asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * price: \"250\",\n * expiry_time: \"1752059586581821725\"\n * };\n *\n * const price = parsePrice(rawPrice);\n * console.log(`${price.assetPair}: ${price.price}`); // \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D: 250\"\n * ```\n */\nexport const parsePriceRepresentation = (priceRepresentation: PriceRepresentation): Price => {\n return {\n assetPair: priceRepresentation.asset_pair,\n price: priceRepresentation.price,\n expiryTime: priceRepresentation.expiry_time,\n };\n};\n\n/**\n * Parses a raw invertible price representation into a structured InvertiblePrice object.\n *\n * An invertible price includes all standard price information plus a flag indicating\n * whether the price has been inverted from its original pair order.\n *\n * @param invertiblePriceRepresentation - The raw invertible price data from the contract\n *\n * @returns A parsed InvertiblePrice object containing all Price properties plus:\n * - isInverse: Boolean indicating if the price is inverted from the original pair\n *\n * @example\n * ```typescript\n * const rawInvertiblePrice = {\n * asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * price: \"40\",\n * expiry_time: \"1752059586581821725\",\n * is_inverse: true\n * };\n *\n * const invertiblePrice = parseInvertiblePrice(rawInvertiblePrice);\n * console.log(invertiblePrice.isInverse); // true (price was inverted)\n * ```\n */\nexport const parseInvertiblePrice = (\n invertiblePriceRepresentation: InvertiblePriceRepresentation\n): InvertiblePrice => {\n return {\n ...parsePriceRepresentation(invertiblePriceRepresentation),\n isInverse: invertiblePriceRepresentation.is_inverse,\n };\n};\n\n/**\n * Parses a query price response from the oracle contract into an InvertiblePrice object.\n *\n * This function extracts the pair data from the response and delegates to parseInvertiblePrice.\n *\n * @param response - The raw response from the oracle's price query\n *\n * @returns A parsed InvertiblePrice object\n *\n * @example\n * ```typescript\n * const response = {\n * pair_data: {\n * asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * price: \"250\",\n * expiry_time: \"1752059586581821725\",\n * is_inverse: false\n * }\n * };\n *\n * const price = parseQueryPriceResponse(response);\n * console.log(price.price); // \"250\"\n * ```\n */\nexport const parseQueryPriceResponse = (response: QueryPriceResponse): InvertiblePrice => {\n return parseInvertiblePrice(response.pair_data);\n};\n\n/**\n * Parses a query prices response containing multiple prices into an array of Price objects.\n *\n * @param response - The raw response from the oracle's all prices query\n *\n * @returns An array of parsed Price objects\n *\n * @example\n * ```typescript\n * const response = {\n * prices: [\n * { asset_pair: \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", price: \"250\", expiry_time: \"1752059586581821725\" },\n * { asset_pair: \"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", price: \"075\", expiry_time: \"1752059586581821736\" }\n * ]\n * };\n *\n * const prices = parseQueryPricesResponse(response);\n * console.log(prices.length); // 2\n * prices.forEach(p => console.log(`${p.assetPair}: ${p.price}`));\n * ```\n */\nexport const parseQueryPricesResponse = (response: QueryPricesResponse): Price[] => {\n return response.prices.map((item) => parsePriceRepresentation(item));\n};\n\n/**\n * Parses a raw pool/market representation from the blockchain into a structured Pool object.\n *\n * Transforms snake_case properties to camelCase and organizes pool information.\n *\n * @param marketRepresentation - The raw pool data from the contract\n *\n * @returns A parsed Pool object containing:\n * - poolAddress: The contract address of the pool\n * - baseAssetSymbol: The symbol of the base asset\n * - quoteAssetsSymbols: Array of available quote asset symbols\n *\n * @example\n * ```typescript\n * const rawPoolOrMarket = {\n * market_address: \"archway1xyz...\",\n * base_asset_symbol: \"aarch\",\n * quote_assets_symbols: [\"ibc/ABC123...\", \"ibc/DEF456...\"]\n * };\n *\n * const pool = parsePoolRepresentation(rawPool);\n * console.log(pool.baseAssetSymbol); // \"aarch\"\n * console.log(pool.quoteAssetsSymbols); // [\"ibc/ABC123...\", \"ibc/DEF456...\"]\n * ```\n */\nexport const parseMarketRepresentation = (marketRepresentation: MarketRepresentation): Pool => {\n return {\n poolAddress: marketRepresentation.market_address,\n baseAssetSymbol: marketRepresentation.base_asset_symbol,\n quoteAssetsSymbols: marketRepresentation.quote_assets_symbols,\n };\n};\n\n/**\n * Parses a query markets response containing all available pools into an array of Pool objects.\n *\n * @param response - The raw response from the router's pools query\n *\n * @returns An array of parsed Pool objects\n *\n * @example\n * ```typescript\n * const response = {\n * pools: [\n * {\n * pool_address: \"archway1abc...\",\n * base_asset_symbol: \"aarch\",\n * quote_assets_symbols: [\"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\"]\n * },\n * {\n * pool_address: \"archway1def...\",\n * base_asset_symbol: \"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2\",\n * quote_assets_symbols: [\"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", \"aarch\"]\n * }\n * ]\n * };\n *\n * const pools = parseQueryMarketsResponse(response);\n * console.log(pools.length); // 2\n * pools.forEach(m => {\n * console.log(`Pool for ${m.baseAssetSymbol} at ${m.poolAddress}`);\n * });\n * ```\n */\nexport const parseQueryMarketsResponse = (response: QueryMarketsResponse): Pool[] => {\n return response.markets.map((item): Pool => parseMarketRepresentation(item));\n};\n\n/**\n * Parses a raw router configuration response from the blockchain into a structured RouterConfig object.\n *\n * This function transforms the snake_case properties from the CosmWasm contract response\n * into camelCase properties following TypeScript conventions.\n *\n * @param response - The raw router configuration response from the contract query\n *\n * @returns A parsed RouterConfig object with:\n * - admin: The admin address of the router contract\n * - defaultPriceOracleContract: Address of the default price oracle\n * - defaultProtocolFeeRecipient: Address that receives protocol fees\n * - defaultProtocolFee: The default protocol fee percentage (as decimal string)\n * - defaultLpFee: The default liquidity provider fee percentage (as decimal string)\n * - settlementCodeId: Code ID for settlement contract instantiation\n *\n * @example\n * ```typescript\n * const rawResponse = {\n * admin: \"archway1admin...\",\n * default_price_oracle_contract: \"archway1oracle...\",\n * default_protocol_fee_recipient: \"archway1treasury...\",\n * default_protocol_fee: \"0.003\",\n * default_lp_fee: \"0.002\",\n * settlement_code_id: 123\n * };\n *\n * const config = parseQueryRouterConfigResponse(rawResponse);\n * console.log(config.defaultProtocolFee); // \"0.003\" (0.3%)\n * console.log(config.settlementCodeId); // 123\n * ```\n */\nexport const parseQueryRouterConfigResponse = (\n response: QueryRouterConfigResponse\n): RouterConfig => {\n return {\n admin: response.admin,\n defaultPriceOracleContract: response.default_price_oracle_contract,\n defaultProtocolFeeRecipient: response.default_protocol_fee_recipient,\n defaultProtocolFee: response.default_protocol_fee,\n defaultLpFee: response.default_lp_fee,\n settlementCodeId: response.settlement_code_id,\n };\n};\n\n/**\n * Parses a raw settlement configuration response from the blockchain into a structured PoolConfig object.\n *\n * This function transforms the snake_case properties from the CosmWasm contract response\n * into camelCase properties following TypeScript conventions. The settlement configuration\n * represents the specific settings for a liquidity pool.\n *\n * @param response - The raw settlement configuration response from the contract query\n *\n * @returns A parsed PoolConfig object with:\n * - priceOracleContract: Address of the price oracle used by this pool\n * - protocolFeeRecipient: Address that receives protocol fees for this pool\n * - protocolFee: The protocol fee percentage for this pool (as decimal string)\n * - lpFee: The liquidity provider fee percentage (as decimal string)\n * - allowanceMode: The allowance mode for the pool's operations\n * - lps: Array of liquidity provider addresses\n * - minBaseOut: Minimum base asset output amount for trades\n *\n * @example\n * ```typescript\n * const rawResponse = {\n * price_oracle_contract: \"archway1oracle...\",\n * protocol_fee_recipient: \"archway1treasury...\",\n * protocol_fee: \"0.003\",\n * lp_fee: \"0.002\",\n * allowance_mode: \"allowed\",\n * lps: [\"archway1lp1...\", \"archway1lp2...\"],\n * min_base_out: \"1000000\"\n * };\n *\n * const config = parseQuerySettlementConfigResponse(rawResponse);\n * console.log(config.protocolFee); // \"0.003\" (0.3%)\n * console.log(config.lps.length); // 2\n * console.log(config.minBaseOut); // \"1000000\"\n * ```\n */\nexport const parseQuerySettlementConfigResponse = (\n response: QuerySettlementConfigResponse\n): PoolConfig => {\n return {\n priceOracleContract: response.price_oracle_contract,\n protocolFeeRecipient: response.protocol_fee_recipient,\n protocolFee: response.protocol_fee,\n lpFee: response.lp_fee,\n allowanceMode: response.allowance_mode,\n lps: response.lps,\n minBaseOut: response.min_base_out,\n };\n};\n","import type { OfflineSigner } from '@cosmjs/proto-signing';\n\nimport { NotFoundError } from '../../common';\n\n/**\n * Extracts the primary address from a CosmJS offline signer.\n *\n * This utility function retrieves the first account's address from an OfflineSigner,\n * which is typically the main account used for signing transactions. This is commonly\n * needed when you need to know the address that will be signing a transaction or\n * when setting default values like the receiver address in a swap operation.\n *\n * @param signer - The CosmJS OfflineSigner instance (e.g., from Keplr, Leap, or other Cosmos wallets)\n *\n * @returns A promise that resolves to the address string of the first account in the signer\n *\n * @throws {NotFoundError} Thrown when the signer has no accounts or the accounts array is empty.\n * This can happen if the wallet is locked or no accounts are available.\n *\n * @example\n * ```typescript\n * // Using with Keplr wallet\n * const chainId = \"archway-1\";\n * const signer = await window.keplr.getOfflineSignerAuto(chainId);\n *\n * try {\n * const address = await getSignerAddress(signer);\n * console.log(\"Signer address:\", address); // \"archway1abc...\"\n * } catch (error) {\n * console.error(\"No accounts found in signer\");\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using with a mnemonic-based signer\n * import { DirectSecp256k1HdWallet } from \"@cosmjs/proto-signing\";\n *\n * const wallet = await DirectSecp256k1HdWallet.fromMnemonic(\n * \"your mnemonic phrase here\",\n * { prefix: \"archway\" }\n * );\n *\n * const address = await getSignerAddress(wallet);\n * console.log(\"Wallet address:\", address); // \"archway1...\"\n * ```\n * ```\n */\nexport const getSignerAddress = async (signer: OfflineSigner): Promise<string> => {\n const accounts = await signer.getAccounts();\n\n if (!accounts?.[0]) {\n throw new NotFoundError(\"Signer account's address\");\n }\n\n return accounts[0].address;\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { OracleConfig } from '../../common';\nimport { parseQueryOracleConfigResponse } from '../helpers';\nimport type { QueryOracleConfigResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve its current configuration settings.\n *\n * This function fetches the oracle's configuration parameters which govern how\n * price feeds are managed, including expiration times, update thresholds, and\n * administrative settings. The raw response is automatically parsed into a\n * structured format for easier consumption.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n *\n * @returns A promise that resolves to an OracleConfig object containing:\n * - admin: The admin address that can update oracle settings\n * - priceThresholdRatio: The minimum price change ratio required for updates (as decimal string)\n * - priceExpireTime: Unix timestamp in nanoseconds indicating price validity duration\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The oracle contract is not found at the configured address\n * - The response cannot be parsed into the expected format\n */\nexport const getOracleConfig = async (client: BoltCosmWasmClient): Promise<OracleConfig> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n config: {},\n })) as QueryOracleConfigResponse;\n\n return parseQueryOracleConfigResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { InvertiblePrice } from '../../common';\nimport { parseQueryPriceResponse } from '../helpers';\nimport type { QueryPriceResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve the current price for a specific asset pair.\n *\n * This function fetches the latest price feed for a given base/quote asset combination.\n * The oracle may return the price in either direction (base/quote or quote/base) and\n * will indicate if the price has been inverted via the `isInverse` flag in the response.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n * @param baseAssetSymbol - The symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteAssetSymbol - The symbol of the quote asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to an InvertiblePrice object containing:\n * - assetPair: The trading pair in format \"base:quote\" (e.g., \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\")\n * - price: The current price as a string (typically an integer representation)\n * - expiryTime: Unix timestamp in nanoseconds when this price expires\n * - isInverse: Boolean indicating if the price was inverted from the stored pair\n *\n * @throws Will throw an error if:\n * - The asset pair is not supported by the oracle\n * - Either asset symbol is invalid or not recognized\n * - The contract query fails due to network issues\n */\nexport const getPrice = async (\n client: BoltCosmWasmClient,\n baseAssetSymbol: string,\n quoteAssetSymbol: string\n): Promise<InvertiblePrice> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n get_price: { base_asset_symbol: baseAssetSymbol, quote_asset_symbol: quoteAssetSymbol },\n })) as QueryPriceResponse;\n\n return parseQueryPriceResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Price } from '../../common';\nimport { parseQueryPricesResponse } from '../helpers';\nimport type { QueryPricesResponse } from '../../types';\n\n/**\n * Queries the oracle smart contract to retrieve all available price feeds at once.\n *\n * This function fetches the current prices for all asset pairs supported by the oracle\n * in a single query. This is more efficient than making multiple individual price\n * queries when you need prices for multiple pairs. Each price includes its expiration\n * time, allowing you to determine if the data is still fresh.\n *\n * @param client - The BoltCosmWasmClient instance configured with the oracle contract address\n *\n * @returns A promise that resolves to an array of Price objects, each containing:\n * - assetPair: The trading pair in format \"base:quote\" (e.g., \"aarch:ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\")\n * - price: The current price as a string (integer representation)\n * - expiryTime: Unix timestamp in nanoseconds when this price expires\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The oracle contract is not properly initialized\n * - The response cannot be parsed into the expected format\n */\nexport const getPrices = async (client: BoltCosmWasmClient): Promise<Price[]> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.oracle, {\n get_prices: {},\n })) as QueryPricesResponse;\n\n return parseQueryPricesResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Address, Coin } from '../../common';\nimport type { QueryBaseLiquidityAllResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve the total base asset liquidity across all pools.\n *\n * This function fetches the current liquidity levels for all base assets in their respective\n * pools. Each pool in the Bolt protocol handles swaps for a specific base asset against\n * multiple quote assets, and this query returns how much of each base asset is currently\n * available in its pool for trading.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n *\n * @returns A promise that resolves to a Record mapping pool addresses to Coin objects.\n * Each entry represents:\n * - Key: The pool contract address\n * - Value: A Coin object containing:\n * - amount: The quantity of base asset liquidity (as string)\n * - denom: The denomination of the base asset\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The router contract is not properly initialized\n */\nexport const getAllBaseLiquidity = async (\n client: BoltCosmWasmClient\n): Promise<Record<Address, Coin>> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n base_liquidity_all: {},\n })) as QueryBaseLiquidityAllResponse;\n\n return response.liquidity;\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Address, Coin } from '../../common';\nimport type { QueryQuotesForUserAllResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve all quote asset positions for a specific liquidity provider.\n *\n * This function fetches all withdrawable quote assets that a liquidity provider (LP) has\n * deposited across all pools in the Bolt protocol. LPs provide quote assets (like USDC)\n * to pools, enabling traders to swap base assets for these quote assets. This query\n * returns what quote assets the LP can withdraw from each pool.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n * @param lpAddress - The blockchain address of the liquidity provider to query\n *\n * @returns A promise that resolves to a Record mapping pool addresses to arrays of Coin objects.\n * Each entry represents:\n * - Key: The pool contract address\n * - Value: An array of Coin objects, each containing:\n * - amount: The withdrawable quantity of quote asset (as string)\n * - denom: The denomination of the quote asset\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The provided address is invalid\n * - The router contract is not properly initialized\n */\nexport const getAllQuotesForUser = async (\n client: BoltCosmWasmClient,\n lpAddress: Address\n): Promise<Record<Address, Coin[]>> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n quotes_for_user_all: { lp_address: lpAddress },\n })) as QueryQuotesForUserAllResponse;\n\n return response.quotes;\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Pool } from '../../common';\nimport { parseMarketRepresentation } from '../helpers';\nimport type { MarketRepresentation } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve pool information for a specific base asset.\n *\n * This function fetches the pool details for a given base asset symbol. In the Bolt protocol,\n * each pool is dedicated to trading one base asset against multiple quote assets. This query\n * returns the pool address and available quote assets for the specified base asset.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n * @param baseAssetSymbol - The symbol of the base asset to query (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to a Pool object containing:\n * - poolAddress: The contract address of the pool\n * - baseAssetSymbol: The symbol of the base asset (echoes the input)\n * - quoteAssetsSymbols: Array of symbols for available quote assets\n *\n * @throws Will throw an error if:\n * - No pool exists for the specified base asset\n * - The base asset symbol is invalid or not recognized\n * - The contract query fails due to network issues\n */\nexport const getPoolForBase = async (\n client: BoltCosmWasmClient,\n baseAssetSymbol: string\n): Promise<Pool> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n market_for_base: { base_asset: baseAssetSymbol },\n })) as MarketRepresentation;\n\n return parseMarketRepresentation(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Pool } from '../../common';\nimport { parseQueryMarketsResponse } from '../helpers';\nimport type { QueryMarketsResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve information about all deployed pools.\n *\n * This function fetches a comprehensive list of all pools in the Bolt protocol,\n * including their addresses, base assets, and available quote assets. This provides\n * a complete overview of all trading possibilities within the protocol at once,\n * making it more efficient than querying individual pools.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n *\n * @returns A promise that resolves to an array of Pool objects, each containing:\n * - poolAddress: The contract address of the pool\n * - baseAssetSymbol: The symbol of the base asset for this pool\n * - quoteAssetsSymbols: Array of symbols for available quote assets\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The router contract is not properly initialized\n * - The response cannot be parsed into the expected format\n */\nexport const getPools = async (client: BoltCosmWasmClient): Promise<Pool[]> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n markets: {},\n })) as QueryMarketsResponse;\n\n return parseQueryMarketsResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { RouterConfig } from '../../common';\nimport { parseQueryRouterConfigResponse } from '../helpers';\nimport type { QueryRouterConfigResponse } from '../../types';\n\n/**\n * Queries the router smart contract to retrieve its current configuration settings.\n *\n * This function fetches the router's configuration parameters which govern how\n * swaps are executed, fees are collected, and new pools are deployed. The router\n * is the central contract that coordinates all trading activities in the Bolt protocol.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n *\n * @returns A promise that resolves to a RouterConfig object containing:\n * - admin: The admin address that can update router settings\n * - defaultPriceOracleContract: Address of the default price oracle used by pools\n * - defaultProtocolFeeRecipient: Address that receives protocol fees\n * - defaultProtocolFee: Protocol fee percentage as a decimal string (e.g., \"0.003\" = 0.3%)\n * - defaultLpFee: Liquidity provider fee percentage as a decimal string (e.g., \"0.002\" = 0.2%)\n * - settlementCodeId: Code ID used for instantiating new pool contracts\n *\n * @throws Will throw an error if:\n * - The contract query fails due to network issues\n * - The router contract is not found at the configured address\n * - The response cannot be parsed into the expected format\n */\nexport const getRouterConfig = async (client: BoltCosmWasmClient): Promise<RouterConfig> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(client.contracts.router, {\n config: {},\n })) as QueryRouterConfigResponse;\n\n return parseQueryRouterConfigResponse(response);\n};\n","export const BOLT_SWAP_EVENT_TYPE = 'wasm-bolt_swap';\nexport const BOLT_COIN_RECEIVED_EVENT_TYPE = 'coin_received';\nexport const BOLT_COIN_RECEIVED_EVENT_AMOUNT_KEY = 'amount';\n","import type { ExecuteResult } from '@cosmjs/cosmwasm-stargate';\nimport type { OfflineSigner } from '@cosmjs/proto-signing';\n\nimport type { BoltCosmWasmClient } from '../client';\nimport {\n type SwapParams,\n type SwapResult,\n TransactionEventNotFoundError,\n getCoinFromAmountWithDenomString,\n} from '../../common';\nimport {\n BOLT_COIN_RECEIVED_EVENT_AMOUNT_KEY,\n BOLT_COIN_RECEIVED_EVENT_TYPE,\n BOLT_SWAP_EVENT_TYPE,\n} from '../constants';\nimport { getSignerAddress } from '../helpers';\n\n/**\n * Executes a token swap transaction on the Bolt protocol through the router contract.\n *\n * This function performs a \"swap exact in\" operation, where the user specifies exactly\n * how much of the input asset they want to swap, and receives a variable amount of the\n * output asset based on current pool conditions. The function handles transaction\n * signing, execution, and parsing of the results to return the actual amount received.\n *\n * @param client - The BoltCosmWasmClient instance configured with the router contract address\n * @param signer - The offline signer that will authorize the swap transaction.\n * Must have sufficient balance of the input asset\n * @param params - The swap configuration parameters\n * @param params.assetIn - The denomination of the asset being sold (e.g., \"aarch\", \"ibc/...\")\n * @param params.amountIn - The exact amount of input asset to swap (as string, in minimal units)\n * @param params.assetOut - The denomination of the asset being bought (e.g., \"aarch\", \"ibc/...\")\n * @param params.minimumAmountOut - Optional minimum acceptable amount of output asset.\n * Transaction will revert if actual output is less\n * @param params.receiver - Optional recipient address for the swapped assets.\n * If not provided, defaults to the signer's address\n *\n * @returns A promise that resolves to a SwapResult containing:\n * - txOutput: The complete ExecuteResult from CosmWasm\n * - txHash: The transaction hash for tracking\n * - amountOut: The actual amount of output asset received (as string)\n * - assetOut: The output asset denomination (echoes the input parameter)\n *\n * @throws {TransactionEventNotFoundError} Thrown when:\n * - No BOLT_SWAP_EVENT is found in transaction events (swap failed)\n * - No COIN_RECEIVED_EVENT is found after the swap event (output not received)\n * @throws Will also throw if:\n * - Signer has insufficient balance of the input asset\n * - Slippage exceeds minimumAmountOut (transaction reverts)\n * - Pool doesn't exist for the asset pair\n * - Network or contract execution errors occur\n *\n * @example\n * ```typescript\n * // Basic swap: 1 ARCH for USDC\n * const signer = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {\n * prefix: \"archway\"\n * });\n *\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH (18 decimals)\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * });\n *\n * console.log(`Swapped 1 ARCH for ${result.amountOut} USDC`);\n * console.log(`Transaction: ${result.txHash}`);\n * ```\n *\n * @example\n * ```typescript\n * // Swap with slippage protection\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"5000000000000000000\", // 5 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC IBC denom\n * minimumAmountOut: \"9500000\", // Minimum 9.5 USDC (allowing ~5% slippage)\n * });\n *\n * // Transaction will revert if output would be less than 9.5 USDC\n * console.log(`Received: ${result.amountOut} USDC`);\n * ```\n *\n * @example\n * ```typescript\n * // Swap to a different receiver\n * const recipientAddress = \"archway1recipient...\";\n *\n * const result = await swap(client, signer, {\n * assetIn: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC\n * amountIn: \"10000000\", // 10 USDC (6 decimals)\n * assetOut: \"aarch\",\n * receiver: recipientAddress, // Send output to different address\n * });\n *\n * console.log(`Sent ${result.amountOut} ARCH to ${recipientAddress}`);\n * ```\n *\n * @example\n * ```typescript\n * // Error handling with detailed logging\n * try {\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\",\n * assetOut: \"ibc/UNKNOWN\",\n * });\n * } catch (error) {\n * if (error instanceof TransactionEventNotFoundError) {\n * if (error.message.includes(\"Bolt Swap Event\")) {\n * console.error(\"Swap failed - check if pool exists for this pair\");\n * } else if (error.message.includes(\"Coin Received Event\")) {\n * console.error(\"Swap executed but output not received - check logs\");\n * }\n * } else if (error.message.includes(\"insufficient funds\")) {\n * console.error(\"Insufficient balance for swap\");\n * } else {\n * console.error(\"Swap failed:\", error);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Calculate and display swap details\n * const result = await swap(client, signer, {\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\",\n * minimumAmountOut: \"1900000\", // Minimum 1.9 USDC\n * });\n *\n * // Parse amounts for display (assuming decimals)\n * const constAmount = BigInt(\"1000000000000000000\") / BigInt(10 ** 18);\n * const usdcAmount = BigInt(result.amountOut) / BigInt(10 ** 6);\n *\n * console.log(`Swap Summary:`);\n * console.log(` Sold: ${constAmount} ARCH`);\n * console.log(` Received: ${usdcAmount} USDC`);\n * console.log(` Rate: ${Number(usdcAmount) / Number(constAmount)} USDC per ARCH`);\n * console.log(` Gas used: ${result.txOutput.gasUsed}`);\n * ```\n *\n * @remarks\n * This function is used internally by the client's `swap()` method.\n *\n * The swap process:\n * 1. Retrieves the signer's address\n * 2. Executes the swap_exact_in message on the router\n * 3. Parses transaction events to find the swap result\n * 4. Extracts the actual amount received from events\n *\n * Important notes:\n * - The function uses \"swap exact in\" semantics - input amount is fixed, output varies\n * - Fees are automatically deducted according to router configuration\n * - The actual output amount comes from parsing transaction events\n * - Failed swaps throw errors rather than returning zero amounts\n * - Gas fees are set to 'auto' for automatic estimation\n *\n * Event parsing:\n * - Looks for BOLT_SWAP_EVENT to confirm swap execution\n * - Finds subsequent COIN_RECEIVED_EVENT to determine output amount\n * - Events must appear in order for successful parsing\n *\n * @see {@link BoltCosmWasmClient.swapExactIn} - The public client method that wraps this function\n * @see {@link SwapParams} - The structure of swap parameters\n * @see {@link SwapResult} - The structure of the return value\n * @see {@link getCoinFromAmountWithDenomString} - Used to parse event amounts\n */\nexport const swapExactIn = async (\n client: BoltCosmWasmClient,\n signer: OfflineSigner,\n { assetIn, amountIn, assetOut, minimumAmountOut, receiver }: SwapParams\n): Promise<SwapResult<ExecuteResult>> => {\n const signingCosmWasmClient = await client.getSigningCosmWasmClient(signer);\n\n const address = await getSignerAddress(signer);\n\n const txOutput = await signingCosmWasmClient.execute(\n address,\n client.contracts.router,\n {\n swap_exact_in: {\n want_out: assetOut,\n minimum_base_out: minimumAmountOut,\n receiver,\n },\n },\n 'auto',\n 'Swap using Bolt Typescript SDK',\n [{ amount: amountIn, denom: assetIn }]\n );\n\n const boltSwapEventIndex = txOutput.events.findIndex(\n (item) => item.type === BOLT_SWAP_EVENT_TYPE\n );\n\n if (boltSwapEventIndex === -1) {\n throw new TransactionEventNotFoundError(\n BOLT_SWAP_EVENT_TYPE,\n 'After the transaction was executed, no successful swap event was emitted, the transaction may have failed'\n );\n }\n\n let amountOut;\n\n for (let i = boltSwapEventIndex + 1; i < txOutput.events.length; i++)\n if (txOutput.events[i]?.type === BOLT_COIN_RECEIVED_EVENT_TYPE) {\n const amountWithDenomOut = txOutput.events[i]?.attributes.find(\n (attr) => attr.key === BOLT_COIN_RECEIVED_EVENT_AMOUNT_KEY\n )?.value;\n\n if (amountWithDenomOut) {\n try {\n amountOut = getCoinFromAmountWithDenomString(amountWithDenomOut).amount;\n break;\n } catch {\n /* empty */\n }\n }\n }\n\n if (!amountOut) {\n throw new TransactionEventNotFoundError(\n BOLT_COIN_RECEIVED_EVENT_TYPE,\n 'After the transaction was executed, no coin received event was emitted, the transaction may have failed'\n );\n }\n\n return {\n txOutput,\n txHash: txOutput.transactionHash,\n amountOut,\n assetOut,\n };\n};\n","import type { ArchwayClient, SigningArchwayClient } from '@archwayhq/arch3.js';\nimport type { CosmWasmClient, SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';\n\nimport type { ClientConfig } from '../common';\n\nexport interface CosmWasmClientConfig extends ClientConfig {\n chain?: CosmWasmChain;\n cosmWasmClient?: CosmWasmClient | ArchwayClient;\n signingCosmWasmClient?: SigningCosmWasmClient | SigningArchwayClient;\n}\n\nexport enum CosmWasmChain {\n Archway = 'archway',\n}\n","import type { BoltCosmWasmClient } from '../client';\nimport type { Address, PoolConfig } from '../../common';\nimport { parseQuerySettlementConfigResponse } from '../helpers';\nimport type { QuerySettlementConfigResponse } from '../../types';\n\n/**\n * Retrieves the configuration settings for a settlement contract (liquidity pool).\n *\n * This function queries a settlement contract on the CosmWasm blockchain to fetch its\n * current configuration parameters. The settlement contract manages liquidity pool\n * operations including swaps, fees, and liquidity provider management.\n *\n * @param client - The BoltCosmWasmClient instance used to interact with the blockchain\n * @param contractAddress - The blockchain address of the settlement contract to query\n *\n * @returns A promise that resolves to a PoolConfig object containing:\n * - priceOracleContract: Address of the price oracle used by this pool\n * - protocolFeeRecipient: Address that receives protocol fees\n * - protocolFee: The protocol fee percentage (as decimal string)\n * - lpFee: The liquidity provider fee percentage (as decimal string)\n * - allowanceMode: The allowance mode for pool operations\n * - lps: Array of authorized liquidity provider addresses\n * - minBaseOut: Minimum base asset output amount for trades\n *\n * @throws Will throw an error if:\n * - The contract address is invalid\n * - The contract query fails\n * - The response cannot be parsed\n */\nexport const getSettlementConfig = async (\n client: BoltCosmWasmClient,\n contractAddress: Address\n): Promise<PoolConfig> => {\n const cosmWasmClient = await client.getCosmWasmClient();\n\n const response = (await cosmWasmClient.queryContractSmart(contractAddress, {\n config: {},\n })) as QuerySettlementConfigResponse;\n\n return parseQuerySettlementConfigResponse(response);\n};\n","import type { BoltCosmWasmClient } from '../client';\nimport type { PoolConfig } from '../../common';\nimport { getSettlementConfig } from './get-settlement-config';\nimport { getPoolForBase } from '../router';\n\n/**\n * Retrieves the configuration settings for a settlement contract (liquidity pool)\n * identified by its base asset symbol.\n *\n * This is a convenience function that combines pool lookup and configuration retrieval.\n * It first finds the pool associated with the given base asset, then fetches that\n * pool's configuration parameters from its settlement contract.\n *\n * @param client - The BoltCosmWasmClient instance used to interact with the blockchain\n * @param baseAssetSymbol - The symbol of the base asset (e.g., \"aarch\", \"ibc/...\")\n *\n * @returns A promise that resolves to a PoolConfig object containing:\n * - priceOracleContract: Address of the price oracle used by this pool\n * - protocolFeeRecipient: Address that receives protocol fees\n * - protocolFee: The protocol fee percentage (as decimal string)\n * - lpFee: The liquidity provider fee percentage (as decimal string)\n * - allowanceMode: The allowance mode for pool operations\n * - lps: Array of authorized liquidity provider addresses\n * - minBaseOut: Minimum base asset output amount for trades\n *\n * @throws Will throw an error if:\n * - No pool exists for the specified base asset symbol\n * - The pool contract query fails\n * - The configuration response cannot be parsed\n */\nexport const getSettlementConfigForBase = async (\n client: BoltCosmWasmClient,\n baseAssetSymbol: string\n): Promise<PoolConfig> => {\n const pool = await getPoolForBase(client, baseAssetSymbol);\n\n return await getSettlementConfig(client, pool.poolAddress);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA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