@bolt-liquidity-hq/cosmwasm-client 0.1.0-beta.7 → 0.1.0-beta.8

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.d.ts CHANGED
@@ -1,730 +1,8 @@
1
1
  import { ArchwayClient, SigningArchwayClient } from '@archwayhq/arch3.js';
2
+ import { ChainConfig, ClientConfig, BaseClient, OracleConfig, OracleAssetPair, InvertiblePrice, Price, RouterConfig, Address, BaseLiquidityDetails, Coin, Pool, PoolConfig, Asset, SwapParams, SwapResult } from '@bolt-liquidity-hq/core';
2
3
  import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from '@cosmjs/cosmwasm-stargate';
3
4
  import { OfflineSigner } from '@cosmjs/proto-signing';
4
5
 
5
- /**
6
- * Error codes used throughout the Bolt SDK to categorize different types of errors.
7
- *
8
- * These codes help in programmatic error handling and provide a consistent way
9
- * to identify error types across the SDK. Error codes are organized into ranges
10
- * by category for easier identification and handling.
11
- *
12
- * Error Code Ranges:
13
- * - 1000-1999: Resource & Data Errors
14
- * - 2000-2999: Blockchain Transaction Errors
15
- * - 3000-3999: Infrastructure & Network Errors
16
- * - 4000-4999: Validation & Input Errors
17
- *
18
- * @enum {number}
19
- * @group Errors
20
- * @category Error Types
21
- *
22
- * @example
23
- * ```typescript
24
- * import { BoltSdkErrorCode, BoltSdkError } from '@bolt-liquidity-hq/cosmwasm-client';
25
- *
26
- * try {
27
- * await client.swap(signer, params);
28
- * } catch (error) {
29
- * if (error instanceof BoltSdkError) {
30
- * switch (error.code) {
31
- * case BoltSdkErrorCode.INVALID_ADDRESS:
32
- * console.error("Invalid address format");
33
- * break;
34
- * case BoltSdkErrorCode.TRANSACTION_EVENT_NOT_FOUND:
35
- * console.error("Transaction event not found");
36
- * break;
37
- * default:
38
- * console.error("Operation failed:", error.message);
39
- * }
40
- * }
41
- * }
42
- * ```
43
- */
44
- declare enum BoltSdkErrorCode {
45
- /** Resource not found (pools, assets, configurations) */
46
- NOT_FOUND = 1000,
47
- /** Invalid object structure or missing required fields */
48
- INVALID_OBJECT = 1001,
49
- /** Type mismatch or invalid type provided */
50
- INVALID_TYPE = 1002,
51
- /** Insufficient balance to perform the operation */
52
- INSUFFICIENT_FUNDS = 2000,
53
- /** Invalid blockchain address format */
54
- INVALID_ADDRESS = 2001,
55
- /** Transaction reverted or failed on-chain */
56
- TRANSACTION_FAILED = 2002,
57
- /** Expected transaction event not found in logs */
58
- TRANSACTION_EVENT_NOT_FOUND = 2003,
59
- /** Network connectivity or RPC communication failure */
60
- NETWORK_ERROR = 3000,
61
- /** Invalid parameter provided to a method */
62
- INVALID_PARAMETER = 4000,
63
- /** Required parameter is missing */
64
- MISSING_PARAMETER = 4001,
65
- /** Numeric value outside acceptable range */
66
- PARAMETER_OUT_OF_RANGE = 4002
67
- }
68
- /**
69
- * Base interface for all Bolt SDK errors.
70
- *
71
- * All custom errors in the SDK implement this interface, providing
72
- * a consistent error structure with error codes for easy handling.
73
- *
74
- * @interface
75
- * @group Errors
76
- * @category Error Types
77
- */
78
- interface BoltSdkError extends Error {
79
- /** The error code categorizing this error */
80
- code: BoltSdkErrorCode;
81
- }
82
- /**
83
- * Base class for all custom errors in the Bolt SDK.
84
- *
85
- * This abstract base class provides common functionality for all SDK errors,
86
- * including error code assignment and proper error name setting.
87
- *
88
- * @abstract
89
- * @group Errors
90
- * @category Error Classes
91
- */
92
- declare class BoltSdkErrorBase extends Error implements BoltSdkError {
93
- code: BoltSdkErrorCode;
94
- /**
95
- * Creates a new BoltSdkErrorBase instance.
96
- *
97
- * @param code - The error code categorizing this error
98
- * @param message - Human-readable error message
99
- */
100
- constructor(code: BoltSdkErrorCode, message: string);
101
- }
102
- /**
103
- * Error thrown when a requested resource cannot be found.
104
- *
105
- * @group Errors
106
- * @category Error Classes
107
- */
108
- declare class NotFoundError extends BoltSdkErrorBase {
109
- /**
110
- * Creates a new NotFoundError instance.
111
- *
112
- * @param resource - The type of resource that was not found
113
- * @param details - Optional additional details about what was searched for
114
- */
115
- constructor(resource: string, details?: string);
116
- }
117
- /**
118
- * Error thrown when an object doesn't have the expected structure.
119
- *
120
- * @group Errors
121
- * @category Error Classes
122
- */
123
- declare class InvalidObjectError extends BoltSdkErrorBase {
124
- /**
125
- * Creates a new InvalidObjectError instance.
126
- *
127
- * @param details - Optional description of what is invalid about the object
128
- */
129
- constructor(details?: string);
130
- }
131
- /**
132
- * Error thrown when an unexpected type is encountered.
133
- *
134
- * @group Errors
135
- * @category Error Classes
136
- */
137
- declare class InvalidTypeError extends BoltSdkErrorBase {
138
- /**
139
- * Creates a new InvalidTypeError instance.
140
- *
141
- * @param expectedType - The type that was expected
142
- * @param receivedType - The actual type that was received
143
- */
144
- constructor(expectedType: string, receivedType: string);
145
- }
146
- /**
147
- * Error thrown when an account has insufficient funds for an operation.
148
- *
149
- * @group Errors
150
- * @category Error Classes
151
- */
152
- declare class InsufficientFundsError extends BoltSdkErrorBase {
153
- /**
154
- * Creates a new InsufficientFundsError instance.
155
- *
156
- * @param required - The amount required for the operation
157
- * @param available - The amount available in the account
158
- */
159
- constructor(required: number, available: number);
160
- }
161
- /**
162
- * Error thrown when an invalid blockchain address is provided.
163
- *
164
- * @group Errors
165
- * @category Error Classes
166
- */
167
- declare class InvalidAddressError extends BoltSdkErrorBase {
168
- /**
169
- * Creates a new InvalidAddressError instance.
170
- *
171
- * @param address - The invalid address that was provided
172
- */
173
- constructor(address: string);
174
- }
175
- /**
176
- * Error thrown when a blockchain transaction fails or is reverted.
177
- *
178
- * @group Errors
179
- * @category Error Classes
180
- */
181
- declare class TransactionFailedError extends BoltSdkErrorBase {
182
- /**
183
- * Creates a new TransactionFailedError instance.
184
- *
185
- * @param transactionId - The transaction hash or identifier
186
- * @param details - Optional details about why the transaction failed
187
- */
188
- constructor(transactionId: string, details?: string);
189
- }
190
- /**
191
- * Error thrown when an expected transaction event is not found in the logs.
192
- *
193
- * @group Errors
194
- * @category Error Classes
195
- */
196
- declare class TransactionEventNotFoundError extends BoltSdkErrorBase {
197
- /**
198
- * Creates a new TransactionEventNotFoundError instance.
199
- *
200
- * @param eventName - The name of the event that was expected
201
- * @param details - Optional details about the context
202
- */
203
- constructor(eventName: string, details?: string);
204
- }
205
- /**
206
- * Error thrown when network communication fails.
207
- *
208
- * @group Errors
209
- * @category Error Classes
210
- */
211
- declare class NetworkError extends BoltSdkErrorBase {
212
- /**
213
- * Creates a new NetworkError instance.
214
- *
215
- * @param details - Optional details about the network failure
216
- */
217
- constructor(details?: string);
218
- }
219
- /**
220
- * Error thrown when an invalid parameter is provided to a method.
221
- *
222
- * @group Errors
223
- * @category Error Classes
224
- */
225
- declare class InvalidParameterError<T = unknown> extends BoltSdkErrorBase {
226
- /**
227
- * Creates a new InvalidParameterError instance.
228
- *
229
- * @param parameterName - The name of the invalid parameter
230
- * @param expected - Description of what was expected
231
- * @param receivedValue - The actual value that was provided
232
- * @param details - Optional additional details or constraints
233
- *
234
- * @template T - The type of the received value
235
- */
236
- constructor(parameterName: string, expected: string, receivedValue: T, details?: string);
237
- }
238
- /**
239
- * Error thrown when a required parameter is missing.
240
- *
241
- * @group Errors
242
- * @category Error Classes
243
- */
244
- declare class MissingParameterError extends BoltSdkErrorBase {
245
- /**
246
- * Creates a new MissingParameterError instance.
247
- *
248
- * @param parameterName - The name of the missing parameter
249
- * @param context - Optional context about where the parameter was expected
250
- */
251
- constructor(parameterName: string, context?: string);
252
- }
253
- /**
254
- * Error thrown when a numeric parameter is outside the acceptable range.
255
- *
256
- * @group Errors
257
- * @category Error Classes
258
- */
259
- declare class ParameterOutOfRangeError extends BoltSdkErrorBase {
260
- /**
261
- * Creates a new ParameterOutOfRangeError instance.
262
- *
263
- * @param parameterName - The name of the parameter that's out of range
264
- * @param value - The actual value that was provided
265
- * @param min - Optional minimum acceptable value (inclusive)
266
- * @param max - Optional maximum acceptable value (inclusive)
267
- * @param details - Optional additional details about the constraint
268
- */
269
- constructor(parameterName: string, value: number | bigint, min?: number | bigint, max?: number | bigint, details?: string);
270
- }
271
-
272
- type Address = string;
273
- type AssetPairString = string;
274
- type Timestamp = string;
275
- type Duration = {
276
- secs: number;
277
- nanos: number;
278
- };
279
- type Coin = {
280
- denom: string;
281
- amount: string;
282
- };
283
-
284
- type Environment = 'mainnet' | 'testnet';
285
- type Asset = {
286
- symbol: string;
287
- name: string;
288
- chainId: string;
289
- denom: string;
290
- decimals: number;
291
- logo?: string;
292
- coingeckoId?: string;
293
- };
294
- type ChainConfig = {
295
- name: string;
296
- id: string;
297
- rpcEndpoint: string;
298
- };
299
- type Contracts = {
300
- oracle: Address;
301
- router: Address;
302
- };
303
- type AssetsConfig = Record<string, Asset>;
304
-
305
- type ClientConfig<TChainConfig = ChainConfig> = {
306
- environment?: Environment;
307
- customOverride?: {
308
- chainConfig?: Partial<TChainConfig>;
309
- contracts?: Partial<Contracts>;
310
- assetsConfig?: AssetsConfig;
311
- };
312
- };
313
-
314
- type OracleConfig = {
315
- admin: Address;
316
- priceThresholdRatio: string;
317
- priceExpireTime: Duration | null;
318
- };
319
- type Price = {
320
- assetPair: AssetPairString;
321
- price: string;
322
- expiryTime: Timestamp;
323
- };
324
- type InvertiblePrice = Price & {
325
- isInverse: boolean;
326
- };
327
- type OracleAsset = {
328
- name: string;
329
- symbol: string;
330
- precision: number;
331
- };
332
- type OracleAssetPair = {
333
- base: OracleAsset;
334
- quote: OracleAsset;
335
- };
336
-
337
- type AllowanceMode = 'allow' | 'disallow';
338
- type PoolConfig = {
339
- priceOracleContract: Address;
340
- protocolFeeRecipient: Address;
341
- protocolFee: string;
342
- lpFee: string;
343
- allowanceMode: AllowanceMode;
344
- lps: Address[];
345
- minBaseOut: string;
346
- };
347
- type BaseLiquidityDetails = {
348
- baseLiquidity: Coin;
349
- totalShares: string;
350
- };
351
-
352
- type RouterConfig = {
353
- admin: Address;
354
- defaultPriceOracleContract: Address;
355
- defaultProtocolFeeRecipient: Address;
356
- defaultProtocolFee: string;
357
- defaultLpFee: string;
358
- settlementCodeId: number;
359
- };
360
- type Pool = {
361
- poolAddress: Address;
362
- baseAssetSymbol: string;
363
- quoteAssetsSymbols: string[];
364
- };
365
- type SwapParams = {
366
- assetIn: string;
367
- amountIn: string;
368
- assetOut: string;
369
- minimumAmountOut?: string;
370
- receiver?: Address;
371
- };
372
- type SwapResult<TTxOutput = unknown> = {
373
- txOutput: TTxOutput;
374
- amountOut: string;
375
- assetOut: string;
376
- txHash: string;
377
- };
378
-
379
- /**
380
- * Abstract base client for all implementations of the Bolt SDK for different chains/networks.
381
- *
382
- * This class provides the foundation for blockchain-specific implementations,
383
- * defining the core interface for interacting with oracle and router contracts.
384
- *
385
- * @template TSigner - The type of the transaction signer specific to the blockchain implementation
386
- * @template TTxOutput - The type of the transaction output specific to the blockchain implementation
387
- *
388
- * @example
389
- * ```typescript
390
- * class BoltCosmWasmClient extends BaseClient<OfflineSigner, ExecuteResult> {
391
- * // Implementation specific to CosmWasm
392
- * }
393
- * ```
394
- */
395
- declare abstract class BaseClient<TSigner = unknown, TTxOutput = unknown> {
396
- /**
397
- * The blockchain network configuration containing chain ID, name, and RPC endpoint
398
- */
399
- chainConfig: ChainConfig;
400
- /**
401
- * Smart contract addresses for making Bolt queries and transactions in the blockchain
402
- */
403
- contracts: Contracts;
404
- /**
405
- * Configuration mapping of supported assets indexed by their symbol
406
- */
407
- assetsConfig: AssetsConfig;
408
- /**
409
- * Creates a new instance of the BaseClient.
410
- *
411
- * @param config - (Optional) Configuration object for the client
412
- * @param config.customOverride - (Optional) Override configuration containing chain settings, contracts, and assets
413
- * @param config.customOverride.chainConfig - (Optional) Chain configuration object
414
- * @param config.customOverride.chainConfig.id - (Optional) The chain ID of the blockchain network (e.g., "archway-1")
415
- * @param config.customOverride.chainConfig.name - (Optional) The human-readable name of the chain (e.g., "Archway")
416
- * @param config.customOverride.chainConfig.rpcEndpoint - (Optional) RPC endpoint URL for the blockchain network
417
- * @param config.customOverride.contracts - (Optional) Contract addresses for oracle and router
418
- * @param config.customOverride.contracts.oracle - (Optional) Oracle contract address
419
- * @param config.customOverride.contracts.router - (Optional) Router contract address
420
- * @param config.customOverride.assetsConfig - (Optional) Configuration for supported assets indexed by symbol
421
- *
422
- * @throws {InvalidObjectError} Thrown when required configuration fields are missing
423
- *
424
- * @example
425
- * ```typescript
426
- * const client = new ConcreteClient({
427
- * customOverride: {
428
- * chainConfig: {
429
- * id: 'archway-1',
430
- * name: 'Archway',
431
- * rpcEndpoint: 'https://rpc.example.com'
432
- * },
433
- * contracts: {
434
- * oracle: 'archway1oracle...',
435
- * router: 'archway1router...'
436
- * },
437
- * assetsConfig: {
438
- * 'ARCH': {
439
- * symbol: 'ARCH',
440
- * name: 'Archway',
441
- * chainId: 'archway-1',
442
- * denom: 'aarch',
443
- * decimals: 18,
444
- * logo: 'https://...',
445
- * coingeckoId: 'archway'
446
- * }
447
- * }
448
- * }
449
- * });
450
- * ```
451
- */
452
- constructor(config?: ClientConfig);
453
- /**
454
- * Fetches the oracle configuration from the blockchain.
455
- *
456
- * @returns A promise that resolves to the oracle configuration containing
457
- * settings such as price expiration time and threshold ratio
458
- *
459
- * @example
460
- * ```typescript
461
- * const oracleConfig = await client.getOracleConfig();
462
- * console.log(`Price expiration: ${oracleConfig.priceExpireTime} seconds`);
463
- * console.log(`Admin: ${oracleConfig.admin}`);
464
- * console.log(`Price threshold ratio: ${oracleConfig.priceThresholdRatio}`);
465
- * ```
466
- */
467
- abstract getOracleConfig(): Promise<OracleConfig>;
468
- /**
469
- * Fetches all asset pairs supported by the oracle.
470
- *
471
- * @returns A promise that resolves to an array of oracle asset pairs,
472
- * each containing base and quote asset information with name, symbol and precision
473
- *
474
- * @example
475
- * ```typescript
476
- * const pairs = await client.getAllOracleAssetPairs();
477
- * pairs.forEach(pair => {
478
- * console.log(`${pair.base.symbol}/${pair.quote.symbol}`);
479
- * console.log(` Base: ${pair.base.name} (${pair.base.precision} decimals)`);
480
- * console.log(` Quote: ${pair.quote.name} (${pair.quote.precision} decimals)`);
481
- * });
482
- * ```
483
- */
484
- abstract getAllOracleAssetPairs(): Promise<OracleAssetPair[]>;
485
- /**
486
- * Fetches the current price for a specific base/quote asset pair from the oracle.
487
- *
488
- * @param baseAssetSymbol - The symbol of the base asset (e.g., "ARCH", "USDC")
489
- * @param quoteAssetSymbol - The symbol of the quote asset (e.g., "ARCH", "USDC")
490
- *
491
- * @returns A promise that resolves to an invertible price object containing
492
- * the current price from the oracle and whether it's inverted
493
- *
494
- * @example
495
- * ```typescript
496
- * // Get price of ARCH in terms of USDC
497
- * const priceResult = await client.getPrice("ARCH", "USDC");
498
- * console.log(`1 ARCH = ${priceResult.price} USDC`);
499
- * console.log(`Is inverted: ${priceResult.isInverse}`);
500
- * ```
501
- */
502
- abstract getPrice(baseAssetSymbol: string, quoteAssetSymbol: string): Promise<InvertiblePrice>;
503
- /**
504
- * Fetches all available prices from the oracle.
505
- *
506
- * @returns A promise that resolves to an array of all current prices
507
- * available in the oracle with their respective asset pairs and expiry times
508
- *
509
- * @example
510
- * ```typescript
511
- * const prices = await client.getAllPrices();
512
- * prices.forEach(priceData => {
513
- * console.log(`${priceData.assetPair}: ${priceData.price}`);
514
- * console.log(` Expires at: ${new Date(priceData.expiryTime * 1000).toISOString()}`);
515
- * });
516
- * ```
517
- */
518
- abstract getAllPrices(): Promise<Price[]>;
519
- /**
520
- * Fetches the router configuration from the blockchain.
521
- *
522
- * @returns A promise that resolves to the router configuration containing
523
- * settings such as default protocol fees, LP fees, and oracle configuration
524
- *
525
- * @example
526
- * ```typescript
527
- * const routerConfig = await client.getRouterConfig();
528
- * console.log(`Default protocol fee: ${routerConfig.defaultProtocolFee * 100}%`);
529
- * console.log(`Default LP fee: ${routerConfig.defaultLpFee * 100}%`);
530
- * console.log(`Oracle address: ${routerConfig.priceOracleContract}`);
531
- * ```
532
- */
533
- abstract getRouterConfig(): Promise<RouterConfig>;
534
- /**
535
- * Fetches the total liquidity for all base assets across all pools.
536
- *
537
- * @returns A promise that resolves to a record mapping pool addresses
538
- * to their respective base asset liquidity details, including
539
- * the base liquidity amount and total shares
540
- *
541
- * @example
542
- * ```typescript
543
- * const liquidity = await client.getAllBaseAssetsLiquidity();
544
- * Object.entries(liquidity).forEach(([poolAddress, details]) => {
545
- * console.log(`Pool ${poolAddress}:`);
546
- * console.log(` Base: ${details.baseLiquidity.amount} ${details.baseLiquidity.denom}`);
547
- * console.log(` Total Shares: ${details.totalShares}`);
548
- * });
549
- * ```
550
- */
551
- abstract getAllBaseAssetsLiquidity(): Promise<Record<Address, BaseLiquidityDetails>>;
552
- /**
553
- * Fetches all withdrawable quote assets for a specific user or liquidity provider.
554
- *
555
- * @param address - The blockchain address of the user or liquidity provider
556
- *
557
- * @returns A promise that resolves to a record mapping pool addresses
558
- * to arrays of withdrawable quote asset coins
559
- *
560
- * @example
561
- * ```typescript
562
- * const quotes = await client.getAllQuotesByUser("archway1...");
563
- * Object.entries(quotes).forEach(([poolAddress, coins]) => {
564
- * console.log(`Pool ${poolAddress}:`);
565
- * coins.forEach(coin => {
566
- * console.log(` ${coin.amount} ${coin.denom}`);
567
- * });
568
- * });
569
- * ```
570
- */
571
- abstract getAllQuotesByUser(address: Address): Promise<Record<Address, Coin[]>>;
572
- /**
573
- * Fetches pool information for a specific base asset.
574
- *
575
- * @param baseAssetSymbol - The symbol of the base asset (e.g., "ARCH", "ATOM")
576
- *
577
- * @returns A promise that resolves to the pool information for the specified asset
578
- *
579
- * @throws Will throw an error if no pool exists for the specified base asset
580
- *
581
- * @example
582
- * ```typescript
583
- * const pool = await client.getPoolByBaseAsset("ARCH");
584
- * console.log(`Pool address: ${pool.poolAddress}`);
585
- * console.log(`Base asset: ${pool.baseAssetSymbol}`);
586
- * console.log('Available quote assets:');
587
- * pool.quoteAssetsSymbols.forEach(symbol => {
588
- * console.log(` - ${symbol}`);
589
- * });
590
- * ```
591
- */
592
- abstract getPoolByBaseAsset(baseAssetSymbol: string): Promise<Pool>;
593
- /**
594
- * Fetches information for all available pools.
595
- *
596
- * @returns A promise that resolves to an array containing all pool information
597
- *
598
- * @example
599
- * ```typescript
600
- * const pools = await client.getAllPools();
601
- * pools.forEach(pool => {
602
- * console.log(`Pool ${pool.poolAddress}:`);
603
- * console.log(` Base: ${pool.baseAssetSymbol}`);
604
- * console.log(` Quotes: ${pool.quoteAssetsSymbols.join(', ')}`);
605
- * });
606
- * ```
607
- */
608
- abstract getAllPools(): Promise<Pool[]>;
609
- /**
610
- * Fetches the configuration settings for a specific liquidity pool.
611
- *
612
- * This method retrieves detailed configuration parameters for a pool, including
613
- * fee structures, oracle settings, liquidity provider information, and trading limits.
614
- *
615
- * @param poolContractAddress - The blockchain address of the pool contract
616
- *
617
- * @returns A promise that resolves to a pool configuration object
618
- * containing settings such as fees, oracle address, LP addresses, and minimum trade amounts
619
- *
620
- * @example
621
- * ```typescript
622
- * const poolConfig = await client.getPoolConfig("archway1pool...");
623
- * console.log(`Oracle: ${poolConfig.priceOracleContract}`);
624
- * console.log(`Protocol fee: ${poolConfig.protocolFee * 100}%`);
625
- * console.log(`LP fee: ${poolConfig.lpFee * 100}%`);
626
- * console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
627
- * console.log(`LPs: ${poolConfig.lps.join(', ')}`);
628
- * console.log(`Min base output: ${poolConfig.minBaseOut}`);
629
- * ```
630
- */
631
- abstract getPoolConfig(poolContractAddress: string): Promise<PoolConfig>;
632
- /**
633
- * Fetches all supported assets across all pools in the Bolt protocol.
634
- *
635
- * This method retrieves comprehensive information about all assets that can be traded,
636
- * including their metadata, chain-specific details, and external identifiers.
637
- *
638
- * @returns A promise that resolves to an array of Asset objects, each containing:
639
- * - symbol: The asset's trading symbol (e.g., "ARCH", "USDC")
640
- * - name: The full name of the asset (e.g., "Archway", "USD Coin")
641
- * - chainId: The blockchain network identifier where this asset exists
642
- * - denom: The chain-specific denomination (e.g., "aarch", "ibc/...")
643
- * - decimals: The number of decimal places for the asset
644
- * - logo: Optional URL to the asset's logo image
645
- * - coingeckoId: Optional CoinGecko identifier for price data
646
- *
647
- * @example
648
- * ```typescript
649
- * const assets = await client.getAllAssets();
650
- *
651
- * // Display all available assets
652
- * assets.forEach(asset => {
653
- * console.log(`${asset.symbol} (${asset.name})`);
654
- * console.log(` Chain: ${asset.chainId}`);
655
- * console.log(` Denom: ${asset.denom}`);
656
- * console.log(` Decimals: ${asset.decimals}`);
657
- * if (asset.coingeckoId) {
658
- * console.log(` CoinGecko: ${asset.coingeckoId}`);
659
- * }
660
- * });
661
- *
662
- * // Find a specific asset
663
- * const archAsset = assets.find(a => a.symbol === 'ARCH');
664
- * console.log(`ARCH denom: ${archAsset?.denom}`);
665
- * ```
666
- *
667
- * @remarks
668
- * Assets returned by this method represent all tokens available for trading
669
- * in the Bolt protocol. The list may vary between mainnet and testnet environments.
670
- */
671
- abstract getAllAssets(): Promise<Asset[]>;
672
- /**
673
- * Executes a swap operation on the blockchain from one asset to another.
674
- *
675
- * This method performs a "swap exact in" where the exact input amount is specified, and the output
676
- * amount varies based on current pool conditions and fees. The transaction includes
677
- * slippage protection through the optional minimumAmountOut parameter.
678
- *
679
- * @param signer - The transaction signer that will authorize the swap operation.
680
- * Must have sufficient balance of the input asset.
681
- * @param params - The swap configuration parameters
682
- * @param params.assetIn - The denom of the asset being sold (e.g., "aarch", "ibc/...")
683
- * @param params.amountIn - The exact amount of input asset to swap (in minimal denomination)
684
- * @param params.assetOut - The denom of the asset being bought (e.g., "aarch", "ibc/...")
685
- * @param params.minimumAmountOut - Optional minimum acceptable amount of output asset.
686
- * Transaction will fail if actual output would be less.
687
- * @param params.receiver - Optional recipient address for the swapped assets.
688
- * If not provided, defaults to the signer's address.
689
- *
690
- * @returns A promise that resolves to a SwapResult containing:
691
- * - txOutput: Transaction execution details (type varies by implementation)
692
- * - amountOut: The actual amount of output asset received (as a string)
693
- * - assetOut: The denom of the asset received
694
- * - txHash: The transaction hash
695
- *
696
- * @throws Will throw an error if the swap fails due to insufficient balance,
697
- * slippage exceeding tolerance, or other transaction errors
698
- *
699
- * @example
700
- * ```typescript
701
- * // Swap exactly 1 ARCH for USDC (output amount varies)
702
- * const result = await client.swap(signer, {
703
- * assetIn: "aarch",
704
- * amountIn: "1000000000000000000", // Exactly 1 ARCH (18 decimals)
705
- * assetOut: "ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D", // USDC IBC denom
706
- * minimumAmountOut: "1950000000", // Accept no less than 1950 USDC
707
- * receiver: "archway1..." // Optional custom receiver
708
- * });
709
- *
710
- * console.log(`Swapped exactly 1 ARCH`);
711
- * console.log(`Received: ${result.amountOut} ${result.assetOut}`);
712
- * console.log(`Transaction: ${result.txHash}`);
713
- * ```
714
- *
715
- * @remarks
716
- * This is a "swap exact in" operation where:
717
- * - The input amount is exactly what you specify
718
- * - The output amount depends on pool conditions
719
- * - Fees are deducted from the output
720
- * - Use minimumAmountOut to protect against excessive slippage
721
- *
722
- * The TTxOutput type parameter represents the transaction execution result type,
723
- * which varies by blockchain implementation (e.g., ExecuteResult for CosmWasm).
724
- */
725
- abstract swap(signer: TSigner, params: SwapParams): Promise<SwapResult<TTxOutput>>;
726
- }
727
-
728
6
  type CosmWasmChainConfig = ChainConfig & {
729
7
  restEndpoint: string;
730
8
  };
