@instadapp/interop-x 0.0.0-dev.92afe89 → 0.0.0-dev.f78418c

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. package/bin/interop-x +1 -1
  2. package/dist/abi/erc20.json +350 -0
  3. package/dist/abi/gnosisSafe.json +747 -0
  4. package/dist/abi/index.js +15 -0
  5. package/dist/abi/interopBridgeToken.json +286 -0
  6. package/dist/abi/interopXGateway.json +184 -0
  7. package/dist/config/index.js +1 -1
  8. package/dist/constants/addresses.js +18 -3
  9. package/dist/constants/index.js +1 -0
  10. package/dist/constants/tokens.js +107 -0
  11. package/dist/db/models/index.js +1 -1
  12. package/dist/db/models/transaction.js +52 -0
  13. package/dist/index.js +14 -5
  14. package/dist/net/peer/index.js +5 -5
  15. package/dist/net/pool/index.js +2 -2
  16. package/dist/net/protocol/dial/BaseDialProtocol.js +1 -1
  17. package/dist/net/protocol/dial/SignatureDialProtocol.js +11 -13
  18. package/dist/net/protocol/index.js +3 -3
  19. package/dist/tasks/BaseTask.js +2 -2
  20. package/dist/tasks/InteropXGateway/SyncDepositEvents.js +79 -0
  21. package/dist/tasks/index.js +9 -1
  22. package/dist/typechain/Erc20.js +2 -0
  23. package/dist/typechain/GnosisSafe.js +2 -0
  24. package/dist/typechain/InteropBridgeToken.js +2 -0
  25. package/dist/typechain/InteropXGateway.js +2 -0
  26. package/dist/typechain/common.js +2 -0
  27. package/dist/typechain/factories/Erc20__factory.js +367 -0
  28. package/dist/typechain/factories/GnosisSafe__factory.js +1174 -0
  29. package/dist/typechain/factories/InteropBridgeToken__factory.js +459 -0
  30. package/dist/typechain/factories/InteropXGateway__factory.js +265 -0
  31. package/dist/typechain/factories/index.js +14 -0
  32. package/dist/typechain/index.js +35 -0
  33. package/dist/utils/index.js +14 -2
  34. package/package.json +23 -3
  35. package/src/abi/erc20.json +350 -0
  36. package/src/abi/gnosisSafe.json +747 -0
  37. package/src/abi/index.ts +11 -0
  38. package/src/abi/interopBridgeToken.json +286 -0
  39. package/src/abi/interopXGateway.json +184 -0
  40. package/src/config/index.ts +1 -1
  41. package/src/constants/addresses.ts +18 -3
  42. package/src/constants/index.ts +1 -0
  43. package/src/constants/tokens.ts +104 -0
  44. package/src/db/index.ts +1 -1
  45. package/src/db/models/index.ts +1 -1
  46. package/src/db/models/transaction.ts +92 -0
  47. package/src/index.ts +16 -5
  48. package/src/net/peer/index.ts +3 -3
  49. package/src/net/pool/index.ts +2 -2
  50. package/src/net/protocol/dial/BaseDialProtocol.ts +1 -1
  51. package/src/net/protocol/dial/SignatureDialProtocol.ts +13 -16
  52. package/src/net/protocol/index.ts +3 -3
  53. package/src/tasks/BaseTask.ts +2 -3
  54. package/src/tasks/InteropXGateway/SyncDepositEvents.ts +114 -0
  55. package/src/tasks/index.ts +4 -1
  56. package/src/typechain/Erc20.ts +491 -0
  57. package/src/typechain/GnosisSafe.ts +1728 -0
  58. package/src/typechain/InteropBridgeToken.ts +686 -0
  59. package/src/typechain/InteropXGateway.ts +407 -0
  60. package/src/typechain/common.ts +44 -0
  61. package/src/typechain/factories/Erc20__factory.ts +368 -0
  62. package/src/typechain/factories/GnosisSafe__factory.ts +1178 -0
  63. package/src/typechain/factories/InteropBridgeToken__factory.ts +466 -0
  64. package/src/typechain/factories/InteropXGateway__factory.ts +272 -0
  65. package/src/typechain/factories/index.ts +7 -0
  66. package/src/typechain/index.ts +12 -0
  67. package/src/types.ts +2 -2
  68. package/src/utils/index.ts +15 -2
  69. package/tsconfig.json +3 -0
  70. package/dist/db/models/execution.js +0 -38
  71. package/src/db/models/execution.ts +0 -57
