@clonegod/ttd-sui-common 1.0.30 → 1.0.31

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.
@@ -56,18 +56,28 @@ class TransactionResultChecker extends trade_1.AbstractTransactionResultCheck {
56
56
  });
57
57
  }
58
58
  on_subscibe_transaction() {
59
- this.event_emitter.once(`SUI_TX_RESULT_${this.txid}`, (response) => {
59
+ this.event_emitter.once(`SUI_TX_RESULT_${this.txid}`, (response) => __awaiter(this, void 0, void 0, function* () {
60
60
  (0, dist_1.log_info)(`receive tx result notification, txid=${this.txid}`);
61
61
  if (response.transaction) {
62
62
  this.processTransactionResult(response, 'grpc');
63
+ return;
63
64
  }
64
- else {
65
- (0, dist_1.log_warn)(`re-fetch tx result by ledgerService, txid=${this.txid}`);
66
- this.leadgerService.getTransaction(this.txid, ['*']).then((txReceipt) => {
67
- this.processTransactionResult(txReceipt, 'grpc2');
68
- });
65
+ (0, dist_1.log_warn)(`re-fetch tx result by ledgerService start, txid=${this.txid}`);
66
+ for (let i = 1; i <= 6; i++) {
67
+ let txReceipt = null;
68
+ try {
69
+ txReceipt = yield this.leadgerService.getTransaction(this.txid, ['*']);
70
+ if (txReceipt) {
71
+ this.processTransactionResult(txReceipt, 'grpc2');
72
+ break;
73
+ }
74
+ }
75
+ catch (error) {
76
+ (0, dist_1.log_warn)(`re-fetch tx result by ledgerService failed (i=${i}), txid=${this.txid}, error=${error.message}`);
77
+ }
78
+ yield (0, dist_1.sleep)(500);
69
79
  }
70
- });
80
+ }));
71
81
  }
72
82
  processTransactionResult(txReceipt, source) {
73
83
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sui-common",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Sui common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",