@instadapp/interop-x 0.0.0-dev.4887ba6 → 0.0.0-dev.4df5dc2

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.
Files changed (81) hide show
  1. package/.github/workflows/ci.yml +19 -0
  2. package/dist/package.json +14 -13
  3. package/dist/src/abi/index.js +2 -4
  4. package/dist/src/abi/interopX.json +1436 -0
  5. package/dist/src/alias.js +10 -0
  6. package/dist/src/api/index.js +4 -1
  7. package/dist/src/config/index.js +10 -1
  8. package/dist/src/constants/addresses.js +2 -7
  9. package/dist/src/constants/index.js +0 -1
  10. package/dist/src/constants/tokens.js +62 -39
  11. package/dist/src/db/models/transaction.js +29 -11
  12. package/dist/src/gnosis/actions/index.js +9 -0
  13. package/dist/src/gnosis/actions/withdraw/index.js +114 -0
  14. package/dist/src/gnosis/index.js +20 -0
  15. package/dist/src/index.js +39 -23
  16. package/dist/src/net/peer/index.js +2 -1
  17. package/dist/src/net/pool/index.js +7 -2
  18. package/dist/src/net/protocol/dial/SignatureDialProtocol.js +9 -10
  19. package/dist/src/net/protocol/dial/TransactionStatusDialProtocol.js +30 -0
  20. package/dist/src/net/protocol/index.js +26 -5
  21. package/dist/src/tasks/AutoUpdateTask.js +36 -13
  22. package/dist/src/tasks/BaseTask.js +11 -3
  23. package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +84 -0
  24. package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +57 -0
  25. package/dist/src/tasks/index.js +7 -17
  26. package/dist/src/typechain/{InteropBridgeToken.js → InteropX.js} +0 -0
  27. package/dist/src/typechain/factories/InteropX__factory.js +1928 -0
  28. package/dist/src/typechain/factories/index.js +3 -5
  29. package/dist/src/typechain/index.js +3 -5
  30. package/dist/src/utils/index.js +59 -92
  31. package/package.json +14 -13
  32. package/src/abi/index.ts +2 -4
  33. package/src/abi/interopX.json +1436 -0
  34. package/src/alias.ts +6 -0
  35. package/src/api/index.ts +4 -1
  36. package/src/config/index.ts +9 -1
  37. package/src/constants/addresses.ts +3 -8
  38. package/src/constants/index.ts +0 -1
  39. package/src/constants/tokens.ts +63 -40
  40. package/src/db/models/transaction.ts +65 -25
  41. package/src/gnosis/actions/index.ts +5 -0
  42. package/src/gnosis/actions/withdraw/index.ts +155 -0
  43. package/src/gnosis/index.ts +19 -0
  44. package/src/index.ts +52 -25
  45. package/src/net/peer/index.ts +2 -1
  46. package/src/net/pool/index.ts +7 -3
  47. package/src/net/protocol/dial/SignatureDialProtocol.ts +11 -13
  48. package/src/net/protocol/dial/TransactionStatusDialProtocol.ts +33 -0
  49. package/src/net/protocol/index.ts +28 -6
  50. package/src/tasks/AutoUpdateTask.ts +40 -16
  51. package/src/tasks/BaseTask.ts +13 -3
  52. package/src/tasks/InteropX/SyncLogSubmitEvents.ts +136 -0
  53. package/src/tasks/Transactions/SyncTransactionStatusTask.ts +69 -0
  54. package/src/tasks/index.ts +12 -21
  55. package/src/typechain/InteropX.ts +1216 -0
  56. package/src/typechain/factories/InteropX__factory.ts +1932 -0
  57. package/src/typechain/factories/index.ts +1 -2
  58. package/src/typechain/index.ts +2 -4
  59. package/src/utils/index.ts +113 -131
  60. package/tsconfig.json +7 -2
  61. package/dist/src/abi/interopBridgeToken.json +0 -286
  62. package/dist/src/abi/interopXGateway.json +0 -184
  63. package/dist/src/constants/itokens.js +0 -13
  64. package/dist/src/tasks/InteropBridge/ProcessWithdrawEvents.js +0 -147
  65. package/dist/src/tasks/InteropBridge/SyncWithdrawEvents.js +0 -70
  66. package/dist/src/tasks/InteropXGateway/ProcessDepositEvents.js +0 -150
  67. package/dist/src/tasks/InteropXGateway/SyncDepositEvents.js +0 -75
  68. package/dist/src/typechain/InteropXGateway.js +0 -2
  69. package/dist/src/typechain/factories/InteropBridgeToken__factory.js +0 -459
  70. package/dist/src/typechain/factories/InteropXGateway__factory.js +0 -265
  71. package/src/abi/interopBridgeToken.json +0 -286
  72. package/src/abi/interopXGateway.json +0 -184
  73. package/src/constants/itokens.ts +0 -10
  74. package/src/tasks/InteropBridge/ProcessWithdrawEvents.ts +0 -233
  75. package/src/tasks/InteropBridge/SyncWithdrawEvents.ts +0 -121
  76. package/src/tasks/InteropXGateway/ProcessDepositEvents.ts +0 -245
  77. package/src/tasks/InteropXGateway/SyncDepositEvents.ts +0 -126
  78. package/src/typechain/InteropBridgeToken.ts +0 -686
  79. package/src/typechain/InteropXGateway.ts +0 -407
  80. package/src/typechain/factories/InteropBridgeToken__factory.ts +0 -466
  81. package/src/typechain/factories/InteropXGateway__factory.ts +0 -272