@@ -0,0 +1,7 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export { Erc20__factory } from "./Erc20__factory";
5
+ export { GnosisSafe__factory } from "./GnosisSafe__factory";
6
+ export { InteropBridgeToken__factory } from "./InteropBridgeToken__factory";
7
+ export { InteropXGateway__factory } from "./InteropXGateway__factory";
@@ -0,0 +1,12 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export type { Erc20 } from "./Erc20";
5
+ export type { GnosisSafe } from "./GnosisSafe";
6
+ export type { InteropBridgeToken } from "./InteropBridgeToken";
7
+ export type { InteropXGateway } from "./InteropXGateway";
8
+ export * as factories from "./factories";
9
+ export { Erc20__factory } from "./factories/Erc20__factory";
10
+ export { GnosisSafe__factory } from "./factories/GnosisSafe__factory";
11
+ export { InteropBridgeToken__factory } from "./factories/InteropBridgeToken__factory";
12
+ export { InteropXGateway__factory } from "./factories/InteropXGateway__factory";
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from 'events'
2
- import { IPeerInfo } from './net'
2
+ import { IPeerInfo } from '@/net'
3
3
 
4
4
  /**
5
5
  * Types for the central event bus, emitted
@@ -36,4 +36,4 @@ export type EventBusType = EventBus<Event.PEER_CONNECTED> &
36
36
  EventBus<Event.POOL_PEER_BANNED>
37
37
 
38
38
 
39
- export type ChainId = 1 | 137;
39
+ export type ChainId = 1 | 137 | 43114;
@@ -3,8 +3,9 @@
3
3
  */
4
4
  import axios from 'axios'
5
5
  import axiosRetry from "axios-retry";
6
- import { addresses } from '../constants';
7
- import { ChainId } from '../types'
6
+ import { addresses } from '@/constants';
7
+ import { ChainId } from '@/types'
8
+ import { ethers } from 'ethers';
8
9
 
9
10
  export const http = axios.create();
10
11
 
@@ -73,6 +74,8 @@ export const getRpcProviderUrl = (chainId: ChainId) => {
73
74
  return 'https://rpc.instadapp.io/mainnet';
74
75
  case 137:
75
76
  return 'https://rpc.instadapp.io/polygon';
77
+ case 43114:
78
+ return 'https://rpc.instadapp.io/avalanche';
76
79
  default:
77
80
  throw new Error(`Unknown chainId: ${chainId}`);
78
81
  }
@@ -113,4 +116,14 @@ export const asyncCallWithTimeout = async <T>(asyncPromise: Promise<T>, timeout:
113
116
  clearTimeout(timeoutHandle);
114
117
  return result;
115
118
  }) as Promise<T>
119
+ }
120
+
121
+
122
+ export const generateInteropTransactionHash = (data: { type: string, sourceTransactionHash: string, sourceChainId: string | number, targetChainId: string | number }) => {
123
+ return ethers.utils.solidityKeccak256(['string', 'string', 'string', 'string'], [
124
+ String(data.type),
125
+ String(data.sourceTransactionHash),
126
+ String(data.sourceChainId),
127
+ String(data.targetChainId),
128
+ ]);
116
129
  }
package/tsconfig.json CHANGED
@@ -16,6 +16,9 @@
16
16
  "noEmit": false,
17
17
  "outDir": "dist",
18
18
  "baseUrl": "src",
