@bolt-liquidity-hq/sui-client 0.1.0-beta.26 → 0.1.0-beta.27
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/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/index.cjs +19 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright [
|
|
189
|
+
Copyright [2025] Bolt Liquidity
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -31,12 +31,12 @@ const price = await client.getPrice(
|
|
|
31
31
|
console.log(`ARCH/USDC: ${price.price}`);
|
|
32
32
|
|
|
33
33
|
// Execute a swap
|
|
34
|
-
const result = await client.swap(
|
|
34
|
+
const result = await client.swap({
|
|
35
35
|
'0x2::sui::SUI', // SUI
|
|
36
36
|
amountIn: '1000000000', // 1 SUI
|
|
37
37
|
'0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC' // USDC
|
|
38
38
|
minimumAmountOut: '3500000', // 3.5 USDC minimum
|
|
39
|
-
});
|
|
39
|
+
}, signer);
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## 📖 API Reference
|
package/dist/index.cjs
CHANGED
|
@@ -85,7 +85,7 @@ var MainnetAssets = {
|
|
|
85
85
|
[SUI_TOKEN_DENOM]: {
|
|
86
86
|
symbol: "SUI",
|
|
87
87
|
name: "Sui",
|
|
88
|
-
chainId:
|
|
88
|
+
chainId: MainnetChainConfig.id,
|
|
89
89
|
denom: SUI_TOKEN_DENOM,
|
|
90
90
|
decimals: import_utils2.SUI_DECIMALS,
|
|
91
91
|
logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
|
|
@@ -94,7 +94,7 @@ var MainnetAssets = {
|
|
|
94
94
|
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC": {
|
|
95
95
|
symbol: "USDC",
|
|
96
96
|
name: "Circle USDC",
|
|
97
|
-
chainId:
|
|
97
|
+
chainId: MainnetChainConfig.id,
|
|
98
98
|
denom: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
99
99
|
decimals: 6,
|
|
100
100
|
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdc.png",
|
|
@@ -103,7 +103,7 @@ var MainnetAssets = {
|
|
|
103
103
|
"0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL": {
|
|
104
104
|
symbol: "WAL",
|
|
105
105
|
name: "Walrus",
|
|
106
|
-
chainId:
|
|
106
|
+
chainId: MainnetChainConfig.id,
|
|
107
107
|
denom: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
108
108
|
decimals: 9,
|
|
109
109
|
logo: "https://app.lotusfinance.io/images/coins/wal-icon.svg",
|
|
@@ -112,7 +112,7 @@ var MainnetAssets = {
|
|
|
112
112
|
"0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT": {
|
|
113
113
|
symbol: "suiUSDT",
|
|
114
114
|
name: "Tether by Sui Bridge",
|
|
115
|
-
chainId:
|
|
115
|
+
chainId: MainnetChainConfig.id,
|
|
116
116
|
denom: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
|
|
117
117
|
decimals: 6,
|
|
118
118
|
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdt.svg",
|
|
@@ -151,7 +151,7 @@ var TestnetAssets = {
|
|
|
151
151
|
[SUI_TOKEN_DENOM]: {
|
|
152
152
|
symbol: "SUI",
|
|
153
153
|
name: "Sui",
|
|
154
|
-
chainId:
|
|
154
|
+
chainId: TestnetChainConfig.id,
|
|
155
155
|
denom: SUI_TOKEN_DENOM,
|
|
156
156
|
decimals: import_utils3.SUI_DECIMALS,
|
|
157
157
|
logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
|
|
@@ -160,7 +160,7 @@ var TestnetAssets = {
|
|
|
160
160
|
"0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC": {
|
|
161
161
|
symbol: "USDC",
|
|
162
162
|
name: "Circle USDC",
|
|
163
|
-
chainId:
|
|
163
|
+
chainId: TestnetChainConfig.id,
|
|
164
164
|
denom: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
|
|
165
165
|
decimals: 6,
|
|
166
166
|
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdc.png",
|
|
@@ -169,7 +169,7 @@ var TestnetAssets = {
|
|
|
169
169
|
"::test_btc::TEST_BTC": {
|
|
170
170
|
symbol: "TEST_BTC",
|
|
171
171
|
name: "Test BTC",
|
|
172
|
-
chainId:
|
|
172
|
+
chainId: TestnetChainConfig.id,
|
|
173
173
|
denom: "::test_btc::TEST_BTC",
|
|
174
174
|
decimals: 8,
|
|
175
175
|
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/bitcoin/images/btc.svg",
|
|
@@ -178,7 +178,7 @@ var TestnetAssets = {
|
|
|
178
178
|
"::test_usdt::TEST_USDT": {
|
|
179
179
|
symbol: "TEST_USDT",
|
|
180
180
|
name: "Test USDT",
|
|
181
|
-
chainId:
|
|
181
|
+
chainId: TestnetChainConfig.id,
|
|
182
182
|
denom: "::test_usdt::TEST_USDT",
|
|
183
183
|
decimals: 6,
|
|
184
184
|
logo: "https://raw.githubusercontent.com/cosmos/chain-registry/refs/heads/master/_non-cosmos/ethereum/images/usdt.svg",
|
|
@@ -187,7 +187,7 @@ var TestnetAssets = {
|
|
|
187
187
|
"::test_deep::TEST_DEEP": {
|
|
188
188
|
symbol: "TEST_DEEP",
|
|
189
189
|
name: "TEST_DEEP",
|
|
190
|
-
chainId:
|
|
190
|
+
chainId: TestnetChainConfig.id,
|
|
191
191
|
denom: "::test_deep::TEST_DEEP",
|
|
192
192
|
decimals: 6,
|
|
193
193
|
logo: "https://app.lotusfinance.io/images/coins/deepbook-icon.svg",
|
|
@@ -196,7 +196,7 @@ var TestnetAssets = {
|
|
|
196
196
|
"::test_wal::TEST_WAL": {
|
|
197
197
|
symbol: "TEST_WAL",
|
|
198
198
|
name: "TEST_WAL",
|
|
199
|
-
chainId:
|
|
199
|
+
chainId: TestnetChainConfig.id,
|
|
200
200
|
denom: "::test_wal::TEST_WAL",
|
|
201
201
|
decimals: 9,
|
|
202
202
|
logo: "https://app.lotusfinance.io/images/coins/wal-icon.svg",
|
|
@@ -206,6 +206,7 @@ var TestnetAssets = {
|
|
|
206
206
|
|
|
207
207
|
// src/lib/constants/defaults.ts
|
|
208
208
|
var BASIS_POINTS = 1e4;
|
|
209
|
+
var PRICE_PRECISION = 18;
|
|
209
210
|
|
|
210
211
|
// src/lib/constants/sui-objects.ts
|
|
211
212
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
@@ -836,7 +837,7 @@ var parsePriceDataStructOutput = (output, baseDenom, quoteDenom, isInverted) =>
|
|
|
836
837
|
return {
|
|
837
838
|
baseDenom,
|
|
838
839
|
quoteDenom,
|
|
839
|
-
price: (0, import_bignumber2.BigNumber)(output.price.price).shiftedBy(-
|
|
840
|
+
price: (0, import_bignumber2.BigNumber)(output.price.price).shiftedBy(-PRICE_PRECISION).toFixed(),
|
|
840
841
|
expiryTime: (0, import_bignumber2.BigNumber)(output.price.expiry).times(1e6).toFixed(),
|
|
841
842
|
isInverse: isInverted ?? false
|
|
842
843
|
};
|
|
@@ -1116,7 +1117,7 @@ var import_core8 = require("@bolt-liquidity-hq/core");
|
|
|
1116
1117
|
|
|
1117
1118
|
// src/lib/settlement/parsers.ts
|
|
1118
1119
|
var import_bignumber4 = require("bignumber.js");
|
|
1119
|
-
var parsePoolConfigStructOutput = (
|
|
1120
|
+
var parsePoolConfigStructOutput = (poolConfig, priceOracleContract) => {
|
|
1120
1121
|
return {
|
|
1121
1122
|
priceOracleContract,
|
|
1122
1123
|
protocolFeeRecipient: "0x",
|
|
@@ -1125,7 +1126,8 @@ var parsePoolConfigStructOutput = (routerClient, poolConfig, priceOracleContract
|
|
|
1125
1126
|
lpFee: (0, import_bignumber4.BigNumber)(poolConfig.lp_fee_pct).div(BASIS_POINTS).toFixed(),
|
|
1126
1127
|
allowanceMode: "allow",
|
|
1127
1128
|
// Should come from pool config
|
|
1128
|
-
lps:
|
|
1129
|
+
lps: [],
|
|
1130
|
+
// TODO: update with lp list
|
|
1129
1131
|
minBaseOut: (0, import_bignumber4.BigNumber)(poolConfig.min_base_out).toFixed()
|
|
1130
1132
|
};
|
|
1131
1133
|
};
|
|
@@ -1171,7 +1173,7 @@ var getPoolConfig = async (client, contractAddress) => {
|
|
|
1171
1173
|
[pool.baseDenom]
|
|
1172
1174
|
);
|
|
1173
1175
|
const output = parseDevInspectResult(poolConfig, PoolConfigStruct);
|
|
1174
|
-
return parsePoolConfigStructOutput(
|
|
1176
|
+
return parsePoolConfigStructOutput(output, client.contracts.oracle);
|
|
1175
1177
|
};
|
|
1176
1178
|
|
|
1177
1179
|
// src/lib/settlement/get-pool-config-by-denom.ts
|
|
@@ -1206,8 +1208,8 @@ var getPoolByDenom = async (client, baseDenom, quoteDenom) => {
|
|
|
1206
1208
|
return result;
|
|
1207
1209
|
};
|
|
1208
1210
|
|
|
1209
|
-
// src/lib/router/get-pools.ts
|
|
1210
|
-
var
|
|
1211
|
+
// src/lib/router/get-all-pools.ts
|
|
1212
|
+
var getAllPools = async (client) => {
|
|
1211
1213
|
return await client.routerClient.getPools();
|
|
1212
1214
|
};
|
|
1213
1215
|
|
|
@@ -1550,7 +1552,7 @@ var BoltSuiClient = class extends import_core15.BaseClient {
|
|
|
1550
1552
|
/** @inheritdoc */
|
|
1551
1553
|
async getAllPools() {
|
|
1552
1554
|
await this.loadConfigFromUrl();
|
|
1553
|
-
return await
|
|
1555
|
+
return await getAllPools(this);
|
|
1554
1556
|
}
|
|
1555
1557
|
/** @inheritdoc */
|
|
1556
1558
|
async getPoolConfig(poolContractAddress) {
|