@clonegod/ttd-sui-common 1.0.50 → 1.0.51
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.
|
@@ -6,5 +6,5 @@ export declare class SuiTxSender {
|
|
|
6
6
|
sui_client: SuiClient;
|
|
7
7
|
grpcClient: SuiGrpcClient;
|
|
8
8
|
constructor(appConfig: AppConfig, sui_client: SuiClient, grpcClient: SuiGrpcClient);
|
|
9
|
-
send_tx: (signedTxBytes: string, signature: string, txDigest: string) => Promise<void>;
|
|
9
|
+
send_tx: (signedTxBytes: string, signature: string, txDigest: string, send_grpc?: boolean) => Promise<void>;
|
|
10
10
|
}
|
|
@@ -13,9 +13,15 @@ exports.SuiTxSender = void 0;
|
|
|
13
13
|
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
14
14
|
class SuiTxSender {
|
|
15
15
|
constructor(appConfig, sui_client, grpcClient) {
|
|
16
|
-
this.send_tx = (
|
|
16
|
+
this.send_tx = (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 = false) {
|
|
17
17
|
const bcsBytes = Buffer.from(signedTxBytes, 'base64');
|
|
18
18
|
const signatureBytes = Buffer.from(signature, 'base64');
|
|
19
|
+
if (send_grpc) {
|
|
20
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
let response = yield this.grpcClient.transactionService.executeTransaction(bcsBytes, signatureBytes);
|
|
22
|
+
this.appConfig.emit(`SUI_TX_RESULT_${txDigest}`, response);
|
|
23
|
+
}), 0);
|
|
24
|
+
}
|
|
19
25
|
try {
|
|
20
26
|
let _response = yield this.sui_client.executeTransactionBlock({
|
|
21
27
|
transactionBlock: signedTxBytes,
|
|
@@ -31,13 +37,6 @@ class SuiTxSender {
|
|
|
31
37
|
}
|
|
32
38
|
catch (error) {
|
|
33
39
|
(0, dist_1.log_error)(`send tx by rpc failed!!! txid=${txDigest}`, error);
|
|
34
|
-
try {
|
|
35
|
-
let response = yield this.grpcClient.transactionService.executeTransaction(bcsBytes, signatureBytes);
|
|
36
|
-
this.appConfig.emit(`SUI_TX_RESULT_${txDigest}`, response);
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
(0, dist_1.log_error)(`send tx by grpc failed!!! txid=${txDigest}`, error);
|
|
40
|
-
}
|
|
41
40
|
}
|
|
42
41
|
});
|
|
43
42
|
this.appConfig = appConfig;
|