@clonegod/ttd-sui-common 1.0.61 → 1.0.63
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.
|
@@ -35,20 +35,20 @@ class AbstractSuiDexTradePlus extends dist_1.AbastrcatTrade {
|
|
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
36
|
this.initSuiClient();
|
|
37
37
|
yield this.initConfigs();
|
|
38
|
-
const walletGroupIds = process.env.SUI_WALLET_GROUP_IDS || '';
|
|
38
|
+
const walletGroupIds = process.env.SUI_WALLET_GROUP_IDS || process.env.WALLET_GROUP_IDS || '';
|
|
39
39
|
this.walletMode = walletGroupIds && walletGroupIds.trim().split(',').length > 0 ? 'multi' : 'single';
|
|
40
40
|
if (this.walletMode === 'multi') {
|
|
41
41
|
let wallet_infos = (0, dist_1.load_wallet_multi)(walletGroupIds.split(','), false);
|
|
42
42
|
this.group_wallets = wallet_infos.map(info => ed25519_1.Ed25519Keypair.fromSecretKey(info.private_key));
|
|
43
43
|
this.walletAddresses = this.group_wallets.map(keypair => keypair.getPublicKey().toSuiAddress());
|
|
44
|
-
(0, dist_1.log_info)(
|
|
44
|
+
(0, dist_1.log_info)(`init wallet mode: multi, wallet count: ${this.group_wallets.length}, walletAddresses: ${this.walletAddresses}`);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
const { private_key } = this.appConfig.trade_runtime.wallet;
|
|
48
48
|
this.wallet = ed25519_1.Ed25519Keypair.fromSecretKey(private_key);
|
|
49
49
|
this.currentWalletAddress = this.wallet.getPublicKey().toSuiAddress();
|
|
50
50
|
this.walletAddresses = [this.currentWalletAddress];
|
|
51
|
-
(0, dist_1.log_info)(
|
|
51
|
+
(0, dist_1.log_info)(`init wallet mode: single, walletAddress= ${this.currentWalletAddress}`);
|
|
52
52
|
}
|
|
53
53
|
this.transactionSender = new index_1.SuiTxSender(this.appConfig, this.sui_client, this.grpcClient);
|
|
54
54
|
});
|
|
@@ -106,7 +106,7 @@ class AbstractSuiDexTradePlus extends dist_1.AbastrcatTrade {
|
|
|
106
106
|
if (!wallet) {
|
|
107
107
|
continue;
|
|
108
108
|
}
|
|
109
|
-
const tokenAsset = (_b = assets.tokens) === null || _b === void 0 ? void 0 : _b.find((token) => token.
|
|
109
|
+
const tokenAsset = (_b = assets.tokens) === null || _b === void 0 ? void 0 : _b.find((token) => token.address.toLowerCase() === inputToken.address.toLowerCase());
|
|
110
110
|
let tokenBalance = (tokenAsset === null || tokenAsset === void 0 ? void 0 : tokenAsset.balance) || '0';
|
|
111
111
|
const balanceDecimal = new decimal_js_1.default(tokenBalance);
|
|
112
112
|
if (balanceDecimal.gte(requiredAmount)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clonegod/ttd-sui-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"description": "Sui common library",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"push": "npm run build && npm publish"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@clonegod/ttd-core": "2.0.
|
|
18
|
+
"@clonegod/ttd-core": "2.0.67",
|
|
19
19
|
"@grpc/grpc-js": "^1.13.4",
|
|
20
20
|
"@grpc/proto-loader": "^0.8.0",
|
|
21
21
|
"@mysten/sui": "^1.37.5",
|
|
22
|
-
"axios": "^1.
|
|
22
|
+
"axios": "^1.12.0",
|
|
23
23
|
"dotenv": "^16.4.7",
|
|
24
24
|
"google-protobuf": "^4.0.0",
|
|
25
25
|
"protobufjs": "^7.5.4"
|