@bolt-liquidity-hq/sui-client 0.1.0-beta.19 → 0.1.0-beta.21
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 +49 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -76,11 +76,11 @@ var MainnetChainConfig = {
|
|
|
76
76
|
rpcEndpoint: "https://fullnode.mainnet.sui.io:443"
|
|
77
77
|
};
|
|
78
78
|
var MainnetContracts = {
|
|
79
|
-
oracle: "
|
|
80
|
-
router: "
|
|
79
|
+
oracle: "0xfa3975b98f3d0e3df18ed88ae6e69db31836b3f4212df02fae144b1e5a89ca8e",
|
|
80
|
+
router: " "
|
|
81
81
|
};
|
|
82
|
-
var MainnetPackageId = "
|
|
83
|
-
var MainnetPoolGlobalConfigId = "
|
|
82
|
+
var MainnetPackageId = "0xc8724de692400a2a08585f6f7c8617acfb783abe2c66ae6a4680a21b36a504c5";
|
|
83
|
+
var MainnetPoolGlobalConfigId = "0x7bcd5035a991f42fa84c5a42216b5638cb3f1a8c4f065063093b0a3d5f165d63";
|
|
84
84
|
var MainnetNativeTokenDenom = SUI_TOKEN_DENOM;
|
|
85
85
|
var MainnetAssets = {
|
|
86
86
|
[SUI_TOKEN_DENOM]: {
|
|
@@ -100,9 +100,38 @@ var MainnetAssets = {
|
|
|
100
100
|
decimals: 6,
|
|
101
101
|
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdc.png",
|
|
102
102
|
coingeckoId: "usd-coin"
|
|
103
|
+
},
|
|
104
|
+
"0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL": {
|
|
105
|
+
symbol: "WAL",
|
|
106
|
+
name: "Walrus",
|
|
107
|
+
chainId: "101",
|
|
108
|
+
denom: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
109
|
+
decimals: 9,
|
|
110
|
+
logo: "https://app.lotusfinance.io/images/coins/wal-icon.svg",
|
|
111
|
+
coingeckoId: "walrus-2"
|
|
112
|
+
},
|
|
113
|
+
"0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT": {
|
|
114
|
+
symbol: "suiUSDT",
|
|
115
|
+
name: "Tether by Sui Bridge",
|
|
116
|
+
chainId: "101",
|
|
117
|
+
denom: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
|
|
118
|
+
decimals: 6,
|
|
119
|
+
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdt.svg",
|
|
120
|
+
coingeckoId: "tether"
|
|
103
121
|
}
|
|
104
122
|
};
|
|
105
|
-
var MainnetPools = [
|
|
123
|
+
var MainnetPools = [
|
|
124
|
+
{
|
|
125
|
+
poolAddress: "0x21167b2e981e2c0a693afcfe882a3a827d663118e19afcb92e45bfe43fe56278",
|
|
126
|
+
baseDenom: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
127
|
+
quoteDenoms: ["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
poolAddress: "0x34fcaa553f1185e1c3a05de37b6a4d10c39535d19f9c8581eeae826434602b58",
|
|
131
|
+
baseDenom: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
132
|
+
quoteDenoms: ["0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
133
|
+
}
|
|
134
|
+
];
|
|
106
135
|
|
|
107
136
|
// src/config/testnet.ts
|
|
108
137
|
var import_utils3 = require("@mysten/sui/utils");
|
|
@@ -119,7 +148,6 @@ var TestnetContracts = {
|
|
|
119
148
|
var TestnetPackageId = "";
|
|
120
149
|
var TestnetPoolGlobalConfigId = "";
|
|
121
150
|
var TestnetNativeTokenDenom = SUI_TOKEN_DENOM;
|
|
122
|
-
var TestnetHelperAssets = ["::test_btc::TEST_BTC", "::test_usdt::TEST_USDT"];
|
|
123
151
|
var TestnetAssets = {
|
|
124
152
|
[SUI_TOKEN_DENOM]: {
|
|
125
153
|
symbol: "SUI",
|
|
@@ -161,7 +189,7 @@ var TestnetAssets = {
|
|
|
161
189
|
symbol: "TEST_DEEP",
|
|
162
190
|
name: "TEST_DEEP",
|
|
163
191
|
chainId: "103",
|
|
164
|
-
denom: "
|
|
192
|
+
denom: "::test_deep::TEST_DEEP",
|
|
165
193
|
decimals: 6,
|
|
166
194
|
logo: "https://app.lotusfinance.io/images/coins/deepbook-icon.svg",
|
|
167
195
|
coingeckoId: "deep"
|
|
@@ -170,7 +198,7 @@ var TestnetAssets = {
|
|
|
170
198
|
symbol: "TEST_WAL",
|
|
171
199
|
name: "TEST_WAL",
|
|
172
200
|
chainId: "103",
|
|
173
|
-
denom: "
|
|
201
|
+
denom: "::test_wal::TEST_WAL",
|
|
174
202
|
decimals: 9,
|
|
175
203
|
logo: "https://app.lotusfinance.io/images/coins/wal-icon.svg",
|
|
176
204
|
coingeckoId: "walrus-2"
|
|
@@ -814,7 +842,7 @@ var parsePriceDataStructOutput = (output, baseDenom, quoteDenom, isInverted) =>
|
|
|
814
842
|
return {
|
|
815
843
|
baseDenom,
|
|
816
844
|
quoteDenom,
|
|
817
|
-
price: output.price.price,
|
|
845
|
+
price: (0, import_bignumber2.BigNumber)(output.price.price).shiftedBy(-18).toFixed(),
|
|
818
846
|
expiryTime: (0, import_bignumber2.BigNumber)(output.price.expiry).times(1e6).toFixed(),
|
|
819
847
|
isInverse: isInverted ?? false
|
|
820
848
|
};
|
|
@@ -1026,6 +1054,7 @@ var getPrice = async (client, baseDenom, quoteDenom) => {
|
|
|
1026
1054
|
// src/lib/oracle/get-prices.ts
|
|
1027
1055
|
var import_core6 = require("@bolt-liquidity-hq/core");
|
|
1028
1056
|
var import_utils8 = require("@mysten/sui/utils");
|
|
1057
|
+
var import_bignumber3 = require("bignumber.js");
|
|
1029
1058
|
var getPrices = async (client) => {
|
|
1030
1059
|
const oracleObject = await client.suiClient.getObject({
|
|
1031
1060
|
id: client.contracts.oracle,
|
|
@@ -1062,7 +1091,7 @@ var getPrices = async (client) => {
|
|
|
1062
1091
|
prices.push({
|
|
1063
1092
|
baseDenom: (0, import_utils8.normalizeStructTag)(pairKey.base.name),
|
|
1064
1093
|
quoteDenom: (0, import_utils8.normalizeStructTag)(pairKey.quote.name),
|
|
1065
|
-
price: fields.price,
|
|
1094
|
+
price: (0, import_bignumber3.BigNumber)(fields.price).shiftedBy(-18).toFixed(),
|
|
1066
1095
|
expiryTime: fields.expiry
|
|
1067
1096
|
});
|
|
1068
1097
|
}
|
|
@@ -1124,7 +1153,7 @@ var getRouterConfig = async (_client) => {
|
|
|
1124
1153
|
|
|
1125
1154
|
// src/lib/router/parsers.ts
|
|
1126
1155
|
var import_core12 = require("@bolt-liquidity-hq/core");
|
|
1127
|
-
var
|
|
1156
|
+
var import_bignumber4 = require("bignumber.js");
|
|
1128
1157
|
var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
|
|
1129
1158
|
return {
|
|
1130
1159
|
poolAddress,
|
|
@@ -1132,7 +1161,7 @@ var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
|
|
|
1132
1161
|
assetOut,
|
|
1133
1162
|
protocolFee: output.protocol_fee,
|
|
1134
1163
|
lpFee: output.lp_fee,
|
|
1135
|
-
dynamicFeePercentage: (0,
|
|
1164
|
+
dynamicFeePercentage: (0, import_bignumber4.BigNumber)(output.dynamic_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1136
1165
|
totalFees: output.swap_fee
|
|
1137
1166
|
};
|
|
1138
1167
|
};
|
|
@@ -1215,18 +1244,18 @@ var swapExactIn = async (client, swapParams, signer) => {
|
|
|
1215
1244
|
var import_core14 = require("@bolt-liquidity-hq/core");
|
|
1216
1245
|
|
|
1217
1246
|
// src/lib/settlement/parsers.ts
|
|
1218
|
-
var
|
|
1247
|
+
var import_bignumber5 = require("bignumber.js");
|
|
1219
1248
|
var parsePoolConfigStructOutput = (routerClient, poolConfig, priceOracleContract) => {
|
|
1220
1249
|
return {
|
|
1221
1250
|
priceOracleContract,
|
|
1222
1251
|
protocolFeeRecipient: "0x",
|
|
1223
1252
|
// TODO: get real fee recipient
|
|
1224
|
-
protocolFee: (0,
|
|
1225
|
-
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(),
|
|
1226
1255
|
allowanceMode: "allow",
|
|
1227
1256
|
// Should come from pool config
|
|
1228
1257
|
lps: routerClient.getPools().map((item) => item.poolAddress),
|
|
1229
|
-
minBaseOut: (0,
|
|
1258
|
+
minBaseOut: (0, import_bignumber5.BigNumber)(poolConfig.min_base_out).toFixed()
|
|
1230
1259
|
};
|
|
1231
1260
|
};
|
|
1232
1261
|
|
|
@@ -1614,13 +1643,13 @@ var BoltSuiClient = class extends import_core15.BaseClient {
|
|
|
1614
1643
|
this.poolGlobalConfigId = global_config_id;
|
|
1615
1644
|
}
|
|
1616
1645
|
for (const item of Object.values(assets)) {
|
|
1617
|
-
for (const
|
|
1618
|
-
if (item.
|
|
1646
|
+
for (const existingConfig of Object.values(this.assetsConfig)) {
|
|
1647
|
+
if (item.endsWith(existingConfig.denom)) {
|
|
1619
1648
|
this.assetsConfig[item] = {
|
|
1620
|
-
...
|
|
1649
|
+
...existingConfig,
|
|
1621
1650
|
denom: item
|
|
1622
1651
|
};
|
|
1623
|
-
delete this.assetsConfig[
|
|
1652
|
+
delete this.assetsConfig[existingConfig.denom];
|
|
1624
1653
|
break;
|
|
1625
1654
|
}
|
|
1626
1655
|
}
|