@bolt-liquidity-hq/sui-client 0.1.0-beta.13 → 0.1.0-beta.15

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.cts CHANGED
@@ -1,6 +1,7 @@
1
- import { ChainConfig, ClientConfig, Pool, BaseClient, OracleConfig, OracleAssetPair, InvertiblePrice, Price, RouterConfig, Address, BaseLiquidityDetails, Coin, PoolConfig, Asset, SwapParams, SwapResult } from '@bolt-liquidity-hq/core';
1
+ import { ChainConfig, ClientConfig, Pool, BaseClient, OracleConfig, OracleAssetPair, InvertiblePrice, Price, RouterConfig, Address, BaseLiquidityDetails, Coin, PoolConfig, Asset, SwapParams, SwapResult, SwapRequiredParams, SimulateSwapResult } from '@bolt-liquidity-hq/core';
2
2
  import { SuiClient, SuiTransactionBlockResponse } from '@mysten/sui/client';
3
3
  import { Signer } from '@mysten/sui/cryptography';
4
+ import { WalletContextState } from '@suiet/wallet-kit';
4
5
  import * as _mysten_bcs from '@mysten/bcs';
5
6
  import { BcsType } from '@mysten/bcs';
6
7
 
@@ -17,8 +18,10 @@ type BcsParsedMultiple<T extends readonly BcsType<any>[]> = {
17
18
 
18
19
  type SuiChainConfig = ChainConfig;
19
20
 
21
+ type WalletSigner = WalletContextState;
22
+
20
23
  type SuiClientConfig = ClientConfig<SuiChainConfig> & {
21
- signer?: Signer;
24
+ signer?: Signer | WalletSigner;
22
25
  suiClient?: SuiClient;
23
26
  customOverride?: ClientConfig<SuiChainConfig>['customOverride'] & {
24
27
  packageId?: string;
@@ -132,31 +135,9 @@ declare const PriceResponseStruct: _mysten_bcs.BcsStruct<{
132
135
  last_updated_ms: string | number | bigint;
133
136
  updater: string;
134
137
  } | null | undefined, `Option<${string}>`>;
138
+ is_inverted: _mysten_bcs.BcsType<boolean, boolean, "bool">;
135
139
  }, string>;
136
140
  type PriceResponseStructOutput = BcsParsed<typeof PriceResponseStruct>;
137
- declare const PricesResponsePaginatedStruct: _mysten_bcs.BcsStruct<{
138
- total_count: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
139
- has_next_page: _mysten_bcs.BcsType<boolean, boolean, "bool">;
140
- next_cursor: _mysten_bcs.BcsType<string | null, string | null | undefined, "Option<string>">;
141
- prices: _mysten_bcs.BcsType<{
142
- price: {
143
- price: string;
144
- expiry: string;
145
- };
146
- last_updated_ms: string;
147
- updater: string;
148
- }[], Iterable<{
149
- price: {
150
- price: string | number | bigint;
151
- expiry: string | number | bigint;
152
- };
153
- last_updated_ms: string | number | bigint;
154
- updater: string;
155
- }> & {
156
- length: number;
157
- }, string>;
158
- }, string>;
159
- type PricesResponsePaginatedStructOutput = BcsParsed<typeof PricesResponsePaginatedStruct>;
160
141
 
161
142
  declare const RouterConfigStruct: _mysten_bcs.BcsStruct<{
162
143
  admin: _mysten_bcs.BcsType<string, string, "address">;
@@ -257,6 +238,18 @@ declare const BaseLiquidityResponseStruct: _mysten_bcs.BcsStruct<{
257
238
  }, string>;
258
239
  }, string>;
259
240
  type BaseLiquidityResponseStructOutput = BcsParsed<typeof BaseLiquidityResponseStruct>;
241
+ declare const SwapSimulationResultStruct: _mysten_bcs.BcsStruct<{
242
+ amount_out: _mysten_bcs.BcsType<string, string | number | bigint, "u128">;
243
+ dynamic_fee_pct: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
244
+ ideal_quote_amt: _mysten_bcs.BcsType<string, string | number | bigint, "u128">;
245
+ swap_fee: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
246
+ lp_fee: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
247
+ protocol_fee: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
248
+ }, string>;
249
+ type SwapSimulationResultStructOutput = BcsParsed<typeof SwapSimulationResultStruct>;
250
+ type RouterPool = Pool & {
251
+ isInverse: boolean;
252
+ };
260
253
 
261
254
  declare const PoolInfoStruct: _mysten_bcs.BcsStruct<{
262
255
  base_liquidity: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
@@ -281,7 +274,7 @@ type ProtocolFeesInfoStructOutput = BcsParsed<typeof ProtocolFeesInfoStruct>;
281
274
  declare class RouterClient {
282
275
  pools: Pool[];
283
276
  constructor(pools: Pool[]);
284
- getPool(denomIn: string, denomOut: string): Pool | undefined;
277
+ getPool(denomIn: string, denomOut: string): RouterPool | undefined;
285
278
  getPools(): Pool[];
286
279
  }
287
280
 
@@ -329,7 +322,7 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
329
322
  /**
330
323
  * Cached instance of the Signer for transaction execution
331
324
  */
332
- signer?: Signer;
325
+ signer?: Signer | WalletSigner;
333
326
  /**
334
327
  * Instance of the Sui client to interact with the blockchain
335
328
  */
@@ -442,7 +435,7 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
442
435
  * const signer = client.getSigner(newSigner);
443
436
  * ```
444
437
  */
445
- getSigner(newSigner?: Signer): Signer;
438
+ getSigner(newSigner?: Signer | WalletSigner): Signer | WalletSigner;
446
439
  /** @inheritdoc */
447
440
  getOracleConfig(): Promise<OracleConfig>;
448
441
  /** @inheritdoc */
@@ -513,7 +506,7 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
513
506
  * This implementation returns a SuiTransactionBlockResponse as the transaction output,
514
507
  * which includes details like gas costs, transaction effects, object changes, and events.
515
508
  */
516
- swap(params: SwapParams, signer?: Signer): Promise<SwapResult<SuiTransactionBlockResponse>>;
509
+ swap(params: SwapParams, signer?: Signer | WalletSigner): Promise<SwapResult<SuiTransactionBlockResponse>>;
517
510
  /**
518
511
  * @inheritdoc
519
512
  *
@@ -542,7 +535,9 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
542
535
  * - The gasAdjustment parameter helps account for variations in actual execution
543
536
  * - Sui's gas model includes computation, storage, and storage rebates
544
537
  */
545
- estimateSwapGasFees(params: SwapParams, signer?: Signer, gasAdjustment?: number): Promise<Coin | undefined>;
538
+ estimateSwapGasFees(params: SwapParams, signer?: Signer | WalletSigner, gasAdjustment?: number): Promise<Coin | undefined>;
539
+ /** @inheritdoc */
540
+ simulateSwap(params: SwapRequiredParams): Promise<SimulateSwapResult>;
546
541
  /**
547
542
  * Loads configuration from a remote URL for testnet environments.
548
543
  *
@@ -566,4 +561,4 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
566
561
  private loadConfigFromUrl;
567
562
  }
568
563
 
569
- export { AssetPairResponseStruct, type AssetPairResponseStructOutput, AssetPairStruct, type AssetPairStructOutput, AssetPairsResponseStruct, type AssetPairsResponseStructOutput, BaseLiquidityInfoStruct, type BaseLiquidityInfoStructOutput, BaseLiquidityResponseStruct, type BaseLiquidityResponseStructOutput, BcsAddressType, type BcsParsed, type BcsParsedMultiple, BoltSuiClient, MarketResponseStruct, type MarketResponseStructOutput, MarketStruct, type MarketStructOutput, MarketsResponsePaginatedStruct, type MarketsResponsePaginatedStructOutput, MarketsResponseStruct, type MarketsResponseStructOutput, OracleConfigStruct, type OracleConfigStructOutput, PaginationStruct, PoolFeesInfoStruct, type PoolFeesInfoStructOutput, PoolInfoStruct, type PoolInfoStructOutput, PriceDataStruct, type PriceDataStructOutput, PriceResponseStruct, type PriceResponseStructOutput, PricesResponsePaginatedStruct, type PricesResponsePaginatedStructOutput, ProtocolFeesInfoStruct, type ProtocolFeesInfoStructOutput, RawPairStruct, type RawPairStructOutput, RawPriceStruct, type RawPriceStructOutput, RouterConfigStruct, type RouterConfigStructOutput, type SuiChainConfig, type SuiClientConfig, TypeNameStruct, type TypeNameStructOutput };
564
+ export { AssetPairResponseStruct, type AssetPairResponseStructOutput, AssetPairStruct, type AssetPairStructOutput, AssetPairsResponseStruct, type AssetPairsResponseStructOutput, BaseLiquidityInfoStruct, type BaseLiquidityInfoStructOutput, BaseLiquidityResponseStruct, type BaseLiquidityResponseStructOutput, BcsAddressType, type BcsParsed, type BcsParsedMultiple, BoltSuiClient, MarketResponseStruct, type MarketResponseStructOutput, MarketStruct, type MarketStructOutput, MarketsResponsePaginatedStruct, type MarketsResponsePaginatedStructOutput, MarketsResponseStruct, type MarketsResponseStructOutput, OracleConfigStruct, type OracleConfigStructOutput, PaginationStruct, PoolFeesInfoStruct, type PoolFeesInfoStructOutput, PoolInfoStruct, type PoolInfoStructOutput, PriceDataStruct, type PriceDataStructOutput, PriceResponseStruct, type PriceResponseStructOutput, ProtocolFeesInfoStruct, type ProtocolFeesInfoStructOutput, RawPairStruct, type RawPairStructOutput, RawPriceStruct, type RawPriceStructOutput, RouterConfigStruct, type RouterConfigStructOutput, type RouterPool, type SuiChainConfig, type SuiClientConfig, SwapSimulationResultStruct, type SwapSimulationResultStructOutput, TypeNameStruct, type TypeNameStructOutput, type WalletSigner };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { ChainConfig, ClientConfig, Pool, BaseClient, OracleConfig, OracleAssetPair, InvertiblePrice, Price, RouterConfig, Address, BaseLiquidityDetails, Coin, PoolConfig, Asset, SwapParams, SwapResult } from '@bolt-liquidity-hq/core';
1
+ import { ChainConfig, ClientConfig, Pool, BaseClient, OracleConfig, OracleAssetPair, InvertiblePrice, Price, RouterConfig, Address, BaseLiquidityDetails, Coin, PoolConfig, Asset, SwapParams, SwapResult, SwapRequiredParams, SimulateSwapResult } from '@bolt-liquidity-hq/core';
2
2
  import { SuiClient, SuiTransactionBlockResponse } from '@mysten/sui/client';
3
3
  import { Signer } from '@mysten/sui/cryptography';
4
+ import { WalletContextState } from '@suiet/wallet-kit';
4
5
  import * as _mysten_bcs from '@mysten/bcs';
5
6
  import { BcsType } from '@mysten/bcs';
6
7
 
@@ -17,8 +18,10 @@ type BcsParsedMultiple<T extends readonly BcsType<any>[]> = {
17
18
 
18
19
  type SuiChainConfig = ChainConfig;
19
20
 
21
+ type WalletSigner = WalletContextState;
22
+
20
23
  type SuiClientConfig = ClientConfig<SuiChainConfig> & {
21
- signer?: Signer;
24
+ signer?: Signer | WalletSigner;
22
25
  suiClient?: SuiClient;
23
26
  customOverride?: ClientConfig<SuiChainConfig>['customOverride'] & {
24
27
  packageId?: string;
@@ -132,31 +135,9 @@ declare const PriceResponseStruct: _mysten_bcs.BcsStruct<{
132
135
  last_updated_ms: string | number | bigint;
133
136
  updater: string;
134
137
  } | null | undefined, `Option<${string}>`>;
138
+ is_inverted: _mysten_bcs.BcsType<boolean, boolean, "bool">;
135
139
  }, string>;
136
140
  type PriceResponseStructOutput = BcsParsed<typeof PriceResponseStruct>;
137
- declare const PricesResponsePaginatedStruct: _mysten_bcs.BcsStruct<{
138
- total_count: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
139
- has_next_page: _mysten_bcs.BcsType<boolean, boolean, "bool">;
140
- next_cursor: _mysten_bcs.BcsType<string | null, string | null | undefined, "Option<string>">;
141
- prices: _mysten_bcs.BcsType<{
142
- price: {
143
- price: string;
144
- expiry: string;
145
- };
146
- last_updated_ms: string;
147
- updater: string;
148
- }[], Iterable<{
149
- price: {
150
- price: string | number | bigint;
151
- expiry: string | number | bigint;
152
- };
153
- last_updated_ms: string | number | bigint;
154
- updater: string;
155
- }> & {
156
- length: number;
157
- }, string>;
158
- }, string>;
159
- type PricesResponsePaginatedStructOutput = BcsParsed<typeof PricesResponsePaginatedStruct>;
160
141
 
161
142
  declare const RouterConfigStruct: _mysten_bcs.BcsStruct<{
162
143
  admin: _mysten_bcs.BcsType<string, string, "address">;
@@ -257,6 +238,18 @@ declare const BaseLiquidityResponseStruct: _mysten_bcs.BcsStruct<{
257
238
  }, string>;
258
239
  }, string>;
259
240
  type BaseLiquidityResponseStructOutput = BcsParsed<typeof BaseLiquidityResponseStruct>;
241
+ declare const SwapSimulationResultStruct: _mysten_bcs.BcsStruct<{
242
+ amount_out: _mysten_bcs.BcsType<string, string | number | bigint, "u128">;
243
+ dynamic_fee_pct: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
244
+ ideal_quote_amt: _mysten_bcs.BcsType<string, string | number | bigint, "u128">;
245
+ swap_fee: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
246
+ lp_fee: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
247
+ protocol_fee: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
248
+ }, string>;
249
+ type SwapSimulationResultStructOutput = BcsParsed<typeof SwapSimulationResultStruct>;
250
+ type RouterPool = Pool & {
251
+ isInverse: boolean;
252
+ };
260
253
 
261
254
  declare const PoolInfoStruct: _mysten_bcs.BcsStruct<{
262
255
  base_liquidity: _mysten_bcs.BcsType<string, string | number | bigint, "u64">;
@@ -281,7 +274,7 @@ type ProtocolFeesInfoStructOutput = BcsParsed<typeof ProtocolFeesInfoStruct>;
281
274
  declare class RouterClient {
282
275
  pools: Pool[];
283
276
  constructor(pools: Pool[]);
284
- getPool(denomIn: string, denomOut: string): Pool | undefined;
277
+ getPool(denomIn: string, denomOut: string): RouterPool | undefined;
285
278
  getPools(): Pool[];
286
279
  }
287
280
 
@@ -329,7 +322,7 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
329
322
  /**
330
323
  * Cached instance of the Signer for transaction execution
331
324
  */
332
- signer?: Signer;
325
+ signer?: Signer | WalletSigner;
333
326
  /**
334
327
  * Instance of the Sui client to interact with the blockchain
335
328
  */
@@ -442,7 +435,7 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
442
435
  * const signer = client.getSigner(newSigner);
443
436
  * ```
444
437
  */
445
- getSigner(newSigner?: Signer): Signer;
438
+ getSigner(newSigner?: Signer | WalletSigner): Signer | WalletSigner;
446
439
  /** @inheritdoc */
447
440
  getOracleConfig(): Promise<OracleConfig>;
448
441
  /** @inheritdoc */
@@ -513,7 +506,7 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
513
506
  * This implementation returns a SuiTransactionBlockResponse as the transaction output,
514
507
  * which includes details like gas costs, transaction effects, object changes, and events.
515
508
  */
516
- swap(params: SwapParams, signer?: Signer): Promise<SwapResult<SuiTransactionBlockResponse>>;
509
+ swap(params: SwapParams, signer?: Signer | WalletSigner): Promise<SwapResult<SuiTransactionBlockResponse>>;
517
510
  /**
518
511
  * @inheritdoc
519
512
  *
@@ -542,7 +535,9 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
542
535
  * - The gasAdjustment parameter helps account for variations in actual execution
543
536
  * - Sui's gas model includes computation, storage, and storage rebates
544
537
  */
545
- estimateSwapGasFees(params: SwapParams, signer?: Signer, gasAdjustment?: number): Promise<Coin | undefined>;
538
+ estimateSwapGasFees(params: SwapParams, signer?: Signer | WalletSigner, gasAdjustment?: number): Promise<Coin | undefined>;
539
+ /** @inheritdoc */
540
+ simulateSwap(params: SwapRequiredParams): Promise<SimulateSwapResult>;
546
541
  /**
547
542
  * Loads configuration from a remote URL for testnet environments.
548
543
  *
@@ -566,4 +561,4 @@ declare class BoltSuiClient extends BaseClient<Signer, SuiTransactionBlockRespon
566
561
  private loadConfigFromUrl;
567
562
  }
568
563
 
569
- export { AssetPairResponseStruct, type AssetPairResponseStructOutput, AssetPairStruct, type AssetPairStructOutput, AssetPairsResponseStruct, type AssetPairsResponseStructOutput, BaseLiquidityInfoStruct, type BaseLiquidityInfoStructOutput, BaseLiquidityResponseStruct, type BaseLiquidityResponseStructOutput, BcsAddressType, type BcsParsed, type BcsParsedMultiple, BoltSuiClient, MarketResponseStruct, type MarketResponseStructOutput, MarketStruct, type MarketStructOutput, MarketsResponsePaginatedStruct, type MarketsResponsePaginatedStructOutput, MarketsResponseStruct, type MarketsResponseStructOutput, OracleConfigStruct, type OracleConfigStructOutput, PaginationStruct, PoolFeesInfoStruct, type PoolFeesInfoStructOutput, PoolInfoStruct, type PoolInfoStructOutput, PriceDataStruct, type PriceDataStructOutput, PriceResponseStruct, type PriceResponseStructOutput, PricesResponsePaginatedStruct, type PricesResponsePaginatedStructOutput, ProtocolFeesInfoStruct, type ProtocolFeesInfoStructOutput, RawPairStruct, type RawPairStructOutput, RawPriceStruct, type RawPriceStructOutput, RouterConfigStruct, type RouterConfigStructOutput, type SuiChainConfig, type SuiClientConfig, TypeNameStruct, type TypeNameStructOutput };
564
+ export { AssetPairResponseStruct, type AssetPairResponseStructOutput, AssetPairStruct, type AssetPairStructOutput, AssetPairsResponseStruct, type AssetPairsResponseStructOutput, BaseLiquidityInfoStruct, type BaseLiquidityInfoStructOutput, BaseLiquidityResponseStruct, type BaseLiquidityResponseStructOutput, BcsAddressType, type BcsParsed, type BcsParsedMultiple, BoltSuiClient, MarketResponseStruct, type MarketResponseStructOutput, MarketStruct, type MarketStructOutput, MarketsResponsePaginatedStruct, type MarketsResponsePaginatedStructOutput, MarketsResponseStruct, type MarketsResponseStructOutput, OracleConfigStruct, type OracleConfigStructOutput, PaginationStruct, PoolFeesInfoStruct, type PoolFeesInfoStructOutput, PoolInfoStruct, type PoolInfoStructOutput, PriceDataStruct, type PriceDataStructOutput, PriceResponseStruct, type PriceResponseStructOutput, ProtocolFeesInfoStruct, type ProtocolFeesInfoStructOutput, RawPairStruct, type RawPairStructOutput, RawPriceStruct, type RawPriceStructOutput, RouterConfigStruct, type RouterConfigStructOutput, type RouterPool, type SuiChainConfig, type SuiClientConfig, SwapSimulationResultStruct, type SwapSimulationResultStructOutput, TypeNameStruct, type TypeNameStructOutput, type WalletSigner };