@clonegod/ttd-sui-common 1.0.66 → 1.0.68
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.
|
@@ -290,8 +290,8 @@ class AbstractSuiDexTradePlus extends dist_1.AbastrcatTrade {
|
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
compareBigIntBalance(a, b) {
|
|
293
|
-
const balanceA = BigInt(a.balance);
|
|
294
|
-
const balanceB = BigInt(b.balance);
|
|
293
|
+
const balanceA = BigInt((a === null || a === void 0 ? void 0 : a.balance) || '0');
|
|
294
|
+
const balanceB = BigInt((b === null || b === void 0 ? void 0 : b.balance) || '0');
|
|
295
295
|
if (balanceA > balanceB)
|
|
296
296
|
return -1;
|
|
297
297
|
if (balanceA < balanceB)
|
|
@@ -65,6 +65,16 @@ class SuiTransactionParser {
|
|
|
65
65
|
if (normalizedCoinType === poolTokenBAddress) {
|
|
66
66
|
tokenBChangeAmount = amount.div(Math.pow(10, pool_info.tokenB.decimals));
|
|
67
67
|
}
|
|
68
|
+
console.log('check balance change', {
|
|
69
|
+
change_coin_type: change.coin_type,
|
|
70
|
+
normalizedCoinType,
|
|
71
|
+
pool_token_a: pool_info.tokenA.address,
|
|
72
|
+
poolTokenAAddress,
|
|
73
|
+
pool_token_b: pool_info.tokenB.address,
|
|
74
|
+
poolTokenBAddress,
|
|
75
|
+
tokenAChangeAmount,
|
|
76
|
+
tokenBChangeAmount
|
|
77
|
+
});
|
|
68
78
|
}
|
|
69
79
|
let tx_price = this.calc_tx_price(tokenAChangeAmount, tokenBChangeAmount, pool_info);
|
|
70
80
|
swap_detail = {
|
|
@@ -23,14 +23,14 @@ function test_get_tx_result() {
|
|
|
23
23
|
const grpc_token = process.env.SUI_GRPC_TOKEN || '';
|
|
24
24
|
const grpcConnection = index_1.GrpcConnection.getInstance(grpc_endpoint, grpc_token);
|
|
25
25
|
const ledgerService = new index_1.LedgerService(grpcConnection);
|
|
26
|
-
let wallet_address = '
|
|
26
|
+
let wallet_address = '0x6a49734e0ac36466078aa5025f8a0aa0da80c3c41cd4e79b3b67c652d47d0519';
|
|
27
27
|
let test_tx_success_buy = {
|
|
28
28
|
txid: '',
|
|
29
29
|
filename: './src/trade/test/receipt_buy_sui.json'
|
|
30
30
|
};
|
|
31
31
|
let test_tx_success_sell = {
|
|
32
|
-
txid: '
|
|
33
|
-
filename: './src/trade/test/
|
|
32
|
+
txid: '6uzFnzNmLQgyYwtxUqBzy9XEjgzwMNHxNtUJtj4zM4LK',
|
|
33
|
+
filename: './src/trade/test/receipt_buy_wal.json'
|
|
34
34
|
};
|
|
35
35
|
let { txid, filename } = test_tx_success_sell;
|
|
36
36
|
console.log('=== 测试 SUI 链交易结果查询 ===');
|
|
@@ -55,47 +55,47 @@ function get_pool_info() {
|
|
|
55
55
|
"program_id": "",
|
|
56
56
|
"authority": "",
|
|
57
57
|
"subscribe_type": "grpc",
|
|
58
|
-
"pair": "SUI
|
|
59
|
-
"dex_id": "
|
|
60
|
-
"pool_name": "SUI
|
|
61
|
-
"pool_address": "
|
|
58
|
+
"pair": "WAL/SUI",
|
|
59
|
+
"dex_id": "BLUEFIN-CLMM",
|
|
60
|
+
"pool_name": "WAL/SUI",
|
|
61
|
+
"pool_address": "0xe60bc7ade245b9f35b49686dfab0a18e5ca9176d49bef1b90f60d67d06315ff0",
|
|
62
62
|
"pool_address_hex": "",
|
|
63
63
|
"tokenA": {
|
|
64
|
-
"symbol": "
|
|
65
|
-
"address": "
|
|
64
|
+
"symbol": "WAL",
|
|
65
|
+
"address": "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
66
66
|
"address_hex": "",
|
|
67
67
|
"decimals": 9,
|
|
68
|
-
"name": "
|
|
68
|
+
"name": "WAL Token",
|
|
69
69
|
"is_token2022": false,
|
|
70
|
-
"market_price": "
|
|
71
|
-
"update_time": "2025-09-
|
|
70
|
+
"market_price": "0.3692294956",
|
|
71
|
+
"update_time": "2025-09-25 13:27:28 141",
|
|
72
72
|
"alias": "",
|
|
73
73
|
"enable": true
|
|
74
74
|
},
|
|
75
75
|
"tokenB": {
|
|
76
|
-
"symbol": "
|
|
77
|
-
"address": "
|
|
76
|
+
"symbol": "SUI",
|
|
77
|
+
"address": "0x2::sui::SUI",
|
|
78
78
|
"address_hex": "",
|
|
79
|
-
"decimals":
|
|
80
|
-
"name": "
|
|
79
|
+
"decimals": 9,
|
|
80
|
+
"name": "Sui",
|
|
81
81
|
"is_token2022": false,
|
|
82
|
-
"market_price": "
|
|
83
|
-
"update_time": "2025-09-
|
|
82
|
+
"market_price": "3.2",
|
|
83
|
+
"update_time": "2025-09-25 13:27:28 141",
|
|
84
84
|
"alias": "",
|
|
85
85
|
"enable": true
|
|
86
86
|
},
|
|
87
87
|
"vaultA": "",
|
|
88
88
|
"vaultB": "",
|
|
89
89
|
"router_id": null,
|
|
90
|
-
"fee_rate":
|
|
91
|
-
"quote_token": "
|
|
92
|
-
"quote_amount_usd":
|
|
90
|
+
"fee_rate": 20,
|
|
91
|
+
"quote_token": "SUI",
|
|
92
|
+
"quote_amount_usd": 100,
|
|
93
93
|
"quote_price_decimals": 18,
|
|
94
94
|
"is_reverse_token": false,
|
|
95
95
|
"cu_limit": 200000,
|
|
96
|
-
"tvl":
|
|
97
|
-
"vol_24h":
|
|
98
|
-
"update_time": "2025-09-
|
|
96
|
+
"tvl": 1756004.9125,
|
|
97
|
+
"vol_24h": 5089953.61133362,
|
|
98
|
+
"update_time": "2025-09-25 13:27:29 241",
|
|
99
99
|
"enable": true,
|
|
100
100
|
};
|
|
101
101
|
}
|