@@ -10,12 +10,17 @@ const config_1 = __importDefault(require("@/config"));
10
10
  const db_1 = require("@/db");
11
11
  const utils_1 = require("@/utils");
12
12
  const constants_1 = require("@/constants");
13
+ const gnosis_1 = require("@/gnosis");
13
14
  class SignatureDialProtocol extends BaseDialProtocol_1.BaseDialProtocol {
14
15
  constructor(libp2p) {
15
16
  super(libp2p, '/interop-x/signatures');
16
17
  this.timeout = 30000;
17
18
  }
18
19
  async response(data) {
20
+ console.log({
21
+ tag: 'SignatureDialProtocol',
22
+ data
23
+ });
19
24
  const signer = config_1.default.wallet;
20
25
  let transaction;
21
26
  let maxTimeout = 20000;
@@ -33,17 +38,11 @@ class SignatureDialProtocol extends BaseDialProtocol_1.BaseDialProtocol {
33
38
  error: 'Event not found'
34
39
  };
35
40
  }
36
- console.log("signing:", {
37
- to: constants_1.addresses[transaction.targetChainId].multisend,
38
- data: await (0, utils_1.buildDataForTransaction)(transaction, data.type),
39
- chainId: transaction.targetChainId,
40
- safeTxGas: data.safeTxGas,
41
- nonce: data.safeNonce,
42
- });
41
+ const { data: gnosisData } = await (0, gnosis_1.buildGnosisAction)(transaction, data.type);
43
42
  const signedData = await (0, utils_1.signGnosisSafeTx)({
44
- to: constants_1.addresses[transaction.targetChainId].multisend,
45
- data: await (0, utils_1.buildDataForTransaction)(transaction, data.type),
46
- chainId: transaction.targetChainId,
43
+ to: constants_1.addresses[transaction.sourceChainId].multisend,
44
+ data: gnosisData,
45
+ chainId: transaction.sourceChainId,
47
46
  safeTxGas: data.safeTxGas,
48
47
  nonce: data.safeNonce,
49
48
  }, { signer });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionStatusDialProtocol = void 0;
4
+ const BaseDialProtocol_1 = require("./BaseDialProtocol");
5
+ const db_1 = require("@/db");
6
+ class TransactionStatusDialProtocol extends BaseDialProtocol_1.BaseDialProtocol {
7
+ constructor(libp2p) {
8
+ super(libp2p, '/interop-x/transaction-status');
9
+ this.timeout = 30000;
10
+ }
11
+ async response(transactionHash) {
12
+ const transaction = await db_1.Transaction.findOne({ where: { transactionHash } });
13
+ if (!transaction) {
14
+ return null;
15
+ }
16
+ return {
17
+ transactionHash: transaction.transactionHash,
18
+ sourceStatus: transaction.sourceStatus,
19
+ sourceTransactionHash: transaction.sourceTransactionHash,
20
+ sourceErrors: transaction.sourceErrors,
21
+ sourceLogs: transaction.sourceLogs,
22
+ targetStatus: transaction.targetStatus,
23
+ targetTransactionHash: transaction.targetTransactionHash,
24
+ targetErrors: transaction.targetErrors,
25
+ targetLogs: transaction.targetLogs,
26
+ status: transaction.status,
27
+ };
28
+ }
29
+ }
30
+ exports.TransactionStatusDialProtocol = TransactionStatusDialProtocol;
@@ -10,6 +10,7 @@ const SignatureDialProtocol_1 = require("./dial/SignatureDialProtocol");
10
10
  const __1 = require("..");
11
11
  const config_1 = __importDefault(require("@/config"));
12
12
  const types_1 = require("@/types");
13
+ const TransactionStatusDialProtocol_1 = require("./dial/TransactionStatusDialProtocol");
13
14
  class Protocol extends stream_1.EventEmitter {
14
15
  constructor() {
15
16
  super(...arguments);
@@ -30,21 +31,31 @@ class Protocol extends stream_1.EventEmitter {
30
31
  encode: (transaction) => [
31
32
  Buffer.from(transaction.transactionHash),
32
33
  Buffer.from(transaction.sourceStatus),
33
- Buffer.from(transaction.sourceTransactionHash),
34
+ Buffer.from(transaction.sourceTransactionHash || ''),
34
35
  transaction.sourceErrors ? transaction.sourceErrors.map((e) => Buffer.from(e)) : [],
36
+ transaction.sourceLogs ? transaction.sourceLogs.map((e) => [Buffer.from(e.type), Buffer.from(e.message)]) : [],
35
37
  Buffer.from(transaction.targetStatus),
36
- Buffer.from(transaction.targetTransactionHash),
38
+ Buffer.from(transaction.targetTransactionHash || ''),
37
39
  transaction.targetErrors ? transaction.targetErrors.map((e) => Buffer.from(e)) : [],
40
+ transaction.targetLogs ? transaction.targetLogs.map((e) => [Buffer.from(e.type), Buffer.from(e.message)]) : [],
38
41
  Buffer.from(transaction.status),
39
42
  ],
40
- decode: ([transactionHash, sourceStatus, sourceTransactionHash, sourceErrors, targetStatus, targetTransactionHash, targetErrors, status]) => ({
43
+ decode: ([transactionHash, sourceStatus, sourceTransactionHash, sourceErrors, sourceLogs, targetStatus, targetTransactionHash, targetErrors, targetLogs, status]) => ({
41
44
  transactionHash: transactionHash.toString(),
42
45
  sourceStatus: sourceStatus.toString(),
43
- sourceTransactionHash: sourceTransactionHash.toString(),
46
+ sourceTransactionHash: sourceTransactionHash.toString() || null,
44
47
  sourceErrors: sourceErrors.map((e) => e.toString()),
48
+ sourceLogs: sourceLogs.map(e => ({
49
+ type: e[0].toString(),
50
+ message: e[1].toString(),
51
+ })),
45
52
  targetStatus: targetStatus.toString(),
46
- targetTransactionHash: targetTransactionHash.toString(),
53
+ targetTransactionHash: targetTransactionHash.toString() || null,
47
54
  targetErrors: targetErrors.map((e) => e.toString()),
55
+ targetLogs: targetLogs.map(e => ({
56
+ type: e[0].toString(),
57
+ message: e[1].toString(),
58
+ })),
48
59
  status: status.toString(),
49
60
  }),
50
61
  },
@@ -64,6 +75,7 @@ class Protocol extends stream_1.EventEmitter {
64
75
  });
65
76
  });
66
77
  this.signature = new SignatureDialProtocol_1.SignatureDialProtocol(this.libp2p);
78
+ this.transactionStatus = new TransactionStatusDialProtocol_1.TransactionStatusDialProtocol(this.libp2p);
67
79
  }
68
80
  init() {
69
81
  this.libp2p.pubsub.subscribe(this.topic);
@@ -117,5 +129,14 @@ class Protocol extends stream_1.EventEmitter {
117
129
  return [];
118
130
  }
119
131
  }
132
+ async requestTransactionStatus(transactionHash, peerId) {
133
+ try {
134
+ return await this.transactionStatus.send(transactionHash, peerId);
135
+ }
136
+ catch (error) {
137
+ console.log(error);
138
+ return null;
139
+ }
140
+ }
120
141
  }
