@bolt-liquidity-hq/cosmwasm-client 0.1.0-beta.2 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +70 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -14
- package/dist/index.d.ts +97 -14
- package/dist/index.js +70 -21
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/index.d.cts
CHANGED
|
@@ -271,7 +271,7 @@ type Address = string;
|
|
|
271
271
|
type AssetPairString = string;
|
|
272
272
|
type Timestamp = string;
|
|
273
273
|
interface Duration {
|
|
274
|
-
secs:
|
|
274
|
+
secs: number;
|
|
275
275
|
nanos: number;
|
|
276
276
|
}
|
|
277
277
|
interface Coin {
|
|
@@ -281,7 +281,7 @@ interface Coin {
|
|
|
281
281
|
|
|
282
282
|
interface ClientConfig {
|
|
283
283
|
environment?: Environment;
|
|
284
|
-
|
|
284
|
+
customOverride?: {
|
|
285
285
|
rpcEndpoint?: string;
|
|
286
286
|
contracts?: Partial<Contracts>;
|
|
287
287
|
};
|
|
@@ -314,6 +314,20 @@ interface OracleAssetPair {
|
|
|
314
314
|
quote: OracleAsset;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
declare enum AllowanceMode {
|
|
318
|
+
Allow = "allow",
|
|
319
|
+
Disallow = "disallow"
|
|
320
|
+
}
|
|
321
|
+
interface PoolConfig {
|
|
322
|
+
priceOracleContract: Address;
|
|
323
|
+
protocolFeeRecipient: Address;
|
|
324
|
+
protocolFee: string;
|
|
325
|
+
lpFee: string;
|
|
326
|
+
allowanceMode: AllowanceMode;
|
|
327
|
+
lps: Address[];
|
|
328
|
+
minBaseOut: string;
|
|
329
|
+
}
|
|
330
|
+
|
|
317
331
|
interface RouterConfig {
|
|
318
332
|
admin: Address;
|
|
319
333
|
defaultPriceOracleContract: Address;
|
|
@@ -368,12 +382,12 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
368
382
|
/**
|
|
369
383
|
* Creates a new instance of the BaseClient.
|
|
370
384
|
*
|
|
371
|
-
* @param config - Optional
|
|
372
|
-
* @param config.
|
|
373
|
-
* @param config.
|
|
374
|
-
* @param config.
|
|
375
|
-
* @param config.
|
|
376
|
-
* @param config.
|
|
385
|
+
* @param config - (Optional) Configuration object for the client
|
|
386
|
+
* @param config.customOverride - (Optional) Override configuration for RPC endpoint and contract addresses
|
|
387
|
+
* @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL for the blockchain network
|
|
388
|
+
* @param config.customOverride.contracts - (Optional) Custom contract addresses
|
|
389
|
+
* @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address
|
|
390
|
+
* @param config.customOverride.contracts.router - (Optional) Custom router contract address
|
|
377
391
|
*
|
|
378
392
|
* @throws {InvalidObjectError} Thrown when required configuration fields are missing
|
|
379
393
|
*
|
|
@@ -527,6 +541,8 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
527
541
|
*
|
|
528
542
|
* @returns A promise that resolves to an array containing all pool information
|
|
529
543
|
*
|
|
544
|
+
* @throws Will throw an error if no pool exists for the specified base asset
|
|
545
|
+
*
|
|
530
546
|
* @example
|
|
531
547
|
* ```typescript
|
|
532
548
|
* const pools = await client.getAllPools();
|
|
@@ -538,6 +554,55 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
538
554
|
* ```
|
|
539
555
|
*/
|
|
540
556
|
abstract getAllPools(): Promise<Pool[]>;
|
|
557
|
+
/**
|
|
558
|
+
* Fetches the configuration settings for a specific liquidity pool.
|
|
559
|
+
*
|
|
560
|
+
* This method retrieves detailed configuration parameters for a pool, including
|
|
561
|
+
* fee structures, oracle settings, liquidity provider information, and trading limits.
|
|
562
|
+
*
|
|
563
|
+
* @param poolContractAddress - The blockchain address of the pool contract
|
|
564
|
+
*
|
|
565
|
+
* @returns A promise that resolves to a pool configuration object
|
|
566
|
+
* containing settings such as fees, oracle address, LP addresses, and minimum trade amounts
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```typescript
|
|
570
|
+
* const poolConfig = await client.getPoolConfig("archway1pool...");
|
|
571
|
+
* console.log(`Oracle: ${poolConfig.priceOracleContract}`);
|
|
572
|
+
* console.log(`Protocol fee: ${poolConfig.protocolFee * 100}%`);
|
|
573
|
+
* console.log(`LP fee: ${poolConfig.lpFee * 100}%`);
|
|
574
|
+
* console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
|
|
575
|
+
* console.log(`LPs: ${poolConfig.lps.join(', ')}`);
|
|
576
|
+
* console.log(`Min base output: ${poolConfig.minBaseOut}`);
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
579
|
+
abstract getPoolConfig(poolContractAddress: string): Promise<PoolConfig>;
|
|
580
|
+
/**
|
|
581
|
+
* Fetches the configuration settings for a pool identified by its base asset symbol.
|
|
582
|
+
*
|
|
583
|
+
* This method retrieves the pool configuration by first looking up the pool
|
|
584
|
+
* associated with the given base asset, then fetching its configuration parameters.
|
|
585
|
+
*
|
|
586
|
+
* @param baseAssetSymbol - The symbol of the base asset (e.g., "aarch", "ibc/...")
|
|
587
|
+
*
|
|
588
|
+
* @returns A promise that resolves to a pool configuration object containing
|
|
589
|
+
* settings such as fees, oracle address, LP addresses, and minimum trade amounts
|
|
590
|
+
*
|
|
591
|
+
* @throws Will throw an error if no pool exists for the specified base asset
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* // Get pool configuration for ARCH base asset
|
|
596
|
+
* const poolConfig = await client.getPoolConfigByBaseAsset("aarch");
|
|
597
|
+
* console.log(`Oracle: ${poolConfig.priceOracleContract}`);
|
|
598
|
+
* console.log(`Protocol fee: ${poolConfig.protocolFee * 100}%`);
|
|
599
|
+
* console.log(`LP fee: ${poolConfig.lpFee * 100}%`);
|
|
600
|
+
* console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
|
|
601
|
+
* console.log(`Number of LPs: ${poolConfig.lps.length}`);
|
|
602
|
+
* console.log(`Min base output: ${poolConfig.minBaseOut}`);
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
abstract getPoolConfigByBaseAsset(baseAssetSymbol: string): Promise<PoolConfig>;
|
|
541
606
|
/**
|
|
542
607
|
* Executes a "swap exact in" operation on the blockchain from one asset to another.
|
|
543
608
|
*
|
|
@@ -590,6 +655,8 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
590
655
|
|
|
591
656
|
interface CosmWasmClientConfig extends ClientConfig {
|
|
592
657
|
chain?: CosmWasmChain;
|
|
658
|
+
cosmWasmClient?: CosmWasmClient | ArchwayClient;
|
|
659
|
+
signingCosmWasmClient?: SigningCosmWasmClient | SigningArchwayClient;
|
|
593
660
|
}
|
|
594
661
|
declare enum CosmWasmChain {
|
|
595
662
|
Archway = "archway"
|
|
@@ -641,6 +708,16 @@ interface QueryQuotesForUserAllResponse {
|
|
|
641
708
|
quotes: Record<Address, Coin[]>;
|
|
642
709
|
}
|
|
643
710
|
|
|
711
|
+
interface QuerySettlementConfigResponse {
|
|
712
|
+
price_oracle_contract: Address;
|
|
713
|
+
protocol_fee_recipient: Address;
|
|
714
|
+
protocol_fee: string;
|
|
715
|
+
lp_fee: string;
|
|
716
|
+
allowance_mode: AllowanceMode;
|
|
717
|
+
lps: Address[];
|
|
718
|
+
min_base_out: string;
|
|
719
|
+
}
|
|
720
|
+
|
|
644
721
|
/**
|
|
645
722
|
* Client implementation for interacting with the Bolt Liquidity Outpost on CosmWasm-based blockchains.
|
|
646
723
|
*
|
|
@@ -697,11 +774,13 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner> {
|
|
|
697
774
|
* @param config - (Optional) Configuration for the client
|
|
698
775
|
* @param config.environment - (Optional) The deployment environment (Mainnet or Testnet). Defaults to Mainnet
|
|
699
776
|
* @param config.chain - (Optional) The specific CosmWasm chain to connect to. Defaults to Archway
|
|
700
|
-
* @param config.
|
|
701
|
-
* @param config.
|
|
702
|
-
* @param config.
|
|
703
|
-
* @param config.
|
|
704
|
-
* @param config.
|
|
777
|
+
* @param config.customOverride - (Optional) Overrides for RPC endpoint and contract addresses
|
|
778
|
+
* @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL
|
|
779
|
+
* @param config.customOverride.contracts - (Optional) Custom contract addresses
|
|
780
|
+
* @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address
|
|
781
|
+
* @param config.customOverride.contracts.router - (Optional) Custom router contract address
|
|
782
|
+
* @param config.customOverride.cosmWasmClient - (Optional) Custom CosmWasmClient to use for blockchain queries
|
|
783
|
+
* @param config.customOverride.signingCosmWasmClient - (Optional) Custom SigningCosmWasmClient to use for blockchain transactions
|
|
705
784
|
*
|
|
706
785
|
* @throws {InvalidTypeError} Thrown when an unsupported chain is specified
|
|
707
786
|
*
|
|
@@ -786,6 +865,10 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner> {
|
|
|
786
865
|
getPoolByBaseAsset(baseAssetSymbol: string): Promise<Pool>;
|
|
787
866
|
/** @inheritdoc */
|
|
788
867
|
getAllPools(): Promise<Pool[]>;
|
|
868
|
+
/** @inheritdoc */
|
|
869
|
+
getPoolConfig(poolContractAddress: Address): Promise<PoolConfig>;
|
|
870
|
+
/** @inheritdoc */
|
|
871
|
+
getPoolConfigByBaseAsset(baseAssetSymbol: string): Promise<PoolConfig>;
|
|
789
872
|
/**
|
|
790
873
|
* @inheritdoc
|
|
791
874
|
*
|
|
@@ -812,4 +895,4 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner> {
|
|
|
812
895
|
swapExactIn(signer: OfflineSigner, params: SwapParams): Promise<SwapResult<ExecuteResult>>;
|
|
813
896
|
}
|
|
814
897
|
|
|
815
|
-
export { type Address, type AssetPairString, BoltCosmWasmClient, type BoltSdkError, BoltSdkErrorBase, BoltSdkErrorCode, type ClientConfig, type Coin, type Contracts, CosmWasmChain, type CosmWasmClientConfig, type Duration, 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 Price, type PriceRepresentation, type QueryAssetPairsResponse, type QueryBaseLiquidityAllResponse, type QueryMarketsResponse, type QueryOracleConfigResponse, type QueryPriceResponse, type QueryPricesResponse, type QueryQuotesForUserAllResponse, type QueryRouterConfigResponse, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError };
|
|
898
|
+
export { type Address, AllowanceMode, type AssetPairString, BaseClient, BoltCosmWasmClient, type BoltSdkError, BoltSdkErrorBase, BoltSdkErrorCode, type ClientConfig, type Coin, type Contracts, CosmWasmChain, type CosmWasmClientConfig, type Duration, 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 QueryMarketsResponse, type QueryOracleConfigResponse, type QueryPriceResponse, type QueryPricesResponse, type QueryQuotesForUserAllResponse, type QueryRouterConfigResponse, type QuerySettlementConfigResponse, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError };
|
package/dist/index.d.ts
CHANGED
|
@@ -271,7 +271,7 @@ type Address = string;
|
|
|
271
271
|
type AssetPairString = string;
|
|
272
272
|
type Timestamp = string;
|
|
273
273
|
interface Duration {
|
|
274
|
-
secs:
|
|
274
|
+
secs: number;
|
|
275
275
|
nanos: number;
|
|
276
276
|
}
|
|
277
277
|
interface Coin {
|
|
@@ -281,7 +281,7 @@ interface Coin {
|
|
|
281
281
|
|
|
282
282
|
interface ClientConfig {
|
|
283
283
|
environment?: Environment;
|
|
284
|
-
|
|
284
|
+
customOverride?: {
|
|
285
285
|
rpcEndpoint?: string;
|
|
286
286
|
contracts?: Partial<Contracts>;
|
|
287
287
|
};
|
|
@@ -314,6 +314,20 @@ interface OracleAssetPair {
|
|
|
314
314
|
quote: OracleAsset;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
declare enum AllowanceMode {
|
|
318
|
+
Allow = "allow",
|
|
319
|
+
Disallow = "disallow"
|
|
320
|
+
}
|
|
321
|
+
interface PoolConfig {
|
|
322
|
+
priceOracleContract: Address;
|
|
323
|
+
protocolFeeRecipient: Address;
|
|
324
|
+
protocolFee: string;
|
|
325
|
+
lpFee: string;
|
|
326
|
+
allowanceMode: AllowanceMode;
|
|
327
|
+
lps: Address[];
|
|
328
|
+
minBaseOut: string;
|
|
329
|
+
}
|
|
330
|
+
|
|
317
331
|
interface RouterConfig {
|
|
318
332
|
admin: Address;
|
|
319
333
|
defaultPriceOracleContract: Address;
|
|
@@ -368,12 +382,12 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
368
382
|
/**
|
|
369
383
|
* Creates a new instance of the BaseClient.
|
|
370
384
|
*
|
|
371
|
-
* @param config - Optional
|
|
372
|
-
* @param config.
|
|
373
|
-
* @param config.
|
|
374
|
-
* @param config.
|
|
375
|
-
* @param config.
|
|
376
|
-
* @param config.
|
|
385
|
+
* @param config - (Optional) Configuration object for the client
|
|
386
|
+
* @param config.customOverride - (Optional) Override configuration for RPC endpoint and contract addresses
|
|
387
|
+
* @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL for the blockchain network
|
|
388
|
+
* @param config.customOverride.contracts - (Optional) Custom contract addresses
|
|
389
|
+
* @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address
|
|
390
|
+
* @param config.customOverride.contracts.router - (Optional) Custom router contract address
|
|
377
391
|
*
|
|
378
392
|
* @throws {InvalidObjectError} Thrown when required configuration fields are missing
|
|
379
393
|
*
|
|
@@ -527,6 +541,8 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
527
541
|
*
|
|
528
542
|
* @returns A promise that resolves to an array containing all pool information
|
|
529
543
|
*
|
|
544
|
+
* @throws Will throw an error if no pool exists for the specified base asset
|
|
545
|
+
*
|
|
530
546
|
* @example
|
|
531
547
|
* ```typescript
|
|
532
548
|
* const pools = await client.getAllPools();
|
|
@@ -538,6 +554,55 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
538
554
|
* ```
|
|
539
555
|
*/
|
|
540
556
|
abstract getAllPools(): Promise<Pool[]>;
|
|
557
|
+
/**
|
|
558
|
+
* Fetches the configuration settings for a specific liquidity pool.
|
|
559
|
+
*
|
|
560
|
+
* This method retrieves detailed configuration parameters for a pool, including
|
|
561
|
+
* fee structures, oracle settings, liquidity provider information, and trading limits.
|
|
562
|
+
*
|
|
563
|
+
* @param poolContractAddress - The blockchain address of the pool contract
|
|
564
|
+
*
|
|
565
|
+
* @returns A promise that resolves to a pool configuration object
|
|
566
|
+
* containing settings such as fees, oracle address, LP addresses, and minimum trade amounts
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```typescript
|
|
570
|
+
* const poolConfig = await client.getPoolConfig("archway1pool...");
|
|
571
|
+
* console.log(`Oracle: ${poolConfig.priceOracleContract}`);
|
|
572
|
+
* console.log(`Protocol fee: ${poolConfig.protocolFee * 100}%`);
|
|
573
|
+
* console.log(`LP fee: ${poolConfig.lpFee * 100}%`);
|
|
574
|
+
* console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
|
|
575
|
+
* console.log(`LPs: ${poolConfig.lps.join(', ')}`);
|
|
576
|
+
* console.log(`Min base output: ${poolConfig.minBaseOut}`);
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
579
|
+
abstract getPoolConfig(poolContractAddress: string): Promise<PoolConfig>;
|
|
580
|
+
/**
|
|
581
|
+
* Fetches the configuration settings for a pool identified by its base asset symbol.
|
|
582
|
+
*
|
|
583
|
+
* This method retrieves the pool configuration by first looking up the pool
|
|
584
|
+
* associated with the given base asset, then fetching its configuration parameters.
|
|
585
|
+
*
|
|
586
|
+
* @param baseAssetSymbol - The symbol of the base asset (e.g., "aarch", "ibc/...")
|
|
587
|
+
*
|
|
588
|
+
* @returns A promise that resolves to a pool configuration object containing
|
|
589
|
+
* settings such as fees, oracle address, LP addresses, and minimum trade amounts
|
|
590
|
+
*
|
|
591
|
+
* @throws Will throw an error if no pool exists for the specified base asset
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* // Get pool configuration for ARCH base asset
|
|
596
|
+
* const poolConfig = await client.getPoolConfigByBaseAsset("aarch");
|
|
597
|
+
* console.log(`Oracle: ${poolConfig.priceOracleContract}`);
|
|
598
|
+
* console.log(`Protocol fee: ${poolConfig.protocolFee * 100}%`);
|
|
599
|
+
* console.log(`LP fee: ${poolConfig.lpFee * 100}%`);
|
|
600
|
+
* console.log(`Allowance mode: ${poolConfig.allowanceMode}`);
|
|
601
|
+
* console.log(`Number of LPs: ${poolConfig.lps.length}`);
|
|
602
|
+
* console.log(`Min base output: ${poolConfig.minBaseOut}`);
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
abstract getPoolConfigByBaseAsset(baseAssetSymbol: string): Promise<PoolConfig>;
|
|
541
606
|
/**
|
|
542
607
|
* Executes a "swap exact in" operation on the blockchain from one asset to another.
|
|
543
608
|
*
|
|
@@ -590,6 +655,8 @@ declare abstract class BaseClient<TSigner = unknown> {
|
|
|
590
655
|
|
|
591
656
|
interface CosmWasmClientConfig extends ClientConfig {
|
|
592
657
|
chain?: CosmWasmChain;
|
|
658
|
+
cosmWasmClient?: CosmWasmClient | ArchwayClient;
|
|
659
|
+
signingCosmWasmClient?: SigningCosmWasmClient | SigningArchwayClient;
|
|
593
660
|
}
|
|
594
661
|
declare enum CosmWasmChain {
|
|
595
662
|
Archway = "archway"
|
|
@@ -641,6 +708,16 @@ interface QueryQuotesForUserAllResponse {
|
|
|
641
708
|
quotes: Record<Address, Coin[]>;
|
|
642
709
|
}
|
|
643
710
|
|
|
711
|
+
interface QuerySettlementConfigResponse {
|
|
712
|
+
price_oracle_contract: Address;
|
|
713
|
+
protocol_fee_recipient: Address;
|
|
714
|
+
protocol_fee: string;
|
|
715
|
+
lp_fee: string;
|
|
716
|
+
allowance_mode: AllowanceMode;
|
|
717
|
+
lps: Address[];
|
|
718
|
+
min_base_out: string;
|
|
719
|
+
}
|
|
720
|
+
|
|
644
721
|
/**
|
|
645
722
|
* Client implementation for interacting with the Bolt Liquidity Outpost on CosmWasm-based blockchains.
|
|
646
723
|
*
|
|
@@ -697,11 +774,13 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner> {
|
|
|
697
774
|
* @param config - (Optional) Configuration for the client
|
|
698
775
|
* @param config.environment - (Optional) The deployment environment (Mainnet or Testnet). Defaults to Mainnet
|
|
699
776
|
* @param config.chain - (Optional) The specific CosmWasm chain to connect to. Defaults to Archway
|
|
700
|
-
* @param config.
|
|
701
|
-
* @param config.
|
|
702
|
-
* @param config.
|
|
703
|
-
* @param config.
|
|
704
|
-
* @param config.
|
|
777
|
+
* @param config.customOverride - (Optional) Overrides for RPC endpoint and contract addresses
|
|
778
|
+
* @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL
|
|
779
|
+
* @param config.customOverride.contracts - (Optional) Custom contract addresses
|
|
780
|
+
* @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address
|
|
781
|
+
* @param config.customOverride.contracts.router - (Optional) Custom router contract address
|
|
782
|
+
* @param config.customOverride.cosmWasmClient - (Optional) Custom CosmWasmClient to use for blockchain queries
|
|
783
|
+
* @param config.customOverride.signingCosmWasmClient - (Optional) Custom SigningCosmWasmClient to use for blockchain transactions
|
|
705
784
|
*
|
|
706
785
|
* @throws {InvalidTypeError} Thrown when an unsupported chain is specified
|
|
707
786
|
*
|
|
@@ -786,6 +865,10 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner> {
|
|
|
786
865
|
getPoolByBaseAsset(baseAssetSymbol: string): Promise<Pool>;
|
|
787
866
|
/** @inheritdoc */
|
|
788
867
|
getAllPools(): Promise<Pool[]>;
|
|
868
|
+
/** @inheritdoc */
|
|
869
|
+
getPoolConfig(poolContractAddress: Address): Promise<PoolConfig>;
|
|
870
|
+
/** @inheritdoc */
|
|
871
|
+
getPoolConfigByBaseAsset(baseAssetSymbol: string): Promise<PoolConfig>;
|
|
789
872
|
/**
|
|
790
873
|
* @inheritdoc
|
|
791
874
|
*
|
|
@@ -812,4 +895,4 @@ declare class BoltCosmWasmClient extends BaseClient<OfflineSigner> {
|
|
|
812
895
|
swapExactIn(signer: OfflineSigner, params: SwapParams): Promise<SwapResult<ExecuteResult>>;
|
|
813
896
|
}
|
|
814
897
|
|
|
815
|
-
export { type Address, type AssetPairString, BoltCosmWasmClient, type BoltSdkError, BoltSdkErrorBase, BoltSdkErrorCode, type ClientConfig, type Coin, type Contracts, CosmWasmChain, type CosmWasmClientConfig, type Duration, 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 Price, type PriceRepresentation, type QueryAssetPairsResponse, type QueryBaseLiquidityAllResponse, type QueryMarketsResponse, type QueryOracleConfigResponse, type QueryPriceResponse, type QueryPricesResponse, type QueryQuotesForUserAllResponse, type QueryRouterConfigResponse, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError };
|
|
898
|
+
export { type Address, AllowanceMode, type AssetPairString, BaseClient, BoltCosmWasmClient, type BoltSdkError, BoltSdkErrorBase, BoltSdkErrorCode, type ClientConfig, type Coin, type Contracts, CosmWasmChain, type CosmWasmClientConfig, type Duration, 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 QueryMarketsResponse, type QueryOracleConfigResponse, type QueryPriceResponse, type QueryPricesResponse, type QueryQuotesForUserAllResponse, type QueryRouterConfigResponse, type QuerySettlementConfigResponse, type RouterConfig, type SwapParams, type SwapResult, type Timestamp, TransactionEventNotFoundError, TransactionFailedError };
|
package/dist/index.js
CHANGED
|
@@ -219,12 +219,12 @@ var BaseClient = class {
|
|
|
219
219
|
/**
|
|
220
220
|
* Creates a new instance of the BaseClient.
|
|
221
221
|
*
|
|
222
|
-
* @param config - Optional
|
|
223
|
-
* @param config.
|
|
224
|
-
* @param config.
|
|
225
|
-
* @param config.
|
|
226
|
-
* @param config.
|
|
227
|
-
* @param config.
|
|
222
|
+
* @param config - (Optional) Configuration object for the client
|
|
223
|
+
* @param config.customOverride - (Optional) Override configuration for RPC endpoint and contract addresses
|
|
224
|
+
* @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL for the blockchain network
|
|
225
|
+
* @param config.customOverride.contracts - (Optional) Custom contract addresses
|
|
226
|
+
* @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address
|
|
227
|
+
* @param config.customOverride.contracts.router - (Optional) Custom router contract address
|
|
228
228
|
*
|
|
229
229
|
* @throws {InvalidObjectError} Thrown when required configuration fields are missing
|
|
230
230
|
*
|
|
@@ -250,7 +250,7 @@ var BaseClient = class {
|
|
|
250
250
|
* Smart contract addresses for making Bolt queries and transactions in the blockchain
|
|
251
251
|
*/
|
|
252
252
|
__publicField(this, "contracts");
|
|
253
|
-
const {
|
|
253
|
+
const { customOverride: { rpcEndpoint, contracts } = {} } = config ?? {};
|
|
254
254
|
if (!rpcEndpoint || !contracts?.oracle || !contracts.router) {
|
|
255
255
|
throw new InvalidObjectError("ClientConfig is missing fields");
|
|
256
256
|
}
|
|
@@ -269,6 +269,13 @@ var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
|
269
269
|
return Environment2;
|
|
270
270
|
})(Environment || {});
|
|
271
271
|
|
|
272
|
+
// src/common/types/pool.ts
|
|
273
|
+
var AllowanceMode = /* @__PURE__ */ ((AllowanceMode2) => {
|
|
274
|
+
AllowanceMode2["Allow"] = "allow";
|
|
275
|
+
AllowanceMode2["Disallow"] = "disallow";
|
|
276
|
+
return AllowanceMode2;
|
|
277
|
+
})(AllowanceMode || {});
|
|
278
|
+
|
|
272
279
|
// src/config/archway-mainnet.json
|
|
273
280
|
var archway_mainnet_default = {
|
|
274
281
|
chain: {
|
|
@@ -277,8 +284,8 @@ var archway_mainnet_default = {
|
|
|
277
284
|
restEndpoint: "https://api.mainnet.archway.io"
|
|
278
285
|
},
|
|
279
286
|
contracts: {
|
|
280
|
-
oracle: "
|
|
281
|
-
router: "
|
|
287
|
+
oracle: "archway1cr5l0tvhqsdjfzun4jkwqfzv7fadu598hultcra4jrljgwl639wsksmd28",
|
|
288
|
+
router: "archway199r5vm4yzww5hct2z58tz9v3chfcvkpln34sqcav3ldqs7nkwktqc7aeju"
|
|
282
289
|
}
|
|
283
290
|
};
|
|
284
291
|
|
|
@@ -291,7 +298,7 @@ var archway_testnet_default = {
|
|
|
291
298
|
},
|
|
292
299
|
contracts: {
|
|
293
300
|
oracle: "archway1r3ug542dq4arzxsjz4kmpvpez2z830rl0u66k00ft3zrugs8k98qwyxgda",
|
|
294
|
-
router: "
|
|
301
|
+
router: "archway1h5x6upghew9xkfek85q48let2twdxq33sgsnzze5weshla46xd8sttps44"
|
|
295
302
|
}
|
|
296
303
|
};
|
|
297
304
|
|
|
@@ -351,6 +358,17 @@ var parseQueryRouterConfigResponse = (response) => {
|
|
|
351
358
|
settlementCodeId: response.settlement_code_id
|
|
352
359
|
};
|
|
353
360
|
};
|
|
361
|
+
var parseQuerySettlementConfigResponse = (response) => {
|
|
362
|
+
return {
|
|
363
|
+
priceOracleContract: response.price_oracle_contract,
|
|
364
|
+
protocolFeeRecipient: response.protocol_fee_recipient,
|
|
365
|
+
protocolFee: response.protocol_fee,
|
|
366
|
+
lpFee: response.lp_fee,
|
|
367
|
+
allowanceMode: response.allowance_mode,
|
|
368
|
+
lps: response.lps,
|
|
369
|
+
minBaseOut: response.min_base_out
|
|
370
|
+
};
|
|
371
|
+
};
|
|
354
372
|
|
|
355
373
|
// src/lib/helpers/transactions.ts
|
|
356
374
|
var getSignerAddress = async (signer) => {
|
|
@@ -499,6 +517,21 @@ var CosmWasmChain = /* @__PURE__ */ ((CosmWasmChain2) => {
|
|
|
499
517
|
return CosmWasmChain2;
|
|
500
518
|
})(CosmWasmChain || {});
|
|
501
519
|
|
|
520
|
+
// src/lib/settlement/get-settlement-config.ts
|
|
521
|
+
var getSettlementConfig = async (client, contractAddress) => {
|
|
522
|
+
const cosmWasmClient = await client.getCosmWasmClient();
|
|
523
|
+
const response = await cosmWasmClient.queryContractSmart(contractAddress, {
|
|
524
|
+
config: {}
|
|
525
|
+
});
|
|
526
|
+
return parseQuerySettlementConfigResponse(response);
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// src/lib/settlement/get-settlement-config-for-base.ts
|
|
530
|
+
var getSettlementConfigForBase = async (client, baseAssetSymbol) => {
|
|
531
|
+
const pool = await getPoolForBase(client, baseAssetSymbol);
|
|
532
|
+
return await getSettlementConfig(client, pool.poolAddress);
|
|
533
|
+
};
|
|
534
|
+
|
|
502
535
|
// src/lib/client.ts
|
|
503
536
|
var BoltCosmWasmClient = class extends BaseClient {
|
|
504
537
|
/**
|
|
@@ -510,11 +543,13 @@ var BoltCosmWasmClient = class extends BaseClient {
|
|
|
510
543
|
* @param config - (Optional) Configuration for the client
|
|
511
544
|
* @param config.environment - (Optional) The deployment environment (Mainnet or Testnet). Defaults to Mainnet
|
|
512
545
|
* @param config.chain - (Optional) The specific CosmWasm chain to connect to. Defaults to Archway
|
|
513
|
-
* @param config.
|
|
514
|
-
* @param config.
|
|
515
|
-
* @param config.
|
|
516
|
-
* @param config.
|
|
517
|
-
* @param config.
|
|
546
|
+
* @param config.customOverride - (Optional) Overrides for RPC endpoint and contract addresses
|
|
547
|
+
* @param config.customOverride.rpcEndpoint - (Optional) Custom RPC endpoint URL
|
|
548
|
+
* @param config.customOverride.contracts - (Optional) Custom contract addresses
|
|
549
|
+
* @param config.customOverride.contracts.oracle - (Optional) Custom oracle contract address
|
|
550
|
+
* @param config.customOverride.contracts.router - (Optional) Custom router contract address
|
|
551
|
+
* @param config.customOverride.cosmWasmClient - (Optional) Custom CosmWasmClient to use for blockchain queries
|
|
552
|
+
* @param config.customOverride.signingCosmWasmClient - (Optional) Custom SigningCosmWasmClient to use for blockchain transactions
|
|
518
553
|
*
|
|
519
554
|
* @throws {InvalidTypeError} Thrown when an unsupported chain is specified
|
|
520
555
|
*
|
|
@@ -540,7 +575,9 @@ var BoltCosmWasmClient = class extends BaseClient {
|
|
|
540
575
|
const {
|
|
541
576
|
environment = "mainnet" /* Mainnet */,
|
|
542
577
|
chain = "archway" /* Archway */,
|
|
543
|
-
|
|
578
|
+
customOverride,
|
|
579
|
+
cosmWasmClient,
|
|
580
|
+
signingCosmWasmClient
|
|
544
581
|
} = config ?? {};
|
|
545
582
|
let configJson;
|
|
546
583
|
switch (chain) {
|
|
@@ -551,11 +588,11 @@ var BoltCosmWasmClient = class extends BaseClient {
|
|
|
551
588
|
throw new InvalidTypeError("A valid value of CosmWasmChain", chain);
|
|
552
589
|
}
|
|
553
590
|
super({
|
|
554
|
-
|
|
555
|
-
rpcEndpoint:
|
|
591
|
+
customOverride: {
|
|
592
|
+
rpcEndpoint: customOverride?.rpcEndpoint ?? configJson.chain.rpcEndpoint,
|
|
556
593
|
contracts: {
|
|
557
|
-
oracle:
|
|
558
|
-
router:
|
|
594
|
+
oracle: customOverride?.contracts?.oracle ?? configJson.contracts.oracle,
|
|
595
|
+
router: customOverride?.contracts?.router ?? configJson.contracts.router
|
|
559
596
|
}
|
|
560
597
|
}
|
|
561
598
|
});
|
|
@@ -574,6 +611,8 @@ var BoltCosmWasmClient = class extends BaseClient {
|
|
|
574
611
|
*/
|
|
575
612
|
__publicField(this, "chain");
|
|
576
613
|
this.chain = chain;
|
|
614
|
+
this._cosmWasmClient = cosmWasmClient;
|
|
615
|
+
this._signingCosmWasmClient = signingCosmWasmClient;
|
|
577
616
|
}
|
|
578
617
|
/**
|
|
579
618
|
* Gets or creates a CosmWasm client instance for read-only blockchain operations.
|
|
@@ -664,12 +703,20 @@ var BoltCosmWasmClient = class extends BaseClient {
|
|
|
664
703
|
}
|
|
665
704
|
/** @inheritdoc */
|
|
666
705
|
async getPoolByBaseAsset(baseAssetSymbol) {
|
|
667
|
-
return getPoolForBase(this, baseAssetSymbol);
|
|
706
|
+
return await getPoolForBase(this, baseAssetSymbol);
|
|
668
707
|
}
|
|
669
708
|
/** @inheritdoc */
|
|
670
709
|
async getAllPools() {
|
|
671
710
|
return await getPools(this);
|
|
672
711
|
}
|
|
712
|
+
/** @inheritdoc */
|
|
713
|
+
async getPoolConfig(poolContractAddress) {
|
|
714
|
+
return await getSettlementConfig(this, poolContractAddress);
|
|
715
|
+
}
|
|
716
|
+
/** @inheritdoc */
|
|
717
|
+
async getPoolConfigByBaseAsset(baseAssetSymbol) {
|
|
718
|
+
return await getSettlementConfigForBase(this, baseAssetSymbol);
|
|
719
|
+
}
|
|
673
720
|
/**
|
|
674
721
|
* @inheritdoc
|
|
675
722
|
*
|
|
@@ -698,6 +745,8 @@ var BoltCosmWasmClient = class extends BaseClient {
|
|
|
698
745
|
}
|
|
699
746
|
};
|
|
700
747
|
export {
|
|
748
|
+
AllowanceMode,
|
|
749
|
+
BaseClient,
|
|
701
750
|
BoltCosmWasmClient,
|
|
702
751
|
BoltSdkErrorBase,
|
|
703
752
|
BoltSdkErrorCode,
|