@bolt-liquidity-hq/sui-client 0.1.0-beta.20 → 0.1.0-beta.22

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
@@ -23,7 +23,7 @@ var MainnetContracts = {
23
23
  oracle: "0xfa3975b98f3d0e3df18ed88ae6e69db31836b3f4212df02fae144b1e5a89ca8e",
24
24
  router: " "
25
25
  };
26
- var MainnetPackageId = "0xc8724de692400a2a08585f6f7c8617acfb783abe2c66ae6a4680a21b36a504c5";
26
+ var MainnetPackageId = "0xbffcccd9d24e319c729e724a0a0e6d0a403b24a03f643da4bbdb0fe6c925f82b";
27
27
  var MainnetPoolGlobalConfigId = "0x7bcd5035a991f42fa84c5a42216b5638cb3f1a8c4f065063093b0a3d5f165d63";
28
28
  var MainnetNativeTokenDenom = SUI_TOKEN_DENOM;
29
29
  var MainnetAssets = {
@@ -791,7 +791,7 @@ var parsePriceDataStructOutput = (output, baseDenom, quoteDenom, isInverted) =>
791
791
  return {
792
792
  baseDenom,
793
793
  quoteDenom,
794
- price: output.price.price,
794
+ price: BigNumber2(output.price.price).shiftedBy(-18).toFixed(),
795
795
  expiryTime: BigNumber2(output.price.expiry).times(1e6).toFixed(),
796
796
  isInverse: isInverted ?? false
797
797
  };
@@ -1003,6 +1003,7 @@ var getPrice = async (client, baseDenom, quoteDenom) => {
1003
1003
  // src/lib/oracle/get-prices.ts
1004
1004
  import { NotFoundError as NotFoundError2 } from "@bolt-liquidity-hq/core";
1005
1005
  import { normalizeStructTag as normalizeStructTag5 } from "@mysten/sui/utils";
1006
+ import { BigNumber as BigNumber3 } from "bignumber.js";
1006
1007
  var getPrices = async (client) => {
1007
1008
  const oracleObject = await client.suiClient.getObject({
1008
1009
  id: client.contracts.oracle,
@@ -1039,7 +1040,7 @@ var getPrices = async (client) => {
1039
1040
  prices.push({
1040
1041
  baseDenom: normalizeStructTag5(pairKey.base.name),
1041
1042
  quoteDenom: normalizeStructTag5(pairKey.quote.name),
1042
- price: fields.price,
1043
+ price: BigNumber3(fields.price).shiftedBy(-18).toFixed(),
1043
1044
  expiryTime: fields.expiry
1044
1045
  });
1045
1046
  }
@@ -1103,7 +1104,7 @@ var getRouterConfig = async (_client) => {
1103
1104
 
1104
1105
  // src/lib/router/parsers.ts
1105
1106
  import { NotFoundError as NotFoundError4 } from "@bolt-liquidity-hq/core";
1106
- import { BigNumber as BigNumber3 } from "bignumber.js";
1107
+ import { BigNumber as BigNumber4 } from "bignumber.js";
1107
1108
  var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
1108
1109
  return {
1109
1110
  poolAddress,
@@ -1111,7 +1112,7 @@ var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
1111
1112
  assetOut,
1112
1113
  protocolFee: output.protocol_fee,
1113
1114
  lpFee: output.lp_fee,
1114
- dynamicFeePercentage: BigNumber3(output.dynamic_fee_pct).div(BASIS_POINTS).toFixed(),
1115
+ dynamicFeePercentage: BigNumber4(output.dynamic_fee_pct).div(BASIS_POINTS).toFixed(),
1115
1116
  totalFees: output.swap_fee
1116
1117
  };
1117
1118
  };
@@ -1196,18 +1197,18 @@ var swapExactIn = async (client, swapParams, signer) => {
1196
1197
  import { NotFoundError as NotFoundError6 } from "@bolt-liquidity-hq/core";
1197
1198
 
1198
1199
  // src/lib/settlement/parsers.ts
1199
- import { BigNumber as BigNumber4 } from "bignumber.js";
1200
+ import { BigNumber as BigNumber5 } from "bignumber.js";
1200
1201
  var parsePoolConfigStructOutput = (routerClient, poolConfig, priceOracleContract) => {
1201
1202
  return {
1202
1203
  priceOracleContract,
1203
1204
  protocolFeeRecipient: "0x",
1204
1205
  // TODO: get real fee recipient
1205
- protocolFee: BigNumber4(poolConfig.swap_fee_pct).div(BASIS_POINTS).toFixed(),
1206
- lpFee: BigNumber4(poolConfig.lp_fee_pct).div(BASIS_POINTS).toFixed(),
1206
+ protocolFee: BigNumber5(poolConfig.swap_fee_pct).div(BASIS_POINTS).toFixed(),
1207
+ lpFee: BigNumber5(poolConfig.lp_fee_pct).div(BASIS_POINTS).toFixed(),
1207
1208
  allowanceMode: "allow",
1208
1209
  // Should come from pool config
1209
1210
  lps: routerClient.getPools().map((item) => item.poolAddress),
1210
- minBaseOut: BigNumber4(poolConfig.min_base_out).toFixed()
1211
+ minBaseOut: BigNumber5(poolConfig.min_base_out).toFixed()
1211
1212
  };
1212
1213
  };
1213
1214