@bolt-liquidity-hq/core 0.1.0-beta.12 → 0.1.0-beta.13
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.
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -16
- package/dist/index.d.ts +78 -16
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
MissingParameterError: () => MissingParameterError,
|
|
34
34
|
NetworkError: () => NetworkError,
|
|
35
35
|
NotFoundError: () => NotFoundError,
|
|
36
|
+
NotImplementedError: () => NotImplementedError,
|
|
36
37
|
ParameterOutOfRangeError: () => ParameterOutOfRangeError,
|
|
37
38
|
ParseError: () => ParseError,
|
|
38
39
|
TransactionEventNotFoundError: () => TransactionEventNotFoundError,
|
|
@@ -267,6 +268,23 @@ var ParameterOutOfRangeError = class extends BoltSdkErrorBase {
|
|
|
267
268
|
);
|
|
268
269
|
}
|
|
269
270
|
};
|
|
271
|
+
var NotImplementedError = class extends BoltSdkErrorBase {
|
|
272
|
+
/**
|
|
273
|
+
* Creates a new NotImplementedError instance.
|
|
274
|
+
*
|
|
275
|
+
* @param feature - The name of the feature or method that is not implemented
|
|
276
|
+
* @param plannedVersion - Optional version when the feature is planned to be implemented
|
|
277
|
+
* @param context - Optional additional context or state information
|
|
278
|
+
*/
|
|
279
|
+
constructor(feature, plannedVersion, context) {
|
|
280
|
+
const versionInfo = plannedVersion ? ` Planned for version ${plannedVersion}.` : "";
|
|
281
|
+
super(
|
|
282
|
+
4003 /* NOT_IMPLEMENTED */,
|
|
283
|
+
`Feature '${feature}' is not implemented yet.${versionInfo}`,
|
|
284
|
+
context
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
270
288
|
var UnexpectedError = class _UnexpectedError extends BoltSdkErrorBase {
|
|
271
289
|
/**
|
|
272
290
|
* Creates a new UnexpectedError instance.
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/constants/defaults.ts","../src/errors.ts","../src/helpers/asset.ts","../src/lib/client.ts"],"sourcesContent":["export * from './constants';\nexport * from './helpers';\nexport * from './lib';\nexport * from './types';\n\nexport * from './errors';\n","export const DEFAULT_GAS_ADJUSTMENT = 1.5;\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. Error codes are organized into ranges\n * by category for easier identification and handling.\n *\n * Error Code Ranges:\n * - 1000-1999: Resource & Data Errors\n * - 2000-2999: Blockchain Transaction Errors\n * - 3000-3999: Infrastructure & Network Errors\n * - 4000-4999: Validation & Input Errors\n * - 9000-9999: Unknown & Unexpected Errors\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.swap(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 * case BoltSdkErrorCode.UNEXPECTED_ERROR:\n * console.error(\"Unexpected error occurred:\", error.message);\n * break;\n * default:\n * console.error(\"Operation failed:\", error.message);\n * }\n * }\n * }\n * ```\n */\nconst enum BoltSdkErrorCode {\n /** Resource not found (pools, assets, configurations) */\n NOT_FOUND = 1000,\n /** Invalid object structure or missing required fields */\n INVALID_OBJECT = 1001,\n /** Type mismatch or invalid type provided */\n INVALID_TYPE = 1002,\n /** Insufficient balance to perform the operation */\n INSUFFICIENT_FUNDS = 2000,\n /** Invalid blockchain address format */\n INVALID_ADDRESS = 2001,\n /** Transaction reverted or failed on-chain */\n TRANSACTION_FAILED = 2002,\n /** Expected transaction event not found in logs */\n TRANSACTION_EVENT_NOT_FOUND = 2003,\n /** Network connectivity or RPC communication failure */\n NETWORK_ERROR = 3000,\n /** Invalid parameter provided to a method */\n INVALID_PARAMETER = 4000,\n /** Required parameter is missing */\n MISSING_PARAMETER = 4001,\n /** Numeric value outside acceptable range */\n PARAMETER_OUT_OF_RANGE = 4002,\n /** Unexpected or unknown error occurred */\n UNEXPECTED_ERROR = 9000,\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 /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\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, proper error name setting, and optional context data.\n *\n * @abstract\n * @group Errors\n * @category Error Classes\n */\nexport class BoltSdkErrorBase extends Error implements BoltSdkError {\n /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\n\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 * @param context - Optional additional context or state information\n */\n constructor(\n public code: BoltSdkErrorCode,\n message: string,\n context?: Record<string, unknown>\n ) {\n super(message);\n this.name = this.constructor.name; // Set the error name to the class name\n this.context = context;\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 * @param context - Optional additional context or state information\n */\n constructor(resource: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NOT_FOUND,\n `Resource not found: ${resource}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_OBJECT,\n `Invalid object or data structure!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(expectedType: string, receivedType: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Invalid object type! Expected: ${expectedType}, Received: ${receivedType}`,\n context\n );\n }\n}\n\n/**\n * Error thrown when a response cannot be parsed into the expected TypeScript type.\n *\n * This error is used when API responses, JSON data, or other external data\n * cannot be successfully parsed or validated against the expected TypeScript\n * interface or type definition.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class ParseError extends BoltSdkErrorBase {\n /**\n * Creates a new ParseError instance.\n *\n * @param targetType - The TypeScript type or interface name that parsing failed for\n * @param details - Specific details about what failed during parsing\n * @param context - Optional additional context including the raw data that failed to parse\n */\n constructor(targetType: string, details: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Failed to parse response to type '${targetType}': ${details}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(\n required: string | number,\n available: string | number,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INSUFFICIENT_FUNDS,\n `Insufficient funds to complete the transaction! Required: ${required}, Available: ${available}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(address: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_ADDRESS,\n `Invalid blockchain address provided: ${address}`,\n context\n );\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 * @param context - Optional additional context or state information\n */\n constructor(transactionId: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_FAILED,\n `Transaction failed or was reverted! Transaction ID: ${transactionId}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(eventName: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND,\n `Transaction Event not found: ${eventName}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NETWORK_ERROR,\n `Network error occurred!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n *\n * @template T - The type of the received value\n */\n constructor(\n parameterName: string,\n expected: string,\n receivedValue: T,\n details?: string,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INVALID_PARAMETER,\n `Invalid parameter '${parameterName}': expected ${expected}, received ${typeof receivedValue}${\n details ? `. ${details}` : ''\n }`,\n context\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 expectedLocation - Optional context about where the parameter was expected to be found\n * @param context - Optional additional context or state information\n */\n constructor(parameterName: string, expectedLocation?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.MISSING_PARAMETER,\n `Required parameter '${parameterName}' is missing${expectedLocation ? ` in ${expectedLocation}` : ''}`,\n 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 * @param context - Optional additional context or state information\n */\n constructor(\n parameterName: string,\n value: number | bigint,\n min?: number | bigint,\n max?: number | bigint,\n details?: string,\n context?: Record<string, unknown>\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 context\n );\n }\n}\n\n/**\n * Error thrown when an unexpected or unhandled error occurs.\n *\n * This error is used as a catch-all for errors that don't fit into any\n * of the specific error categories. It can wrap unknown errors from\n * external libraries or unexpected runtime conditions.\n *\n * @group Errors\n * @category Error Classes\n *\n * @example\n * ```typescript\n * try {\n * // Some operation that might throw unknown errors\n * await someExternalLibraryCall();\n * } catch (error) {\n * if (error instanceof Error) {\n * throw new UnexpectedError(error.message, error);\n * } else {\n * throw new UnexpectedError(String(error));\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Handle unexpected conditions\n * if (someUnexpectedCondition) {\n * throw new UnexpectedError(\n * \"Unexpected state encountered during swap operation\",\n * undefined,\n * { poolState, userBalance, timestamp }\n * );\n * }\n * ```\n */\nexport class UnexpectedError extends BoltSdkErrorBase {\n /** The original error that was caught, if any */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown;\n\n /**\n * Creates a new UnexpectedError instance.\n *\n * @param message - A description of the unexpected error\n * @param originalError - Optional original error that was caught\n * @param context - Optional additional context or state information\n */\n constructor(\n message: string,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown,\n context?: Record<string, unknown>\n ) {\n super(BoltSdkErrorCode.UNEXPECTED_ERROR, message, context);\n this.originalError = originalError;\n\n // Preserve the original error's stack trace if available\n if (originalError instanceof Error && originalError.stack) {\n // Append original stack trace to current stack\n this.stack = this.stack + '\\n\\nCaused by:\\n' + originalError.stack;\n }\n }\n\n /**\n * Creates an UnexpectedError from an unknown caught value.\n * This is a convenience method for error handling blocks.\n *\n * @param caught - The value that was caught in a try-catch block\n * @param message - Optional custom message to prepend\n * @param context - Optional additional context\n * @returns A new UnexpectedError instance\n *\n * @example\n * ```typescript\n * try {\n * await riskyOperation();\n * } catch (caught) {\n * throw UnexpectedError.from(\n * caught,\n * \"Failed to execute risky operation\",\n * { operation: 'riskyOperation', timestamp: Date.now() }\n * );\n * }\n * ```\n */\n static from(\n caught: unknown,\n message?: string,\n context?: Record<string, unknown>\n ): UnexpectedError {\n const errorMessage = message\n ? `${message}: ${caught instanceof Error ? caught.message : String(caught)}`\n : caught instanceof Error\n ? caught.message\n : String(caught);\n\n return new UnexpectedError(errorMessage, caught, context);\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 AssetsConfig,\n Asset,\n BaseLiquidityDetails,\n ChainConfig,\n ClientConfig,\n Coin,\n Contracts,\n InvertiblePrice,\n OracleAssetPair,\n OracleConfig,\n Pool,\n PoolConfig,\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 * @template TTxOutput - The type of the transaction output specific to the blockchain implementation\n *\n * @example\n * ```typescript\n * class BoltCosmWasmClient extends BaseClient<OfflineSigner, ExecuteResult> {\n * // Implementation specific to CosmWasm\n * }\n * ```\n */\nexport abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {\n /**\n * The blockchain network configuration containing chain ID, name, and RPC endpoint\n */\n public chainConfig: ChainConfig;\n\n /**\n * Smart contract addresses for making Bolt queries and transactions in the blockchain\n */\n public contracts: Contracts;\n\n /**\n * The denomination of the native token for the chain.\n * This is used for gas fee calculations and native token operations.\n */\n public nativeTokenDenom: string;\n\n /**\n * Configuration mapping of supported assets indexed by their symbol\n */\n public assetsConfig: AssetsConfig;\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 containing chain settings, contracts, native token, and assets\n * @param config.customOverride.chainConfig - (Optional) Chain configuration object\n * @param config.customOverride.chainConfig.id - (Optional) The chain ID of the blockchain network (e.g., \"archway-1\")\n * @param config.customOverride.chainConfig.name - (Optional) The human-readable name of the chain (e.g., \"Archway\")\n * @param config.customOverride.chainConfig.rpcEndpoint - (Optional) RPC endpoint URL for the blockchain network\n * @param config.customOverride.contracts - (Optional) Contract addresses for oracle and router\n * @param config.customOverride.contracts.oracle - (Optional) Oracle contract address\n * @param config.customOverride.contracts.router - (Optional) Router contract address\n * @param config.customOverride.nativeTokenDenom - (Optional) The denomination of the native token (e.g., \"aarch\", \"0x2::sui::SUI\")\n * @param config.customOverride.assetsConfig - (Optional) Configuration for supported assets indexed by symbol\n *\n * @throws {InvalidObjectError} Thrown when required configuration fields are missing\n *\n * @example\n * ```typescript\n * const client = new ConcreteClient({\n * customOverride: {\n * chainConfig: {\n * id: 'archway-1',\n * name: 'Archway',\n * rpcEndpoint: 'https://rpc.example.com'\n * },\n * contracts: {\n * oracle: 'archway1oracle...',\n * router: 'archway1router...'\n * },\n * nativeTokenDenom: 'uarch',\n * assetsConfig: {\n * 'ARCH': {\n * symbol: 'ARCH',\n * name: 'Archway',\n * chainId: 'archway-1',\n * denom: 'aarch',\n * decimals: 18,\n * logo: 'https://...',\n * coingeckoId: 'archway'\n * }\n * }\n * }\n * });\n * ```\n */\n constructor(config?: ClientConfig) {\n const { customOverride: { chainConfig, contracts, nativeTokenDenom, assetsConfig } = {} } =\n config ?? {};\n\n if (\n !chainConfig ||\n !chainConfig?.id ||\n !chainConfig?.name ||\n !chainConfig?.rpcEndpoint ||\n !contracts?.oracle ||\n !contracts?.router ||\n !nativeTokenDenom ||\n !assetsConfig\n ) {\n throw new InvalidObjectError('ClientConfig is missing fields');\n }\n\n this.chainConfig = chainConfig as ChainConfig;\n this.contracts = contracts as Contracts;\n this.nativeTokenDenom = nativeTokenDenom;\n this.assetsConfig = assetsConfig;\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 * console.log(`Admin: ${oracleConfig.admin}`);\n * console.log(`Price threshold ratio: ${oracleConfig.priceThresholdRatio}`);\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} (${pair.base.precision} decimals)`);\n * console.log(` Quote: ${pair.quote.name} (${pair.quote.precision} decimals)`);\n * });\n * ```\n */\n abstract getAllOracleAssetPairs(): Promise<OracleAssetPair[]>;\n\n /**\n * Fetches the current price for a specific base/quote asset pair from the oracle.\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - The denom 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 and whether it's inverted\n *\n * @example\n * ```typescript\n * // Get price of ARCH in terms of USDC\n * const priceResult = await client.getPrice(\"aarch\", \"ibc/...\");\n * console.log(`1 ARCH = ${priceResult.price} USDC`);\n * console.log(`Is inverted: ${priceResult.isInverse}`);\n * ```\n */\n abstract getPrice(baseDenom: string, quoteDenom: 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 and expiry times\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 at: ${new Date(priceData.expiryTime * 1000).toISOString()}`);\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 * console.log(`Oracle address: ${routerConfig.priceOracleContract}`);\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 details, including\n * the base liquidity amount and total shares\n *\n * @example\n * ```typescript\n * const liquidity = await client.getAllBaseAssetsLiquidity();\n * Object.entries(liquidity).forEach(([poolAddress, details]) => {\n * console.log(`Pool ${poolAddress}:`);\n * console.log(` Base: ${details.baseLiquidity.amount} ${details.baseLiquidity.denom}`);\n * console.log(` Total Shares: ${details.totalShares}`);\n * });\n * ```\n */\n abstract getAllBaseAssetsLiquidity(): Promise<Record<Address, BaseLiquidityDetails>>;\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.denom}`);\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 baseDenom - The denom 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 * @throws Will throw an error if no pool exists for the specified base 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.baseDenom}`);\n * console.log('Available quote assets:');\n * pool.quoteAssetsSymbols.forEach(symbol => {\n * console.log(` - ${symbol}`);\n * });\n * ```\n */\n abstract getPoolByBaseAsset(baseDenom: 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.baseDenom}`);\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 is a convenience method 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 baseDenom - The denom 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: ${parseFloat(poolConfig.protocolFee) * 100}%`);\n * console.log(`LP fee: ${parseFloat(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(baseDenom: string): Promise<PoolConfig>;\n\n /**\n * Fetches all supported assets across all pools in the Bolt protocol.\n *\n * This method retrieves comprehensive information about all assets that can be traded,\n * including their metadata, chain-specific details, and external identifiers.\n *\n * @returns A promise that resolves to an array of Asset objects, each containing:\n * - symbol: The asset's trading symbol (e.g., \"ARCH\", \"USDC\")\n * - name: The full name of the asset (e.g., \"Archway\", \"USD Coin\")\n * - chainId: The blockchain network identifier where this asset exists\n * - denom: The chain-specific denomination (e.g., \"aarch\", \"ibc/...\")\n * - decimals: The number of decimal places for the asset\n * - logo: Optional URL to the asset's logo image\n * - coingeckoId: Optional CoinGecko identifier for price data\n *\n * @example\n * ```typescript\n * const assets = await client.getAssets();\n *\n * // Display all available assets\n * assets.forEach(asset => {\n * console.log(`${asset.symbol} (${asset.name})`);\n * console.log(` Chain: ${asset.chainId}`);\n * console.log(` Denom: ${asset.denom}`);\n * console.log(` Decimals: ${asset.decimals}`);\n * if (asset.coingeckoId) {\n * console.log(` CoinGecko: ${asset.coingeckoId}`);\n * }\n * });\n *\n * // Find a specific asset\n * const archAsset = assets.find(a => a.symbol === 'ARCH');\n * console.log(`ARCH denom: ${archAsset?.denom}`);\n * ```\n *\n * @remarks\n * Assets returned by this method represent all tokens available for trading\n * in the Bolt protocol. The list may vary between mainnet and testnet environments.\n */\n abstract getAssets(): Promise<Asset[]>;\n\n /**\n * Executes a swap operation on the blockchain from one asset to another.\n *\n * This method performs a \"swap exact in\" 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 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 * @param signer - The transaction signer that will authorize the swap operation.\n * Must have sufficient balance of the input asset.\n *\n * @returns A promise that resolves to a SwapResult containing:\n * - txOutput: Transaction execution details (type varies by implementation)\n * - amountOut: The actual amount of output asset received (as a string)\n * - assetOut: The denom of the asset received\n * - txHash: The transaction hash\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.swap({\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 * }, signer);\n *\n * console.log(`Swapped exactly 1 ARCH`);\n * console.log(`Received: ${result.amountOut} ${result.assetOut}`);\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 * The TTxOutput type parameter represents the transaction execution result type,\n * which varies by blockchain implementation (e.g., ExecuteResult for CosmWasm).\n */\n abstract swap(params: SwapParams, signer?: TSigner): Promise<SwapResult<TTxOutput>>;\n\n /**\n * Estimates the gas fees for a swap operation without executing the transaction.\n *\n * This method performs a dry run of the swap transaction to calculate the required gas fees\n * in the chain's native token denomination. It's useful for displaying estimated costs\n * to users before they confirm a swap, or for ensuring sufficient gas balance.\n *\n * @param params - The swap configuration parameters (same as for the swap method)\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 * @param params.receiver - Optional recipient address for the swapped assets\n * @param signer - The transaction signer that would authorize the swap operation\n * @param gasAdjustment - Optional multiplier for gas estimation (default: 1.5).\n * Use higher values for safety margin. For example, 1.5 means 50% buffer.\n *\n * @returns A promise that resolves to a Coin object containing:\n * - denom: The gas token denomination (e.g., \"uarch\" for Archway, \"SUI\" for Sui)\n * - amount: The estimated gas amount as a string (in minimal denomination)\n * Returns undefined if gas estimation fails or is not supported\n *\n * @example\n * ```typescript\n * // Estimate gas for swapping 1 ARCH to USDC\n * const gasEstimate = await client.estimateSwapGasFees({\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC\n * minimumAmountOut: \"1950000000\" // Min 1950 USDC\n * }, signer, 1.3); // 30% safety margin\n *\n * if (gasEstimate) {\n * console.log(`Estimated gas: ${gasEstimate.amount} ${gasEstimate.denom}`);\n * }\n * ```\n *\n * @remarks\n * - Gas estimation is performed via simulation/dry run without state changes\n * - The returned amount is in the smallest denomination of the native token\n * - Different chains have different decimal places (e.g., 6 for Cosmos chains, 9 for Sui)\n * - The gasAdjustment parameter helps account for potential variations in actual execution\n * - Some implementations may return undefined if gas estimation is not available\n * - Always ensure the signer has sufficient native token balance for gas fees\n */\n abstract estimateSwapGasFees(\n params: SwapParams,\n signer?: TSigner,\n gasAdjustment?: number\n ): Promise<Coin | undefined>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,yBAAyB;;;ACiG/B,IAAM,mBAAN,cAA+B,MAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWlE,YACS,MACP,SACA,SACA;AACA,UAAM,OAAO;AAJN;AAVT;AAAA;AAeE,SAAK,OAAO,KAAK,YAAY;AAC7B,SAAK,UAAU;AAAA,EACjB;AACF;AAUO,IAAM,gBAAN,cAA4B,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,YAAY,UAAkB,SAAkB,SAAmC;AACjF;AAAA,MACE;AAAA,MACA,uBAAuB,QAAQ,IAAI,UAAU,aAAa,OAAO,KAAK,EAAE;AAAA,MACxE;AAAA,IACF;AAAA,EACF;AACF;AAQO,IAAM,qBAAN,cAAiC,iBAAiB;AAAA;AAAA;AAAA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E;AAC7C;;;ACjCO,IAAe,aAAf,MAAkE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoEvE,YAAY,QAAuB;AAhEnC;AAAA;AAAA;AAAA,wBAAO;AAKP;AAAA;AAAA;AAAA,wBAAO;AAMP;AAAA;AAAA;AAAA;AAAA,wBAAO;AAKP;AAAA;AAAA;AAAA,wBAAO;AAiDL,UAAM,EAAE,gBAAgB,EAAE,aAAa,WAAW,kBAAkB,aAAa,IAAI,CAAC,EAAE,IACtF,UAAU,CAAC;AAEb,QACE,CAAC,eACD,CAAC,aAAa,MACd,CAAC,aAAa,QACd,CAAC,aAAa,eACd,CAAC,WAAW,UACZ,CAAC,WAAW,UACZ,CAAC,oBACD,CAAC,cACD;AACA,YAAM,IAAI,mBAAmB,gCAAgC;AAAA,IAC/D;AAEA,SAAK,cAAc;AACnB,SAAK,YAAY;AACjB,SAAK,mBAAmB;AACxB,SAAK,eAAe;AAAA,EACtB;AA6WF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/constants/defaults.ts","../src/errors.ts","../src/helpers/asset.ts","../src/lib/client.ts"],"sourcesContent":["export * from './constants';\nexport * from './helpers';\nexport * from './lib';\nexport * from './types';\n\nexport * from './errors';\n","export const DEFAULT_GAS_ADJUSTMENT = 1.5;\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. Error codes are organized into ranges\n * by category for easier identification and handling.\n *\n * Error Code Ranges:\n * - 1000-1999: Resource & Data Errors\n * - 2000-2999: Blockchain Transaction Errors\n * - 3000-3999: Infrastructure & Network Errors\n * - 4000-4999: Validation & Input Errors\n * - 9000-9999: Unknown & Unexpected Errors\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.swap(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 * case BoltSdkErrorCode.UNEXPECTED_ERROR:\n * console.error(\"Unexpected error occurred:\", error.message);\n * break;\n * default:\n * console.error(\"Operation failed:\", error.message);\n * }\n * }\n * }\n * ```\n */\nconst enum BoltSdkErrorCode {\n /** Resource not found (pools, assets, configurations) */\n NOT_FOUND = 1000,\n /** Invalid object structure or missing required fields */\n INVALID_OBJECT = 1001,\n /** Type mismatch or invalid type provided */\n INVALID_TYPE = 1002,\n /** Insufficient balance to perform the operation */\n INSUFFICIENT_FUNDS = 2000,\n /** Invalid blockchain address format */\n INVALID_ADDRESS = 2001,\n /** Transaction reverted or failed on-chain */\n TRANSACTION_FAILED = 2002,\n /** Expected transaction event not found in logs */\n TRANSACTION_EVENT_NOT_FOUND = 2003,\n /** Network connectivity or RPC communication failure */\n NETWORK_ERROR = 3000,\n /** Invalid parameter provided to a method */\n INVALID_PARAMETER = 4000,\n /** Required parameter is missing */\n MISSING_PARAMETER = 4001,\n /** Numeric value outside acceptable range */\n PARAMETER_OUT_OF_RANGE = 4002,\n /** Feature or method not yet implemented */\n NOT_IMPLEMENTED = 4003,\n /** Unexpected or unknown error occurred */\n UNEXPECTED_ERROR = 9000,\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 /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\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, proper error name setting, and optional context data.\n *\n * @abstract\n * @group Errors\n * @category Error Classes\n */\nexport class BoltSdkErrorBase extends Error implements BoltSdkError {\n /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\n\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 * @param context - Optional additional context or state information\n */\n constructor(\n public code: BoltSdkErrorCode,\n message: string,\n context?: Record<string, unknown>\n ) {\n super(message);\n this.name = this.constructor.name; // Set the error name to the class name\n this.context = context;\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 * @param context - Optional additional context or state information\n */\n constructor(resource: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NOT_FOUND,\n `Resource not found: ${resource}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_OBJECT,\n `Invalid object or data structure!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(expectedType: string, receivedType: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Invalid object type! Expected: ${expectedType}, Received: ${receivedType}`,\n context\n );\n }\n}\n\n/**\n * Error thrown when a response cannot be parsed into the expected TypeScript type.\n *\n * This error is used when API responses, JSON data, or other external data\n * cannot be successfully parsed or validated against the expected TypeScript\n * interface or type definition.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class ParseError extends BoltSdkErrorBase {\n /**\n * Creates a new ParseError instance.\n *\n * @param targetType - The TypeScript type or interface name that parsing failed for\n * @param details - Specific details about what failed during parsing\n * @param context - Optional additional context including the raw data that failed to parse\n */\n constructor(targetType: string, details: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Failed to parse response to type '${targetType}': ${details}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(\n required: string | number,\n available: string | number,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INSUFFICIENT_FUNDS,\n `Insufficient funds to complete the transaction! Required: ${required}, Available: ${available}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(address: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_ADDRESS,\n `Invalid blockchain address provided: ${address}`,\n context\n );\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 * @param context - Optional additional context or state information\n */\n constructor(transactionId: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_FAILED,\n `Transaction failed or was reverted! Transaction ID: ${transactionId}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(eventName: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND,\n `Transaction Event not found: ${eventName}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NETWORK_ERROR,\n `Network error occurred!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n *\n * @template T - The type of the received value\n */\n constructor(\n parameterName: string,\n expected: string,\n receivedValue: T,\n details?: string,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INVALID_PARAMETER,\n `Invalid parameter '${parameterName}': expected ${expected}, received ${typeof receivedValue}${\n details ? `. ${details}` : ''\n }`,\n context\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 expectedLocation - Optional context about where the parameter was expected to be found\n * @param context - Optional additional context or state information\n */\n constructor(parameterName: string, expectedLocation?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.MISSING_PARAMETER,\n `Required parameter '${parameterName}' is missing${expectedLocation ? ` in ${expectedLocation}` : ''}`,\n 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 * @param context - Optional additional context or state information\n */\n constructor(\n parameterName: string,\n value: number | bigint,\n min?: number | bigint,\n max?: number | bigint,\n details?: string,\n context?: Record<string, unknown>\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 context\n );\n }\n}\n\n/**\n * Error thrown when a feature or method is not yet implemented.\n *\n * This error is useful during development to mark planned functionality\n * that hasn't been completed yet. It helps distinguish between bugs\n * and intentionally unimplemented features.\n *\n * @group Errors\n * @category Error Classes\n *\n * @example\n * ```typescript\n * class BoltClient {\n * async advancedSwap(params: AdvancedSwapParams): Promise<SwapResult> {\n * throw new NotImplementedError('advancedSwap', 'v2.0.0');\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * throw new NotImplementedError(\n * 'multi-hop routing',\n * undefined,\n * { requestedHops: 3, maxSupportedHops: 1 }\n * );\n * ```\n */\nexport class NotImplementedError extends BoltSdkErrorBase {\n /**\n * Creates a new NotImplementedError instance.\n *\n * @param feature - The name of the feature or method that is not implemented\n * @param plannedVersion - Optional version when the feature is planned to be implemented\n * @param context - Optional additional context or state information\n */\n constructor(feature: string, plannedVersion?: string, context?: Record<string, unknown>) {\n const versionInfo = plannedVersion ? ` Planned for version ${plannedVersion}.` : '';\n\n super(\n BoltSdkErrorCode.NOT_IMPLEMENTED,\n `Feature '${feature}' is not implemented yet.${versionInfo}`,\n context\n );\n }\n}\n\n/**\n * Error thrown when an unexpected or unhandled error occurs.\n *\n * This error is used as a catch-all for errors that don't fit into any\n * of the specific error categories. It can wrap unknown errors from\n * external libraries or unexpected runtime conditions.\n *\n * @group Errors\n * @category Error Classes\n *\n * @example\n * ```typescript\n * try {\n * // Some operation that might throw unknown errors\n * await someExternalLibraryCall();\n * } catch (error) {\n * if (error instanceof Error) {\n * throw new UnexpectedError(error.message, error);\n * } else {\n * throw new UnexpectedError(String(error));\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Handle unexpected conditions\n * if (someUnexpectedCondition) {\n * throw new UnexpectedError(\n * \"Unexpected state encountered during swap operation\",\n * undefined,\n * { poolState, userBalance, timestamp }\n * );\n * }\n * ```\n */\nexport class UnexpectedError extends BoltSdkErrorBase {\n /** The original error that was caught, if any */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown;\n\n /**\n * Creates a new UnexpectedError instance.\n *\n * @param message - A description of the unexpected error\n * @param originalError - Optional original error that was caught\n * @param context - Optional additional context or state information\n */\n constructor(\n message: string,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown,\n context?: Record<string, unknown>\n ) {\n super(BoltSdkErrorCode.UNEXPECTED_ERROR, message, context);\n this.originalError = originalError;\n\n // Preserve the original error's stack trace if available\n if (originalError instanceof Error && originalError.stack) {\n // Append original stack trace to current stack\n this.stack = this.stack + '\\n\\nCaused by:\\n' + originalError.stack;\n }\n }\n\n /**\n * Creates an UnexpectedError from an unknown caught value.\n * This is a convenience method for error handling blocks.\n *\n * @param caught - The value that was caught in a try-catch block\n * @param message - Optional custom message to prepend\n * @param context - Optional additional context\n * @returns A new UnexpectedError instance\n *\n * @example\n * ```typescript\n * try {\n * await riskyOperation();\n * } catch (caught) {\n * throw UnexpectedError.from(\n * caught,\n * \"Failed to execute risky operation\",\n * { operation: 'riskyOperation', timestamp: Date.now() }\n * );\n * }\n * ```\n */\n static from(\n caught: unknown,\n message?: string,\n context?: Record<string, unknown>\n ): UnexpectedError {\n const errorMessage = message\n ? `${message}: ${caught instanceof Error ? caught.message : String(caught)}`\n : caught instanceof Error\n ? caught.message\n : String(caught);\n\n return new UnexpectedError(errorMessage, caught, context);\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 AssetsConfig,\n Asset,\n BaseLiquidityDetails,\n ChainConfig,\n ClientConfig,\n Coin,\n Contracts,\n InvertiblePrice,\n OracleAssetPair,\n OracleConfig,\n Pool,\n PoolConfig,\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 * @template TTxOutput - The type of the transaction output specific to the blockchain implementation\n *\n * @example\n * ```typescript\n * class BoltCosmWasmClient extends BaseClient<OfflineSigner, ExecuteResult> {\n * // Implementation specific to CosmWasm\n * }\n * ```\n */\nexport abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {\n /**\n * The blockchain network configuration containing chain ID, name, and RPC endpoint\n */\n public chainConfig: ChainConfig;\n\n /**\n * Smart contract addresses for making Bolt queries and transactions in the blockchain\n */\n public contracts: Contracts;\n\n /**\n * The denomination of the native token for the chain.\n * This is used for gas fee calculations and native token operations.\n */\n public nativeTokenDenom: string;\n\n /**\n * Configuration mapping of supported assets indexed by their symbol\n */\n public assetsConfig: AssetsConfig;\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 containing chain settings, contracts, native token, and assets\n * @param config.customOverride.chainConfig - (Optional) Chain configuration object\n * @param config.customOverride.chainConfig.id - (Optional) The chain ID of the blockchain network (e.g., \"archway-1\")\n * @param config.customOverride.chainConfig.name - (Optional) The human-readable name of the chain (e.g., \"Archway\")\n * @param config.customOverride.chainConfig.rpcEndpoint - (Optional) RPC endpoint URL for the blockchain network\n * @param config.customOverride.contracts - (Optional) Contract addresses for oracle and router\n * @param config.customOverride.contracts.oracle - (Optional) Oracle contract address\n * @param config.customOverride.contracts.router - (Optional) Router contract address\n * @param config.customOverride.nativeTokenDenom - (Optional) The denomination of the native token (e.g., \"aarch\", \"0x2::sui::SUI\")\n * @param config.customOverride.assetsConfig - (Optional) Configuration for supported assets indexed by symbol\n *\n * @throws {InvalidObjectError} Thrown when required configuration fields are missing\n *\n * @example\n * ```typescript\n * const client = new ConcreteClient({\n * customOverride: {\n * chainConfig: {\n * id: 'archway-1',\n * name: 'Archway',\n * rpcEndpoint: 'https://rpc.example.com'\n * },\n * contracts: {\n * oracle: 'archway1oracle...',\n * router: 'archway1router...'\n * },\n * nativeTokenDenom: 'uarch',\n * assetsConfig: {\n * 'ARCH': {\n * symbol: 'ARCH',\n * name: 'Archway',\n * chainId: 'archway-1',\n * denom: 'aarch',\n * decimals: 18,\n * logo: 'https://...',\n * coingeckoId: 'archway'\n * }\n * }\n * }\n * });\n * ```\n */\n constructor(config?: ClientConfig) {\n const { customOverride: { chainConfig, contracts, nativeTokenDenom, assetsConfig } = {} } =\n config ?? {};\n\n if (\n !chainConfig ||\n !chainConfig?.id ||\n !chainConfig?.name ||\n !chainConfig?.rpcEndpoint ||\n !contracts?.oracle ||\n !contracts?.router ||\n !nativeTokenDenom ||\n !assetsConfig\n ) {\n throw new InvalidObjectError('ClientConfig is missing fields');\n }\n\n this.chainConfig = chainConfig as ChainConfig;\n this.contracts = contracts as Contracts;\n this.nativeTokenDenom = nativeTokenDenom;\n this.assetsConfig = assetsConfig;\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 * console.log(`Admin: ${oracleConfig.admin}`);\n * console.log(`Price threshold ratio: ${oracleConfig.priceThresholdRatio}`);\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} (${pair.base.precision} decimals)`);\n * console.log(` Quote: ${pair.quote.name} (${pair.quote.precision} decimals)`);\n * });\n * ```\n */\n abstract getAllOracleAssetPairs(): Promise<OracleAssetPair[]>;\n\n /**\n * Fetches the current price for a specific base/quote asset pair from the oracle.\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - The denom 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 and whether it's inverted\n *\n * @example\n * ```typescript\n * // Get price of ARCH in terms of USDC\n * const priceResult = await client.getPrice(\"aarch\", \"ibc/...\");\n * console.log(`1 ARCH = ${priceResult.price} USDC`);\n * console.log(`Is inverted: ${priceResult.isInverse}`);\n * ```\n */\n abstract getPrice(baseDenom: string, quoteDenom: 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 and expiry times\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 at: ${new Date(priceData.expiryTime * 1000).toISOString()}`);\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 * console.log(`Oracle address: ${routerConfig.priceOracleContract}`);\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 details, including\n * the base liquidity amount and total shares\n *\n * @example\n * ```typescript\n * const liquidity = await client.getAllBaseAssetsLiquidity();\n * Object.entries(liquidity).forEach(([poolAddress, details]) => {\n * console.log(`Pool ${poolAddress}:`);\n * console.log(` Base: ${details.baseLiquidity.amount} ${details.baseLiquidity.denom}`);\n * console.log(` Total Shares: ${details.totalShares}`);\n * });\n * ```\n */\n abstract getAllBaseAssetsLiquidity(): Promise<Record<Address, BaseLiquidityDetails>>;\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.denom}`);\n * });\n * });\n * ```\n */\n abstract getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>>;\n\n /**\n * Fetches pool information for a specific asset pair.\n *\n * This method retrieves pool information based on a base asset denomination,\n * with an optional quote asset denomination to find a specific pool when\n * multiple pools exist for the same base asset (this depends on the chain-specific\n * implementation)\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool\n *\n * @returns A promise that resolves to the pool information for the specified asset(s)\n *\n * @throws Will throw an error if no pool exists for the specified base asset,\n * or if quoteDenom is provided but no matching pool is found\n *\n * @example\n * ```typescript\n * // Get any pool for the base asset\n * const pool = await client.getPoolByDenom(\"aarch\");\n * console.log(`Pool address: ${pool.poolAddress}`);\n * console.log(`Base asset: ${pool.baseDenom}`);\n * console.log('Available quote assets:');\n * pool.quoteDenoms.forEach(denom => {\n * console.log(` - ${denom}`);\n * });\n *\n * // Get pool for ARCH as base asset\n * const specificPool = await client.getPoolByDenom(\n * \"aarch\"\n * );\n * console.log(`Found pool: ${specificPool.poolAddress}`);\n * ```\n */\n abstract getPoolByDenom(baseDenom: string, quoteDenom?: 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.baseDenom}`);\n * console.log(` Quotes: ${pool.quoteDenoms.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 asset denominations.\n *\n * This is a convenience method that combines pool lookup and configuration retrieval.\n * It first finds the pool associated with the given asset pair, then fetches that\n * pool's configuration parameters.\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool\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 asset(s)\n *\n * @example\n * ```typescript\n * // Get pool configuration for any ARCH pool\n * const poolConfig = await client.getPoolConfigByDenom(\"aarch\");\n * console.log(`Oracle: ${poolConfig.priceOracleContract}`);\n * console.log(`Protocol fee: ${parseFloat(poolConfig.protocolFee) * 100}%`);\n * console.log(`LP fee: ${parseFloat(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 * // Get configuration for specific ARCH/USDC pool\n * const specificConfig = await client.getPoolConfigByDenom(\n * \"aarch\",\n * \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\"\n * );\n * console.log(`Specific pool fees: ${specificConfig.protocolFee}`);\n * ```\n */\n abstract getPoolConfigByDenom(baseDenom: string, quoteDenom?: string): Promise<PoolConfig>;\n\n /**\n * Fetches all supported assets across all pools in the Bolt protocol.\n *\n * This method retrieves comprehensive information about all assets that can be traded,\n * including their metadata, chain-specific details, and external identifiers.\n *\n * @returns A promise that resolves to an array of Asset objects, each containing:\n * - symbol: The asset's trading symbol (e.g., \"ARCH\", \"USDC\")\n * - name: The full name of the asset (e.g., \"Archway\", \"USD Coin\")\n * - chainId: The blockchain network identifier where this asset exists\n * - denom: The chain-specific denomination (e.g., \"aarch\", \"ibc/...\")\n * - decimals: The number of decimal places for the asset\n * - logo: Optional URL to the asset's logo image\n * - coingeckoId: Optional CoinGecko identifier for price data\n *\n * @example\n * ```typescript\n * const assets = await client.getAssets();\n *\n * // Display all available assets\n * assets.forEach(asset => {\n * console.log(`${asset.symbol} (${asset.name})`);\n * console.log(` Chain: ${asset.chainId}`);\n * console.log(` Denom: ${asset.denom}`);\n * console.log(` Decimals: ${asset.decimals}`);\n * if (asset.coingeckoId) {\n * console.log(` CoinGecko: ${asset.coingeckoId}`);\n * }\n * });\n *\n * // Find a specific asset\n * const archAsset = assets.find(a => a.symbol === 'ARCH');\n * console.log(`ARCH denom: ${archAsset?.denom}`);\n * ```\n *\n * @remarks\n * Assets returned by this method represent all tokens available for trading\n * in the Bolt protocol. The list may vary between mainnet and testnet environments.\n */\n abstract getAssets(): Promise<Asset[]>;\n\n /**\n * Executes a swap operation on the blockchain from one asset to another.\n *\n * This method performs a \"swap exact in\" 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 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 * @param signer - The transaction signer that will authorize the swap operation.\n * Must have sufficient balance of the input asset.\n *\n * @returns A promise that resolves to a SwapResult containing:\n * - txOutput: Transaction execution details (type varies by implementation)\n * - amountOut: The actual amount of output asset received (as a string)\n * - assetOut: The denom of the asset received\n * - txHash: The transaction hash\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.swap({\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 * }, signer);\n *\n * console.log(`Swapped exactly 1 ARCH`);\n * console.log(`Received: ${result.amountOut} ${result.assetOut}`);\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 * The TTxOutput type parameter represents the transaction execution result type,\n * which varies by blockchain implementation (e.g., ExecuteResult for CosmWasm).\n */\n abstract swap(params: SwapParams, signer?: TSigner): Promise<SwapResult<TTxOutput>>;\n\n /**\n * Estimates the gas fees for a swap operation without executing the transaction.\n *\n * This method performs a dry run of the swap transaction to calculate the required gas fees\n * in the chain's native token denomination. It's useful for displaying estimated costs\n * to users before they confirm a swap, or for ensuring sufficient gas balance.\n *\n * @param params - The swap configuration parameters (same as for the swap method)\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 * @param params.receiver - Optional recipient address for the swapped assets\n * @param signer - The transaction signer that would authorize the swap operation\n * @param gasAdjustment - Optional multiplier for gas estimation (default: 1.5).\n * Use higher values for safety margin. For example, 1.5 means 50% buffer.\n *\n * @returns A promise that resolves to a Coin object containing:\n * - denom: The gas token denomination (e.g., \"uarch\" for Archway, \"SUI\" for Sui)\n * - amount: The estimated gas amount as a string (in minimal denomination)\n * Returns undefined if gas estimation fails or is not supported\n *\n * @example\n * ```typescript\n * // Estimate gas for swapping 1 ARCH to USDC\n * const gasEstimate = await client.estimateSwapGasFees({\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC\n * minimumAmountOut: \"1950000000\" // Min 1950 USDC\n * }, signer, 1.3); // 30% safety margin\n *\n * if (gasEstimate) {\n * console.log(`Estimated gas: ${gasEstimate.amount} ${gasEstimate.denom}`);\n * }\n * ```\n *\n * @remarks\n * - Gas estimation is performed via simulation/dry run without state changes\n * - The returned amount is in the smallest denomination of the native token\n * - Different chains have different decimal places (e.g., 6 for Cosmos chains, 9 for Sui)\n * - The gasAdjustment parameter helps account for potential variations in actual execution\n * - Some implementations may return undefined if gas estimation is not available\n * - Always ensure the signer has sufficient native token balance for gas fees\n */\n abstract est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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoEvE,YAAY,QAAuB;AAhEnC;AAAA;AAAA;AAAA,wBAAO;AAKP;AAAA;AAAA;AAAA,wBAAO;AAMP;AAAA;AAAA;AAAA;AAAA,wBAAO;AAKP;AAAA;AAAA;AAAA,wBAAO;AAiDL,UAAM,EAAE,gBAAgB,EAAE,aAAa,WAAW,kBAAkB,aAAa,IAAI,CAAC,EAAE,IACtF,UAAU,CAAC;AAEb,QACE,CAAC,eACD,CAAC,aAAa,MACd,CAAC,aAAa,QACd,CAAC,aAAa,eACd,CAAC,WAAW,UACZ,CAAC,WAAW,UACZ,CAAC,oBACD,CAAC,cACD;AACA,YAAM,IAAI,mBAAmB,gCAAgC;AAAA,IAC/D;AAEA,SAAK,cAAc;AACnB,SAAK,YAAY;AACjB,SAAK,mBAAmB;AACxB,SAAK,eAAe;AAAA,EACtB;AAmYF;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -365,26 +365,40 @@ declare abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {
|
|
|
365
365
|
*/
|
|
366
366
|
abstract getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>>;
|
|
367
367
|
/**
|
|
368
|
-
* Fetches pool information for a specific
|
|
368
|
+
* Fetches pool information for a specific asset pair.
|
|
369
|
+
*
|
|
370
|
+
* This method retrieves pool information based on a base asset denomination,
|
|
371
|
+
* with an optional quote asset denomination to find a specific pool when
|
|
372
|
+
* multiple pools exist for the same base asset (this depends on the chain-specific
|
|
373
|
+
* implementation)
|
|
369
374
|
*
|
|
370
375
|
* @param baseDenom - The denom of the base asset (e.g., "aarch", "ibc/...")
|
|
376
|
+
* @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool
|
|
371
377
|
*
|
|
372
|
-
* @returns A promise that resolves to the pool information for the specified asset
|
|
378
|
+
* @returns A promise that resolves to the pool information for the specified asset(s)
|
|
373
379
|
*
|
|
374
|
-
* @throws Will throw an error if no pool exists for the specified base asset
|
|
380
|
+
* @throws Will throw an error if no pool exists for the specified base asset,
|
|
381
|
+
* or if quoteDenom is provided but no matching pool is found
|
|
375
382
|
*
|
|
376
383
|
* @example
|
|
377
384
|
* ```typescript
|
|
378
|
-
*
|
|
385
|
+
* // Get any pool for the base asset
|
|
386
|
+
* const pool = await client.getPoolByDenom("aarch");
|
|
379
387
|
* console.log(`Pool address: ${pool.poolAddress}`);
|
|
380
388
|
* console.log(`Base asset: ${pool.baseDenom}`);
|
|
381
389
|
* console.log('Available quote assets:');
|
|
382
|
-
* pool.
|
|
383
|
-
* console.log(` - ${
|
|
390
|
+
* pool.quoteDenoms.forEach(denom => {
|
|
391
|
+
* console.log(` - ${denom}`);
|
|
384
392
|
* });
|
|
393
|
+
*
|
|
394
|
+
* // Get pool for ARCH as base asset
|
|
395
|
+
* const specificPool = await client.getPoolByDenom(
|
|
396
|
+
* "aarch"
|
|
397
|
+
* );
|
|
398
|
+
* console.log(`Found pool: ${specificPool.poolAddress}`);
|
|
385
399
|
* ```
|
|
386
400
|
*/
|
|
387
|
-
abstract
|
|
401
|
+
abstract getPoolByDenom(baseDenom: string, quoteDenom?: string): Promise<Pool>;
|
|
388
402
|
/**
|
|
389
403
|
* Fetches information for all available pools.
|
|
390
404
|
*
|
|
@@ -396,7 +410,7 @@ declare abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {
|
|
|
396
410
|
* pools.forEach(pool => {
|
|
397
411
|
* console.log(`Pool ${pool.poolAddress}:`);
|
|
398
412
|
* console.log(` Base: ${pool.baseDenom}`);
|
|
399
|
-
* console.log(` Quotes: ${pool.
|
|
413
|
+
* console.log(` Quotes: ${pool.quoteDenoms.join(', ')}`);
|
|
400
414
|
* });
|
|
401
415
|
* ```
|
|
402
416
|
*/
|
|
@@ -425,32 +439,40 @@ declare abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {
|
|
|
425
439
|
*/
|
|
426
440
|
abstract getPoolConfig(poolContractAddress: string): Promise<PoolConfig>;
|
|
427
441
|
/**
|
|
428
|
-
* Fetches the configuration settings for a pool identified by
|
|
442
|
+
* Fetches the configuration settings for a pool identified by asset denominations.
|
|
429
443
|
*
|
|
430
444
|
* This is a convenience method that combines pool lookup and configuration retrieval.
|
|
431
|
-
* It first finds the pool associated with the given
|
|
432
|
-
* pool's configuration parameters
|
|
445
|
+
* It first finds the pool associated with the given asset pair, then fetches that
|
|
446
|
+
* pool's configuration parameters.
|
|
433
447
|
*
|
|
434
448
|
* @param baseDenom - The denom of the base asset (e.g., "aarch", "ibc/...")
|
|
449
|
+
* @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool
|
|
435
450
|
*
|
|
436
451
|
* @returns A promise that resolves to a pool configuration object containing
|
|
437
452
|
* settings such as fees, oracle address, LP addresses, and minimum trade amounts
|
|
438
453
|
*
|
|
439
|
-
* @throws Will throw an error if no pool exists for the specified
|
|
454
|
+
* @throws Will throw an error if no pool exists for the specified asset(s)
|
|
440
455
|
*
|
|
441
456
|
* @example
|
|
442
457
|
* ```typescript
|
|
443
|
-
* // Get pool configuration for ARCH
|
|
444
|
-
* const poolConfig = await client.
|
|
458
|
+
* // Get pool configuration for any ARCH pool
|
|
459
|
+
* const poolConfig = await client.getPoolConfigByDenom("aarch");
|
|
445
460
|
* console.log(`Oracle: ${poolConfig.priceOracleContract}`);
|
|
446
461
|
* console.log(`Protocol fee: ${parseFloat(poolConfig.protocolFee) * 100}%`);
|
|
447
462
|
* console.log(`LP fee: ${parseFloat(poolConfig.lpFee) * 100}%`);
|
|
448
463
|
* console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
|
|
449
464
|
* console.log(`Number of LPs: ${poolConfig.lps.length}`);
|
|
450
465
|
* console.log(`Min base output: ${poolConfig.minBaseOut}`);
|
|
466
|
+
*
|
|
467
|
+
* // Get configuration for specific ARCH/USDC pool
|
|
468
|
+
* const specificConfig = await client.getPoolConfigByDenom(
|
|
469
|
+
* "aarch",
|
|
470
|
+
* "ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D"
|
|
471
|
+
* );
|
|
472
|
+
* console.log(`Specific pool fees: ${specificConfig.protocolFee}`);
|
|
451
473
|
* ```
|
|
452
474
|
*/
|
|
453
|
-
abstract
|
|
475
|
+
abstract getPoolConfigByDenom(baseDenom: string, quoteDenom?: string): Promise<PoolConfig>;
|
|
454
476
|
/**
|
|
455
477
|
* Fetches all supported assets across all pools in the Bolt protocol.
|
|
456
478
|
*
|
|
@@ -659,6 +681,8 @@ declare const enum BoltSdkErrorCode {
|
|
|
659
681
|
MISSING_PARAMETER = 4001,
|
|
660
682
|
/** Numeric value outside acceptable range */
|
|
661
683
|
PARAMETER_OUT_OF_RANGE = 4002,
|
|
684
|
+
/** Feature or method not yet implemented */
|
|
685
|
+
NOT_IMPLEMENTED = 4003,
|
|
662
686
|
/** Unexpected or unknown error occurred */
|
|
663
687
|
UNEXPECTED_ERROR = 9000
|
|
664
688
|
}
|
|
@@ -901,6 +925,44 @@ declare class ParameterOutOfRangeError extends BoltSdkErrorBase {
|
|
|
901
925
|
*/
|
|
902
926
|
constructor(parameterName: string, value: number | bigint, min?: number | bigint, max?: number | bigint, details?: string, context?: Record<string, unknown>);
|
|
903
927
|
}
|
|
928
|
+
/**
|
|
929
|
+
* Error thrown when a feature or method is not yet implemented.
|
|
930
|
+
*
|
|
931
|
+
* This error is useful during development to mark planned functionality
|
|
932
|
+
* that hasn't been completed yet. It helps distinguish between bugs
|
|
933
|
+
* and intentionally unimplemented features.
|
|
934
|
+
*
|
|
935
|
+
* @group Errors
|
|
936
|
+
* @category Error Classes
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```typescript
|
|
940
|
+
* class BoltClient {
|
|
941
|
+
* async advancedSwap(params: AdvancedSwapParams): Promise<SwapResult> {
|
|
942
|
+
* throw new NotImplementedError('advancedSwap', 'v2.0.0');
|
|
943
|
+
* }
|
|
944
|
+
* }
|
|
945
|
+
* ```
|
|
946
|
+
*
|
|
947
|
+
* @example
|
|
948
|
+
* ```typescript
|
|
949
|
+
* throw new NotImplementedError(
|
|
950
|
+
* 'multi-hop routing',
|
|
951
|
+
* undefined,
|
|
952
|
+
* { requestedHops: 3, maxSupportedHops: 1 }
|
|
953
|
+
* );
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
956
|
+
declare class NotImplementedError extends BoltSdkErrorBase {
|
|
957
|
+
/**
|
|
958
|
+
* Creates a new NotImplementedError instance.
|
|
959
|
+
*
|
|
960
|
+
* @param feature - The name of the feature or method that is not implemented
|
|
961
|
+
* @param plannedVersion - Optional version when the feature is planned to be implemented
|
|
962
|
+
* @param context - Optional additional context or state information
|
|
963
|
+
*/
|
|
964
|
+
constructor(feature: string, plannedVersion?: string, context?: Record<string, unknown>);
|
|
965
|
+
}
|
|
904
966
|
/**
|
|
905
967
|
* Error thrown when an unexpected or unhandled error occurs.
|
|
906
968
|
*
|
|
@@ -973,4 +1035,4 @@ declare class UnexpectedError extends BoltSdkErrorBase {
|
|
|
973
1035
|
static from(caught: unknown, message?: string, context?: Record<string, unknown>): UnexpectedError;
|
|
974
1036
|
}
|
|
975
1037
|
|
|
976
|
-
export { type Address, type AllowanceMode, type Asset, type AssetsConfig, BaseClient, type BaseLiquidityDetails, type BoltSdkError, BoltSdkErrorBase, type ChainConfig, type ClientConfig, type Coin, type Contracts, DEFAULT_GAS_ADJUSTMENT, type Duration, type Environment, InsufficientFundsError, InvalidAddressError, InvalidObjectError, InvalidParameterError, InvalidTypeError, type InvertiblePrice, MissingParameterError, NetworkError, NotFoundError, type OracleAsset, type OracleAssetPair, type OracleConfig, ParameterOutOfRangeError, ParseError, type Pool, type PoolConfig, type Price, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError, UnexpectedError, getCoinFromAmountWithDenomString };
|
|
1038
|
+
export { type Address, type AllowanceMode, type Asset, type AssetsConfig, BaseClient, type BaseLiquidityDetails, type BoltSdkError, BoltSdkErrorBase, type ChainConfig, type ClientConfig, type Coin, type Contracts, DEFAULT_GAS_ADJUSTMENT, type Duration, type Environment, InsufficientFundsError, InvalidAddressError, InvalidObjectError, InvalidParameterError, InvalidTypeError, type InvertiblePrice, MissingParameterError, NetworkError, NotFoundError, NotImplementedError, type OracleAsset, type OracleAssetPair, type OracleConfig, ParameterOutOfRangeError, ParseError, type Pool, type PoolConfig, type Price, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError, UnexpectedError, getCoinFromAmountWithDenomString };
|
package/dist/index.d.ts
CHANGED
|
@@ -365,26 +365,40 @@ declare abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {
|
|
|
365
365
|
*/
|
|
366
366
|
abstract getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>>;
|
|
367
367
|
/**
|
|
368
|
-
* Fetches pool information for a specific
|
|
368
|
+
* Fetches pool information for a specific asset pair.
|
|
369
|
+
*
|
|
370
|
+
* This method retrieves pool information based on a base asset denomination,
|
|
371
|
+
* with an optional quote asset denomination to find a specific pool when
|
|
372
|
+
* multiple pools exist for the same base asset (this depends on the chain-specific
|
|
373
|
+
* implementation)
|
|
369
374
|
*
|
|
370
375
|
* @param baseDenom - The denom of the base asset (e.g., "aarch", "ibc/...")
|
|
376
|
+
* @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool
|
|
371
377
|
*
|
|
372
|
-
* @returns A promise that resolves to the pool information for the specified asset
|
|
378
|
+
* @returns A promise that resolves to the pool information for the specified asset(s)
|
|
373
379
|
*
|
|
374
|
-
* @throws Will throw an error if no pool exists for the specified base asset
|
|
380
|
+
* @throws Will throw an error if no pool exists for the specified base asset,
|
|
381
|
+
* or if quoteDenom is provided but no matching pool is found
|
|
375
382
|
*
|
|
376
383
|
* @example
|
|
377
384
|
* ```typescript
|
|
378
|
-
*
|
|
385
|
+
* // Get any pool for the base asset
|
|
386
|
+
* const pool = await client.getPoolByDenom("aarch");
|
|
379
387
|
* console.log(`Pool address: ${pool.poolAddress}`);
|
|
380
388
|
* console.log(`Base asset: ${pool.baseDenom}`);
|
|
381
389
|
* console.log('Available quote assets:');
|
|
382
|
-
* pool.
|
|
383
|
-
* console.log(` - ${
|
|
390
|
+
* pool.quoteDenoms.forEach(denom => {
|
|
391
|
+
* console.log(` - ${denom}`);
|
|
384
392
|
* });
|
|
393
|
+
*
|
|
394
|
+
* // Get pool for ARCH as base asset
|
|
395
|
+
* const specificPool = await client.getPoolByDenom(
|
|
396
|
+
* "aarch"
|
|
397
|
+
* );
|
|
398
|
+
* console.log(`Found pool: ${specificPool.poolAddress}`);
|
|
385
399
|
* ```
|
|
386
400
|
*/
|
|
387
|
-
abstract
|
|
401
|
+
abstract getPoolByDenom(baseDenom: string, quoteDenom?: string): Promise<Pool>;
|
|
388
402
|
/**
|
|
389
403
|
* Fetches information for all available pools.
|
|
390
404
|
*
|
|
@@ -396,7 +410,7 @@ declare abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {
|
|
|
396
410
|
* pools.forEach(pool => {
|
|
397
411
|
* console.log(`Pool ${pool.poolAddress}:`);
|
|
398
412
|
* console.log(` Base: ${pool.baseDenom}`);
|
|
399
|
-
* console.log(` Quotes: ${pool.
|
|
413
|
+
* console.log(` Quotes: ${pool.quoteDenoms.join(', ')}`);
|
|
400
414
|
* });
|
|
401
415
|
* ```
|
|
402
416
|
*/
|
|
@@ -425,32 +439,40 @@ declare abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {
|
|
|
425
439
|
*/
|
|
426
440
|
abstract getPoolConfig(poolContractAddress: string): Promise<PoolConfig>;
|
|
427
441
|
/**
|
|
428
|
-
* Fetches the configuration settings for a pool identified by
|
|
442
|
+
* Fetches the configuration settings for a pool identified by asset denominations.
|
|
429
443
|
*
|
|
430
444
|
* This is a convenience method that combines pool lookup and configuration retrieval.
|
|
431
|
-
* It first finds the pool associated with the given
|
|
432
|
-
* pool's configuration parameters
|
|
445
|
+
* It first finds the pool associated with the given asset pair, then fetches that
|
|
446
|
+
* pool's configuration parameters.
|
|
433
447
|
*
|
|
434
448
|
* @param baseDenom - The denom of the base asset (e.g., "aarch", "ibc/...")
|
|
449
|
+
* @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool
|
|
435
450
|
*
|
|
436
451
|
* @returns A promise that resolves to a pool configuration object containing
|
|
437
452
|
* settings such as fees, oracle address, LP addresses, and minimum trade amounts
|
|
438
453
|
*
|
|
439
|
-
* @throws Will throw an error if no pool exists for the specified
|
|
454
|
+
* @throws Will throw an error if no pool exists for the specified asset(s)
|
|
440
455
|
*
|
|
441
456
|
* @example
|
|
442
457
|
* ```typescript
|
|
443
|
-
* // Get pool configuration for ARCH
|
|
444
|
-
* const poolConfig = await client.
|
|
458
|
+
* // Get pool configuration for any ARCH pool
|
|
459
|
+
* const poolConfig = await client.getPoolConfigByDenom("aarch");
|
|
445
460
|
* console.log(`Oracle: ${poolConfig.priceOracleContract}`);
|
|
446
461
|
* console.log(`Protocol fee: ${parseFloat(poolConfig.protocolFee) * 100}%`);
|
|
447
462
|
* console.log(`LP fee: ${parseFloat(poolConfig.lpFee) * 100}%`);
|
|
448
463
|
* console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
|
|
449
464
|
* console.log(`Number of LPs: ${poolConfig.lps.length}`);
|
|
450
465
|
* console.log(`Min base output: ${poolConfig.minBaseOut}`);
|
|
466
|
+
*
|
|
467
|
+
* // Get configuration for specific ARCH/USDC pool
|
|
468
|
+
* const specificConfig = await client.getPoolConfigByDenom(
|
|
469
|
+
* "aarch",
|
|
470
|
+
* "ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D"
|
|
471
|
+
* );
|
|
472
|
+
* console.log(`Specific pool fees: ${specificConfig.protocolFee}`);
|
|
451
473
|
* ```
|
|
452
474
|
*/
|
|
453
|
-
abstract
|
|
475
|
+
abstract getPoolConfigByDenom(baseDenom: string, quoteDenom?: string): Promise<PoolConfig>;
|
|
454
476
|
/**
|
|
455
477
|
* Fetches all supported assets across all pools in the Bolt protocol.
|
|
456
478
|
*
|
|
@@ -659,6 +681,8 @@ declare const enum BoltSdkErrorCode {
|
|
|
659
681
|
MISSING_PARAMETER = 4001,
|
|
660
682
|
/** Numeric value outside acceptable range */
|
|
661
683
|
PARAMETER_OUT_OF_RANGE = 4002,
|
|
684
|
+
/** Feature or method not yet implemented */
|
|
685
|
+
NOT_IMPLEMENTED = 4003,
|
|
662
686
|
/** Unexpected or unknown error occurred */
|
|
663
687
|
UNEXPECTED_ERROR = 9000
|
|
664
688
|
}
|
|
@@ -901,6 +925,44 @@ declare class ParameterOutOfRangeError extends BoltSdkErrorBase {
|
|
|
901
925
|
*/
|
|
902
926
|
constructor(parameterName: string, value: number | bigint, min?: number | bigint, max?: number | bigint, details?: string, context?: Record<string, unknown>);
|
|
903
927
|
}
|
|
928
|
+
/**
|
|
929
|
+
* Error thrown when a feature or method is not yet implemented.
|
|
930
|
+
*
|
|
931
|
+
* This error is useful during development to mark planned functionality
|
|
932
|
+
* that hasn't been completed yet. It helps distinguish between bugs
|
|
933
|
+
* and intentionally unimplemented features.
|
|
934
|
+
*
|
|
935
|
+
* @group Errors
|
|
936
|
+
* @category Error Classes
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```typescript
|
|
940
|
+
* class BoltClient {
|
|
941
|
+
* async advancedSwap(params: AdvancedSwapParams): Promise<SwapResult> {
|
|
942
|
+
* throw new NotImplementedError('advancedSwap', 'v2.0.0');
|
|
943
|
+
* }
|
|
944
|
+
* }
|
|
945
|
+
* ```
|
|
946
|
+
*
|
|
947
|
+
* @example
|
|
948
|
+
* ```typescript
|
|
949
|
+
* throw new NotImplementedError(
|
|
950
|
+
* 'multi-hop routing',
|
|
951
|
+
* undefined,
|
|
952
|
+
* { requestedHops: 3, maxSupportedHops: 1 }
|
|
953
|
+
* );
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
956
|
+
declare class NotImplementedError extends BoltSdkErrorBase {
|
|
957
|
+
/**
|
|
958
|
+
* Creates a new NotImplementedError instance.
|
|
959
|
+
*
|
|
960
|
+
* @param feature - The name of the feature or method that is not implemented
|
|
961
|
+
* @param plannedVersion - Optional version when the feature is planned to be implemented
|
|
962
|
+
* @param context - Optional additional context or state information
|
|
963
|
+
*/
|
|
964
|
+
constructor(feature: string, plannedVersion?: string, context?: Record<string, unknown>);
|
|
965
|
+
}
|
|
904
966
|
/**
|
|
905
967
|
* Error thrown when an unexpected or unhandled error occurs.
|
|
906
968
|
*
|
|
@@ -973,4 +1035,4 @@ declare class UnexpectedError extends BoltSdkErrorBase {
|
|
|
973
1035
|
static from(caught: unknown, message?: string, context?: Record<string, unknown>): UnexpectedError;
|
|
974
1036
|
}
|
|
975
1037
|
|
|
976
|
-
export { type Address, type AllowanceMode, type Asset, type AssetsConfig, BaseClient, type BaseLiquidityDetails, type BoltSdkError, BoltSdkErrorBase, type ChainConfig, type ClientConfig, type Coin, type Contracts, DEFAULT_GAS_ADJUSTMENT, type Duration, type Environment, InsufficientFundsError, InvalidAddressError, InvalidObjectError, InvalidParameterError, InvalidTypeError, type InvertiblePrice, MissingParameterError, NetworkError, NotFoundError, type OracleAsset, type OracleAssetPair, type OracleConfig, ParameterOutOfRangeError, ParseError, type Pool, type PoolConfig, type Price, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError, UnexpectedError, getCoinFromAmountWithDenomString };
|
|
1038
|
+
export { type Address, type AllowanceMode, type Asset, type AssetsConfig, BaseClient, type BaseLiquidityDetails, type BoltSdkError, BoltSdkErrorBase, type ChainConfig, type ClientConfig, type Coin, type Contracts, DEFAULT_GAS_ADJUSTMENT, type Duration, type Environment, InsufficientFundsError, InvalidAddressError, InvalidObjectError, InvalidParameterError, InvalidTypeError, type InvertiblePrice, MissingParameterError, NetworkError, NotFoundError, NotImplementedError, type OracleAsset, type OracleAssetPair, type OracleConfig, ParameterOutOfRangeError, ParseError, type Pool, type PoolConfig, type Price, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError, UnexpectedError, getCoinFromAmountWithDenomString };
|
package/dist/index.js
CHANGED
|
@@ -227,6 +227,23 @@ var ParameterOutOfRangeError = class extends BoltSdkErrorBase {
|
|
|
227
227
|
);
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
+
var NotImplementedError = class extends BoltSdkErrorBase {
|
|
231
|
+
/**
|
|
232
|
+
* Creates a new NotImplementedError instance.
|
|
233
|
+
*
|
|
234
|
+
* @param feature - The name of the feature or method that is not implemented
|
|
235
|
+
* @param plannedVersion - Optional version when the feature is planned to be implemented
|
|
236
|
+
* @param context - Optional additional context or state information
|
|
237
|
+
*/
|
|
238
|
+
constructor(feature, plannedVersion, context) {
|
|
239
|
+
const versionInfo = plannedVersion ? ` Planned for version ${plannedVersion}.` : "";
|
|
240
|
+
super(
|
|
241
|
+
4003 /* NOT_IMPLEMENTED */,
|
|
242
|
+
`Feature '${feature}' is not implemented yet.${versionInfo}`,
|
|
243
|
+
context
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
230
247
|
var UnexpectedError = class _UnexpectedError extends BoltSdkErrorBase {
|
|
231
248
|
/**
|
|
232
249
|
* Creates a new UnexpectedError instance.
|
|
@@ -374,6 +391,7 @@ export {
|
|
|
374
391
|
MissingParameterError,
|
|
375
392
|
NetworkError,
|
|
376
393
|
NotFoundError,
|
|
394
|
+
NotImplementedError,
|
|
377
395
|
ParameterOutOfRangeError,
|
|
378
396
|
ParseError,
|
|
379
397
|
TransactionEventNotFoundError,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/defaults.ts","../src/errors.ts","../src/helpers/asset.ts","../src/lib/client.ts"],"sourcesContent":["export const DEFAULT_GAS_ADJUSTMENT = 1.5;\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. Error codes are organized into ranges\n * by category for easier identification and handling.\n *\n * Error Code Ranges:\n * - 1000-1999: Resource & Data Errors\n * - 2000-2999: Blockchain Transaction Errors\n * - 3000-3999: Infrastructure & Network Errors\n * - 4000-4999: Validation & Input Errors\n * - 9000-9999: Unknown & Unexpected Errors\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.swap(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 * case BoltSdkErrorCode.UNEXPECTED_ERROR:\n * console.error(\"Unexpected error occurred:\", error.message);\n * break;\n * default:\n * console.error(\"Operation failed:\", error.message);\n * }\n * }\n * }\n * ```\n */\nconst enum BoltSdkErrorCode {\n /** Resource not found (pools, assets, configurations) */\n NOT_FOUND = 1000,\n /** Invalid object structure or missing required fields */\n INVALID_OBJECT = 1001,\n /** Type mismatch or invalid type provided */\n INVALID_TYPE = 1002,\n /** Insufficient balance to perform the operation */\n INSUFFICIENT_FUNDS = 2000,\n /** Invalid blockchain address format */\n INVALID_ADDRESS = 2001,\n /** Transaction reverted or failed on-chain */\n TRANSACTION_FAILED = 2002,\n /** Expected transaction event not found in logs */\n TRANSACTION_EVENT_NOT_FOUND = 2003,\n /** Network connectivity or RPC communication failure */\n NETWORK_ERROR = 3000,\n /** Invalid parameter provided to a method */\n INVALID_PARAMETER = 4000,\n /** Required parameter is missing */\n MISSING_PARAMETER = 4001,\n /** Numeric value outside acceptable range */\n PARAMETER_OUT_OF_RANGE = 4002,\n /** Unexpected or unknown error occurred */\n UNEXPECTED_ERROR = 9000,\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 /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\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, proper error name setting, and optional context data.\n *\n * @abstract\n * @group Errors\n * @category Error Classes\n */\nexport class BoltSdkErrorBase extends Error implements BoltSdkError {\n /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\n\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 * @param context - Optional additional context or state information\n */\n constructor(\n public code: BoltSdkErrorCode,\n message: string,\n context?: Record<string, unknown>\n ) {\n super(message);\n this.name = this.constructor.name; // Set the error name to the class name\n this.context = context;\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 * @param context - Optional additional context or state information\n */\n constructor(resource: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NOT_FOUND,\n `Resource not found: ${resource}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_OBJECT,\n `Invalid object or data structure!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(expectedType: string, receivedType: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Invalid object type! Expected: ${expectedType}, Received: ${receivedType}`,\n context\n );\n }\n}\n\n/**\n * Error thrown when a response cannot be parsed into the expected TypeScript type.\n *\n * This error is used when API responses, JSON data, or other external data\n * cannot be successfully parsed or validated against the expected TypeScript\n * interface or type definition.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class ParseError extends BoltSdkErrorBase {\n /**\n * Creates a new ParseError instance.\n *\n * @param targetType - The TypeScript type or interface name that parsing failed for\n * @param details - Specific details about what failed during parsing\n * @param context - Optional additional context including the raw data that failed to parse\n */\n constructor(targetType: string, details: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Failed to parse response to type '${targetType}': ${details}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(\n required: string | number,\n available: string | number,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INSUFFICIENT_FUNDS,\n `Insufficient funds to complete the transaction! Required: ${required}, Available: ${available}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(address: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_ADDRESS,\n `Invalid blockchain address provided: ${address}`,\n context\n );\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 * @param context - Optional additional context or state information\n */\n constructor(transactionId: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_FAILED,\n `Transaction failed or was reverted! Transaction ID: ${transactionId}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(eventName: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND,\n `Transaction Event not found: ${eventName}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NETWORK_ERROR,\n `Network error occurred!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n *\n * @template T - The type of the received value\n */\n constructor(\n parameterName: string,\n expected: string,\n receivedValue: T,\n details?: string,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INVALID_PARAMETER,\n `Invalid parameter '${parameterName}': expected ${expected}, received ${typeof receivedValue}${\n details ? `. ${details}` : ''\n }`,\n context\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 expectedLocation - Optional context about where the parameter was expected to be found\n * @param context - Optional additional context or state information\n */\n constructor(parameterName: string, expectedLocation?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.MISSING_PARAMETER,\n `Required parameter '${parameterName}' is missing${expectedLocation ? ` in ${expectedLocation}` : ''}`,\n 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 * @param context - Optional additional context or state information\n */\n constructor(\n parameterName: string,\n value: number | bigint,\n min?: number | bigint,\n max?: number | bigint,\n details?: string,\n context?: Record<string, unknown>\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 context\n );\n }\n}\n\n/**\n * Error thrown when an unexpected or unhandled error occurs.\n *\n * This error is used as a catch-all for errors that don't fit into any\n * of the specific error categories. It can wrap unknown errors from\n * external libraries or unexpected runtime conditions.\n *\n * @group Errors\n * @category Error Classes\n *\n * @example\n * ```typescript\n * try {\n * // Some operation that might throw unknown errors\n * await someExternalLibraryCall();\n * } catch (error) {\n * if (error instanceof Error) {\n * throw new UnexpectedError(error.message, error);\n * } else {\n * throw new UnexpectedError(String(error));\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Handle unexpected conditions\n * if (someUnexpectedCondition) {\n * throw new UnexpectedError(\n * \"Unexpected state encountered during swap operation\",\n * undefined,\n * { poolState, userBalance, timestamp }\n * );\n * }\n * ```\n */\nexport class UnexpectedError extends BoltSdkErrorBase {\n /** The original error that was caught, if any */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown;\n\n /**\n * Creates a new UnexpectedError instance.\n *\n * @param message - A description of the unexpected error\n * @param originalError - Optional original error that was caught\n * @param context - Optional additional context or state information\n */\n constructor(\n message: string,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown,\n context?: Record<string, unknown>\n ) {\n super(BoltSdkErrorCode.UNEXPECTED_ERROR, message, context);\n this.originalError = originalError;\n\n // Preserve the original error's stack trace if available\n if (originalError instanceof Error && originalError.stack) {\n // Append original stack trace to current stack\n this.stack = this.stack + '\\n\\nCaused by:\\n' + originalError.stack;\n }\n }\n\n /**\n * Creates an UnexpectedError from an unknown caught value.\n * This is a convenience method for error handling blocks.\n *\n * @param caught - The value that was caught in a try-catch block\n * @param message - Optional custom message to prepend\n * @param context - Optional additional context\n * @returns A new UnexpectedError instance\n *\n * @example\n * ```typescript\n * try {\n * await riskyOperation();\n * } catch (caught) {\n * throw UnexpectedError.from(\n * caught,\n * \"Failed to execute risky operation\",\n * { operation: 'riskyOperation', timestamp: Date.now() }\n * );\n * }\n * ```\n */\n static from(\n caught: unknown,\n message?: string,\n context?: Record<string, unknown>\n ): UnexpectedError {\n const errorMessage = message\n ? `${message}: ${caught instanceof Error ? caught.message : String(caught)}`\n : caught instanceof Error\n ? caught.message\n : String(caught);\n\n return new UnexpectedError(errorMessage, caught, context);\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 AssetsConfig,\n Asset,\n BaseLiquidityDetails,\n ChainConfig,\n ClientConfig,\n Coin,\n Contracts,\n InvertiblePrice,\n OracleAssetPair,\n OracleConfig,\n Pool,\n PoolConfig,\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 * @template TTxOutput - The type of the transaction output specific to the blockchain implementation\n *\n * @example\n * ```typescript\n * class BoltCosmWasmClient extends BaseClient<OfflineSigner, ExecuteResult> {\n * // Implementation specific to CosmWasm\n * }\n * ```\n */\nexport abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {\n /**\n * The blockchain network configuration containing chain ID, name, and RPC endpoint\n */\n public chainConfig: ChainConfig;\n\n /**\n * Smart contract addresses for making Bolt queries and transactions in the blockchain\n */\n public contracts: Contracts;\n\n /**\n * The denomination of the native token for the chain.\n * This is used for gas fee calculations and native token operations.\n */\n public nativeTokenDenom: string;\n\n /**\n * Configuration mapping of supported assets indexed by their symbol\n */\n public assetsConfig: AssetsConfig;\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 containing chain settings, contracts, native token, and assets\n * @param config.customOverride.chainConfig - (Optional) Chain configuration object\n * @param config.customOverride.chainConfig.id - (Optional) The chain ID of the blockchain network (e.g., \"archway-1\")\n * @param config.customOverride.chainConfig.name - (Optional) The human-readable name of the chain (e.g., \"Archway\")\n * @param config.customOverride.chainConfig.rpcEndpoint - (Optional) RPC endpoint URL for the blockchain network\n * @param config.customOverride.contracts - (Optional) Contract addresses for oracle and router\n * @param config.customOverride.contracts.oracle - (Optional) Oracle contract address\n * @param config.customOverride.contracts.router - (Optional) Router contract address\n * @param config.customOverride.nativeTokenDenom - (Optional) The denomination of the native token (e.g., \"aarch\", \"0x2::sui::SUI\")\n * @param config.customOverride.assetsConfig - (Optional) Configuration for supported assets indexed by symbol\n *\n * @throws {InvalidObjectError} Thrown when required configuration fields are missing\n *\n * @example\n * ```typescript\n * const client = new ConcreteClient({\n * customOverride: {\n * chainConfig: {\n * id: 'archway-1',\n * name: 'Archway',\n * rpcEndpoint: 'https://rpc.example.com'\n * },\n * contracts: {\n * oracle: 'archway1oracle...',\n * router: 'archway1router...'\n * },\n * nativeTokenDenom: 'uarch',\n * assetsConfig: {\n * 'ARCH': {\n * symbol: 'ARCH',\n * name: 'Archway',\n * chainId: 'archway-1',\n * denom: 'aarch',\n * decimals: 18,\n * logo: 'https://...',\n * coingeckoId: 'archway'\n * }\n * }\n * }\n * });\n * ```\n */\n constructor(config?: ClientConfig) {\n const { customOverride: { chainConfig, contracts, nativeTokenDenom, assetsConfig } = {} } =\n config ?? {};\n\n if (\n !chainConfig ||\n !chainConfig?.id ||\n !chainConfig?.name ||\n !chainConfig?.rpcEndpoint ||\n !contracts?.oracle ||\n !contracts?.router ||\n !nativeTokenDenom ||\n !assetsConfig\n ) {\n throw new InvalidObjectError('ClientConfig is missing fields');\n }\n\n this.chainConfig = chainConfig as ChainConfig;\n this.contracts = contracts as Contracts;\n this.nativeTokenDenom = nativeTokenDenom;\n this.assetsConfig = assetsConfig;\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 * console.log(`Admin: ${oracleConfig.admin}`);\n * console.log(`Price threshold ratio: ${oracleConfig.priceThresholdRatio}`);\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} (${pair.base.precision} decimals)`);\n * console.log(` Quote: ${pair.quote.name} (${pair.quote.precision} decimals)`);\n * });\n * ```\n */\n abstract getAllOracleAssetPairs(): Promise<OracleAssetPair[]>;\n\n /**\n * Fetches the current price for a specific base/quote asset pair from the oracle.\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - The denom 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 and whether it's inverted\n *\n * @example\n * ```typescript\n * // Get price of ARCH in terms of USDC\n * const priceResult = await client.getPrice(\"aarch\", \"ibc/...\");\n * console.log(`1 ARCH = ${priceResult.price} USDC`);\n * console.log(`Is inverted: ${priceResult.isInverse}`);\n * ```\n */\n abstract getPrice(baseDenom: string, quoteDenom: 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 and expiry times\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 at: ${new Date(priceData.expiryTime * 1000).toISOString()}`);\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 * console.log(`Oracle address: ${routerConfig.priceOracleContract}`);\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 details, including\n * the base liquidity amount and total shares\n *\n * @example\n * ```typescript\n * const liquidity = await client.getAllBaseAssetsLiquidity();\n * Object.entries(liquidity).forEach(([poolAddress, details]) => {\n * console.log(`Pool ${poolAddress}:`);\n * console.log(` Base: ${details.baseLiquidity.amount} ${details.baseLiquidity.denom}`);\n * console.log(` Total Shares: ${details.totalShares}`);\n * });\n * ```\n */\n abstract getAllBaseAssetsLiquidity(): Promise<Record<Address, BaseLiquidityDetails>>;\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.denom}`);\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 baseDenom - The denom 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 * @throws Will throw an error if no pool exists for the specified base 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.baseDenom}`);\n * console.log('Available quote assets:');\n * pool.quoteAssetsSymbols.forEach(symbol => {\n * console.log(` - ${symbol}`);\n * });\n * ```\n */\n abstract getPoolByBaseAsset(baseDenom: 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.baseDenom}`);\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 is a convenience method 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 baseDenom - The denom 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: ${parseFloat(poolConfig.protocolFee) * 100}%`);\n * console.log(`LP fee: ${parseFloat(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(baseDenom: string): Promise<PoolConfig>;\n\n /**\n * Fetches all supported assets across all pools in the Bolt protocol.\n *\n * This method retrieves comprehensive information about all assets that can be traded,\n * including their metadata, chain-specific details, and external identifiers.\n *\n * @returns A promise that resolves to an array of Asset objects, each containing:\n * - symbol: The asset's trading symbol (e.g., \"ARCH\", \"USDC\")\n * - name: The full name of the asset (e.g., \"Archway\", \"USD Coin\")\n * - chainId: The blockchain network identifier where this asset exists\n * - denom: The chain-specific denomination (e.g., \"aarch\", \"ibc/...\")\n * - decimals: The number of decimal places for the asset\n * - logo: Optional URL to the asset's logo image\n * - coingeckoId: Optional CoinGecko identifier for price data\n *\n * @example\n * ```typescript\n * const assets = await client.getAssets();\n *\n * // Display all available assets\n * assets.forEach(asset => {\n * console.log(`${asset.symbol} (${asset.name})`);\n * console.log(` Chain: ${asset.chainId}`);\n * console.log(` Denom: ${asset.denom}`);\n * console.log(` Decimals: ${asset.decimals}`);\n * if (asset.coingeckoId) {\n * console.log(` CoinGecko: ${asset.coingeckoId}`);\n * }\n * });\n *\n * // Find a specific asset\n * const archAsset = assets.find(a => a.symbol === 'ARCH');\n * console.log(`ARCH denom: ${archAsset?.denom}`);\n * ```\n *\n * @remarks\n * Assets returned by this method represent all tokens available for trading\n * in the Bolt protocol. The list may vary between mainnet and testnet environments.\n */\n abstract getAssets(): Promise<Asset[]>;\n\n /**\n * Executes a swap operation on the blockchain from one asset to another.\n *\n * This method performs a \"swap exact in\" 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 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 * @param signer - The transaction signer that will authorize the swap operation.\n * Must have sufficient balance of the input asset.\n *\n * @returns A promise that resolves to a SwapResult containing:\n * - txOutput: Transaction execution details (type varies by implementation)\n * - amountOut: The actual amount of output asset received (as a string)\n * - assetOut: The denom of the asset received\n * - txHash: The transaction hash\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.swap({\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 * }, signer);\n *\n * console.log(`Swapped exactly 1 ARCH`);\n * console.log(`Received: ${result.amountOut} ${result.assetOut}`);\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 * The TTxOutput type parameter represents the transaction execution result type,\n * which varies by blockchain implementation (e.g., ExecuteResult for CosmWasm).\n */\n abstract swap(params: SwapParams, signer?: TSigner): Promise<SwapResult<TTxOutput>>;\n\n /**\n * Estimates the gas fees for a swap operation without executing the transaction.\n *\n * This method performs a dry run of the swap transaction to calculate the required gas fees\n * in the chain's native token denomination. It's useful for displaying estimated costs\n * to users before they confirm a swap, or for ensuring sufficient gas balance.\n *\n * @param params - The swap configuration parameters (same as for the swap method)\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 * @param params.receiver - Optional recipient address for the swapped assets\n * @param signer - The transaction signer that would authorize the swap operation\n * @param gasAdjustment - Optional multiplier for gas estimation (default: 1.5).\n * Use higher values for safety margin. For example, 1.5 means 50% buffer.\n *\n * @returns A promise that resolves to a Coin object containing:\n * - denom: The gas token denomination (e.g., \"uarch\" for Archway, \"SUI\" for Sui)\n * - amount: The estimated gas amount as a string (in minimal denomination)\n * Returns undefined if gas estimation fails or is not supported\n *\n * @example\n * ```typescript\n * // Estimate gas for swapping 1 ARCH to USDC\n * const gasEstimate = await client.estimateSwapGasFees({\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC\n * minimumAmountOut: \"1950000000\" // Min 1950 USDC\n * }, signer, 1.3); // 30% safety margin\n *\n * if (gasEstimate) {\n * console.log(`Estimated gas: ${gasEstimate.amount} ${gasEstimate.denom}`);\n * }\n * ```\n *\n * @remarks\n * - Gas estimation is performed via simulation/dry run without state changes\n * - The returned amount is in the smallest denomination of the native token\n * - Different chains have different decimal places (e.g., 6 for Cosmos chains, 9 for Sui)\n * - The gasAdjustment parameter helps account for potential variations in actual execution\n * - Some implementations may return undefined if gas estimation is not available\n * - Always ensure the signer has sufficient native token balance for gas fees\n */\n abstract estimateSwapGasFees(\n params: SwapParams,\n signer?: TSigner,\n gasAdjustment?: number\n ): Promise<Coin | undefined>;\n}\n"],"mappings":";;;;;AAAO,IAAM,yBAAyB;;;ACiG/B,IAAM,mBAAN,cAA+B,MAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWlE,YACS,MACP,SACA,SACA;AACA,UAAM,OAAO;AAJN;AAVT;AAAA;AAeE,SAAK,OAAO,KAAK,YAAY;AAC7B,SAAK,UAAU;AAAA,EACjB;AACF;AAUO,IAAM,gBAAN,cAA4B,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,YAAY,UAAkB,SAAkB,SAAmC;AACjF;AAAA,MACE;AAAA,MACA,uBAAuB,QAAQ,IAAI,UAAU,aAAa,OAAO,KAAK,EAAE;AAAA,MACxE;AAAA,IACF;AAAA,EACF;AACF;AAQO,IAAM,qBAAN,cAAiC,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOvD,YAAY,SAAkB,SAAmC;AAC/D;AAAA,MACE;AAAA,MACA,oCAAoC,UAAU,aAAa,OAAO,KAAK,EAAE;AAAA,MACzE;AAAA,IACF;AAAA,EACF;AACF;AAQO,IAAM,mBAAN,cAA+B,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQrD,YAAY,cAAsB,cAAsB,SAAmC;AACzF;AAAA,MACE;AAAA,MACA,kCAAkC,YAAY,eAAe,YAAY;AAAA,MACzE;AAAA,IACF;AAAA,EACF;AACF;AAYO,IAAM,aAAN,cAAyB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AAO;AAKP;AAAA;AAAA;AAAA,wBAAO;AAiDL,UAAM,EAAE,gBAAgB,EAAE,aAAa,WAAW,kBAAkB,aAAa,IAAI,CAAC,EAAE,IACtF,UAAU,CAAC;AAEb,QACE,CAAC,eACD,CAAC,aAAa,MACd,CAAC,aAAa,QACd,CAAC,aAAa,eACd,CAAC,WAAW,UACZ,CAAC,WAAW,UACZ,CAAC,oBACD,CAAC,cACD;AACA,YAAM,IAAI,mBAAmB,gCAAgC;AAAA,IAC/D;AAEA,SAAK,cAAc;AACnB,SAAK,YAAY;AACjB,SAAK,mBAAmB;AACxB,SAAK,eAAe;AAAA,EACtB;AA6WF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/constants/defaults.ts","../src/errors.ts","../src/helpers/asset.ts","../src/lib/client.ts"],"sourcesContent":["export const DEFAULT_GAS_ADJUSTMENT = 1.5;\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. Error codes are organized into ranges\n * by category for easier identification and handling.\n *\n * Error Code Ranges:\n * - 1000-1999: Resource & Data Errors\n * - 2000-2999: Blockchain Transaction Errors\n * - 3000-3999: Infrastructure & Network Errors\n * - 4000-4999: Validation & Input Errors\n * - 9000-9999: Unknown & Unexpected Errors\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.swap(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 * case BoltSdkErrorCode.UNEXPECTED_ERROR:\n * console.error(\"Unexpected error occurred:\", error.message);\n * break;\n * default:\n * console.error(\"Operation failed:\", error.message);\n * }\n * }\n * }\n * ```\n */\nconst enum BoltSdkErrorCode {\n /** Resource not found (pools, assets, configurations) */\n NOT_FOUND = 1000,\n /** Invalid object structure or missing required fields */\n INVALID_OBJECT = 1001,\n /** Type mismatch or invalid type provided */\n INVALID_TYPE = 1002,\n /** Insufficient balance to perform the operation */\n INSUFFICIENT_FUNDS = 2000,\n /** Invalid blockchain address format */\n INVALID_ADDRESS = 2001,\n /** Transaction reverted or failed on-chain */\n TRANSACTION_FAILED = 2002,\n /** Expected transaction event not found in logs */\n TRANSACTION_EVENT_NOT_FOUND = 2003,\n /** Network connectivity or RPC communication failure */\n NETWORK_ERROR = 3000,\n /** Invalid parameter provided to a method */\n INVALID_PARAMETER = 4000,\n /** Required parameter is missing */\n MISSING_PARAMETER = 4001,\n /** Numeric value outside acceptable range */\n PARAMETER_OUT_OF_RANGE = 4002,\n /** Feature or method not yet implemented */\n NOT_IMPLEMENTED = 4003,\n /** Unexpected or unknown error occurred */\n UNEXPECTED_ERROR = 9000,\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 /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\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, proper error name setting, and optional context data.\n *\n * @abstract\n * @group Errors\n * @category Error Classes\n */\nexport class BoltSdkErrorBase extends Error implements BoltSdkError {\n /** Optional additional context data that might help debugging */\n context?: Record<string, unknown>;\n\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 * @param context - Optional additional context or state information\n */\n constructor(\n public code: BoltSdkErrorCode,\n message: string,\n context?: Record<string, unknown>\n ) {\n super(message);\n this.name = this.constructor.name; // Set the error name to the class name\n this.context = context;\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 * @param context - Optional additional context or state information\n */\n constructor(resource: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NOT_FOUND,\n `Resource not found: ${resource}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_OBJECT,\n `Invalid object or data structure!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(expectedType: string, receivedType: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Invalid object type! Expected: ${expectedType}, Received: ${receivedType}`,\n context\n );\n }\n}\n\n/**\n * Error thrown when a response cannot be parsed into the expected TypeScript type.\n *\n * This error is used when API responses, JSON data, or other external data\n * cannot be successfully parsed or validated against the expected TypeScript\n * interface or type definition.\n *\n * @group Errors\n * @category Error Classes\n */\nexport class ParseError extends BoltSdkErrorBase {\n /**\n * Creates a new ParseError instance.\n *\n * @param targetType - The TypeScript type or interface name that parsing failed for\n * @param details - Specific details about what failed during parsing\n * @param context - Optional additional context including the raw data that failed to parse\n */\n constructor(targetType: string, details: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_TYPE,\n `Failed to parse response to type '${targetType}': ${details}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(\n required: string | number,\n available: string | number,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INSUFFICIENT_FUNDS,\n `Insufficient funds to complete the transaction! Required: ${required}, Available: ${available}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(address: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.INVALID_ADDRESS,\n `Invalid blockchain address provided: ${address}`,\n context\n );\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 * @param context - Optional additional context or state information\n */\n constructor(transactionId: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_FAILED,\n `Transaction failed or was reverted! Transaction ID: ${transactionId}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(eventName: string, details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND,\n `Transaction Event not found: ${eventName}.${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n */\n constructor(details?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.NETWORK_ERROR,\n `Network error occurred!${details ? ` Details: ${details}` : ''}`,\n context\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 * @param context - Optional additional context or state information\n *\n * @template T - The type of the received value\n */\n constructor(\n parameterName: string,\n expected: string,\n receivedValue: T,\n details?: string,\n context?: Record<string, unknown>\n ) {\n super(\n BoltSdkErrorCode.INVALID_PARAMETER,\n `Invalid parameter '${parameterName}': expected ${expected}, received ${typeof receivedValue}${\n details ? `. ${details}` : ''\n }`,\n context\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 expectedLocation - Optional context about where the parameter was expected to be found\n * @param context - Optional additional context or state information\n */\n constructor(parameterName: string, expectedLocation?: string, context?: Record<string, unknown>) {\n super(\n BoltSdkErrorCode.MISSING_PARAMETER,\n `Required parameter '${parameterName}' is missing${expectedLocation ? ` in ${expectedLocation}` : ''}`,\n 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 * @param context - Optional additional context or state information\n */\n constructor(\n parameterName: string,\n value: number | bigint,\n min?: number | bigint,\n max?: number | bigint,\n details?: string,\n context?: Record<string, unknown>\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 context\n );\n }\n}\n\n/**\n * Error thrown when a feature or method is not yet implemented.\n *\n * This error is useful during development to mark planned functionality\n * that hasn't been completed yet. It helps distinguish between bugs\n * and intentionally unimplemented features.\n *\n * @group Errors\n * @category Error Classes\n *\n * @example\n * ```typescript\n * class BoltClient {\n * async advancedSwap(params: AdvancedSwapParams): Promise<SwapResult> {\n * throw new NotImplementedError('advancedSwap', 'v2.0.0');\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * throw new NotImplementedError(\n * 'multi-hop routing',\n * undefined,\n * { requestedHops: 3, maxSupportedHops: 1 }\n * );\n * ```\n */\nexport class NotImplementedError extends BoltSdkErrorBase {\n /**\n * Creates a new NotImplementedError instance.\n *\n * @param feature - The name of the feature or method that is not implemented\n * @param plannedVersion - Optional version when the feature is planned to be implemented\n * @param context - Optional additional context or state information\n */\n constructor(feature: string, plannedVersion?: string, context?: Record<string, unknown>) {\n const versionInfo = plannedVersion ? ` Planned for version ${plannedVersion}.` : '';\n\n super(\n BoltSdkErrorCode.NOT_IMPLEMENTED,\n `Feature '${feature}' is not implemented yet.${versionInfo}`,\n context\n );\n }\n}\n\n/**\n * Error thrown when an unexpected or unhandled error occurs.\n *\n * This error is used as a catch-all for errors that don't fit into any\n * of the specific error categories. It can wrap unknown errors from\n * external libraries or unexpected runtime conditions.\n *\n * @group Errors\n * @category Error Classes\n *\n * @example\n * ```typescript\n * try {\n * // Some operation that might throw unknown errors\n * await someExternalLibraryCall();\n * } catch (error) {\n * if (error instanceof Error) {\n * throw new UnexpectedError(error.message, error);\n * } else {\n * throw new UnexpectedError(String(error));\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Handle unexpected conditions\n * if (someUnexpectedCondition) {\n * throw new UnexpectedError(\n * \"Unexpected state encountered during swap operation\",\n * undefined,\n * { poolState, userBalance, timestamp }\n * );\n * }\n * ```\n */\nexport class UnexpectedError extends BoltSdkErrorBase {\n /** The original error that was caught, if any */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown;\n\n /**\n * Creates a new UnexpectedError instance.\n *\n * @param message - A description of the unexpected error\n * @param originalError - Optional original error that was caught\n * @param context - Optional additional context or state information\n */\n constructor(\n message: string,\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n originalError?: Error | unknown,\n context?: Record<string, unknown>\n ) {\n super(BoltSdkErrorCode.UNEXPECTED_ERROR, message, context);\n this.originalError = originalError;\n\n // Preserve the original error's stack trace if available\n if (originalError instanceof Error && originalError.stack) {\n // Append original stack trace to current stack\n this.stack = this.stack + '\\n\\nCaused by:\\n' + originalError.stack;\n }\n }\n\n /**\n * Creates an UnexpectedError from an unknown caught value.\n * This is a convenience method for error handling blocks.\n *\n * @param caught - The value that was caught in a try-catch block\n * @param message - Optional custom message to prepend\n * @param context - Optional additional context\n * @returns A new UnexpectedError instance\n *\n * @example\n * ```typescript\n * try {\n * await riskyOperation();\n * } catch (caught) {\n * throw UnexpectedError.from(\n * caught,\n * \"Failed to execute risky operation\",\n * { operation: 'riskyOperation', timestamp: Date.now() }\n * );\n * }\n * ```\n */\n static from(\n caught: unknown,\n message?: string,\n context?: Record<string, unknown>\n ): UnexpectedError {\n const errorMessage = message\n ? `${message}: ${caught instanceof Error ? caught.message : String(caught)}`\n : caught instanceof Error\n ? caught.message\n : String(caught);\n\n return new UnexpectedError(errorMessage, caught, context);\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 AssetsConfig,\n Asset,\n BaseLiquidityDetails,\n ChainConfig,\n ClientConfig,\n Coin,\n Contracts,\n InvertiblePrice,\n OracleAssetPair,\n OracleConfig,\n Pool,\n PoolConfig,\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 * @template TTxOutput - The type of the transaction output specific to the blockchain implementation\n *\n * @example\n * ```typescript\n * class BoltCosmWasmClient extends BaseClient<OfflineSigner, ExecuteResult> {\n * // Implementation specific to CosmWasm\n * }\n * ```\n */\nexport abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {\n /**\n * The blockchain network configuration containing chain ID, name, and RPC endpoint\n */\n public chainConfig: ChainConfig;\n\n /**\n * Smart contract addresses for making Bolt queries and transactions in the blockchain\n */\n public contracts: Contracts;\n\n /**\n * The denomination of the native token for the chain.\n * This is used for gas fee calculations and native token operations.\n */\n public nativeTokenDenom: string;\n\n /**\n * Configuration mapping of supported assets indexed by their symbol\n */\n public assetsConfig: AssetsConfig;\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 containing chain settings, contracts, native token, and assets\n * @param config.customOverride.chainConfig - (Optional) Chain configuration object\n * @param config.customOverride.chainConfig.id - (Optional) The chain ID of the blockchain network (e.g., \"archway-1\")\n * @param config.customOverride.chainConfig.name - (Optional) The human-readable name of the chain (e.g., \"Archway\")\n * @param config.customOverride.chainConfig.rpcEndpoint - (Optional) RPC endpoint URL for the blockchain network\n * @param config.customOverride.contracts - (Optional) Contract addresses for oracle and router\n * @param config.customOverride.contracts.oracle - (Optional) Oracle contract address\n * @param config.customOverride.contracts.router - (Optional) Router contract address\n * @param config.customOverride.nativeTokenDenom - (Optional) The denomination of the native token (e.g., \"aarch\", \"0x2::sui::SUI\")\n * @param config.customOverride.assetsConfig - (Optional) Configuration for supported assets indexed by symbol\n *\n * @throws {InvalidObjectError} Thrown when required configuration fields are missing\n *\n * @example\n * ```typescript\n * const client = new ConcreteClient({\n * customOverride: {\n * chainConfig: {\n * id: 'archway-1',\n * name: 'Archway',\n * rpcEndpoint: 'https://rpc.example.com'\n * },\n * contracts: {\n * oracle: 'archway1oracle...',\n * router: 'archway1router...'\n * },\n * nativeTokenDenom: 'uarch',\n * assetsConfig: {\n * 'ARCH': {\n * symbol: 'ARCH',\n * name: 'Archway',\n * chainId: 'archway-1',\n * denom: 'aarch',\n * decimals: 18,\n * logo: 'https://...',\n * coingeckoId: 'archway'\n * }\n * }\n * }\n * });\n * ```\n */\n constructor(config?: ClientConfig) {\n const { customOverride: { chainConfig, contracts, nativeTokenDenom, assetsConfig } = {} } =\n config ?? {};\n\n if (\n !chainConfig ||\n !chainConfig?.id ||\n !chainConfig?.name ||\n !chainConfig?.rpcEndpoint ||\n !contracts?.oracle ||\n !contracts?.router ||\n !nativeTokenDenom ||\n !assetsConfig\n ) {\n throw new InvalidObjectError('ClientConfig is missing fields');\n }\n\n this.chainConfig = chainConfig as ChainConfig;\n this.contracts = contracts as Contracts;\n this.nativeTokenDenom = nativeTokenDenom;\n this.assetsConfig = assetsConfig;\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 * console.log(`Admin: ${oracleConfig.admin}`);\n * console.log(`Price threshold ratio: ${oracleConfig.priceThresholdRatio}`);\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} (${pair.base.precision} decimals)`);\n * console.log(` Quote: ${pair.quote.name} (${pair.quote.precision} decimals)`);\n * });\n * ```\n */\n abstract getAllOracleAssetPairs(): Promise<OracleAssetPair[]>;\n\n /**\n * Fetches the current price for a specific base/quote asset pair from the oracle.\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - The denom 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 and whether it's inverted\n *\n * @example\n * ```typescript\n * // Get price of ARCH in terms of USDC\n * const priceResult = await client.getPrice(\"aarch\", \"ibc/...\");\n * console.log(`1 ARCH = ${priceResult.price} USDC`);\n * console.log(`Is inverted: ${priceResult.isInverse}`);\n * ```\n */\n abstract getPrice(baseDenom: string, quoteDenom: 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 and expiry times\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 at: ${new Date(priceData.expiryTime * 1000).toISOString()}`);\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 * console.log(`Oracle address: ${routerConfig.priceOracleContract}`);\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 details, including\n * the base liquidity amount and total shares\n *\n * @example\n * ```typescript\n * const liquidity = await client.getAllBaseAssetsLiquidity();\n * Object.entries(liquidity).forEach(([poolAddress, details]) => {\n * console.log(`Pool ${poolAddress}:`);\n * console.log(` Base: ${details.baseLiquidity.amount} ${details.baseLiquidity.denom}`);\n * console.log(` Total Shares: ${details.totalShares}`);\n * });\n * ```\n */\n abstract getAllBaseAssetsLiquidity(): Promise<Record<Address, BaseLiquidityDetails>>;\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.denom}`);\n * });\n * });\n * ```\n */\n abstract getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>>;\n\n /**\n * Fetches pool information for a specific asset pair.\n *\n * This method retrieves pool information based on a base asset denomination,\n * with an optional quote asset denomination to find a specific pool when\n * multiple pools exist for the same base asset (this depends on the chain-specific\n * implementation)\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool\n *\n * @returns A promise that resolves to the pool information for the specified asset(s)\n *\n * @throws Will throw an error if no pool exists for the specified base asset,\n * or if quoteDenom is provided but no matching pool is found\n *\n * @example\n * ```typescript\n * // Get any pool for the base asset\n * const pool = await client.getPoolByDenom(\"aarch\");\n * console.log(`Pool address: ${pool.poolAddress}`);\n * console.log(`Base asset: ${pool.baseDenom}`);\n * console.log('Available quote assets:');\n * pool.quoteDenoms.forEach(denom => {\n * console.log(` - ${denom}`);\n * });\n *\n * // Get pool for ARCH as base asset\n * const specificPool = await client.getPoolByDenom(\n * \"aarch\"\n * );\n * console.log(`Found pool: ${specificPool.poolAddress}`);\n * ```\n */\n abstract getPoolByDenom(baseDenom: string, quoteDenom?: 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.baseDenom}`);\n * console.log(` Quotes: ${pool.quoteDenoms.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 asset denominations.\n *\n * This is a convenience method that combines pool lookup and configuration retrieval.\n * It first finds the pool associated with the given asset pair, then fetches that\n * pool's configuration parameters.\n *\n * @param baseDenom - The denom of the base asset (e.g., \"aarch\", \"ibc/...\")\n * @param quoteDenom - (Optional) The denom of the quote asset to find a specific pool\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 asset(s)\n *\n * @example\n * ```typescript\n * // Get pool configuration for any ARCH pool\n * const poolConfig = await client.getPoolConfigByDenom(\"aarch\");\n * console.log(`Oracle: ${poolConfig.priceOracleContract}`);\n * console.log(`Protocol fee: ${parseFloat(poolConfig.protocolFee) * 100}%`);\n * console.log(`LP fee: ${parseFloat(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 * // Get configuration for specific ARCH/USDC pool\n * const specificConfig = await client.getPoolConfigByDenom(\n * \"aarch\",\n * \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\"\n * );\n * console.log(`Specific pool fees: ${specificConfig.protocolFee}`);\n * ```\n */\n abstract getPoolConfigByDenom(baseDenom: string, quoteDenom?: string): Promise<PoolConfig>;\n\n /**\n * Fetches all supported assets across all pools in the Bolt protocol.\n *\n * This method retrieves comprehensive information about all assets that can be traded,\n * including their metadata, chain-specific details, and external identifiers.\n *\n * @returns A promise that resolves to an array of Asset objects, each containing:\n * - symbol: The asset's trading symbol (e.g., \"ARCH\", \"USDC\")\n * - name: The full name of the asset (e.g., \"Archway\", \"USD Coin\")\n * - chainId: The blockchain network identifier where this asset exists\n * - denom: The chain-specific denomination (e.g., \"aarch\", \"ibc/...\")\n * - decimals: The number of decimal places for the asset\n * - logo: Optional URL to the asset's logo image\n * - coingeckoId: Optional CoinGecko identifier for price data\n *\n * @example\n * ```typescript\n * const assets = await client.getAssets();\n *\n * // Display all available assets\n * assets.forEach(asset => {\n * console.log(`${asset.symbol} (${asset.name})`);\n * console.log(` Chain: ${asset.chainId}`);\n * console.log(` Denom: ${asset.denom}`);\n * console.log(` Decimals: ${asset.decimals}`);\n * if (asset.coingeckoId) {\n * console.log(` CoinGecko: ${asset.coingeckoId}`);\n * }\n * });\n *\n * // Find a specific asset\n * const archAsset = assets.find(a => a.symbol === 'ARCH');\n * console.log(`ARCH denom: ${archAsset?.denom}`);\n * ```\n *\n * @remarks\n * Assets returned by this method represent all tokens available for trading\n * in the Bolt protocol. The list may vary between mainnet and testnet environments.\n */\n abstract getAssets(): Promise<Asset[]>;\n\n /**\n * Executes a swap operation on the blockchain from one asset to another.\n *\n * This method performs a \"swap exact in\" 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 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 * @param signer - The transaction signer that will authorize the swap operation.\n * Must have sufficient balance of the input asset.\n *\n * @returns A promise that resolves to a SwapResult containing:\n * - txOutput: Transaction execution details (type varies by implementation)\n * - amountOut: The actual amount of output asset received (as a string)\n * - assetOut: The denom of the asset received\n * - txHash: The transaction hash\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.swap({\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 * }, signer);\n *\n * console.log(`Swapped exactly 1 ARCH`);\n * console.log(`Received: ${result.amountOut} ${result.assetOut}`);\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 * The TTxOutput type parameter represents the transaction execution result type,\n * which varies by blockchain implementation (e.g., ExecuteResult for CosmWasm).\n */\n abstract swap(params: SwapParams, signer?: TSigner): Promise<SwapResult<TTxOutput>>;\n\n /**\n * Estimates the gas fees for a swap operation without executing the transaction.\n *\n * This method performs a dry run of the swap transaction to calculate the required gas fees\n * in the chain's native token denomination. It's useful for displaying estimated costs\n * to users before they confirm a swap, or for ensuring sufficient gas balance.\n *\n * @param params - The swap configuration parameters (same as for the swap method)\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 * @param params.receiver - Optional recipient address for the swapped assets\n * @param signer - The transaction signer that would authorize the swap operation\n * @param gasAdjustment - Optional multiplier for gas estimation (default: 1.5).\n * Use higher values for safety margin. For example, 1.5 means 50% buffer.\n *\n * @returns A promise that resolves to a Coin object containing:\n * - denom: The gas token denomination (e.g., \"uarch\" for Archway, \"SUI\" for Sui)\n * - amount: The estimated gas amount as a string (in minimal denomination)\n * Returns undefined if gas estimation fails or is not supported\n *\n * @example\n * ```typescript\n * // Estimate gas for swapping 1 ARCH to USDC\n * const gasEstimate = await client.estimateSwapGasFees({\n * assetIn: \"aarch\",\n * amountIn: \"1000000000000000000\", // 1 ARCH\n * assetOut: \"ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D\", // USDC\n * minimumAmountOut: \"1950000000\" // Min 1950 USDC\n * }, signer, 1.3); // 30% safety margin\n *\n * if (gasEstimate) {\n * console.log(`Estimated gas: ${gasEstimate.amount} ${gasEstimate.denom}`);\n * }\n * ```\n *\n * @remarks\n * - Gas estimation is performed via simulation/dry run without state changes\n * - The returned amount is in the smallest denomination of the native token\n * - Different chains have different decimal places (e.g., 6 for Cosmos chains, 9 for Sui)\n * - The gasAdjustment parameter helps account for potential variations in actual execution\n * - Some implementations may return undefined if gas estimation is not available\n * - Always ensure the signer has sufficient native token balance for gas fees\n */\n abstract estimateSwapGasFees(\n params: SwapParams,\n signer?: TSigner,\n gasAdjustment?: number\n ): Promise<Coin | undefined>;\n}\n"],"mappings":";;;;;AAAO,IAAM,yBAAyB;;;ACmG/B,IAAM,mBAAN,cAA+B,MAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWlE,YACS,MACP,SACA,SACA;AACA,UAAM,OAAO;AAJN;AAVT;AAAA;AAeE,SAAK,OAAO,KAAK,YAAY;AAC7B,SAAK,UAAU;AAAA,EACjB;AACF;AAUO,IAAM,gBAAN,cAA4B,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,YAAY,UAAkB,SAAkB,SAAmC;AACjF;AAAA,MACE;AAAA,MACA,uBAAuB,QAAQ,IAAI,UAAU,aAAa,OAAO,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