@instadapp/interop-x 0.0.0-dev.55abf28 → 0.0.0-dev.5bcd66b

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.55abf28",
3
+ "version": "0.0.0-dev.5bcd66b",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -24,7 +24,6 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@achingbrain/libp2p-gossipsub": "^0.12.2",
27
- "@fastify/cors": "^7.0.0",
28
27
  "axios": "^0.27.1",
29
28
  "axios-retry": "^3.2.4",
30
29
  "bignumber.js": "^9.0.2",
@@ -33,9 +32,9 @@
33
32
  "ethereumjs-util": "^7.1.4",
34
33
  "ethers": "^5.6.4",
35
34
  "ethers-multisend": "^2.1.1",
36
- "execa": "^6.1.0",
37
35
  "expand-home-dir": "^0.0.3",
38
36
  "fastify": "^3.28.0",
37
+ "fastify-cors": "^6.0.3",
39
38
  "libp2p": "^0.36.2",
40
39
  "libp2p-bootstrap": "^0.14.0",
41
40
  "libp2p-kad-dht": "^0.28.6",
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.startApiServer = void 0;
7
7
  const fastify_1 = __importDefault(require("fastify"));
8
- const cors_1 = __importDefault(require("@fastify/cors"));
8
+ const fastify_cors_1 = __importDefault(require("fastify-cors"));
9
9
  const logger_1 = __importDefault(require("@/logger"));
10
10
  const db_1 = require("@/db");
11
11
  const logger = new logger_1.default("RPC");
12
12
  const server = (0, fastify_1.default)({ logger: false });
13
- server.register(cors_1.default, {});
13
+ server.register(fastify_cors_1.default, {});
14
14
  server.get('/', async () => 'Interop X API');