@@ -736,66 +14,6 @@ type CosmWasmClientConfig = ClientConfig<CosmWasmChainConfig> & {
736
14
  };
737
15
  type CosmWasmChain = 'archway';
738
16
 
739
- type QueryOracleConfigResponse = {
740
- admin: Address;
741
- price_threshold_ratio: string;
742
- price_expire_time: Duration | null;
743
- };
744
- type PriceRepresentation = {
745
- asset_pair: AssetPairString;
746
- price: string;
747
- expiry_time: Timestamp;
748
- };
749
- type InvertiblePriceRepresentation = PriceRepresentation & {
750
- is_inverse: boolean;
751
- };
752
- type QueryPriceResponse = {
753
- pair_data: InvertiblePriceRepresentation;
754
- };
755
- type QueryPricesResponse = {
756
- prices: PriceRepresentation[];
757
- };
758
- type QueryAssetPairsResponse = {
759
- list: OracleAssetPair[];
760
- };
761
-
762
- type QuerySettlementConfigResponse = {
763
- price_oracle_contract: Address;
764
- protocol_fee_recipient: Address;
765
- protocol_fee: string;
766
- lp_fee: string;
767
- allowance_mode: AllowanceMode;
768
- lps: Address[];
769
- min_base_out: string;
770
- };
771
- type QueryBaseLiquidityResponse = {
772
- base_liquidity: Coin;
773
- total_shares: string;
774
- };
775
-
776
- type QueryRouterConfigResponse = {
777
- admin: Address;
778
- default_price_oracle_contract: Address;
779
- default_protocol_fee_recipient: Address;
780
- default_protocol_fee: string;
781
- default_lp_fee: string;
782
- settlement_code_id: number;
783
- };
784
- type MarketRepresentation = {
785
- market_address: Address;
786
- base_asset_symbol: string;
787
- quote_assets_symbols: string[];
788
- };
789
- type QueryMarketsResponse = {
790
- markets: MarketRepresentation[];
791
- };
792
- type QueryBaseLiquidityAllResponse = {
793
- liquidity: Record<Address, QueryBaseLiquidityResponse>;
794
- };
795
- type QueryQuotesForUserAllResponse = {
796
- quotes: Record<Address, Coin[]>;
797
- };
798
-
799
17
  /**
800
18
  * Client implementation for interacting with the Bolt Liquidity Outpost on CosmWasm-based blockchains.
801
19
  *
@@ -980,32 +198,7 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner, ExecuteResult
980
198
  getPoolConfig(poolContractAddress: Address): Promise<PoolConfig>;
981
199
  /** @inheritdoc */
