@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.js CHANGED
@@ -5,11 +5,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5
5
  // src/lib/client.ts
6
6
  import { BaseClient, MissingParameterError as MissingParameterError2 } from "@bolt-liquidity-hq/core";
7
7
  import { SuiClient } from "@mysten/sui/client";
8
- import { normalizeStructTag as normalizeStructTag5 } from "@mysten/sui/utils";
8
+ import { normalizeStructTag as normalizeStructTag6 } from "@mysten/sui/utils";
9
9
  import axios from "axios";
10
10
 
11
+ // src/config/common.ts
12
+ import { normalizeStructTag, SUI_TYPE_ARG } from "@mysten/sui/utils";
13
+ var SUI_TOKEN_DENOM = normalizeStructTag(SUI_TYPE_ARG);
14
+
11
15
  // src/config/mainnet.ts
12
- import { SUI_DECIMALS, SUI_TYPE_ARG } from "@mysten/sui/utils";
16
+ import { SUI_DECIMALS } from "@mysten/sui/utils";
13
17
  var MainnetChainConfig = {
14
18
  name: "Sui",
15
19
  id: "101",
@@ -21,13 +25,13 @@ var MainnetContracts = {
21
25
  };
22
26
  var MainnetPackageId = "0x...";
23
27
  var MainnetPoolGlobalConfigId = "0x...";
24
- var MainnetNativeTokenDenom = SUI_TYPE_ARG;
28
+ var MainnetNativeTokenDenom = SUI_TOKEN_DENOM;
25
29
  var MainnetAssets = {
26
- [SUI_TYPE_ARG]: {
30
+ [SUI_TOKEN_DENOM]: {
27
31
  symbol: "SUI",
28
32
  name: "Sui",
29
33
  chainId: "101",
30
- denom: SUI_TYPE_ARG,
34
+ denom: SUI_TOKEN_DENOM,
31
35
  decimals: SUI_DECIMALS,
32
36
  logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
33
37
  coingeckoId: "sui"
@@ -45,7 +49,7 @@ var MainnetAssets = {
45
49
  var MainnetPools = [];
46
50
 
47
51
  // src/config/testnet.ts
48
- import { SUI_DECIMALS as SUI_DECIMALS2, SUI_TYPE_ARG as SUI_TYPE_ARG2 } from "@mysten/sui/utils";
52
+ import { SUI_DECIMALS as SUI_DECIMALS2 } from "@mysten/sui/utils";
49
53
  var TestnetConfigUrl = "https://phi-labs-ltd.github.io/sui-outpost/testnet.json";
50
54
  var TestnetChainConfig = {
51
55
  name: "Sui Testnet",
@@ -58,14 +62,14 @@ var TestnetContracts = {
58
62
  };
59
63
  var TestnetPackageId = "";
60
64
  var TestnetPoolGlobalConfigId = "";
61
- var TestnetNativeTokenDenom = SUI_TYPE_ARG2;
65
+ var TestnetNativeTokenDenom = SUI_TOKEN_DENOM;
62
66
  var TestnetHelperAssets = ["::test_btc::TEST_BTC", "::test_usdt::TEST_USDT"];
63
67
  var TestnetAssets = {
64
- [SUI_TYPE_ARG2]: {
68
+ [SUI_TOKEN_DENOM]: {
65
69
  symbol: "SUI",
66
70
  name: "Sui",
67
71
  chainId: "103",
68
- denom: SUI_TYPE_ARG2,
72
+ denom: SUI_TOKEN_DENOM,
69
73
  decimals: SUI_DECIMALS2,
70
74
  logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
71
75
  coingeckoId: "sui"
@@ -85,7 +89,7 @@ var TestnetAssets = {
85
89
  chainId: "103",
86
90
  denom: "::test_btc::TEST_BTC",
87
91
  decimals: 8,
88
- logo: "https://github.com/cosmos/chain-registry/blob/master/_non-cosmos/bitcoin/images/btc.png",
92
+ logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/bitcoin/images/btc.svg",
89
93
  coingeckoId: "bitcoin"
90
94
  },
91
95
  "::test_usdt::TEST_USDT": {
@@ -94,11 +98,14 @@ var TestnetAssets = {
94
98
  chainId: "103",
95
99
  denom: "::test_usdt::TEST_USDT",
96
100
  decimals: 6,
97
- logo: "https://github.com/cosmos/chain-registry/blob/master/_non-cosmos/ethereum/images/usdt.png",
101
+ logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdt.svg",
98
102
  coingeckoId: "tether"
99
103
  }
100
104
  };
101
105
 
106
+ // src/lib/constants/defaults.ts
107
+ var BASIS_POINTS = 1e4;
108
+
102
109
  // src/lib/constants/sui-objects.ts
103
110
  var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000000";
104
111
  var PRICE_ORACLE_MODULE = "price_oracle";
@@ -140,7 +147,7 @@ var parseDevInspectResult = (result, bcsType, resultIndex = 0, returnValueIndex
140
147
 
141
148
  // src/lib/helpers/coin-manager.ts
142
149
  import { InsufficientFundsError, MissingParameterError } from "@bolt-liquidity-hq/core";
143
- import { SUI_TYPE_ARG as SUI_TYPE_ARG3 } from "@mysten/sui/utils";
150
+ import { normalizeStructTag as normalizeStructTag2 } from "@mysten/sui/utils";
144
151
  var CoinManager = class {
145
152
  /**
146
153
  * Creates a new CoinManager instance.
@@ -507,7 +514,7 @@ var CoinManager = class {
507
514
  */
508
515
  async prepareCoinInput(tx, coinType, amount, options = {}, owner) {
509
516
  const ownerAddress = this.getOwnerAddress(owner);
510
- if (coinType === SUI_TYPE_ARG3) {
517
+ if (normalizeStructTag2(coinType) === SUI_TOKEN_DENOM) {
511
518
  const [coin] = tx.splitCoins(tx.gas, [amount]);
512
519
  return coin;
513
520
  }
@@ -579,7 +586,7 @@ import {
579
586
  } from "@bolt-liquidity-hq/core";
580
587
  import { bcs as bcs2 } from "@mysten/bcs";
581
588
  import { Transaction as Transaction2 } from "@mysten/sui/transactions";
582
- import { normalizeStructTag, SUI_CLOCK_OBJECT_ID, SUI_TYPE_ARG as SUI_TYPE_ARG4 } from "@mysten/sui/utils";
589
+ import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
583
590
  import { BigNumber } from "bignumber.js";
584
591
  var buildSwapTxArgs = async (client, swapParams, signer) => {
585
592
  const { assetIn, amountIn, assetOut, minimumAmountOut, receiver } = swapParams;
@@ -587,14 +594,15 @@ var buildSwapTxArgs = async (client, swapParams, signer) => {
587
594
  if (!pool) {
588
595
  throw new NotFoundError(`Pool for the pair ${assetIn}/${assetOut}`);
589
596
  }
590
- const isSell = normalizeStructTag(assetIn) === pool.baseDenom;
591
- const FUNCTION_NAME = isSell ? "swap_sell" : "swap_buy";
597
+ const FUNCTION_NAME = pool.isInverse ? "swap_sell" : "swap_buy";
592
598
  const finalSigner = client.getSigner(signer);
593
599
  const tx = new Transaction2();
594
- const coinManager = new CoinManager(client.suiClient, finalSigner.toSuiAddress());
600
+ const signerAddress = getSignerAddress(finalSigner);
601
+ const coinManager = new CoinManager(client.suiClient, signerAddress);
595
602
  const coinInput = await coinManager.prepareCoinInput(tx, assetIn, amountIn);
596
603
  return {
597
604
  signer: finalSigner,
605
+ signerAddress,
598
606
  target: [client.packageId, ROUTER_MODULE, FUNCTION_NAME],
599
607
  args: [
600
608
  pool.poolAddress,
@@ -602,10 +610,10 @@ var buildSwapTxArgs = async (client, swapParams, signer) => {
602
610
  SUI_CLOCK_OBJECT_ID,
603
611
  coinInput,
604
612
  bcs2.u64().serialize(amountIn),
605
- bcs2.option(bcs2.string()).serialize(minimumAmountOut),
613
+ bcs2.option(bcs2.u64()).serialize(minimumAmountOut),
606
614
  bcs2.option(bcs2.string()).serialize(receiver)
607
615
  ],
608
- typeArguments: [isSell ? assetIn : assetOut, isSell ? assetOut : assetIn],
616
+ typeArguments: [pool.isInverse ? assetIn : assetOut, pool.isInverse ? assetOut : assetIn],
609
617
  tx
610
618
  };
611
619
  };
@@ -621,15 +629,29 @@ var signAndExecuteTx = async (suiClient, signer, target, args, typeArguments, tr
621
629
  typeArguments
622
630
  });
623
631
  try {
624
- const result = await suiClient.signAndExecuteTransaction({
625
- signer,
626
- transaction: tx,
627
- options
628
- });
629
- if (result.effects?.status.status === "success") {
630
- return result;
632
+ if ("toSuiAddress" in signer) {
633
+ const result = await suiClient.signAndExecuteTransaction({
634
+ signer,
635
+ transaction: tx,
636
+ options
637
+ });
638
+ if (result.effects?.status.status === "success") {
639
+ return result;
640
+ } else {
641
+ throw new TransactionFailedError2(result.digest, result.effects?.status.error, { result });
642
+ }
631
643
  } else {
632
- throw new TransactionFailedError2(result.digest, result.effects?.status.error, { result });
644
+ const result = await signer.signAndExecuteTransaction({
645
+ transaction: tx
646
+ });
647
+ if (!result.digest) {
648
+ throw new TransactionFailedError2("not found");
649
+ }
650
+ const fullTx = await suiClient.waitForTransaction({
651
+ digest: result.digest,
652
+ options
653
+ });
654
+ return fullTx;
633
655
  }
634
656
  } catch (error) {
635
657
  throw UnexpectedError2.from(error, "Failed to execute transaction", {
@@ -672,13 +694,20 @@ var estimateTxGasPrice = async (suiClient, senderAddress, target, args, typeArgu
672
694
  const totalGasCost = BigNumber(gasUsed.computationCost).plus(gasUsed.storageCost).minus(gasUsed.storageRebate);
673
695
  const adjustedGasCost = totalGasCost.times(gasAdjustment);
674
696
  return {
675
- denom: SUI_TYPE_ARG4,
697
+ denom: SUI_TOKEN_DENOM,
676
698
  amount: adjustedGasCost.toFixed(0, BigNumber.ROUND_CEIL)
677
699
  };
678
700
  } catch {
679
701
  return;
680
702
  }
681
703
  };
704
+ var getSignerAddress = (signer) => {
705
+ const address = "address" in signer ? signer.address : signer.toSuiAddress?.();
706
+ if (!address) {
707
+ throw new NotFoundError("Signer account's address");
708
+ }
709
+ return address;
710
+ };
682
711
 
683
712
  // src/lib/oracle/parsers.ts
684
713
  import { InvalidObjectError as InvalidObjectError2 } from "@bolt-liquidity-hq/core";
@@ -713,20 +742,20 @@ var parseAssetPairStructOutput = (output) => {
713
742
  var parseAssetPairsResponseStructOutput = (output) => {
714
743
  return output.map((item) => parseAssetPairStructOutput(item.info));
715
744
  };
716
- var parsePriceDataStructOutput = (output, baseDenom, quoteDenom) => {
745
+ var parsePriceDataStructOutput = (output, baseDenom, quoteDenom, isInverted) => {
717
746
  return {
718
747
  baseDenom,
719
748
  quoteDenom,
720
749
  price: output.price.price,
721
750
  expiryTime: BigNumber2(output.price.expiry).times(1e6).toFixed(),
722
- isInverse: false
751
+ isInverse: isInverted ?? false
723
752
  };
724
753
  };
725
754
  var parsePriceResponseStructOutput = (output, baseDenom, quoteDenom) => {
726
755
  if (!output.pair_data) {
727
756
  throw new InvalidObjectError2("Can't find pair data price");
728
757
  }
729
- return parsePriceDataStructOutput(output.pair_data, baseDenom, quoteDenom);
758
+ return parsePriceDataStructOutput(output.pair_data, baseDenom, quoteDenom, output.is_inverted);
730
759
  };
731
760
 
732
761
  // src/types/bcs.ts
@@ -789,11 +818,8 @@ var PriceDataStruct = bcs4.struct("PriceData", {
789
818
  updater: BcsAddressType
790
819
  });
791
820
  var PriceResponseStruct = bcs4.struct("PriceResponse", {
792
- pair_data: bcs4.option(PriceDataStruct)
793
- });
794
- var PricesResponsePaginatedStruct = bcs4.struct("PricesResponsePaginated", {
795
- prices: bcs4.vector(PriceDataStruct),
796
- ...PaginationStruct
821
+ pair_data: bcs4.option(PriceDataStruct),
822
+ is_inverted: bcs4.bool()
797
823
  });
798
824
 
799
825
  // src/types/router.ts
@@ -830,6 +856,14 @@ var BaseLiquidityResponseStruct = bcs5.struct("BaseLiquidityResponse", {
830
856
  base_assets: bcs5.vector(BaseLiquidityInfoStruct),
831
857
  ...PaginationStruct
832
858
  });
859
+ var SwapSimulationResultStruct = bcs5.struct("SwapSimulationResult", {
860
+ amount_out: bcs5.u128(),
861
+ dynamic_fee_pct: bcs5.u64(),
862
+ ideal_quote_amt: bcs5.u128(),
863
+ swap_fee: bcs5.u64(),
864
+ lp_fee: bcs5.u64(),
865
+ protocol_fee: bcs5.u64()
866
+ });
833
867
 
834
868
  // src/types/pool.ts
835
869
  import { bcs as bcs6 } from "@mysten/bcs";
@@ -863,13 +897,19 @@ var getAssetPairs = async (client) => {
863
897
  };
864
898
 
865
899
  // src/lib/oracle/get-assets.ts
866
- import { normalizeStructTag as normalizeStructTag2 } from "@mysten/sui/utils";
900
+ import { normalizeStructTag as normalizeStructTag3 } from "@mysten/sui/utils";
867
901
  var getAssets = async (client) => {
868
902
  const assetPairs = await client.getAllOracleAssetPairs();
869
903
  const uniqueOracleAssets = {};
870
904
  for (const item of assetPairs) {
871
- uniqueOracleAssets[item.base.symbol] = item.base;
872
- uniqueOracleAssets[item.quote.symbol] = item.quote;
905
+ uniqueOracleAssets[normalizeStructTag3(item.base.symbol)] = {
906
+ ...item.base,
907
+ symbol: normalizeStructTag3(item.base.symbol)
908
+ };
909
+ uniqueOracleAssets[normalizeStructTag3(item.quote.symbol)] = {
910
+ ...item.quote,
911
+ symbol: normalizeStructTag3(item.quote.symbol)
912
+ };
873
913
  }
874
914
  return Object.values(uniqueOracleAssets).map(
875
915
  (item) => client.assetsConfig[item.symbol] ?? // Fallback to minimal asset data from oracle
@@ -877,7 +917,7 @@ var getAssets = async (client) => {
877
917
  symbol: item.name,
878
918
  name: item.name,
879
919
  chainId: client.chainConfig.id,
880
- denom: normalizeStructTag2(item.symbol),
920
+ denom: normalizeStructTag3(item.symbol),
881
921
  decimals: item.precision,
882
922
  logo: void 0,
883
923
  coingeckoId: void 0
@@ -912,7 +952,7 @@ var getPrice = async (client, baseDenom, quoteDenom) => {
912
952
 
913
953
  // src/lib/oracle/get-prices.ts
914
954
  import { NotFoundError as NotFoundError2 } from "@bolt-liquidity-hq/core";
915
- import { normalizeStructTag as normalizeStructTag3 } from "@mysten/sui/utils";
955
+ import { normalizeStructTag as normalizeStructTag4 } from "@mysten/sui/utils";
916
956
  var getPrices = async (client) => {
917
957
  const oracleObject = await client.suiClient.getObject({
918
958
  id: client.contracts.oracle,
@@ -947,8 +987,8 @@ var getPrices = async (client) => {
947
987
  const pairKey = dynamicFields.data[index]?.name?.value;
948
988
  if (fields && pairKey) {
949
989
  prices.push({
950
- baseDenom: normalizeStructTag3(pairKey.base.name),
951
- quoteDenom: normalizeStructTag3(pairKey.quote.name),
990
+ baseDenom: normalizeStructTag4(pairKey.base.name),
991
+ quoteDenom: normalizeStructTag4(pairKey.quote.name),
952
992
  price: fields.price,
953
993
  expiryTime: fields.expiry
954
994
  });
@@ -967,7 +1007,7 @@ var estimateSwapExactInGasFees = async (client, swapParams, signer, gasAdjustmen
967
1007
  const swapArgs = await buildSwapTxArgs(client, swapParams, signer);
968
1008
  return await estimateTxGasPrice(
969
1009
  client.suiClient,
970
- swapArgs.signer.toSuiAddress(),
1010
+ swapArgs.signerAddress,
971
1011
  swapArgs.target,
972
1012
  swapArgs.args,
973
1013
  swapArgs.typeArguments,
@@ -993,9 +1033,9 @@ var getAllQuotesForUser = async (_client, _lpAddress) => {
993
1033
  // src/lib/router/get-pool-by-denom.ts
994
1034
  import { NotFoundError as NotFoundError3 } from "@bolt-liquidity-hq/core";
995
1035
  var getPoolByDenom = async (client, baseDenom, quoteDenom) => {
996
- const result = await client.routerClient.getPool(baseDenom, quoteDenom);
1036
+ const result = await client.routerClient.getPool(quoteDenom, baseDenom);
997
1037
  if (!result) {
998
- throw new NotFoundError3("Pool", `Didn't find a pool to swap ${baseDenom} for ${quoteDenom}`);
1038
+ throw new NotFoundError3("Pool", `Didn't find a pool to swap ${quoteDenom} for ${baseDenom}`);
999
1039
  }
1000
1040
  return result;
1001
1041
  };
@@ -1011,26 +1051,47 @@ var getRouterConfig = async (_client) => {
1011
1051
  throw new NotImplementedError3("getRouterConfig on Sui Client");
1012
1052
  };
1013
1053
 
1054
+ // src/lib/router/parsers.ts
1055
+ import { NotFoundError as NotFoundError4 } from "@bolt-liquidity-hq/core";
1056
+ import { BigNumber as BigNumber3 } from "bignumber.js";
1057
+ var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
1058
+ return {
1059
+ poolAddress,
1060
+ amountOut: output.amount_out,
1061
+ assetOut,
1062
+ protocolFee: output.protocol_fee,
1063
+ lpFee: output.lp_fee,
1064
+ dynamicFeePercentage: BigNumber3(output.dynamic_fee_pct).div(BASIS_POINTS).toFixed(),
1065
+ totalFees: output.swap_fee
1066
+ };
1067
+ };
1068
+
1014
1069
  // src/lib/router/router-client/RouterClient.ts
1015
- import { normalizeStructTag as normalizeStructTag4 } from "@mysten/sui/utils";
1070
+ import { normalizeStructTag as normalizeStructTag5 } from "@mysten/sui/utils";
1016
1071
  var RouterClient = class {
1017
1072
  constructor(pools) {
1018
1073
  this.pools = pools;
1019
1074
  }
1020
1075
  getPool(denomIn, denomOut) {
1021
- const normalizedDenomIn = normalizeStructTag4(denomIn);
1022
- const normalizedDenomOut = normalizeStructTag4(denomOut);
1076
+ const normalizedDenomIn = normalizeStructTag5(denomIn);
1077
+ const normalizedDenomOut = normalizeStructTag5(denomOut);
1023
1078
  const directPairPool = this.pools.find(
1024
- (item) => item.baseDenom === normalizedDenomIn && item.quoteDenoms.includes(normalizedDenomOut)
1079
+ (item) => item.baseDenom === normalizedDenomOut && item.quoteDenoms.includes(normalizedDenomIn)
1025
1080
  );
1026
1081
  if (directPairPool) {
1027
- return directPairPool;
1082
+ return {
1083
+ ...directPairPool,
1084
+ isInverse: false
1085
+ };
1028
1086
  }
1029
1087
  const inversePairPool = this.pools.find(
1030
- (item) => item.baseDenom === normalizedDenomOut && item.quoteDenoms.includes(normalizedDenomIn)
1088
+ (item) => item.baseDenom === normalizedDenomIn && item.quoteDenoms.includes(normalizedDenomOut)
1031
1089
  );
1032
1090
  if (inversePairPool) {
1033
- return inversePairPool;
1091
+ return {
1092
+ ...inversePairPool,
1093
+ isInverse: true
1094
+ };
1034
1095
  }
1035
1096
  return;
1036
1097
  }
@@ -1039,6 +1100,28 @@ var RouterClient = class {
1039
1100
  }
1040
1101
  };
1041
1102
 
1103
+ // src/lib/router/simulate-swap.ts
1104
+ import {
1105
+ NotFoundError as NotFoundError5
1106
+ } from "@bolt-liquidity-hq/core";
1107
+ import { bcs as bcs7 } from "@mysten/bcs";
1108
+ import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID2 } from "@mysten/sui/utils";
1109
+ var simulateSwap = async (client, { assetIn, amountIn, assetOut }) => {
1110
+ const pool = await client.routerClient.getPool(assetIn, assetOut);
1111
+ if (!pool) {
1112
+ throw new NotFoundError5("Pool", `Didn't find a pool to swap ${assetIn} for ${assetOut}`);
1113
+ }
1114
+ const FUNCTION_NAME = pool.isInverse ? "simulate_sell_swap" : "simulate_buy_swap";
1115
+ const response = await queryDevInspect(
1116
+ client.suiClient,
1117
+ [client.packageId, POOL_MODULE, FUNCTION_NAME],
1118
+ [pool.poolAddress, client.contracts.oracle, SUI_CLOCK_OBJECT_ID2, bcs7.u64().serialize(amountIn)],
1119
+ [pool.isInverse ? assetIn : assetOut, pool.isInverse ? assetOut : assetIn]
1120
+ );
1121
+ const output = parseDevInspectResult(response, SwapSimulationResultStruct);
1122
+ return parseSwapSimulationResultStructOutput(output, pool.poolAddress, assetOut);
1123
+ };
1124
+
1042
1125
  // src/lib/router/swap-exact-in.ts
1043
1126
  var swapExactIn = async (client, swapParams, signer) => {
1044
1127
  const swapArgs = await buildSwapTxArgs(client, swapParams, signer);
@@ -1060,15 +1143,16 @@ var swapExactIn = async (client, swapParams, signer) => {
1060
1143
  };
1061
1144
 
1062
1145
  // src/lib/settlement/get-pool-info.ts
1063
- import { SUI_TYPE_ARG as SUI_TYPE_ARG5 } from "@mysten/sui/utils";
1146
+ import { NotFoundError as NotFoundError6 } from "@bolt-liquidity-hq/core";
1064
1147
 
1065
1148
  // src/lib/settlement/parsers.ts
1149
+ import { BigNumber as BigNumber4 } from "bignumber.js";
1066
1150
  var parseSettlementConfigStructOutput = (routerClient, poolFeesInfo, protocolFeesInfo, priceOracleContract) => {
1067
1151
  return {
1068
1152
  priceOracleContract,
1069
1153
  protocolFeeRecipient: protocolFeesInfo.bolt_fee_addr,
1070
- protocolFee: poolFeesInfo.swap_fee_pct,
1071
- lpFee: poolFeesInfo.lp_fee_pct,
1154
+ protocolFee: BigNumber4(poolFeesInfo.swap_fee_pct).div(BASIS_POINTS).toFixed(),
1155
+ lpFee: BigNumber4(poolFeesInfo.lp_fee_pct).div(BASIS_POINTS).toFixed(),
1072
1156
  allowanceMode: "allow",
1073
1157
  // Should come from pool config
1074
1158
  lps: routerClient.getPools().map((item) => item.poolAddress),
@@ -1081,22 +1165,24 @@ var parseSettlementConfigStructOutput = (routerClient, poolFeesInfo, protocolFee
1081
1165
  var getPoolInfo = async (client, contractAddress) => {
1082
1166
  const GET_POOL_FEES_INFO_FUNCTION = "get_pool_fees_info";
1083
1167
  const GET_PROTOCOL_FEES_INFO_FUNCTION = "get_protocol_fees_info";
1168
+ const pool = client.routerClient.pools.find((item) => item.poolAddress === contractAddress);
1169
+ if (!pool) {
1170
+ throw new NotFoundError6(`Pool with the address ${contractAddress}`);
1171
+ }
1084
1172
  const [poolFeesInfo, protocolFeesInfo] = await Promise.all([
1085
1173
  // Query pool fee information
1086
1174
  queryDevInspect(
1087
1175
  client.suiClient,
1088
1176
  [client.packageId, POOL_MODULE, GET_POOL_FEES_INFO_FUNCTION],
1089
1177
  [contractAddress],
1090
- // TODO: get the base token of the pool to pass it here instead of hardcoded SUI token
1091
- [SUI_TYPE_ARG5]
1178
+ [pool.baseDenom]
1092
1179
  ),
1093
1180
  // Query protocol fee information
1094
1181
  queryDevInspect(
1095
1182
  client.suiClient,
1096
1183
  [client.packageId, POOL_MODULE, GET_PROTOCOL_FEES_INFO_FUNCTION],
1097
1184
  [contractAddress],
1098
- // TODO: get the base token of the pool to pass it here instead of hardcoded SUI token
1099
- [SUI_TYPE_ARG5]
1185
+ [pool.baseDenom]
1100
1186
  )
1101
1187
  ]);
1102
1188
  const poolFeesInfoOutput = parseDevInspectResult(poolFeesInfo, PoolFeesInfoStruct);
@@ -1436,6 +1522,10 @@ var BoltSuiClient = class extends BaseClient {
1436
1522
  await this.loadConfigFromUrl();
1437
1523
  return await estimateSwapExactInGasFees(this, params, signer, gasAdjustment);
1438
1524
  }
1525
+ /** @inheritdoc */
1526
+ async simulateSwap(params) {
1527
+ return await simulateSwap(this, params);
1528
+ }
1439
1529
  /**
1440
1530
  * Loads configuration from a remote URL for testnet environments.
1441
1531
  *
@@ -1487,8 +1577,8 @@ var BoltSuiClient = class extends BaseClient {
1487
1577
  for (const item of pools) {
1488
1578
  this.routerClient.pools.push({
1489
1579
  poolAddress: item.pool_object_id,
1490
- baseDenom: normalizeStructTag5(item.base),
1491
- quoteDenoms: Object.values(assets).map((auxAsset) => normalizeStructTag5(auxAsset)).filter((auxAsset) => auxAsset !== normalizeStructTag5(item.base))
1580
+ baseDenom: normalizeStructTag6(item.base),
1581
+ quoteDenoms: Object.values(assets).map((auxAsset) => normalizeStructTag6(auxAsset)).filter((auxAsset) => auxAsset !== normalizeStructTag6(item.base))
1492
1582
  });
1493
1583
  }
1494
1584
  }
@@ -1513,11 +1603,11 @@ export {
1513
1603
  PoolInfoStruct,
1514
1604
  PriceDataStruct,
1515
1605
  PriceResponseStruct,
1516
- PricesResponsePaginatedStruct,
1517
1606
  ProtocolFeesInfoStruct,
1518
1607
  RawPairStruct,
1519
1608
  RawPriceStruct,
1520
1609
  RouterConfigStruct,
1610
+ SwapSimulationResultStruct,
1521
1611
  TypeNameStruct
1522
1612
  };
1523
1613
  //# sourceMappingURL=index.js.map