@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.js
CHANGED
|
@@ -20,11 +20,11 @@ var MainnetChainConfig = {
|
|
|
20
20
|
rpcEndpoint: "https://fullnode.mainnet.sui.io:443"
|
|
21
21
|
};
|
|
22
22
|
var MainnetContracts = {
|
|
23
|
-
oracle: "
|
|
24
|
-
router: "
|
|
23
|
+
oracle: "0xfa3975b98f3d0e3df18ed88ae6e69db31836b3f4212df02fae144b1e5a89ca8e",
|
|
24
|
+
router: " "
|
|
25
25
|
};
|
|
26
|
-
var MainnetPackageId = "
|
|
27
|
-
var MainnetPoolGlobalConfigId = "
|
|
26
|
+
var MainnetPackageId = "0xc8724de692400a2a08585f6f7c8617acfb783abe2c66ae6a4680a21b36a504c5";
|
|
27
|
+
var MainnetPoolGlobalConfigId = "0x7bcd5035a991f42fa84c5a42216b5638cb3f1a8c4f065063093b0a3d5f165d63";
|
|
28
28
|
var MainnetNativeTokenDenom = SUI_TOKEN_DENOM;
|
|
29
29
|
var MainnetAssets = {
|
|
30
30
|
[SUI_TOKEN_DENOM]: {
|
|
@@ -44,9 +44,38 @@ var MainnetAssets = {
|
|
|
44
44
|
decimals: 6,
|
|
45
45
|
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdc.png",
|
|
46
46
|
coingeckoId: "usd-coin"
|
|
47
|
+
},
|
|
48
|
+
"0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL": {
|
|
49
|
+
symbol: "WAL",
|
|
50
|
+
name: "Walrus",
|
|
51
|
+
chainId: "101",
|
|
52
|
+
denom: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
53
|
+
decimals: 9,
|
|
54
|
+
logo: "https://app.lotusfinance.io/images/coins/wal-icon.svg",
|
|
55
|
+
coingeckoId: "walrus-2"
|
|
56
|
+
},
|
|
57
|
+
"0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT": {
|
|
58
|
+
symbol: "suiUSDT",
|
|
59
|
+
name: "Tether by Sui Bridge",
|
|
60
|
+
chainId: "101",
|
|
61
|
+
denom: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
|
|
62
|
+
decimals: 6,
|
|
63
|
+
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdt.svg",
|
|
64
|
+
coingeckoId: "tether"
|
|
47
65
|
}
|
|
48
66
|
};
|
|
49
|
-
var MainnetPools = [
|
|
67
|
+
var MainnetPools = [
|
|
68
|
+
{
|
|
69
|
+
poolAddress: "0x21167b2e981e2c0a693afcfe882a3a827d663118e19afcb92e45bfe43fe56278",
|
|
70
|
+
baseDenom: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
71
|
+
quoteDenoms: ["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
poolAddress: "0x34fcaa553f1185e1c3a05de37b6a4d10c39535d19f9c8581eeae826434602b58",
|
|
75
|
+
baseDenom: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
76
|
+
quoteDenoms: ["0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"]
|
|
77
|
+
}
|
|
78
|
+
];
|
|
50
79
|
|
|
51
80
|
// src/config/testnet.ts
|
|
52
81
|
import { SUI_DECIMALS as SUI_DECIMALS2 } from "@mysten/sui/utils";
|
|
@@ -63,7 +92,6 @@ var TestnetContracts = {
|
|
|
63
92
|
var TestnetPackageId = "";
|
|
64
93
|
var TestnetPoolGlobalConfigId = "";
|
|
65
94
|
var TestnetNativeTokenDenom = SUI_TOKEN_DENOM;
|
|
66
|
-
var TestnetHelperAssets = ["::test_btc::TEST_BTC", "::test_usdt::TEST_USDT"];
|
|
67
95
|
var TestnetAssets = {
|
|
68
96
|
[SUI_TOKEN_DENOM]: {
|
|
69
97
|
symbol: "SUI",
|
|
@@ -105,7 +133,7 @@ var TestnetAssets = {
|
|
|
105
133
|
symbol: "TEST_DEEP",
|
|
106
134
|
name: "TEST_DEEP",
|
|
107
135
|
chainId: "103",
|
|
108
|
-
denom: "
|
|
136
|
+
denom: "::test_deep::TEST_DEEP",
|
|
109
137
|
decimals: 6,
|
|
110
138
|
logo: "https://app.lotusfinance.io/images/coins/deepbook-icon.svg",
|
|
111
139
|
coingeckoId: "deep"
|
|
@@ -114,7 +142,7 @@ var TestnetAssets = {
|
|
|
114
142
|
symbol: "TEST_WAL",
|
|
115
143
|
name: "TEST_WAL",
|
|
116
144
|
chainId: "103",
|
|
117
|
-
denom: "
|
|
145
|
+
denom: "::test_wal::TEST_WAL",
|
|
118
146
|
decimals: 9,
|
|
119
147
|
logo: "https://app.lotusfinance.io/images/coins/wal-icon.svg",
|
|
120
148
|
coingeckoId: "walrus-2"
|
|
@@ -763,7 +791,7 @@ var parsePriceDataStructOutput = (output, baseDenom, quoteDenom, isInverted) =>
|
|
|
763
791
|
return {
|
|
764
792
|
baseDenom,
|
|
765
793
|
quoteDenom,
|
|
766
|
-
price: output.price.price,
|
|
794
|
+
price: BigNumber2(output.price.price).shiftedBy(-18).toFixed(),
|
|
767
795
|
expiryTime: BigNumber2(output.price.expiry).times(1e6).toFixed(),
|
|
768
796
|
isInverse: isInverted ?? false
|
|
769
797
|
};
|
|
@@ -975,6 +1003,7 @@ var getPrice = async (client, baseDenom, quoteDenom) => {
|
|
|
975
1003
|
// src/lib/oracle/get-prices.ts
|
|
976
1004
|
import { NotFoundError as NotFoundError2 } from "@bolt-liquidity-hq/core";
|
|
977
1005
|
import { normalizeStructTag as normalizeStructTag5 } from "@mysten/sui/utils";
|
|
1006
|
+
import { BigNumber as BigNumber3 } from "bignumber.js";
|
|
978
1007
|
var getPrices = async (client) => {
|
|
979
1008
|
const oracleObject = await client.suiClient.getObject({
|
|
980
1009
|
id: client.contracts.oracle,
|
|
@@ -1011,7 +1040,7 @@ var getPrices = async (client) => {
|
|
|
1011
1040
|
prices.push({
|
|
1012
1041
|
baseDenom: normalizeStructTag5(pairKey.base.name),
|
|
1013
1042
|
quoteDenom: normalizeStructTag5(pairKey.quote.name),
|
|
1014
|
-
price: fields.price,
|
|
1043
|
+
price: BigNumber3(fields.price).shiftedBy(-18).toFixed(),
|
|
1015
1044
|
expiryTime: fields.expiry
|
|
1016
1045
|
});
|
|
1017
1046
|
}
|
|
@@ -1075,7 +1104,7 @@ var getRouterConfig = async (_client) => {
|
|
|
1075
1104
|
|
|
1076
1105
|
// src/lib/router/parsers.ts
|
|
1077
1106
|
import { NotFoundError as NotFoundError4 } from "@bolt-liquidity-hq/core";
|
|
1078
|
-
import { BigNumber as
|
|
1107
|
+
import { BigNumber as BigNumber4 } from "bignumber.js";
|
|
1079
1108
|
var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
|
|
1080
1109
|
return {
|
|
1081
1110
|
poolAddress,
|
|
@@ -1083,7 +1112,7 @@ var parseSwapSimulationResultStructOutput = (output, poolAddress, assetOut) => {
|
|
|
1083
1112
|
assetOut,
|
|
1084
1113
|
protocolFee: output.protocol_fee,
|
|
1085
1114
|
lpFee: output.lp_fee,
|
|
1086
|
-
dynamicFeePercentage:
|
|
1115
|
+
dynamicFeePercentage: BigNumber4(output.dynamic_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1087
1116
|
totalFees: output.swap_fee
|
|
1088
1117
|
};
|
|
1089
1118
|
};
|
|
@@ -1168,18 +1197,18 @@ var swapExactIn = async (client, swapParams, signer) => {
|
|
|
1168
1197
|
import { NotFoundError as NotFoundError6 } from "@bolt-liquidity-hq/core";
|
|
1169
1198
|
|
|
1170
1199
|
// src/lib/settlement/parsers.ts
|
|
1171
|
-
import { BigNumber as
|
|
1200
|
+
import { BigNumber as BigNumber5 } from "bignumber.js";
|
|
1172
1201
|
var parsePoolConfigStructOutput = (routerClient, poolConfig, priceOracleContract) => {
|
|
1173
1202
|
return {
|
|
1174
1203
|
priceOracleContract,
|
|
1175
1204
|
protocolFeeRecipient: "0x",
|
|
1176
1205
|
// TODO: get real fee recipient
|
|
1177
|
-
protocolFee:
|
|
1178
|
-
lpFee:
|
|
1206
|
+
protocolFee: BigNumber5(poolConfig.swap_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1207
|
+
lpFee: BigNumber5(poolConfig.lp_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1179
1208
|
allowanceMode: "allow",
|
|
1180
1209
|
// Should come from pool config
|
|
1181
1210
|
lps: routerClient.getPools().map((item) => item.poolAddress),
|
|
1182
|
-
minBaseOut:
|
|
1211
|
+
minBaseOut: BigNumber5(poolConfig.min_base_out).toFixed()
|
|
1183
1212
|
};
|
|
1184
1213
|
};
|
|
1185
1214
|
|
|
@@ -1567,13 +1596,13 @@ var BoltSuiClient = class extends BaseClient {
|
|
|
1567
1596
|
this.poolGlobalConfigId = global_config_id;
|
|
1568
1597
|
}
|
|
1569
1598
|
for (const item of Object.values(assets)) {
|
|
1570
|
-
for (const
|
|
1571
|
-
if (item.
|
|
1599
|
+
for (const existingConfig of Object.values(this.assetsConfig)) {
|
|
1600
|
+
if (item.endsWith(existingConfig.denom)) {
|
|
1572
1601
|
this.assetsConfig[item] = {
|
|
1573
|
-
...
|
|
1602
|
+
...existingConfig,
|
|
1574
1603
|
denom: item
|
|
1575
1604
|
};
|
|
1576
|
-
delete this.assetsConfig[
|
|
1605
|
+
delete this.assetsConfig[existingConfig.denom];
|
|
1577
1606
|
break;
|
|
1578
1607
|
}
|
|
1579
1608
|
}
|