19
+ "paths": {
20
+ "@/*" : ["./*" ]
21
+ },
19
22
  "typeRoots": [
20
23
  "./node_modules/@types",
21
24
  "./@types"
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Execution = void 0;
4
- const sequelize_1 = require("../sequelize");
5
- const sequelize_2 = require("sequelize");
6
- class Execution extends sequelize_2.Model {
7
- }
8
- exports.Execution = Execution;
9
- Execution.init({
10
- id: {
11
- type: sequelize_2.DataTypes.INTEGER,
12
- autoIncrement: true,
13
- primaryKey: true
14
- },
15
- transactionHash: sequelize_2.DataTypes.STRING,
16
- from: sequelize_2.DataTypes.STRING,
17
- executions: sequelize_2.DataTypes.JSON,
18
- chainId: sequelize_2.DataTypes.NUMBER,
19
- gas: sequelize_2.DataTypes.STRING,
20
- maxGasPrice: sequelize_2.DataTypes.STRING,
21
- assets: sequelize_2.DataTypes.JSON,
22
- metadata: sequelize_2.DataTypes.STRING,
23
- vnonce: sequelize_2.DataTypes.STRING,
24
- txHash: sequelize_2.DataTypes.STRING,
25
- blockNumber: sequelize_2.DataTypes.STRING,
26
- status: {
27
- type: sequelize_2.DataTypes.STRING,
28
- defaultValue: 'pending'
29
- },
30
- delayUntil: sequelize_2.DataTypes.DATE,
31
- delayedCount: {
32
- type: sequelize_2.DataTypes.INTEGER,
33
- defaultValue: 0
34
- },
35
- error: sequelize_2.DataTypes.STRING,
36
- createdAt: sequelize_2.DataTypes.DATE,
37
- updatedAt: sequelize_2.DataTypes.DATE,
38
- }, { sequelize: sequelize_1.sequelize, tableName: 'executions' });
@@ -1,57 +0,0 @@
1
- import { sequelize } from '../sequelize'
2
- import { CreationOptional, InferAttributes, InferCreationAttributes, Model, DataTypes } from 'sequelize';
3
-
4
- export class Execution extends Model<InferAttributes<Execution>, InferCreationAttributes<Execution>> {
5
- declare id: CreationOptional<number>;
6
-
7
- declare transactionHash: string;
8
- declare from: string;
9
- declare executions: any[];
10
- declare chainId: number;
11
- declare gas: string;
12
- declare maxGasPrice: string;
13
- declare assets: any[];
14
- declare metadata: string;
15
- declare vnonce: string;
16
- declare txHash: string;
17
-
18
- declare blockNumber: string;
19
- declare status: CreationOptional<string>;
20
- declare delayUntil: CreationOptional<Date>;
21
- declare delayedCount: CreationOptional<number>;
22
-
23
- declare error: CreationOptional<string>;
24
- declare createdAt: CreationOptional<Date>;
25
- declare updatedAt: CreationOptional<Date>;
26
- }
27
-
28
- Execution.init({
29
- id: {
30
- type: DataTypes.INTEGER,
31
- autoIncrement: true,
32
- primaryKey: true
33
- },
34
- transactionHash: DataTypes.STRING,
35
- from: DataTypes.STRING,
36
- executions: DataTypes.JSON,
37
- chainId: DataTypes.NUMBER,
38
- gas: DataTypes.STRING,
39
- maxGasPrice: DataTypes.STRING,
40
- assets: DataTypes.JSON,
41
- metadata: DataTypes.STRING,
42
- vnonce: DataTypes.STRING,
43
- txHash: DataTypes.STRING,
44
- blockNumber: DataTypes.STRING,
45
- status: {
46
- type: DataTypes.STRING,
47
- defaultValue: 'pending'
48
- },
49
- delayUntil: DataTypes.DATE,
50
- delayedCount: {
51
- type: DataTypes.INTEGER,
52
- defaultValue: 0
53
- },
54
- error: DataTypes.STRING,
55
- createdAt: DataTypes.DATE,
56
- updatedAt: DataTypes.DATE,
57
- }, { sequelize, tableName: 'executions' });