982
200
  getAllAssets(): Promise<Asset[]>;
983
- /**
984
- * Fetches the configuration settings for a pool identified by its base asset symbol.
985
- *
986
- * This is a convenience method that combines pool lookup and configuration retrieval.
987
- * It first finds the pool associated with the given base asset, then fetches that
988
- * pool's configuration parameters from its settlement contract.
989
- *
990
- * @param baseAssetSymbol - The symbol of the base asset (e.g., "ARCH", "ATOM")
991
- *
992
- * @returns A promise that resolves to a pool configuration object containing
993
- * settings such as fees, oracle address, LP addresses, and minimum trade amounts
994
- *
995
- * @throws Will throw an error if no pool exists for the specified base asset
996
- *
997
- * @example
998
- * ```typescript
999
- * // Get pool configuration for ARCH base asset
1000
- * const poolConfig = await client.getPoolConfigByBaseAsset("ARCH");
1001
- * console.log(`Oracle: ${poolConfig.priceOracleContract}`);
1002
- * console.log(`Protocol fee: ${parseFloat(poolConfig.protocolFee) * 100}%`);
1003
- * console.log(`LP fee: ${parseFloat(poolConfig.lpFee) * 100}%`);
1004
- * console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
1005
- * console.log(`Number of LPs: ${poolConfig.lps.length}`);
1006
- * console.log(`Min base output: ${poolConfig.minBaseOut}`);
1007
- * ```
1008
- */
201
+ /** @inheritdoc */
1009
202
  getPoolConfigByBaseAsset(baseAssetSymbol: string): Promise<PoolConfig>;
