@instadapp/interop-x 0.0.0-dev.1f933be → 0.0.0-dev.28f049d

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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/interop-x",
3
- "version": "0.0.0-dev.1f933be",
3
+ "version": "0.0.0-dev.28f049d",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -7,7 +7,7 @@ exports.buildGnosisAction = void 0;
7
7
  const ethers_multisend_1 = require("ethers-multisend");
8
8
  const actions_1 = __importDefault(require("./actions"));
9
9
  const buildGnosisAction = async (transaction, type) => {
10
- // type = type || (transaction.sourceStatus === 'success' ? 'target' : 'source')
10
+ type = type || transaction.sourceStatus === 'pending' ? 'source' : 'target';
11
11
  if (actions_1.default.hasOwnProperty(transaction.action)) {
12
12
  const { transactions, logs } = await actions_1.default[transaction.action](transaction, type);
13
13
  return {
package/dist/src/index.js CHANGED
@@ -13,7 +13,7 @@ const package_json_1 = __importDefault(require("../package.json"));
13
13
  dotenv_1.default.config();
14
14
  const logger_1 = __importDefault(require("@/logger"));
15
15
  const logger = new logger_1.default('Process');
16
- const GIT_SHORT_HASH = '1f933be';
16
+ const GIT_SHORT_HASH = '28f049d';
17
17
  const printUsage = () => {
18
18
  console.log();
19
19
  console.log(`Interop X Node (v${package_json_1.default.version} - rev.${GIT_SHORT_HASH})`);
@@ -72,9 +72,7 @@ const utils_1 = require("./utils");
72
72
  async function main() {
73
73
  (0, net_1.startPeer)({});
74
74
  const tasks = new tasks_1.Tasks();
75
- setTimeout(() => {
76
- tasks.start();
77
- }, 10000);
75
+ tasks.start();
78
76
  (0, api_1.startApiServer)();
79
77
  net_1.protocol.on('TransactionStatus', async (payload) => {
80
78
  if (!net_1.peerPool.isLeadNode(payload.peerId)) {
@@ -17,10 +17,6 @@ class SignatureDialProtocol extends BaseDialProtocol_1.BaseDialProtocol {
17
17
  this.timeout = 30000;
18
18
  }
19
19
  async response(data) {
20
- console.log({
21
- tag: 'SignatureDialProtocol',
22
- data
23
- });
24
20
  const signer = config_1.default.wallet;
25
21
  let transaction;
26
22
  let maxTimeout = 20000;
@@ -30,7 +30,7 @@ class ProccessBridgeRequestEvents extends BaseTask_1.BaseTask {
30
30
  where: {
31
31
  status: 'pending',
32
32
  sourceStatus: 'uninitialised',
33
- createdAt: {
33
+ sourceCreatedAt: {
34
34
  [sequelize_1.Op.gte]: new Date(Date.now() - 12 * 60 * 60 * 1000),
35
35
  },
36
36
  sourceDelayUntil: {
@@ -39,7 +39,7 @@ class ProccessBridgeRequestEvents extends BaseTask_1.BaseTask {
39
39
  [sequelize_1.Op.lt]: new Date(),
40
40
  }
41
41
  },
42
- requestBlockNumber: {
42
+ sourceBlockNumber: {
43
43
  [sequelize_1.Op.lt]: blockNumber - 12,
44
44
  },
45
45
  sourceChainId: this.chainId,
@@ -55,7 +55,7 @@ class ProccessBridgeRequestEvents extends BaseTask_1.BaseTask {
55
55
  await (0, waait_1.default)(10000);
56
56
  let data, logs = [];
57
57
  try {
58
- ({ data, logs } = await (0, gnosis_1.buildGnosisAction)(transaction, 'source'));
58
+ ({ data, logs } = await (0, gnosis_1.buildGnosisAction)(transaction));
59
59
  }
60
60
  catch (error) {
61
61
  console.log(error);
@@ -108,7 +108,6 @@ class ProccessBridgeRequestEvents extends BaseTask_1.BaseTask {
108
108
  to: this.safeContractAddress,
109
109
  data: txData,
110
110
  });
111
- console.log(txSent);
112
111
  const receipt = await txSent.wait();
113
112
  const parsedLogs = [];
114
113
  receipt.logs.forEach((log) => {
@@ -7,7 +7,6 @@ exports.Tasks = void 0;
7
7
  const AutoUpdateTask_1 = __importDefault(require("./AutoUpdateTask"));
8
8
  const SyncBridgeRequestEvents_1 = __importDefault(require("./InteropXContract/SyncBridgeRequestEvents"));
9
9
  const ProcessBridgeRequestEvents_1 = __importDefault(require("./InteropXContract/ProcessBridgeRequestEvents"));
10
- const waait_1 = __importDefault(require("waait"));
11
10
  class Tasks {
12
11
  constructor() {
13
12
  this.tasks = [
@@ -24,7 +23,6 @@ class Tasks {
24
23
  for (const task of this.tasks) {
25
24
  try {
26
25
  task.start();
27
- await (0, waait_1.default)(1000);
28
26
  }
29
27
  catch (error) {
30
28
  console.error(`Error starting task: ${task.constructor.name}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/interop-x",
3
- "version": "0.0.0-dev.1f933be",
3
+ "version": "0.0.0-dev.28f049d",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -2,8 +2,8 @@ import { Transaction } from "@/db";
2
2
  import { encodeMulti } from "ethers-multisend";
3
3
  import actions from "./actions";
4
4
 
5
- export const buildGnosisAction = async (transaction: Transaction, type: 'source' | 'target') => {
6
- // type = type || (transaction.sourceStatus === 'success' ? 'target' : 'source')
5
+ export const buildGnosisAction = async (transaction: Transaction, type?: 'source' | 'target') => {
6
+ type = type || transaction.sourceStatus === 'pending' ? 'source' : 'target';
7
7
 
8
8
  if (actions.hasOwnProperty(transaction.action)) {
9
9
 
package/src/index.ts CHANGED
@@ -89,9 +89,7 @@ async function main() {
89
89
 
90
90
  const tasks = new Tasks()
91
91
 
92
- setTimeout(() => {
93
- tasks.start();
94
- }, 10000)
92
+ tasks.start();
95
93
 
96
94
  startApiServer()
97
95
 
@@ -26,10 +26,6 @@ export class SignatureDialProtocol extends BaseDialProtocol<ISignatureRequest, I
26
26
  }
27
27
 
28
28
  async response(data: ISignatureRequest): Promise<ISignatureResponse> {
29
- console.log({
30
- tag: 'SignatureDialProtocol',
31
- data
32
- })
33
29
  const signer = config.wallet;
34
30
 
35
31
  let transaction: Transaction | null;
@@ -39,7 +39,7 @@ class ProccessBridgeRequestEvents extends BaseTask {
39
39
  where: {
40
40
  status: 'pending',
41
41
  sourceStatus: 'uninitialised',
42
- createdAt: {
42
+ sourceCreatedAt: {
43
43
  [Op.gte]: new Date(Date.now() - 12 * 60 * 60 * 1000),
44
44
  },
45
45
  sourceDelayUntil: {
@@ -48,7 +48,7 @@ class ProccessBridgeRequestEvents extends BaseTask {
48
48
  [Op.lt]: new Date(),
49
49
  }
50
50
  },
51
- requestBlockNumber: {
51
+ sourceBlockNumber: {
52
52
  [Op.lt]: blockNumber - 12,
53
53
  },
54
54
  sourceChainId: this.chainId,
@@ -71,7 +71,7 @@ class ProccessBridgeRequestEvents extends BaseTask {
71
71
  let data, logs = [];
72
72
 
73
73
  try {
74
- ({ data, logs } = await buildGnosisAction(transaction, 'source'));
74
+ ({ data, logs } = await buildGnosisAction(transaction));
75
75
 
76
76
  } catch (error) {
77
77
  console.log(error);
@@ -151,9 +151,6 @@ class ProccessBridgeRequestEvents extends BaseTask {
151
151
  data: txData,
152
152
  })
153
153
 
154
- console.log(txSent);
155
-
156
-
157
154
  const receipt = await txSent.wait();
158
155
 
159
156
  const parsedLogs: LogDescription[] = [];
@@ -5,10 +5,9 @@ import AutoUpdateTask from "./AutoUpdateTask";
5
5
 
6
6
  import SyncBridgeRequestEvents from "./InteropXContract/SyncBridgeRequestEvents";
7
7
  import ProccessBridgeRequestEvents from "./InteropXContract/ProcessBridgeRequestEvents";
8
- import wait from "waait";
9
8
 
10
9
  export class Tasks {
11
-
10
+
12
11
  tasks: BaseTask[] = [
13
12
  // new SyncTransactionStatusTask(),
14
13
  new AutoUpdateTask(),
@@ -26,7 +25,6 @@ export class Tasks {
26
25
  for (const task of this.tasks) {
27
26
  try {
28
27
  task.start();
29
- await wait(1000)
30
28
  } catch (error) {
31
29
  console.error(`Error starting task: ${task.constructor.name}`);
32
30
  }