15
15
  const startApiServer = async () => {
16
16
  const HOST = process.env.API_HOST || '0.0.0.0';
@@ -8,7 +8,6 @@ class Config {
8
8
  this.maxPeers = 10;
9
9
  this.privateKey = process.env.PRIVATE_KEY;
10
10
  this.staging = !!process.env.STAGING && process.env.STAGING === 'true';
11
- this.autoUpdate = !!process.env.AUTO_UPDATE && process.env.AUTO_UPDATE === 'true';
12
11
  this.wallet = new ethers_1.Wallet(this.privateKey);
13
12
  this.leadNodeAddress = '0x910E413DBF3F6276Fe8213fF656726bDc142E08E';
14
13
  }
package/dist/src/index.js CHANGED
@@ -30,18 +30,12 @@ const printUsage = () => {
30
30
  console.log('Usage:');
31
31
  console.log(' PRIVATE_KEY=abcd1234 interop-x');
32
32
  console.log(' PRIVATE_KEY=abcd1234 STAGING=true interop-x');
33
- console.log(' PRIVATE_KEY=abcd1234 AUTO_UPDATE=true interop-x');
34
33
  console.log(' PRIVATE_KEY=abcd1234 API_HOST=0.0.0.0 API_PORT=8080 interop-x');
35
34
  };
36
35
  if (process.argv.at(-1) === 'help') {
37
36
  printUsage();
38
37
  process.exit(0);
39
38
  }
40
- const GIT_SHORT_HASH = '55abf28';
41
- if (process.argv.at(-1) === 'version') {
42
- console.log(`Interop X Node (v${package_json_1.default.version} - rev.${GIT_SHORT_HASH})`);
43
- process.exit(0);
44
- }
45
39
  if (!process.env.PRIVATE_KEY) {
46
40
  console.error(chalk_1.default.bgRed.white.bold('Please provide a private key\n'));
47
41
  printUsage();
@@ -55,7 +49,7 @@ catch (e) {
55
49
  printUsage();
56
50
  process.exit(1);
57
51
  }
58
- logger.debug(`Starting Interop X Node (v${package_json_1.default.version} - rev.${GIT_SHORT_HASH})`);
52
+ logger.debug(`Starting Interop X Node (v${package_json_1.default.version} - rev.5bcd66b)`);
59
53
  const tasks_1 = require("@/tasks");
60
54
  const net_1 = require("@/net");
61
55
  const api_1 = require("@/api");
@@ -8,11 +8,9 @@ const ProcessDepositEvents_1 = __importDefault(require("./InteropXGateway/Proces
8
8
  const SyncDepositEvents_1 = __importDefault(require("./InteropXGateway/SyncDepositEvents"));
9
9
  const SyncWithdrawEvents_1 = __importDefault(require("./InteropBridge/SyncWithdrawEvents"));
10
10
  const ProcessWithdrawEvents_1 = __importDefault(require("./InteropBridge/ProcessWithdrawEvents"));
11
- const AutoUpdateTask_1 = __importDefault(require("./AutoUpdateTask"));
12
11
  class Tasks {
13
12
  constructor() {
14
13
  this.tasks = [
15
- new AutoUpdateTask_1.default(),
16
14
  new SyncDepositEvents_1.default({
17
15
  chainId: 43114
18
16
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/interop-x",
3
- "version": "0.0.0-dev.55abf28",
3
+ "version": "0.0.0-dev.5bcd66b",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -24,7 +24,6 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@achingbrain/libp2p-gossipsub": "^0.12.2",
27
- "@fastify/cors": "^7.0.0",
28
27
  "axios": "^0.27.1",
29
28
  "axios-retry": "^3.2.4",
30
29
  "bignumber.js": "^9.0.2",
@@ -33,9 +32,9 @@
33
32
  "ethereumjs-util": "^7.1.4",
34
33
  "ethers": "^5.6.4",
35
34
  "ethers-multisend": "^2.1.1",
36
- "execa": "^6.1.0",
37
35
  "expand-home-dir": "^0.0.3",
38
36
  "fastify": "^3.28.0",
37
+ "fastify-cors": "^6.0.3",
39
38
  "libp2p": "^0.36.2",
40
39
  "libp2p-bootstrap": "^0.14.0",
41
40
  "libp2p-kad-dht": "^0.28.6",
package/src/api/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import fastify from "fastify"
2
- import cors from '@fastify/cors'
2
+ import cors from 'fastify-cors'
3
3
  import Logger from "@/logger"
4
4
  import { Transaction } from "@/db";
5
5
 
@@ -8,14 +8,12 @@ class Config {
8
8
  public readonly privateKey: string
9
9
  public readonly wallet: Wallet
10
10
  public readonly staging: boolean
11
- public readonly autoUpdate: boolean
12
11
 
13
12
  constructor() {
14
13
  this.events = new EventBus() as EventBusType
15
14
  this.maxPeers = 10
16
15
  this.privateKey = process.env.PRIVATE_KEY as string;
17
16
  this.staging = !! process.env.STAGING && process.env.STAGING === 'true';
18
- this.autoUpdate = !! process.env.AUTO_UPDATE && process.env.AUTO_UPDATE === 'true';
19
17
  this.wallet = new Wallet(this.privateKey);
20
18
  this.leadNodeAddress = '0x910E413DBF3F6276Fe8213fF656726bDc142E08E'
21
19
  }
package/src/index.ts CHANGED
@@ -29,7 +29,6 @@ const printUsage = () => {
29
29
  console.log('Usage:')
30
30
  console.log(' PRIVATE_KEY=abcd1234 interop-x')
31
31
  console.log(' PRIVATE_KEY=abcd1234 STAGING=true interop-x')
32
- console.log(' PRIVATE_KEY=abcd1234 AUTO_UPDATE=true interop-x')
33
32
  console.log(' PRIVATE_KEY=abcd1234 API_HOST=0.0.0.0 API_PORT=8080 interop-x')
34
33
  }
35
34
 
@@ -38,12 +37,6 @@ if (process.argv.at(-1) === 'help') {
38
37
  process.exit(0)
39
38
  }
40
39
 
41
- const GIT_SHORT_HASH = '@GIT_SHORT_HASH@';
42
-
43
- if (process.argv.at(-1) === 'version') {
44
- console.log(`Interop X Node (v${packageJson.version} - rev.${GIT_SHORT_HASH})`)
45
- process.exit(0)
46
- }
47
40
 
48
41
  if(! process.env.PRIVATE_KEY) {
49
42
  console.error(chalk.bgRed.white.bold('Please provide a private key\n'))
@@ -58,7 +51,7 @@ try {
58
51
  process.exit(1)
59
52
  }
60
53
 
61
- logger.debug(`Starting Interop X Node (v${packageJson.version} - rev.${GIT_SHORT_HASH})`)
54
+ logger.debug(`Starting Interop X Node (v${packageJson.version} - rev.@GIT_SHORT_HASH@)`)
62
55
 
63
56
  import { Tasks } from "@/tasks";
64
57
  import { startPeer, protocol, peerPool } from "@/net";
@@ -4,13 +4,10 @@ import InteropXGatewaySyncDepositEvents from "./InteropXGateway/SyncDepositEvent
4
4
 
5
5
  import InteropBridgeSyncWithdrawEvents from "./InteropBridge/SyncWithdrawEvents";
6
6
  import InteropBridgeProcessWithdrawEvents from "./InteropBridge/ProcessWithdrawEvents";
7
- import AutoUpdateTask from "./AutoUpdateTask";
8
7
 
9
8
  export class Tasks {
10
9
 
11
10
  tasks: BaseTask[] = [
12
- new AutoUpdateTask(),
13
-
14
11
  new InteropXGatewaySyncDepositEvents({
15
12
  chainId: 43114
16
13
  }),
@@ -1,54 +0,0 @@
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 utils_1 = require("@/utils");
9
- const config_1 = __importDefault(require("@/config"));
10
- const waait_1 = __importDefault(require("waait"));
11
- const execa_1 = require("execa");
12
- class AutoUpdateTask extends BaseTask_1.BaseTask {
13
- constructor() {
14
- super({
15
- logger: new logger_1.default("AutoUpdateTask"),
16
- });
17
- this.pollIntervalMs = 60 * 5 * 1000;
18
- }
19
- prePollHandler() {
20
- return config_1.default.autoUpdate && !config_1.default.isLeadNode();
21
- }
22
- getCurrentVersion() {
23
- return require('../../package.json').version;
24
- }
25
- 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();
29
- if (version === currentVersion) {
30
- return;
31
- }
32
- try {
33
- this.logger.warn(`New version ${version} available.`);
34
- await (0, execa_1.execa)('npm', ['-g', 'install', '@instadapp/interop-x@latest', '-f']);
35
- await (0, waait_1.default)(5000);
36
- if (currentVersion === this.getCurrentVersion()) {
37
- this.logger.warn(`failed to install ${version}, retrying in 5 minutes`);
38
- return;
39
- }
40
- this.logger.warn(`Installed version ${version}`);
41
- this.logger.warn(`Restarting...`);
42
- (0, execa_1.execa)(process.argv[0], process.argv.slice(1), {
43
- cwd: process.cwd(),
44
- stdio: "inherit"
45
- });
46
- process.exit();
47
- }
48
- catch (error) {
49
- this.logger.warn(`failed to install ${version}, retrying in 5 minutes`);
50
- console.log(error);
51
- }
52
- }
53
- }
54
- exports.default = AutoUpdateTask;
@@ -1,63 +0,0 @@
1
- import { BaseTask } from "./BaseTask";
2
- import Logger from '@/logger';
3
- import { http } from "@/utils";
4
- import config from "@/config";
5
- import wait from "waait";
6
- import { execa } from "execa";
7
-
8
- class AutoUpdateTask extends BaseTask {
9
- pollIntervalMs: number = 60 * 5 * 1000
10
-
11
- constructor() {
12
- super({
13
- logger: new Logger("AutoUpdateTask"),
14
- })
15
- }
16
-
17
- prePollHandler(): boolean {
18
- return config.autoUpdate && !config.isLeadNode();
19
- }
20
-
21
- getCurrentVersion() {
22
- return require('../../package.json').version
23
- }
24
- async pollHandler() {
25
-
26
- const { data } = await http.get('https://registry.npmjs.org/@instadapp/interop-x')
27
-
28
- const version = data['dist-tags'].latest
29
- const currentVersion = this.getCurrentVersion()
30
-
31
- if (version === currentVersion) {
32
- return;
33
- }
34
-
35
- try {
36
- this.logger.warn(`New version ${version} available.`)
37
-
38
- await execa('npm', ['-g', 'install', '@instadapp/interop-x@latest', '-f'])
39
-
40
- await wait(5000)
41
-
42
- if (currentVersion === this.getCurrentVersion()) {
43
- this.logger.warn(`failed to install ${version}, retrying in 5 minutes`)
44
- return;
45
- }
46
-
47
- this.logger.warn(`Installed version ${version}`)
48
- this.logger.warn(`Restarting...`)
49
-
50
- execa(process.argv[0], process.argv.slice(1), {
51
- cwd: process.cwd(),
52
- stdio: "inherit"
53
- });
54
-
55
- process.exit()
56
- } catch (error) {
57
- this.logger.warn(`failed to install ${version}, retrying in 5 minutes`)
58
- console.log(error)
59
- }
60
- }
61
- }
62
-
63
- export default AutoUpdateTask;