@instadapp/interop-x 0.0.0-dev.a861339 → 0.0.0-dev.a9cd1d2
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 +12 -11
- package/dist/src/abi/index.js +2 -2
- package/dist/src/abi/interopX.json +1436 -0
- package/dist/src/api/index.js +1 -1
- package/dist/src/constants/addresses.js +2 -7
- package/dist/src/constants/tokens.js +62 -39
- package/dist/src/db/models/transaction.js +10 -10
- package/dist/src/gnosis/actions/withdraw/index.js +106 -33
- package/dist/src/gnosis/index.js +3 -3
- package/dist/src/index.js +1 -1
- package/dist/src/tasks/{InteropXContract/SyncBridgeRequestEvents.js → InteropX/SyncLogSubmitEvents.js} +20 -14
- package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +4 -2
- package/dist/src/tasks/index.js +4 -10
- package/dist/src/typechain/{InteropXContract.js → InteropX.js} +0 -0
- package/dist/src/typechain/factories/InteropX__factory.js +1928 -0
- package/dist/src/typechain/factories/index.js +3 -3
- package/dist/src/typechain/index.js +3 -3
- package/dist/src/utils/index.js +36 -9
- package/package.json +12 -11
- package/src/abi/index.ts +2 -2
- package/src/abi/interopX.json +1436 -0
- package/src/api/index.ts +1 -1
- package/src/constants/addresses.ts +3 -8
- package/src/constants/tokens.ts +63 -40
- package/src/db/models/transaction.ts +29 -34
- package/src/gnosis/actions/withdraw/index.ts +141 -42
- package/src/gnosis/index.ts +3 -3
- package/src/tasks/{InteropXContract/SyncBridgeRequestEvents.ts → InteropX/SyncLogSubmitEvents.ts} +39 -19
- package/src/tasks/Transactions/SyncTransactionStatusTask.ts +4 -2
- package/src/tasks/index.ts +5 -13
- package/src/typechain/InteropX.ts +1216 -0
- package/src/typechain/factories/InteropX__factory.ts +1932 -0
- package/src/typechain/factories/index.ts +1 -1
- package/src/typechain/index.ts +2 -2
- package/src/utils/index.ts +88 -39
- package/dist/src/abi/interopXContract.json +0 -391
- package/dist/src/tasks/InteropXContract/ProcessBridgeRequestEvents.js +0 -147
- package/dist/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.js +0 -80
- package/dist/src/typechain/factories/InteropXContract__factory.js +0 -526
- package/src/abi/interopXContract.json +0 -391
- package/src/tasks/InteropXContract/ProcessBridgeRequestEvents.ts +0 -211
- package/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.ts +0 -112
- package/src/typechain/InteropXContract.ts +0 -524
- package/src/typechain/factories/InteropXContract__factory.ts +0 -533
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.InteropX__factory = exports.GnosisSafe__factory = exports.Erc20__factory = void 0;
|
4
4
|
/* Autogenerated file. Do not edit manually. */
|
5
5
|
/* tslint:disable */
|
6
6
|
/* eslint-disable */
|
@@ -8,5 +8,5 @@ var Erc20__factory_1 = require("./Erc20__factory");
|
|
8
8
|
Object.defineProperty(exports, "Erc20__factory", { enumerable: true, get: function () { return Erc20__factory_1.Erc20__factory; } });
|
9
9
|
var GnosisSafe__factory_1 = require("./GnosisSafe__factory");
|
10
10
|
Object.defineProperty(exports, "GnosisSafe__factory", { enumerable: true, get: function () { return GnosisSafe__factory_1.GnosisSafe__factory; } });
|
11
|
-
var
|
12
|
-
Object.defineProperty(exports, "
|
11
|
+
var InteropX__factory_1 = require("./InteropX__factory");
|
12
|
+
Object.defineProperty(exports, "InteropX__factory", { enumerable: true, get: function () { return InteropX__factory_1.InteropX__factory; } });
|
@@ -23,11 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.
|
26
|
+
exports.InteropX__factory = exports.GnosisSafe__factory = exports.Erc20__factory = exports.factories = void 0;
|
27
27
|
exports.factories = __importStar(require("./factories"));
|
28
28
|
var Erc20__factory_1 = require("./factories/Erc20__factory");
|
29
29
|
Object.defineProperty(exports, "Erc20__factory", { enumerable: true, get: function () { return Erc20__factory_1.Erc20__factory; } });
|
30
30
|
var GnosisSafe__factory_1 = require("./factories/GnosisSafe__factory");
|
31
31
|
Object.defineProperty(exports, "GnosisSafe__factory", { enumerable: true, get: function () { return GnosisSafe__factory_1.GnosisSafe__factory; } });
|
32
|
-
var
|
33
|
-
Object.defineProperty(exports, "
|
32
|
+
var InteropX__factory_1 = require("./factories/InteropX__factory");
|
33
|
+
Object.defineProperty(exports, "InteropX__factory", { enumerable: true, get: function () { return InteropX__factory_1.InteropX__factory; } });
|
package/dist/src/utils/index.js
CHANGED
@@ -3,7 +3,7 @@ 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
|
-
exports.generateGnosisTransaction = exports.getContract = exports.generateInteropTransactionHash = exports.asyncCallWithTimeout = exports.buildSignatureBytes = exports.getRpcProviderUrl = exports.signGnosisSafeTx = exports.short = exports.shortenHash = exports.http = void 0;
|
6
|
+
exports.LiquidityError = exports.generateGnosisTransaction = exports.getContract = exports.ContractError = exports.generateInteropTransactionHash = exports.asyncCallWithTimeout = exports.buildSignatureBytes = exports.getRpcProviderUrl = exports.signGnosisSafeTx = exports.short = exports.shortenHash = exports.http = void 0;
|
7
7
|
/**
|
8
8
|
* @module util
|
9
9
|
*/
|
@@ -11,6 +11,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
11
11
|
const axios_retry_1 = __importDefault(require("axios-retry"));
|
12
12
|
const constants_1 = require("@/constants");
|
13
13
|
const ethers_1 = require("ethers");
|
14
|
+
const async_retry_1 = __importDefault(require("async-retry"));
|
14
15
|
exports.http = axios_1.default.create();
|
15
16
|
(0, axios_retry_1.default)(exports.http, { retries: 3, retryDelay: axios_retry_1.default.exponentialDelay });
|
16
17
|
function shortenHash(hash, length = 4) {
|
@@ -101,15 +102,20 @@ const asyncCallWithTimeout = async (asyncPromise, timeout) => {
|
|
101
102
|
};
|
102
103
|
exports.asyncCallWithTimeout = asyncCallWithTimeout;
|
103
104
|
const generateInteropTransactionHash = (data) => {
|
104
|
-
return ethers_1.ethers.utils.solidityKeccak256(
|
105
|
-
String(data.
|
106
|
-
String(data.
|
107
|
-
String(data.
|
105
|
+
return ethers_1.ethers.utils.solidityKeccak256(Array.from(Array(7), () => 'string'), [
|
106
|
+
String(data.actionId),
|
107
|
+
String(data.vnonce),
|
108
|
+
String(data.sourceSender),
|
108
109
|
String(data.sourceChainId),
|
110
|
+
String(data.sourceDsaId),
|
109
111
|
String(data.targetChainId),
|
112
|
+
String(data.targetDsaId),
|
110
113
|
]);
|
111
114
|
};
|
112
115
|
exports.generateInteropTransactionHash = generateInteropTransactionHash;
|
116
|
+
class ContractError extends Error {
|
117
|
+
}
|
118
|
+
exports.ContractError = ContractError;
|
113
119
|
function getContract(address, contractInterface, signerOrProvider) {
|
114
120
|
if (!ethers_1.ethers.utils.getAddress(address) || address === ethers_1.ethers.constants.AddressZero) {
|
115
121
|
throw Error(`Invalid 'address' parameter '${address}'.`);
|
@@ -124,12 +130,22 @@ function getContract(address, contractInterface, signerOrProvider) {
|
|
124
130
|
get(target, prop, receiver) {
|
125
131
|
const value = Reflect.get(target, prop, receiver);
|
126
132
|
if (typeof value === 'function' && (contract.functions.hasOwnProperty(prop) || ['queryFilter'].includes(String(prop)))) {
|
133
|
+
let isConstant = false;
|
134
|
+
try {
|
135
|
+
isConstant = contract.interface.getFunction(String(prop)).constant;
|
136
|
+
}
|
137
|
+
catch (error) {
|
138
|
+
}
|
127
139
|
return async (...args) => {
|
128
140
|
try {
|
129
|
-
return await value.bind(contract)(...args);
|
141
|
+
return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: isConstant ? 1 : 3 });
|
130
142
|
}
|
131
143
|
catch (error) {
|
132
|
-
|
144
|
+
const err = new ContractError(`Error calling "${String(prop)}" on "${address}": ${error.reason || error.message}`);
|
145
|
+
err.method = String(prop);
|
146
|
+
err.address = address;
|
147
|
+
err.args = [...args];
|
148
|
+
throw err;
|
133
149
|
}
|
134
150
|
};
|
135
151
|
}
|
@@ -141,10 +157,14 @@ function getContract(address, contractInterface, signerOrProvider) {
|
|
141
157
|
if (typeof value === 'function') {
|
142
158
|
return async (...args) => {
|
143
159
|
try {
|
144
|
-
return await value.bind(contract)(...args);
|
160
|
+
return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: parentProp === 'callStatic' ? 3 : 1 });
|
145
161
|
}
|
146
162
|
catch (error) {
|
147
|
-
|
163
|
+
const err = new ContractError(`Error calling "${String(prop)}" using "${parentProp}" on "${address}": ${error.reason || error.message}`);
|
164
|
+
err.method = String(prop);
|
165
|
+
err.address = address;
|
166
|
+
err.args = [...args];
|
167
|
+
throw err;
|
148
168
|
}
|
149
169
|
};
|
150
170
|
}
|
@@ -166,3 +186,10 @@ const generateGnosisTransaction = async (transactionData, safeContract) => {
|
|
166
186
|
return transactionData;
|
167
187
|
};
|
168
188
|
exports.generateGnosisTransaction = generateGnosisTransaction;
|
189
|
+
class LiquidityError extends Error {
|
190
|
+
constructor(message) {
|
191
|
+
super(message || 'Not enough liquidity');
|
192
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
exports.LiquidityError = LiquidityError;
|
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.a9cd1d2",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"engines": {
|
@@ -25,16 +25,17 @@
|
|
25
25
|
"dependencies": {
|
26
26
|
"@achingbrain/libp2p-gossipsub": "^0.12.2",
|
27
27
|
"@fastify/cors": "^7.0.0",
|
28
|
+
"async-retry": "^1.3.3",
|
28
29
|
"await-spawn": "^4.0.2",
|
29
|
-
"axios": "^0.27.
|
30
|
-
"axios-retry": "^3.2.
|
30
|
+
"axios": "^0.27.2",
|
31
|
+
"axios-retry": "^3.2.5",
|
31
32
|
"chalk": "4.1.2",
|
32
|
-
"dotenv": "^16.0.
|
33
|
+
"dotenv": "^16.0.1",
|
33
34
|
"ethereumjs-util": "^7.1.4",
|
34
|
-
"ethers": "^5.6.
|
35
|
+
"ethers": "^5.6.5",
|
35
36
|
"ethers-multisend": "^2.1.1",
|
36
37
|
"expand-home-dir": "^0.0.3",
|
37
|
-
"fastify": "^3.
|
38
|
+
"fastify": "^3.29.0",
|
38
39
|
"fs-extra": "^10.1.0",
|
39
40
|
"libp2p": "^0.36.2",
|
40
41
|
"libp2p-bootstrap": "^0.14.0",
|
@@ -45,12 +46,12 @@
|
|
45
46
|
"libp2p-pubsub-peer-discovery": "^4.0.0",
|
46
47
|
"libp2p-tcp": "^0.17.2",
|
47
48
|
"libp2p-websockets": "^0.16.2",
|
48
|
-
"luxon": "^2.
|
49
|
+
"luxon": "^2.4.0",
|
49
50
|
"module-alias": "^2.2.2",
|
50
51
|
"patch-package": "^6.4.7",
|
51
52
|
"postinstall-postinstall": "^2.1.0",
|
52
53
|
"sequelize": "6.18.0",
|
53
|
-
"sqlite3": "^5.0.
|
54
|
+
"sqlite3": "^5.0.8",
|
54
55
|
"waait": "^1.0.5"
|
55
56
|
},
|
56
57
|
"bin": {
|
@@ -61,13 +62,13 @@
|
|
61
62
|
"@typechain/ethers-v5": "^10.0.0",
|
62
63
|
"@types/bn.js": "^5.1.0",
|
63
64
|
"@types/fs-extra": "^9.0.13",
|
64
|
-
"@types/node": "^17.0.
|
65
|
-
"nodemon": "^2.0.
|
65
|
+
"@types/node": "^17.0.33",
|
66
|
+
"nodemon": "^2.0.16",
|
66
67
|
"replace-in-file": "^6.3.2",
|
67
68
|
"rimraf": "^3.0.2",
|
68
69
|
"ts-node": "^10.5.0",
|
69
70
|
"tsconfig-paths": "^3.12.0",
|
70
71
|
"typechain": "^8.0.0",
|
71
|
-
"typescript": "^4.
|
72
|
+
"typescript": "^4.6.4"
|
72
73
|
}
|
73
74
|
}
|
package/src/abi/index.ts
CHANGED