1010
203
  /**
1011
204
  * @inheritdoc
@@ -1038,4 +231,4 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner, ExecuteResult
1038
231
  swap(signer: OfflineSigner, params: SwapParams): Promise<SwapResult<ExecuteResult>>;
1039
232
  }
1040
233
 
1041
- export { type Address, type AllowanceMode, type Asset, type AssetPairString, type AssetsConfig, BaseClient, type BaseLiquidityDetails, BoltCosmWasmClient, type BoltSdkError, BoltSdkErrorBase, BoltSdkErrorCode, type ChainConfig, type ClientConfig, type Coin, type Contracts, type CosmWasmChain, type CosmWasmChainConfig, type CosmWasmClientConfig, type Duration, type Environment, InsufficientFundsError, InvalidAddressError, InvalidObjectError, InvalidParameterError, InvalidTypeError, type InvertiblePrice, type InvertiblePriceRepresentation, type MarketRepresentation, MissingParameterError, NetworkError, NotFoundError, type OracleAsset, type OracleAssetPair, type OracleConfig, ParameterOutOfRangeError, type Pool, type PoolConfig, type Price, type PriceRepresentation, type QueryAssetPairsResponse, type QueryBaseLiquidityAllResponse, type QueryBaseLiquidityResponse, type QueryMarketsResponse, type QueryOracleConfigResponse, type QueryPriceResponse, type QueryPricesResponse, type QueryQuotesForUserAllResponse, type QueryRouterConfigResponse, type QuerySettlementConfigResponse, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError };
234
+ export { BoltCosmWasmClient };