@instadapp/interop-x 0.0.0-dev.9387bd9 → 0.0.0-dev.ef78459
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/config/index.js +1 -1
- package/dist/db/models/execution.js +1 -1
- package/dist/index.js +4 -3
- package/dist/net/peer/index.js +5 -5
- package/dist/net/pool/index.js +2 -2
- package/dist/net/protocol/dial/BaseDialProtocol.js +1 -1
- package/dist/net/protocol/dial/SignatureDialProtocol.js +3 -3
- package/dist/tasks/BaseTask.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +7 -1
- package/src/config/index.ts +1 -1
- package/src/db/index.ts +1 -1
- package/src/db/models/execution.ts +1 -1
- package/src/index.ts +4 -3
- package/src/net/peer/index.ts +3 -3
- package/src/net/pool/index.ts +2 -2
- package/src/net/protocol/dial/BaseDialProtocol.ts +1 -1
- package/src/net/protocol/dial/SignatureDialProtocol.ts +4 -4
- package/src/tasks/BaseTask.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/tsconfig.json +3 -0
package/dist/config/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const ethers_1 = require("ethers");
|
4
|
-
const types_1 = require("
|
4
|
+
const types_1 = require("@/types");
|
5
5
|
class Config {
|
6
6
|
constructor() {
|
7
7
|
this.events = new types_1.EventBus();
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Execution = void 0;
|
4
|
-
const sequelize_1 = require("
|
4
|
+
const sequelize_1 = require("@/db/sequelize");
|
5
5
|
const sequelize_2 = require("sequelize");
|
6
6
|
class Execution extends sequelize_2.Model {
|
7
7
|
}
|
package/dist/index.js
CHANGED
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
require("module-alias/register");
|
6
7
|
const assert_1 = __importDefault(require("assert"));
|
7
8
|
const dotenv_1 = __importDefault(require("dotenv"));
|
8
|
-
const logger_1 = __importDefault(require("
|
9
|
+
const logger_1 = __importDefault(require("@/logger"));
|
9
10
|
const ethers_1 = require("ethers");
|
10
11
|
dotenv_1.default.config();
|
11
12
|
const logger = new logger_1.default('Process');
|
@@ -17,8 +18,8 @@ catch (e) {
|
|
17
18
|
logger.error('Invalid private key');
|
18
19
|
process.exit(1);
|
19
20
|
}
|
20
|
-
const tasks_1 = require("
|
21
|
-
const net_1 = require("
|
21
|
+
const tasks_1 = require("@/tasks");
|
22
|
+
const net_1 = require("@/net");
|
22
23
|
async function main() {
|
23
24
|
(0, net_1.startPeer)({});
|
24
25
|
const tasks = new tasks_1.Tasks();
|
package/dist/net/peer/index.js
CHANGED
@@ -11,7 +11,7 @@ const libp2p_websockets_1 = __importDefault(require("libp2p-websockets"));
|
|
11
11
|
//@ts-ignore
|
12
12
|
const libp2p_mplex_1 = __importDefault(require("libp2p-mplex"));
|
13
13
|
const libp2p_noise_1 = require("libp2p-noise");
|
14
|
-
const logger_1 = __importDefault(require("
|
14
|
+
const logger_1 = __importDefault(require("@/logger"));
|
15
15
|
const libp2p_bootstrap_1 = __importDefault(require("libp2p-bootstrap"));
|
16
16
|
const waait_1 = __importDefault(require("waait"));
|
17
17
|
const libp2p_gossipsub_1 = __importDefault(require("@achingbrain/libp2p-gossipsub"));
|
@@ -21,8 +21,8 @@ const libp2p_mdns_1 = __importDefault(require("libp2p-mdns"));
|
|
21
21
|
const libp2p_kad_dht_1 = __importDefault(require("libp2p-kad-dht"));
|
22
22
|
//@ts-ignore
|
23
23
|
const libp2p_pubsub_peer_discovery_1 = __importDefault(require("libp2p-pubsub-peer-discovery"));
|
24
|
-
const
|
25
|
-
const config_1 = __importDefault(require("
|
24
|
+
const net_1 = require("@/net");
|
25
|
+
const config_1 = __importDefault(require("@/config"));
|
26
26
|
const logger = new logger_1.default("Peer");
|
27
27
|
let node;
|
28
28
|
// Known peers addresses
|
@@ -79,14 +79,14 @@ const startPeer = async ({}) => {
|
|
79
79
|
});
|
80
80
|
logger.info("Peer ID:", node.peerId.toB58String());
|
81
81
|
await node.start();
|
82
|
-
|
82
|
+
net_1.protocol.start({
|
83
83
|
libp2p: node
|
84
84
|
});
|
85
85
|
node.on("peer:discovery", (peer) => logger.log(`Discovered peer ${peer}`)); // peer disc.
|
86
86
|
node.connectionManager.on("peer:connect", (connection) => logger.log(`Connected to ${connection.remotePeer.toB58String()}`));
|
87
87
|
logger.log("Peer discovery started");
|
88
88
|
await (0, waait_1.default)(1000);
|
89
|
-
setInterval(() =>
|
89
|
+
setInterval(() => net_1.protocol.sendPeerInfo({
|
90
90
|
publicAddress: config_1.default.wallet.address,
|
91
91
|
}), 5000);
|
92
92
|
};
|
package/dist/net/pool/index.js
CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.peerPool = exports.PeerPool = void 0;
|
7
|
-
const types_1 = require("
|
8
|
-
const config_1 = __importDefault(require("
|
7
|
+
const types_1 = require("@/types");
|
8
|
+
const config_1 = __importDefault(require("@/config"));
|
9
9
|
class PeerPool {
|
10
10
|
constructor() {
|
11
11
|
this.PEERS_CLEANUP_TIME_LIMIT = 1;
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.BaseDialProtocol = void 0;
|
14
14
|
const it_pipe_1 = __importDefault(require("it-pipe"));
|
15
15
|
const peer_id_1 = __importDefault(require("peer-id"));
|
16
|
-
const utils_1 = require("
|
16
|
+
const utils_1 = require("@/utils");
|
17
17
|
const waait_1 = __importDefault(require("waait"));
|
18
18
|
class BaseDialProtocol {
|
19
19
|
constructor(libp2p, protocol) {
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.SignatureDialProtocol = void 0;
|
7
|
-
const utils_1 = require("
|
7
|
+
const utils_1 = require("@/utils");
|
8
8
|
const BaseDialProtocol_1 = require("./BaseDialProtocol");
|
9
9
|
const waait_1 = __importDefault(require("waait"));
|
10
|
-
const config_1 = __importDefault(require("
|
11
|
-
const constants_1 = require("
|
10
|
+
const config_1 = __importDefault(require("@/config"));
|
11
|
+
const constants_1 = require("@/constants");
|
12
12
|
const db_1 = require("db");
|
13
13
|
class SignatureDialProtocol extends BaseDialProtocol_1.BaseDialProtocol {
|
14
14
|
constructor(libp2p) {
|
package/dist/tasks/BaseTask.js
CHANGED
@@ -7,7 +7,7 @@ exports.BaseTask = void 0;
|
|
7
7
|
const config_1 = __importDefault(require("config"));
|
8
8
|
const events_1 = __importDefault(require("events"));
|
9
9
|
const waait_1 = __importDefault(require("waait"));
|
10
|
-
const logger_1 = __importDefault(require("
|
10
|
+
const logger_1 = __importDefault(require("@/logger"));
|
11
11
|
class BaseTask extends events_1.default {
|
12
12
|
constructor({ logger }) {
|
13
13
|
super();
|
package/dist/utils/index.js
CHANGED
@@ -9,7 +9,7 @@ exports.asyncCallWithTimeout = exports.buildSignatureBytes = exports.getRpcProvi
|
|
9
9
|
*/
|
10
10
|
const axios_1 = __importDefault(require("axios"));
|
11
11
|
const axios_retry_1 = __importDefault(require("axios-retry"));
|
12
|
-
const constants_1 = require("
|
12
|
+
const constants_1 = require("@/constants");
|
13
13
|
exports.http = axios_1.default.create();
|
14
14
|
(0, axios_retry_1.default)(exports.http, { retries: 3, retryDelay: axios_retry_1.default.exponentialDelay });
|
15
15
|
function short(buffer) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instadapp/interop-x",
|
3
|
-
"version": "0.0.0-dev.
|
3
|
+
"version": "0.0.0-dev.ef78459",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"engines": {
|
@@ -30,6 +30,7 @@
|
|
30
30
|
"ethereumjs-util": "^7.1.4",
|
31
31
|
"ethers": "^5.6.4",
|
32
32
|
"ethers-multisend": "^2.1.1",
|
33
|
+
"expand-home-dir": "^0.0.3",
|
33
34
|
"libp2p": "^0.36.2",
|
34
35
|
"libp2p-bootstrap": "^0.14.0",
|
35
36
|
"libp2p-kad-dht": "^0.28.6",
|
@@ -40,7 +41,9 @@
|
|
40
41
|
"libp2p-tcp": "^0.17.2",
|
41
42
|
"libp2p-websockets": "^0.16.2",
|
42
43
|
"luxon": "^2.3.2",
|
44
|
+
"module-alias": "^2.2.2",
|
43
45
|
"sequelize": "^6.19.0",
|
46
|
+
"sqlite3": "^5.0.5",
|
44
47
|
"waait": "^1.0.5"
|
45
48
|
},
|
46
49
|
"bin": {
|
@@ -55,5 +58,8 @@
|
|
55
58
|
"ts-node": "^10.5.0",
|
56
59
|
"tsconfig-paths": "^3.12.0",
|
57
60
|
"typescript": "^4.5.5"
|
61
|
+
},
|
62
|
+
"_moduleAliases": {
|
63
|
+
"@/": "./"
|
58
64
|
}
|
59
65
|
}
|
package/src/config/index.ts
CHANGED
package/src/db/index.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export * from "./models"
|
1
|
+
export * from "./models"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { sequelize } from '
|
1
|
+
import { sequelize } from '@/db/sequelize'
|
2
2
|
import { CreationOptional, InferAttributes, InferCreationAttributes, Model, DataTypes } from 'sequelize';
|
3
3
|
|
4
4
|
export class Execution extends Model<InferAttributes<Execution>, InferCreationAttributes<Execution>> {
|
package/src/index.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
import 'module-alias/register';
|
1
2
|
import assert from "assert";
|
2
3
|
import dotenv from "dotenv";
|
3
|
-
import Logger from "
|
4
|
+
import Logger from "@/logger";
|
4
5
|
import { ethers } from "ethers";
|
5
6
|
dotenv.config();
|
6
7
|
const logger = new Logger('Process')
|
@@ -14,8 +15,8 @@ try {
|
|
14
15
|
process.exit(1)
|
15
16
|
}
|
16
17
|
|
17
|
-
import { Tasks } from "
|
18
|
-
import { startPeer } from "
|
18
|
+
import { Tasks } from "@/tasks";
|
19
|
+
import { startPeer } from "@/net";
|
19
20
|
|
20
21
|
|
21
22
|
async function main() {
|
package/src/net/peer/index.ts
CHANGED
@@ -5,7 +5,7 @@ import WS from "libp2p-websockets";
|
|
5
5
|
//@ts-ignore
|
6
6
|
import Mplex from "libp2p-mplex";
|
7
7
|
import { NOISE } from "libp2p-noise";
|
8
|
-
import Logger from "
|
8
|
+
import Logger from "@/logger";
|
9
9
|
import Bootstrap from "libp2p-bootstrap";
|
10
10
|
import wait from "waait";
|
11
11
|
import Gossipsub from "@achingbrain/libp2p-gossipsub";
|
@@ -15,8 +15,8 @@ import MulticastDNS from "libp2p-mdns";
|
|
15
15
|
import KadDHT from "libp2p-kad-dht";
|
16
16
|
//@ts-ignore
|
17
17
|
import PubsubPeerDiscovery from "libp2p-pubsub-peer-discovery";
|
18
|
-
import { protocol } from "
|
19
|
-
import config from "
|
18
|
+
import { protocol } from "@/net";
|
19
|
+
import config from "@/config";
|
20
20
|
|
21
21
|
const logger = new Logger("Peer");
|
22
22
|
|
package/src/net/pool/index.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import pipe from 'it-pipe';
|
2
2
|
import Libp2p from 'libp2p';
|
3
3
|
import PeerId from 'peer-id';
|
4
|
-
import { asyncCallWithTimeout } from '
|
4
|
+
import { asyncCallWithTimeout } from '@/utils';
|
5
5
|
import wait from 'waait';
|
6
6
|
|
7
7
|
export class BaseDialProtocol<TRequest extends any, TResponse extends any> {
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { signGnosisSafeTx } from "
|
1
|
+
import { signGnosisSafeTx } from "@/utils";
|
2
2
|
import { BaseDialProtocol } from "./BaseDialProtocol";
|
3
3
|
import wait from "waait";
|
4
|
-
import { ChainId } from "
|
5
|
-
import config from "
|
6
|
-
import { addresses } from "
|
4
|
+
import { ChainId } from "@/types";
|
5
|
+
import config from "@/config";
|
6
|
+
import { addresses } from "@/constants";
|
7
7
|
import { Execution } from "db";
|
8
8
|
|
9
9
|
export interface ISignatureRequest {
|
package/src/tasks/BaseTask.ts
CHANGED
package/src/types.ts
CHANGED
package/src/utils/index.ts
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
*/
|
4
4
|
import axios from 'axios'
|
5
5
|
import axiosRetry from "axios-retry";
|
6
|
-
import { addresses } from '
|
7
|
-
import { ChainId } from '
|
6
|
+
import { addresses } from '@/constants';
|
7
|
+
import { ChainId } from '@/types'
|
8
8
|
|
9
9
|
export const http = axios.create();
|
10
10
|
|