121
142
  exports.protocol = new Protocol();
@@ -5,42 +5,65 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const BaseTask_1 = require("./BaseTask");
7
7
  const logger_1 = __importDefault(require("@/logger"));
8
- const utils_1 = require("@/utils");
9
8
  const await_spawn_1 = __importDefault(require("await-spawn"));
9
+ const child_process_1 = require("child_process");
10
10
  const config_1 = __importDefault(require("@/config"));
11
11
  const waait_1 = __importDefault(require("waait"));
12
+ const package_json_1 = __importDefault(require("../../package.json"));
13
+ const currentVersion = package_json_1.default.version;
14
+ const tag = config_1.default.staging ? 'dev' : 'latest';
12
15
  class AutoUpdateTask extends BaseTask_1.BaseTask {
13
16
  constructor() {
14
17
  super({
15
18
  logger: new logger_1.default("AutoUpdateTask"),
16
19
  });
17
- this.pollIntervalMs = 60 * 1000;
20
+ this.pollIntervalMs = 60 * 10 * 1000;
18
21
  }
19
22
  prePollHandler() {
20
23
  return config_1.default.autoUpdate && !config_1.default.isLeadNode();
21
24
  }
22
- getCurrentVersion() {
23
- return require('../../package.json').version;
25
+ async getInstalledVersion() {
26
+ try {
27
+ const stdout = await (0, await_spawn_1.default)('npm', ['-g', 'ls', '--depth=0', '--json']);
28
+ return JSON.parse(stdout.toString()).dependencies[package_json_1.default.name].version;
29
+ }
30
+ catch (error) {
31
+ this.logger.error(error);
32
+ return currentVersion;
33
+ }
34
+ }
35
+ async getLatestVersion() {
36
+ try {
37
+ const stdout = await (0, await_spawn_1.default)('npm', ['view', `${package_json_1.default.name}@${tag}`, 'version']);
38
+ return stdout.toString().trim();
39
+ }
40
+ catch (error) {
41
+ this.logger.error(error);
42
+ return currentVersion;
43
+ }
24
44
  }
25
45
  async pollHandler() {
26
- const { data } = await utils_1.http.get('https://registry.npmjs.org/@instadapp/interop-x');
27
- const version = data['dist-tags'].latest;
28
- const currentVersion = this.getCurrentVersion();
46
+ const version = await this.getLatestVersion();
29
47
  if (version === currentVersion) {
30
48
  return;
31
49
  }
32
50
  this.logger.warn(`New version ${version} available.`);
33
- await (0, await_spawn_1.default)('npm', ['-g', 'install', '@instadapp/interop-x', '-f']);
34
- this.logger.warn(`Installed version ${version}`);
35
- this.logger.warn(`Restarting...`);
51
+ this.logger.info('Updating...');
52
+ await (0, await_spawn_1.default)('npm', ['-g', 'install', `@instadapp/interop-x@${tag}`, '-f']);
36
53
  await (0, waait_1.default)(5000);
37
- if (currentVersion === this.getCurrentVersion()) {
54
+ if (version !== await this.getInstalledVersion()) {
55
+ this.logger.warn(`failed to install ${version}, retrying in 5 minutes`);
38
56
  return;
39
57
  }
40
- (0, await_spawn_1.default)(process.argv[0], process.argv.slice(1), {
58
+ this.logger.warn(`Installed version ${version}`);
59
+ this.logger.warn(`Restarting...`);
60
+ // TODO: its restarting in the bg, but it should be in the fg
61
+ const subprocess = (0, child_process_1.spawn)(process.argv[0], process.argv.slice(1), {
41
62
  cwd: process.cwd(),
42
- stdio: "inherit"
63
+ stdio: "inherit",
64
+ // shell: process.env.SHELL,
43
65
  });
66
+ subprocess.unref();
44
67
  process.exit();
45
68
  }
46
69
  }
@@ -14,6 +14,7 @@ class BaseTask extends events_1.default {
14
14
  this.started = false;
15
15
  this.pollIntervalMs = 10 * 1000;
16
16
  this.leadNodeOnly = false;
17
+ this.exceptLeadNode = false;
17
18
  this.logger = logger !== null && logger !== void 0 ? logger : new logger_1.default('BaseTask');
18
19
  }
19
20
  async pollCheck() {
@@ -34,10 +35,17 @@ class BaseTask extends events_1.default {
34
35
  }
35
36
  }
36
37
  prePollHandler() {
37
- if (!this.leadNodeOnly) {
38
- return true;
38
+ if (config_1.default.isMaintenanceMode()) {
39
+ this.logger.warn('Maintenance mode is enabled. Skipping task.');
40
+ return false;
39
41
  }
40
- return config_1.default.isLeadNode();
42
+ if (this.exceptLeadNode) {
43
+ return !config_1.default.isLeadNode();
44
+ }
45
+ if (this.leadNodeOnly) {
46
+ return config_1.default.isLeadNode();
47
+ }
48
+ return true;
41
49
  }
42
50
  async pollHandler() {
43
51
  this.logger.warn('pollHandler not implemented');
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseTask_1 = require("../BaseTask");
7
+ const logger_1 = __importDefault(require("@/logger"));
8
+ const ethers_1 = require("ethers");
9
+ const abi_1 = __importDefault(require("@/abi"));
10
+ const db_1 = require("@/db");
11
+ const utils_1 = require("@/utils");
12
+ const constants_1 = require("@/constants");
13
+ const config_1 = __importDefault(require("@/config"));
14
+ class SyncLogSubmitEvents extends BaseTask_1.BaseTask {
15
+ constructor({ chainId }) {
16
+ super({
17
+ logger: new logger_1.default("InteropX::SyncLogSubmitEvents"),
18
+ });
19
+ this.chainId = chainId;
20
+ }
21
+ async pollHandler() {
22
+ const currentBlock = await this.provider.getBlockNumber();
23
+ const events = await this.contract.queryFilter(this.contract.filters.LogSubmit(), currentBlock - 2000, currentBlock);
24
+ let processedEvents = 0;
25
+ for (const event of events) {
26
+ try {
27
+ if (!event.args) {
28
+ continue;
29
+ }
30
+ const { position, actionId, actionIdHashHash, sourceSender, sourceDsaId, targetDsaId, sourceChainId, targetChainId, vnonce, metadata, } = event.args;
31
+ const uniqueIdentifier = {
32
+ actionId,
33
+ vnonce: vnonce.toString(),
34
+ sourceSender: sourceSender.toString(),
35
+ sourceChainId: sourceChainId.toNumber(),
36
+ targetChainId: targetChainId.toNumber(),
37
+ sourceDsaId: sourceDsaId.toString(),
38
+ targetDsaId: targetDsaId.toString(),
39
+ };
40
+ let transactionHash = (0, utils_1.generateInteropTransactionHash)(uniqueIdentifier);
41
+ const transaction = await db_1.Transaction.findOne({ where: { transactionHash } });
42
+ if (transaction) {
43
+ continue;
44
+ }
45
+ await db_1.Transaction.create(Object.assign(Object.assign({ transactionHash }, uniqueIdentifier), { submitChainId: this.chainId, submitTransactionHash: event.transactionHash, submitBlockNumber: event.blockNumber, submitCreatedAt: new Date(), submitEvent: {
46
+ actionId,
47
+ actionIdHashHash,
48
+ vnonce: vnonce.toString(),
49
+ position: {
50
+ withdraw: position.withdraw.map((v) => ({
51
+ sourceToken: v.sourceToken,
52
+ targetToken: v.targetToken,
53
+ amount: v.amount.toString()
54
+ })),
55
+ supply: position.supply.map((v) => ({
56
+ sourceToken: v.sourceToken,
57
+ targetToken: v.targetToken,
58
+ amount: v.amount.toString()
59
+ })),
60
+ },
61
+ sourceChainId: sourceChainId.toNumber(),
62
+ targetChainId: targetChainId.toNumber(),
63
+ sourceSender,
64
+ sourceDsaId: sourceDsaId.toString(),
65
+ targetDsaId: targetDsaId.toString(),
66
+ metadata,
67
+ } }));
68
+ this.logger.info(`New InteropX tranaction: ${transactionHash} `);
69
+ }
70
+ catch (error) {
71
+ this.logger.error(error);
72
+ }
73
+ }
74
+ if (processedEvents > 0)
75
+ this.logger.info(`${processedEvents} events processed`);
76
+ }
77
+ async start() {
78
+ this.contractAddress = constants_1.addresses[this.chainId].interopX;
79
+ this.provider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(this.chainId));
80
+ this.contract = (0, utils_1.getContract)(this.contractAddress, abi_1.default.interopX, new ethers_1.ethers.Wallet(config_1.default.privateKey, this.provider));
81
+ await super.start();
82
+ }
83
+ }
84
+ exports.default = SyncLogSubmitEvents;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseTask_1 = require("../BaseTask");
7
+ const logger_1 = __importDefault(require("@/logger"));
8
+ const net_1 = require("@/net");
9
+ const db_1 = require("@/db");
10
+ const sequelize_1 = require("sequelize");
11
+ class SyncTransactionStatusTask extends BaseTask_1.BaseTask {
12
+ constructor() {
13
+ super({
14
+ logger: new logger_1.default("SyncTransactionStatusTask"),
15
+ });
16
+ this.pollIntervalMs = 60 * 1000;
17
+ this.exceptLeadNode = true;
18
+ }
19
+ async pollHandler() {
20
+ // if transaction is pending for more than 1 hour, check lead node for status
21
+ const leadNode = net_1.peerPool.getLeadPeer();
22
+ if (!leadNode) {
23
+ return;
24
+ }
25
+ const transaction = await db_1.Transaction.findOne({
26
+ where: {
27
+ sourceStatus: {
28
+ [sequelize_1.Op.notIn]: ['success', 'failed'],
29
+ },
30
+ sourceCreatedAt: {
31
+ [sequelize_1.Op.gte]: new Date(Date.now() - 15 * 60 * 1000),
32
+ },
33
+ }
34
+ });
35
+ if (!transaction) {
36
+ return;
37
+ }
38
+ this.logger.info(`Requesting transaction status for ${transaction.transactionHash}`);
39
+ const transactionStatus = await net_1.protocol.requestTransactionStatus(transaction.transactionHash, leadNode.id);
40
+ if (!transactionStatus) {
41
+ return;
42
+ }
43
+ this.logger.info(`Received transaction status for ${transaction.transactionHash}`);
44
+ transaction.sourceStatus = transactionStatus.sourceStatus;
45
+ transaction.sourceTransactionHash = transactionStatus.sourceTransactionHash;
46
+ transaction.sourceErrors = transactionStatus.sourceErrors;
47
+ transaction.sourceLogs = transactionStatus.sourceLogs;
48
+ transaction.targetStatus = transactionStatus.targetStatus;
49
+ transaction.targetTransactionHash = transactionStatus.targetTransactionHash;
50
+ transaction.targetErrors = transactionStatus.targetErrors;
51
+ transaction.targetLogs = transactionStatus.targetLogs;
52
+ transaction.status = transactionStatus.status;
53
+ await transaction.save();
54
+ this.logger.info(`Updated transaction status for ${transaction.transactionHash}`);
55
+ }
56
+ }
57
+ exports.default = SyncTransactionStatusTask;
@@ -4,34 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Tasks = void 0;
7
- const ProcessDepositEvents_1 = __importDefault(require("./InteropXGateway/ProcessDepositEvents"));
8
- const SyncDepositEvents_1 = __importDefault(require("./InteropXGateway/SyncDepositEvents"));
9
- const SyncWithdrawEvents_1 = __importDefault(require("./InteropBridge/SyncWithdrawEvents"));
10
- const ProcessWithdrawEvents_1 = __importDefault(require("./InteropBridge/ProcessWithdrawEvents"));
7
+ const waait_1 = __importDefault(require("waait"));
11
8
  const AutoUpdateTask_1 = __importDefault(require("./AutoUpdateTask"));
9
+ const SyncLogSubmitEvents_1 = __importDefault(require("./InteropX/SyncLogSubmitEvents"));
12
10
  class Tasks {
13
11
  constructor() {
14
12
  this.tasks = [
13
+ // new SyncTransactionStatusTask(),
15
14
  new AutoUpdateTask_1.default(),
16
- new SyncDepositEvents_1.default({
17
- chainId: 43114
18
- }),
19
- new ProcessDepositEvents_1.default({
20
- chainId: 43114
21
- }),
22
- new SyncWithdrawEvents_1.default({
23
- chainId: 137,
24
- itokenAddress: '0xEab02fe1F016eE3e4106c1C6aad35FeEe657268E',
25
- }),
26
- new ProcessWithdrawEvents_1.default({
27
- chainId: 137,
28
- })
15
+ // InteropX
16
+ new SyncLogSubmitEvents_1.default({ chainId: 137 }),
17
+ new SyncLogSubmitEvents_1.default({ chainId: 43114 }),
29
18
  ];
30
19
  }
31
20
  async start() {
32
21
  for (const task of this.tasks) {
33
22
  try {
34
23
  task.start();
24
+ await (0, waait_1.default)(1000);
35
25
  }
36
26
  catch (error) {
37
27
  console.error(`Error starting task: ${task.constructor.name}`);