@clonegod/ttd-sui-common 1.0.60 → 1.0.62
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
|
});
|
|
@@ -9,6 +9,4 @@ export declare class SuiTxSender {
|
|
|
9
9
|
send_tx: (signedTxBytes: string, signature: string, txDigest: string, send_grpc?: boolean, read_mask_fields?: string[]) => Promise<void>;
|
|
10
10
|
private sendTxByGrpc;
|
|
11
11
|
private sendTxByRpc;
|
|
12
|
-
send_tx_fast: (signedTxBytes: string, signature: string, txDigest: string, send_grpc?: boolean) => Promise<void>;
|
|
13
|
-
send_tx_safe: (signedTxBytes: string, signature: string, txDigest: string, send_grpc?: boolean) => Promise<void>;
|
|
14
12
|
}
|
|
@@ -23,12 +23,6 @@ class SuiTxSender {
|
|
|
23
23
|
}
|
|
24
24
|
(0, dist_1.log_info)(`send_tx, txid=${txDigest}, send_grpc=${send_grpc}, cost=${Date.now() - start_time}ms`);
|
|
25
25
|
});
|
|
26
|
-
this.send_tx_fast = (signedTxBytes_1, signature_1, txDigest_1, ...args_1) => __awaiter(this, [signedTxBytes_1, signature_1, txDigest_1, ...args_1], void 0, function* (signedTxBytes, signature, txDigest, send_grpc = true) {
|
|
27
|
-
return this.send_tx(signedTxBytes, signature, txDigest, send_grpc, ['transaction']);
|
|
28
|
-
});
|
|
29
|
-
this.send_tx_safe = (signedTxBytes_1, signature_1, txDigest_1, ...args_1) => __awaiter(this, [signedTxBytes_1, signature_1, txDigest_1, ...args_1], void 0, function* (signedTxBytes, signature, txDigest, send_grpc = true) {
|
|
30
|
-
return this.send_tx(signedTxBytes, signature, txDigest, send_grpc, ['transaction', 'finality']);
|
|
31
|
-
});
|
|
32
26
|
this.appConfig = appConfig;
|
|
33
27
|
this.sui_client = sui_client;
|
|
34
28
|
this.grpcClient = grpcClient;
|
|
@@ -42,8 +36,8 @@ class SuiTxSender {
|
|
|
42
36
|
this.appConfig.emit(`SUI_TX_RESULT_${txDigest}`, response);
|
|
43
37
|
}
|
|
44
38
|
catch (error) {
|
|
45
|
-
(0, dist_1.
|
|
46
|
-
|
|
39
|
+
(0, dist_1.log_warn)(`send tx by grpc failed!!! txid=${txDigest}, error=${error.message}`);
|
|
40
|
+
throw error;
|
|
47
41
|
}
|
|
48
42
|
});
|
|
49
43
|
}
|
|
@@ -63,7 +57,8 @@ class SuiTxSender {
|
|
|
63
57
|
this.appConfig.emit(`SUI_TX_RESULT_${txDigest}`, txDigest);
|
|
64
58
|
}
|
|
65
59
|
catch (error) {
|
|
66
|
-
(0, dist_1.
|
|
60
|
+
(0, dist_1.log_warn)(`send tx by rpc failed!!! txid=${txDigest}, error=${error.message}`);
|
|
61
|
+
throw error;
|
|
67
62
|
}
|
|
68
63
|
});
|
|
69
64
|
}
|
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.62",
|
|
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"
|