@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.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -79,7 +79,7 @@ var MainnetContracts = {
|
|
|
79
79
|
oracle: "0xfa3975b98f3d0e3df18ed88ae6e69db31836b3f4212df02fae144b1e5a89ca8e",
|
|
80
80
|
router: " "
|
|
81
81
|
};
|
|
82
|
-
var MainnetPackageId = "
|
|
82
|
+
var MainnetPackageId = "0xbffcccd9d24e319c729e724a0a0e6d0a403b24a03f643da4bbdb0fe6c925f82b";
|
|
83
83
|
var MainnetPoolGlobalConfigId = "0x7bcd5035a991f42fa84c5a42216b5638cb3f1a8c4f065063093b0a3d5f165d63";
|
|
84
84
|
var MainnetNativeTokenDenom = SUI_TOKEN_DENOM;
|
|
85
85
|
var MainnetAssets = {
|
|
@@ -842,7 +842,7 @@ var parsePriceDataStructOutput = (output, baseDenom, quoteDenom, isInverted) =>
|
|
|
842
842
|
return {
|
|
843
843
|
baseDenom,
|
|
844
844
|
quoteDenom,
|
|
845
|
-
price: output.price.price,
|
|
845
|
+
price: (0, import_bignumber2.BigNumber)(output.price.price).shiftedBy(-18).toFixed(),
|
|
846
846
|
expiryTime: (0, import_bignumber2.BigNumber)(output.price.expiry).times(1e6).toFixed(),
|
|
847
847
|
isInverse: isInverted ?? false
|
|
848
848
|
};
|
|
@@ -1054,6 +1054,7 @@ var getPrice = async (client, baseDenom, quoteDenom) => {
|
|
|
1054
1054
|
// src/lib/oracle/get-prices.ts
|
|
1055
1055
|
var import_core6 = require("@bolt-liquidity-hq/core");
|
|
1056
1056
|
var import_utils8 = require("@mysten/sui/utils");
|
|
1057
|
+
var import_bignumber3 = require("bignumber.js");
|
|
1057
1058
|
var getPrices = async (client) => {
|
|
1058
1059
|
const oracleObject = await client.suiClient.getObject({
|
|
1059
1060
|
id: client.contracts.oracle,
|
|
@@ -1090,7 +1091,7 @@ var getPrices = async (client) => {
|
|
|
1090
1091
|
prices.push({
|
|
1091
1092
|
baseDenom: (0, import_utils8.normalizeStructTag)(pairKey.base.name),
|
|
1092
1093
|
quoteDenom: (0, import_utils8.normalizeStructTag)(pairKey.quote.name),
|
|
1093
|
-
price: fields.price,
|
|
1094
|
+
price: (0, import_bignumber3.BigNumber)(fields.price).shiftedBy(-18).toFixed(),
|
|
1094
1095
|
expiryTime: fields.expiry
|
|
1095
1096
|
});
|
|
1096
1097
|
}
|
|
@@ -1152,7 +1153,7 @@ var getRouterConfig = async (_client) => {
|
|
|
1152
1153
|
|
|
1153
1154
|
// src/lib/router/parsers.ts
|
|
1154
1155
|
var import_core12 = require("@bolt-liquidity-hq/core");
|
|
1155
|
-
var
|
|
1156
|
+
var import_bignumber4 = require("bignumber.js");
|
|
1156
1157
|
var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
|
|
1157
1158
|
return {
|
|
1158
1159
|
poolAddress,
|
|
@@ -1160,7 +1161,7 @@ var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
|
|
|
1160
1161
|
assetOut,
|
|
1161
1162
|
protocolFee: output.protocol_fee,
|
|
1162
1163
|
lpFee: output.lp_fee,
|
|
1163
|
-
dynamicFeePercentage: (0,
|
|
1164
|
+
dynamicFeePercentage: (0, import_bignumber4.BigNumber)(output.dynamic_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1164
1165
|
totalFees: output.swap_fee
|
|
1165
1166
|
};
|
|
1166
1167
|
};
|
|
@@ -1243,18 +1244,18 @@ var swapExactIn = async (client, swapParams, signer) => {
|
|
|
1243
1244
|
var import_core14 = require("@bolt-liquidity-hq/core");
|
|
1244
1245
|
|
|
1245
1246
|
// src/lib/settlement/parsers.ts
|
|
1246
|
-
var
|
|
1247
|
+
var import_bignumber5 = require("bignumber.js");
|
|
1247
1248
|
var parsePoolConfigStructOutput = (routerClient, poolConfig, priceOracleContract) => {
|
|
1248
1249
|
return {
|
|
1249
1250
|
priceOracleContract,
|
|
1250
1251
|
protocolFeeRecipient: "0x",
|
|
1251
1252
|
// TODO: get real fee recipient
|
|
1252
|
-
protocolFee: (0,
|
|
1253
|
-
lpFee: (0,
|
|
1253
|
+
protocolFee: (0, import_bignumber5.BigNumber)(poolConfig.swap_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1254
|
+
lpFee: (0, import_bignumber5.BigNumber)(poolConfig.lp_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1254
1255
|
allowanceMode: "allow",
|
|
1255
1256
|
// Should come from pool config
|
|
1256
1257
|
lps: routerClient.getPools().map((item) => item.poolAddress),
|
|
1257
|
-
minBaseOut: (0,
|
|
1258
|
+
minBaseOut: (0, import_bignumber5.BigNumber)(poolConfig.min_base_out).toFixed()
|
|
1258
1259
|
};
|
|
1259
1260
|
};
|
|
1260
1261
|
|