@instadapp/interop-x 0.0.0-dev.50c72b9 → 0.0.0-dev.55e8bb4

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.
Files changed (224) hide show
  1. package/.github/workflows/ci.yml +19 -0
  2. package/dist/package.json +4 -2
  3. package/dist/src/abi/connectors/index.js +36 -0
  4. package/dist/src/abi/connectors/v1/aave.js +148 -0
  5. package/dist/src/abi/connectors/v1/aave_claim.js +4 -0
  6. package/dist/src/abi/connectors/v1/aave_migrate.js +109 -0
  7. package/dist/src/abi/connectors/v1/aave_polygon_migrate.js +110 -0
  8. package/dist/src/abi/connectors/v1/aave_stake.js +4 -0
  9. package/dist/src/abi/connectors/v1/aave_v1_import.js +54 -0
  10. package/dist/src/abi/connectors/v1/aave_v2.js +230 -0
  11. package/dist/src/abi/connectors/v1/aave_v2_import.js +59 -0
  12. package/dist/src/abi/connectors/v1/authority.js +100 -0
  13. package/dist/src/abi/connectors/v1/basic.js +136 -0
  14. package/dist/src/abi/connectors/v1/chi.js +36 -0
  15. package/dist/src/abi/connectors/v1/comp.js +4 -0
  16. package/dist/src/abi/connectors/v1/compound.js +4 -0
  17. package/dist/src/abi/connectors/v1/compoundImport.js +69 -0
  18. package/dist/src/abi/connectors/v1/compoundImport_v2.js +4 -0
  19. package/dist/src/abi/connectors/v1/compound_old.js +448 -0
  20. package/dist/src/abi/connectors/v1/curve.js +140 -0
  21. package/dist/src/abi/connectors/v1/curve_claim.js +63 -0
  22. package/dist/src/abi/connectors/v1/curve_gauge.js +158 -0
  23. package/dist/src/abi/connectors/v1/curve_sbtc.js +140 -0
  24. package/dist/src/abi/connectors/v1/curve_susd.js +140 -0
  25. package/dist/src/abi/connectors/v1/curve_three.js +79 -0
  26. package/dist/src/abi/connectors/v1/curve_y.js +140 -0
  27. package/dist/src/abi/connectors/v1/dsa_migrate_v1_to_v2.js +4 -0
  28. package/dist/src/abi/connectors/v1/dydx.js +148 -0
  29. package/dist/src/abi/connectors/v1/dydx_flash.js +52 -0
  30. package/dist/src/abi/connectors/v1/fee.js +50 -0
  31. package/dist/src/abi/connectors/v1/gelato.js +1138 -0
  32. package/dist/src/abi/connectors/v1/index.js +58 -0
  33. package/dist/src/abi/connectors/v1/instapool.js +439 -0
  34. package/dist/src/abi/connectors/v1/instapool_v2.js +126 -0
  35. package/dist/src/abi/connectors/v1/kyber.js +117 -0
  36. package/dist/src/abi/connectors/v1/maker.js +480 -0
  37. package/dist/src/abi/connectors/v1/maker_old.js +300 -0
  38. package/dist/src/abi/connectors/v1/math.js +43 -0
  39. package/dist/src/abi/connectors/v1/migrate.js +46 -0
  40. package/dist/src/abi/connectors/v1/oasis.js +198 -0
  41. package/dist/src/abi/connectors/v1/oneInch.js +160 -0
  42. package/dist/src/abi/connectors/v1/polygon_bridge.js +4 -0
  43. package/dist/src/abi/connectors/v1/refinance.js +4 -0
  44. package/dist/src/abi/connectors/v1/staking.js +220 -0
  45. package/dist/src/abi/connectors/v1/swerve.js +179 -0
  46. package/dist/src/abi/connectors/v1/uniswap.js +297 -0
  47. package/dist/src/abi/connectors/v2/1INCH-A.js +4 -0
  48. package/dist/src/abi/connectors/v2/1INCH-B.js +4 -0
  49. package/dist/src/abi/connectors/v2/AAVE-CLAIM-A.js +4 -0
  50. package/dist/src/abi/connectors/v2/AAVE-CLAIM-B.js +166 -0
  51. package/dist/src/abi/connectors/v2/AAVE-STAKE-A.js +4 -0
  52. package/dist/src/abi/connectors/v2/AAVE-V1-A.js +130 -0
  53. package/dist/src/abi/connectors/v2/AAVE-V1-IMPORT-A.js +4 -0
  54. package/dist/src/abi/connectors/v2/AAVE-V2-A.js +230 -0
  55. package/dist/src/abi/connectors/v2/AAVE-V2-IMPORT-A.js +4 -0
  56. package/dist/src/abi/connectors/v2/AAVE-V2-IMPORT-B.js +225 -0
  57. package/dist/src/abi/connectors/v2/AUTHORITY-A.js +100 -0
  58. package/dist/src/abi/connectors/v2/B-COMPOUND-A.js +4 -0
  59. package/dist/src/abi/connectors/v2/B-LIQUITY-A.js +4 -0
  60. package/dist/src/abi/connectors/v2/B-MAKERDAO-A.js +4 -0
  61. package/dist/src/abi/connectors/v2/BASIC-A.js +136 -0
  62. package/dist/src/abi/connectors/v2/BASIC-B.js +4 -0
  63. package/dist/src/abi/connectors/v2/BASIC-C.js +4 -0
  64. package/dist/src/abi/connectors/v2/COMP-A.js +4 -0
  65. package/dist/src/abi/connectors/v2/COMPOUND-A.js +4 -0
  66. package/dist/src/abi/connectors/v2/COMPOUND-IMPORT-A.js +4 -0
  67. package/dist/src/abi/connectors/v2/COMPOUND-IMPORT-B.js +195 -0
  68. package/dist/src/abi/connectors/v2/G-UNISWAP-A.js +4 -0
  69. package/dist/src/abi/connectors/v2/GELATO-AAVE-A.js +4 -0
  70. package/dist/src/abi/connectors/v2/INST-A.js +4 -0
  71. package/dist/src/abi/connectors/v2/INST-LM-A.js +4 -0
  72. package/dist/src/abi/connectors/v2/INST-STAKING-A.js +4 -0
  73. package/dist/src/abi/connectors/v2/INST-STAKING-B.js +4 -0
  74. package/dist/src/abi/connectors/v2/INSTAPOOL-A.js +4 -0
  75. package/dist/src/abi/connectors/v2/LIQUITY-A.js +4 -0
  76. package/dist/src/abi/connectors/v2/MAKERDAO-A.js +4 -0
  77. package/dist/src/abi/connectors/v2/MAKERDAO-CLAIM-A.js +136 -0
  78. package/dist/src/abi/connectors/v2/PARASWAP-A.js +4 -0
  79. package/dist/src/abi/connectors/v2/POLYGON-BRIDGE-A.js +4 -0
  80. package/dist/src/abi/connectors/v2/REFINANCE-A.js +4 -0
  81. package/dist/src/abi/connectors/v2/REFLEXER-A.js +4 -0
  82. package/dist/src/abi/connectors/v2/STAKE-ERC20-A.js +4 -0
  83. package/dist/src/abi/connectors/v2/UNISWAP-A.js +297 -0
  84. package/dist/src/abi/connectors/v2/UNISWAP-V2-A.js +4 -0
  85. package/dist/src/abi/connectors/v2/UNISWAP-V3-A.js +4 -0
  86. package/dist/src/abi/connectors/v2/UNISWAP-V3-STAKE-A.js +4 -0
  87. package/dist/src/abi/connectors/v2/WETH-A.js +4 -0
  88. package/dist/src/abi/connectors/v2/YEARN-VAULT-A.js +4 -0
  89. package/dist/src/abi/connectors/v2/index.js +89 -0
  90. package/dist/src/abi/index.js +4 -0
  91. package/dist/src/abi/instList.json +232 -0
  92. package/dist/src/constants/addresses.js +5 -1
  93. package/dist/src/constants/blockConfirmations.js +8 -0
  94. package/dist/src/constants/index.js +1 -0
  95. package/dist/src/db/models/transaction.js +15 -11
  96. package/dist/src/gnosis/actions/aaveV2/index.js +11 -0
  97. package/dist/src/gnosis/actions/aaveV2/source.js +73 -0
  98. package/dist/src/gnosis/actions/aaveV2/target.js +85 -0
  99. package/dist/src/gnosis/actions/index.js +2 -2
  100. package/dist/src/index.js +1 -1
  101. package/dist/src/net/protocol/dial/SignatureDialProtocol.js +2 -2
  102. package/dist/src/tasks/InteropX/ProcessSubmitSubmitEvents.js +179 -0
  103. package/dist/src/tasks/InteropX/ProcessValidateEvents.js +183 -0
  104. package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +8 -5
  105. package/dist/src/tasks/InteropX/SyncLogValidateEvents.js +105 -0
  106. package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +4 -3
  107. package/dist/src/tasks/index.js +11 -0
  108. package/dist/src/typechain/InstList.js +2 -0
  109. package/dist/src/typechain/factories/InstList__factory.js +249 -0
  110. package/dist/src/typechain/factories/index.js +3 -1
  111. package/dist/src/typechain/index.js +3 -1
  112. package/dist/src/utils/index.js +58 -30
  113. package/package.json +4 -2
  114. package/src/abi/connectors/index.ts +14 -0
  115. package/src/abi/connectors/v1/aave.ts +147 -0
  116. package/src/abi/connectors/v1/aave_claim.ts +3 -0
  117. package/src/abi/connectors/v1/aave_migrate.ts +108 -0
  118. package/src/abi/connectors/v1/aave_polygon_migrate.ts +109 -0
  119. package/src/abi/connectors/v1/aave_stake.ts +3 -0
  120. package/src/abi/connectors/v1/aave_v1_import.ts +53 -0
  121. package/src/abi/connectors/v1/aave_v2.ts +229 -0
  122. package/src/abi/connectors/v1/aave_v2_import.ts +58 -0
  123. package/src/abi/connectors/v1/authority.ts +99 -0
  124. package/src/abi/connectors/v1/basic.ts +135 -0
  125. package/src/abi/connectors/v1/chi.ts +35 -0
  126. package/src/abi/connectors/v1/comp.ts +3 -0
  127. package/src/abi/connectors/v1/compound.ts +3 -0
  128. package/src/abi/connectors/v1/compoundImport.ts +68 -0
  129. package/src/abi/connectors/v1/compoundImport_v2.ts +3 -0
  130. package/src/abi/connectors/v1/compound_old.ts +447 -0
  131. package/src/abi/connectors/v1/curve.ts +139 -0
  132. package/src/abi/connectors/v1/curve_claim.ts +62 -0
  133. package/src/abi/connectors/v1/curve_gauge.ts +157 -0
  134. package/src/abi/connectors/v1/curve_sbtc.ts +139 -0
  135. package/src/abi/connectors/v1/curve_susd.ts +139 -0
  136. package/src/abi/connectors/v1/curve_three.ts +78 -0
  137. package/src/abi/connectors/v1/curve_y.ts +139 -0
  138. package/src/abi/connectors/v1/dsa_migrate_v1_to_v2.ts +3 -0
  139. package/src/abi/connectors/v1/dydx.ts +147 -0
  140. package/src/abi/connectors/v1/dydx_flash.ts +51 -0
  141. package/src/abi/connectors/v1/fee.ts +49 -0
  142. package/src/abi/connectors/v1/gelato.ts +1137 -0
  143. package/src/abi/connectors/v1/index.ts +42 -0
  144. package/src/abi/connectors/v1/instapool.ts +438 -0
  145. package/src/abi/connectors/v1/instapool_v2.ts +125 -0
  146. package/src/abi/connectors/v1/kyber.ts +116 -0
  147. package/src/abi/connectors/v1/maker.ts +479 -0
  148. package/src/abi/connectors/v1/maker_old.ts +299 -0
  149. package/src/abi/connectors/v1/math.ts +42 -0
  150. package/src/abi/connectors/v1/migrate.ts +45 -0
  151. package/src/abi/connectors/v1/oasis.ts +197 -0
  152. package/src/abi/connectors/v1/oneInch.ts +159 -0
  153. package/src/abi/connectors/v1/polygon_bridge.ts +3 -0
  154. package/src/abi/connectors/v1/refinance.ts +3 -0
  155. package/src/abi/connectors/v1/staking.ts +219 -0
  156. package/src/abi/connectors/v1/swerve.ts +178 -0
  157. package/src/abi/connectors/v1/uniswap.ts +297 -0
  158. package/src/abi/connectors/v2/1INCH-A.ts +3 -0
  159. package/src/abi/connectors/v2/1INCH-B.ts +3 -0
  160. package/src/abi/connectors/v2/AAVE-CLAIM-A.ts +3 -0
  161. package/src/abi/connectors/v2/AAVE-CLAIM-B.ts +165 -0
  162. package/src/abi/connectors/v2/AAVE-STAKE-A.ts +3 -0
  163. package/src/abi/connectors/v2/AAVE-V1-A.ts +130 -0
  164. package/src/abi/connectors/v2/AAVE-V1-IMPORT-A.ts +3 -0
  165. package/src/abi/connectors/v2/AAVE-V2-A.ts +229 -0
  166. package/src/abi/connectors/v2/AAVE-V2-IMPORT-A.ts +3 -0
  167. package/src/abi/connectors/v2/AAVE-V2-IMPORT-B.ts +224 -0
  168. package/src/abi/connectors/v2/AUTHORITY-A.ts +99 -0
  169. package/src/abi/connectors/v2/B-COMPOUND-A.ts +3 -0
  170. package/src/abi/connectors/v2/B-LIQUITY-A.ts +3 -0
  171. package/src/abi/connectors/v2/B-MAKERDAO-A.ts +3 -0
  172. package/src/abi/connectors/v2/BASIC-A.ts +135 -0
  173. package/src/abi/connectors/v2/BASIC-B.ts +3 -0
  174. package/src/abi/connectors/v2/BASIC-C.ts +3 -0
  175. package/src/abi/connectors/v2/COMP-A.ts +3 -0
  176. package/src/abi/connectors/v2/COMPOUND-A.ts +3 -0
  177. package/src/abi/connectors/v2/COMPOUND-IMPORT-A.ts +3 -0
  178. package/src/abi/connectors/v2/COMPOUND-IMPORT-B.ts +194 -0
  179. package/src/abi/connectors/v2/G-UNISWAP-A.ts +3 -0
  180. package/src/abi/connectors/v2/GELATO-AAVE-A.ts +3 -0
  181. package/src/abi/connectors/v2/INST-A.ts +3 -0
  182. package/src/abi/connectors/v2/INST-LM-A.ts +3 -0
  183. package/src/abi/connectors/v2/INST-STAKING-A.ts +3 -0
  184. package/src/abi/connectors/v2/INST-STAKING-B.ts +3 -0
  185. package/src/abi/connectors/v2/INSTAPOOL-A.ts +3 -0
  186. package/src/abi/connectors/v2/LIQUITY-A.ts +3 -0
  187. package/src/abi/connectors/v2/MAKERDAO-A.ts +3 -0
  188. package/src/abi/connectors/v2/MAKERDAO-CLAIM-A.ts +135 -0
  189. package/src/abi/connectors/v2/PARASWAP-A.ts +3 -0
  190. package/src/abi/connectors/v2/POLYGON-BRIDGE-A.ts +3 -0
  191. package/src/abi/connectors/v2/REFINANCE-A.ts +3 -0
  192. package/src/abi/connectors/v2/REFLEXER-A.ts +3 -0
  193. package/src/abi/connectors/v2/STAKE-ERC20-A.ts +3 -0
  194. package/src/abi/connectors/v2/UNISWAP-A.ts +297 -0
  195. package/src/abi/connectors/v2/UNISWAP-V2-A.ts +3 -0
  196. package/src/abi/connectors/v2/UNISWAP-V3-A.ts +3 -0
  197. package/src/abi/connectors/v2/UNISWAP-V3-STAKE-A.ts +3 -0
  198. package/src/abi/connectors/v2/WETH-A.ts +3 -0
  199. package/src/abi/connectors/v2/YEARN-VAULT-A.ts +3 -0
  200. package/src/abi/connectors/v2/index.ts +87 -0
  201. package/src/abi/index.ts +8 -4
  202. package/src/abi/instList.json +232 -0
  203. package/src/constants/addresses.ts +6 -2
  204. package/src/constants/blockConfirmations.ts +5 -0
  205. package/src/constants/index.ts +1 -0
  206. package/src/db/models/transaction.ts +117 -84
  207. package/src/gnosis/actions/aaveV2/index.ts +9 -0
  208. package/src/gnosis/actions/aaveV2/source.ts +118 -0
  209. package/src/gnosis/actions/aaveV2/target.ts +140 -0
  210. package/src/gnosis/actions/index.ts +2 -2
  211. package/src/net/protocol/dial/SignatureDialProtocol.ts +3 -2
  212. package/src/tasks/InteropX/ProcessSubmitSubmitEvents.ts +269 -0
  213. package/src/tasks/InteropX/ProcessValidateEvents.ts +274 -0
  214. package/src/tasks/InteropX/SyncLogSubmitEvents.ts +119 -116
  215. package/src/tasks/InteropX/SyncLogValidateEvents.ts +152 -0
  216. package/src/tasks/Transactions/SyncTransactionStatusTask.ts +4 -3
  217. package/src/tasks/index.ts +14 -1
  218. package/src/typechain/InstList.ts +402 -0
  219. package/src/typechain/factories/InstList__factory.ts +253 -0
  220. package/src/typechain/factories/index.ts +1 -0
  221. package/src/typechain/index.ts +2 -0
  222. package/src/utils/index.ts +169 -93
  223. package/dist/src/gnosis/actions/withdraw/index.js +0 -114
  224. package/src/gnosis/actions/withdraw/index.ts +0 -155
@@ -5,8 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Tasks = void 0;
7
7
  const waait_1 = __importDefault(require("waait"));
8
+ const SyncTransactionStatusTask_1 = __importDefault(require("./Transactions/SyncTransactionStatusTask"));
8
9
  const AutoUpdateTask_1 = __importDefault(require("./AutoUpdateTask"));
9
10
  const SyncLogSubmitEvents_1 = __importDefault(require("./InteropX/SyncLogSubmitEvents"));
11
+ const ProcessSubmitSubmitEvents_1 = __importDefault(require("./InteropX/ProcessSubmitSubmitEvents"));
12
+ const SyncLogValidateEvents_1 = __importDefault(require("./InteropX/SyncLogValidateEvents"));
13
+ const ProcessValidateEvents_1 = __importDefault(require("./InteropX/ProcessValidateEvents"));
10
14
  class Tasks {
11
15
  constructor() {
12
16
  this.tasks = [
@@ -15,6 +19,13 @@ class Tasks {
15
19
  // InteropX
16
20
  new SyncLogSubmitEvents_1.default({ chainId: 137 }),
17
21
  new SyncLogSubmitEvents_1.default({ chainId: 43114 }),
22
+ new ProcessSubmitSubmitEvents_1.default({ chainId: 137 }),
23
+ new ProcessSubmitSubmitEvents_1.default({ chainId: 43114 }),
24
+ new SyncLogValidateEvents_1.default({ chainId: 137 }),
25
+ new SyncLogValidateEvents_1.default({ chainId: 43114 }),
26
+ new ProcessValidateEvents_1.default({ chainId: 137 }),
27
+ new ProcessValidateEvents_1.default({ chainId: 43114 }),
28
+ new SyncTransactionStatusTask_1.default(),
18
29
  ];
19
30
  }
20
31
  async start() {
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ /* Autogenerated file. Do not edit manually. */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.InstList__factory = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const _abi = [
9
+ {
10
+ inputs: [
11
+ {
12
+ internalType: "address",
13
+ name: "_instaIndex",
14
+ type: "address",
15
+ },
16
+ ],
17
+ stateMutability: "nonpayable",
18
+ type: "constructor",
19
+ },
20
+ {
21
+ inputs: [
22
+ {
23
+ internalType: "uint64",
24
+ name: "",
25
+ type: "uint64",
26
+ },
27
+ ],
28
+ name: "accountAddr",
29
+ outputs: [
30
+ {
31
+ internalType: "address",
32
+ name: "",
33
+ type: "address",
34
+ },
35
+ ],
36
+ stateMutability: "view",
37
+ type: "function",
38
+ },
39
+ {
40
+ inputs: [
41
+ {
42
+ internalType: "address",
43
+ name: "",
44
+ type: "address",
45
+ },
46
+ ],
47
+ name: "accountID",
48
+ outputs: [
49
+ {
50
+ internalType: "uint64",
51
+ name: "",
52
+ type: "uint64",
53
+ },
54
+ ],
55
+ stateMutability: "view",
56
+ type: "function",
57
+ },
58
+ {
59
+ inputs: [
60
+ {
61
+ internalType: "uint64",
62
+ name: "",
63
+ type: "uint64",
64
+ },
65
+ ],
66
+ name: "accountLink",
67
+ outputs: [
68
+ {
69
+ internalType: "address",
70
+ name: "first",
71
+ type: "address",
72
+ },
73
+ {
74
+ internalType: "address",
75
+ name: "last",
76
+ type: "address",
77
+ },
78
+ {
79
+ internalType: "uint64",
80
+ name: "count",
81
+ type: "uint64",
82
+ },
83
+ ],
84
+ stateMutability: "view",
85
+ type: "function",
86
+ },
87
+ {
88
+ inputs: [
89
+ {
90
+ internalType: "uint64",
91
+ name: "",
92
+ type: "uint64",
93
+ },
94
+ {
95
+ internalType: "address",
96
+ name: "",
97
+ type: "address",
98
+ },
99
+ ],
100
+ name: "accountList",
101
+ outputs: [
102
+ {
103
+ internalType: "address",
104
+ name: "prev",
105
+ type: "address",
106
+ },
107
+ {
108
+ internalType: "address",
109
+ name: "next",
110
+ type: "address",
111
+ },
112
+ ],
113
+ stateMutability: "view",
114
+ type: "function",
115
+ },
116
+ {
117
+ inputs: [],
118
+ name: "accounts",
119
+ outputs: [
120
+ {
121
+ internalType: "uint64",
122
+ name: "",
123
+ type: "uint64",
124
+ },
125
+ ],
126
+ stateMutability: "view",
127
+ type: "function",
128
+ },
129
+ {
130
+ inputs: [
131
+ {
132
+ internalType: "address",
133
+ name: "_owner",
134
+ type: "address",
135
+ },
136
+ ],
137
+ name: "addAuth",
138
+ outputs: [],
139
+ stateMutability: "nonpayable",
140
+ type: "function",
141
+ },
142
+ {
143
+ inputs: [
144
+ {
145
+ internalType: "address",
146
+ name: "_account",
147
+ type: "address",
148
+ },
149
+ ],
150
+ name: "init",
151
+ outputs: [],
152
+ stateMutability: "nonpayable",
153
+ type: "function",
154
+ },
155
+ {
156
+ inputs: [],
157
+ name: "instaIndex",
158
+ outputs: [
159
+ {
160
+ internalType: "address",
161
+ name: "",
162
+ type: "address",
163
+ },
164
+ ],
165
+ stateMutability: "view",
166
+ type: "function",
167
+ },
168
+ {
169
+ inputs: [
170
+ {
171
+ internalType: "address",
172
+ name: "_owner",
173
+ type: "address",
174
+ },
175
+ ],
176
+ name: "removeAuth",
177
+ outputs: [],
178
+ stateMutability: "nonpayable",
179
+ type: "function",
180
+ },
181
+ {
182
+ inputs: [
183
+ {
184
+ internalType: "address",
185
+ name: "",
186
+ type: "address",
187
+ },
188
+ ],
189
+ name: "userLink",
190
+ outputs: [
191
+ {
192
+ internalType: "uint64",
193
+ name: "first",
194
+ type: "uint64",
195
+ },
196
+ {
197
+ internalType: "uint64",
198
+ name: "last",
199
+ type: "uint64",
200
+ },
201
+ {
202
+ internalType: "uint64",
203
+ name: "count",
204
+ type: "uint64",
205
+ },
206
+ ],
207
+ stateMutability: "view",
208
+ type: "function",
209
+ },
210
+ {
211
+ inputs: [
212
+ {
213
+ internalType: "address",
214
+ name: "",
215
+ type: "address",
216
+ },
217
+ {
218
+ internalType: "uint64",
219
+ name: "",
220
+ type: "uint64",
221
+ },
222
+ ],
223
+ name: "userList",
224
+ outputs: [
225
+ {
226
+ internalType: "uint64",
227
+ name: "prev",
228
+ type: "uint64",
229
+ },
230
+ {
231
+ internalType: "uint64",
232
+ name: "next",
233
+ type: "uint64",
234
+ },
235
+ ],
236
+ stateMutability: "view",
237
+ type: "function",
238
+ },
239
+ ];
240
+ class InstList__factory {
241
+ static createInterface() {
242
+ return new ethers_1.utils.Interface(_abi);
243
+ }
244
+ static connect(address, signerOrProvider) {
245
+ return new ethers_1.Contract(address, _abi, signerOrProvider);
246
+ }
247
+ }
248
+ exports.InstList__factory = InstList__factory;
249
+ InstList__factory.abi = _abi;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InteropX__factory = exports.GnosisSafe__factory = exports.Erc20__factory = void 0;
3
+ exports.InteropX__factory = exports.InstList__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,7 @@ 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 InstList__factory_1 = require("./InstList__factory");
12
+ Object.defineProperty(exports, "InstList__factory", { enumerable: true, get: function () { return InstList__factory_1.InstList__factory; } });
11
13
  var InteropX__factory_1 = require("./InteropX__factory");
12
14
  Object.defineProperty(exports, "InteropX__factory", { enumerable: true, get: function () { return InteropX__factory_1.InteropX__factory; } });
@@ -23,11 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.InteropX__factory = exports.GnosisSafe__factory = exports.Erc20__factory = exports.factories = void 0;
26
+ exports.InteropX__factory = exports.InstList__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 InstList__factory_1 = require("./factories/InstList__factory");
33
+ Object.defineProperty(exports, "InstList__factory", { enumerable: true, get: function () { return InstList__factory_1.InstList__factory; } });
32
34
  var InteropX__factory_1 = require("./factories/InteropX__factory");
33
35
  Object.defineProperty(exports, "InteropX__factory", { enumerable: true, get: function () { return InteropX__factory_1.InteropX__factory; } });
@@ -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.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;
6
+ exports.encodeConnectorMethod = 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
  */
@@ -12,6 +12,8 @@ const axios_retry_1 = __importDefault(require("axios-retry"));
12
12
  const constants_1 = require("@/constants");
13
13
  const ethers_1 = require("ethers");
14
14
  const async_retry_1 = __importDefault(require("async-retry"));
15
+ const connectors_1 = require("@/abi/connectors");
16
+ const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
15
17
  exports.http = axios_1.default.create();
16
18
  (0, axios_retry_1.default)(exports.http, { retries: 3, retryDelay: axios_retry_1.default.exponentialDelay });
17
19
  function shortenHash(hash, length = 4) {
@@ -25,10 +27,10 @@ function shortenHash(hash, length = 4) {
25
27
  }
26
28
  exports.shortenHash = shortenHash;
27
29
  function short(buffer) {
28
- return buffer.toString('hex').slice(0, 8) + '...';
30
+ return buffer.toString("hex").slice(0, 8) + "...";
29
31
  }
30
32
  exports.short = short;
31
- const signGnosisSafeTx = async ({ to, data = null, value = '0', operation = '1', baseGas = '0', gasPrice = "0", gasToken = "0x0000000000000000000000000000000000000000", refundReceiver = "0x0000000000000000000000000000000000000000", safeTxGas = "79668", nonce = "0", chainId = 137, }, { signer }) => {
33
+ const signGnosisSafeTx = async ({ to, data = null, value = "0", operation = "1", baseGas = "0", gasPrice = "0", gasToken = "0x0000000000000000000000000000000000000000", refundReceiver = "0x0000000000000000000000000000000000000000", safeTxGas = "79668", nonce = "0", chainId = 137, }, { signer }) => {
32
34
  const gnosisSafe = constants_1.addresses[chainId].gnosisSafe;
33
35
  const domain = {
34
36
  verifyingContract: gnosisSafe,
@@ -36,16 +38,16 @@ const signGnosisSafeTx = async ({ to, data = null, value = '0', operation = '1',
36
38
  };
37
39
  const types = {
38
40
  SafeTx: [
39
- { type: 'address', name: 'to' },
40
- { type: 'uint256', name: 'value' },
41
- { type: 'bytes', name: 'data' },
42
- { type: 'uint8', name: 'operation' },
43
- { type: 'uint256', name: 'safeTxGas' },
44
- { type: 'uint256', name: 'baseGas' },
45
- { type: 'uint256', name: 'gasPrice' },
46
- { type: 'address', name: 'gasToken' },
47
- { type: 'address', name: 'refundReceiver' },
48
- { type: 'uint256', name: 'nonce' },
41
+ { type: "address", name: "to" },
42
+ { type: "uint256", name: "value" },
43
+ { type: "bytes", name: "data" },
44
+ { type: "uint8", name: "operation" },
45
+ { type: "uint256", name: "safeTxGas" },
46
+ { type: "uint256", name: "baseGas" },
47
+ { type: "uint256", name: "gasPrice" },
48
+ { type: "address", name: "gasToken" },
49
+ { type: "address", name: "refundReceiver" },
50
+ { type: "uint256", name: "nonce" },
49
51
  ],
50
52
  };
51
53
  const message = {
@@ -67,11 +69,11 @@ exports.signGnosisSafeTx = signGnosisSafeTx;
67
69
  const getRpcProviderUrl = (chainId) => {
68
70
  switch (chainId) {
69
71
  case 1:
70
- return 'https://rpc.ankr.com/eth';
72
+ return "https://rpc.ankr.com/eth";
71
73
  case 137:
72
- return 'https://rpc.ankr.com/polygon';
74
+ return "https://rpc.ankr.com/polygon";
73
75
  case 43114:
74
- return 'https://rpc.ankr.com/avalanche';
76
+ return "https://rpc.ankr.com/avalanche";
75
77
  default:
76
78
  throw new Error(`Unknown chainId: ${chainId}`);
77
79
  }
@@ -93,16 +95,16 @@ exports.buildSignatureBytes = buildSignatureBytes;
93
95
  const asyncCallWithTimeout = async (asyncPromise, timeout) => {
94
96
  let timeoutHandle;
95
97
  const timeoutPromise = new Promise((_resolve, reject) => {
96
- timeoutHandle = setTimeout(() => reject(new Error('Async call timeout limit reached')), timeout);
98
+ timeoutHandle = setTimeout(() => reject(new Error("Async call timeout limit reached")), timeout);
97
99
  });
98
- return Promise.race([asyncPromise, timeoutPromise]).then(result => {
100
+ return Promise.race([asyncPromise, timeoutPromise]).then((result) => {
99
101
  clearTimeout(timeoutHandle);
100
102
  return result;
101
103
  });
102
104
  };
103
105
  exports.asyncCallWithTimeout = asyncCallWithTimeout;
104
106
  const generateInteropTransactionHash = (data) => {
105
- return ethers_1.ethers.utils.solidityKeccak256(Array.from(Array(7), () => 'string'), [
107
+ return ethers_1.ethers.utils.solidityKeccak256(Array.from({ length: 7 }, () => "string"), [
106
108
  String(data.actionId),
107
109
  String(data.vnonce),
108
110
  String(data.sourceSender),
@@ -117,25 +119,27 @@ class ContractError extends Error {
117
119
  }
118
120
  exports.ContractError = ContractError;
119
121
  function getContract(address, contractInterface, signerOrProvider) {
120
- if (!ethers_1.ethers.utils.getAddress(address) || address === ethers_1.ethers.constants.AddressZero) {
122
+ if (!ethers_1.ethers.utils.getAddress(address) ||
123
+ address === ethers_1.ethers.constants.AddressZero) {
121
124
  throw Error(`Invalid 'address' parameter '${address}'.`);
122
125
  }
123
126
  const contract = new ethers_1.ethers.Contract(address, contractInterface, signerOrProvider);
124
127
  // Make sure the contract properties is writable
125
- const desc = Object.getOwnPropertyDescriptor(contract, 'functions');
128
+ const desc = Object.getOwnPropertyDescriptor(contract, "functions");
126
129
  if (!desc || desc.writable !== true) {
127
130
  return contract;
128
131
  }
129
132
  return new Proxy(contract, {
130
133
  get(target, prop, receiver) {
131
134
  const value = Reflect.get(target, prop, receiver);
132
- if (typeof value === 'function' && (contract.functions.hasOwnProperty(prop) || ['queryFilter'].includes(String(prop)))) {
135
+ if (typeof value === "function" &&
136
+ (contract.functions.hasOwnProperty(prop) ||
137
+ ["queryFilter"].includes(String(prop)))) {
133
138
  let isConstant = false;
134
139
  try {
135
140
  isConstant = contract.interface.getFunction(String(prop)).constant;
136
141
  }
137
- catch (error) {
138
- }
142
+ catch (error) { }
139
143
  return async (...args) => {
140
144
  try {
141
145
  return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: isConstant ? 1 : 3 });
@@ -149,15 +153,21 @@ function getContract(address, contractInterface, signerOrProvider) {
149
153
  }
150
154
  };
151
155
  }
152
- if (typeof value === 'object' && ['populateTransaction', 'estimateGas', 'functions', 'callStatic'].includes(String(prop))) {
156
+ if (typeof value === "object" &&
157
+ [
158
+ "populateTransaction",
159
+ "estimateGas",
160
+ "functions",
161
+ "callStatic",
162
+ ].includes(String(prop))) {
153
163
  const parentProp = String(prop);
154
164
  return new Proxy(value, {
155
165
  get(target, prop, receiver) {
156
166
  const value = Reflect.get(target, prop, receiver);
157
- if (typeof value === 'function') {
167
+ if (typeof value === "function") {
158
168
  return async (...args) => {
159
169
  try {
160
- return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: parentProp === 'callStatic' ? 3 : 1 });
170
+ return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: parentProp === "callStatic" ? 3 : 1 });
161
171
  }
162
172
  catch (error) {
163
173
  const err = new ContractError(`Error calling "${String(prop)}" using "${parentProp}" on "${address}": ${error.reason || error.message}`);
@@ -168,7 +178,7 @@ function getContract(address, contractInterface, signerOrProvider) {
168
178
  }
169
179
  };
170
180
  }
171
- }
181
+ },
172
182
  });
173
183
  }
174
184
  return value;
@@ -180,7 +190,9 @@ const generateGnosisTransaction = async (transactionData, safeContract) => {
180
190
  console.log(transactionData);
181
191
  let isExecuted = await safeContract.dataHashes(await safeContract.getTransactionHash(transactionData.to, transactionData.value, transactionData.data, transactionData.operation, transactionData.safeTxGas, transactionData.baseGas, transactionData.gasPrice, transactionData.gasToken, transactionData.refundReceiver, transactionData.nonce));
182
192
  while (isExecuted == 1) {
183
- transactionData.safeTxGas = ethers_1.ethers.BigNumber.from(String(transactionData.safeTxGas)).add(1).toString();
193
+ transactionData.safeTxGas = ethers_1.ethers.BigNumber.from(String(transactionData.safeTxGas))
194
+ .add(1)
195
+ .toString();
184
196
  isExecuted = await safeContract.dataHashes(await safeContract.getTransactionHash(transactionData.to, transactionData.value, transactionData.data, transactionData.operation, transactionData.safeTxGas, transactionData.baseGas, transactionData.gasPrice, transactionData.gasToken, transactionData.refundReceiver, transactionData.nonce));
185
197
  }
186
198
  return transactionData;
@@ -188,8 +200,24 @@ const generateGnosisTransaction = async (transactionData, safeContract) => {
188
200
  exports.generateGnosisTransaction = generateGnosisTransaction;
189
201
  class LiquidityError extends Error {
190
202
  constructor(message) {
191
- super(message || 'Not enough liquidity');
203
+ super(message || "Not enough liquidity");
192
204
  Object.setPrototypeOf(this, new.target.prototype);
193
205
  }
194
206
  }
195
207
  exports.LiquidityError = LiquidityError;
208
+ const encodeConnectorMethod = (params) => {
209
+ const connectorInterface = getInterface(connectors_1.connectors.versions[2][params.connector], params.method);
210
+ if (!connectorInterface)
211
+ throw new Error(`ConnectorInterface '${params.method}' not found`);
212
+ //@ts-ignore
213
+ return web3_eth_abi_1.default.encodeFunctionCall(connectorInterface, params.args);
214
+ };
215
+ exports.encodeConnectorMethod = encodeConnectorMethod;
216
+ const getInterface = (abiItems, method) => {
217
+ const abiItem = abiItems.find((abiItem) => abiItem.name === method);
218
+ if (!abiItem) {
219
+ console.error(`${method} is an invalid method.`);
220
+ return;
221
+ }
222
+ return abiItem;
223
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/interop-x",
3
- "version": "0.0.0-dev.50c72b9",
3
+ "version": "0.0.0-dev.55e8bb4",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -52,7 +52,9 @@
52
52
  "postinstall-postinstall": "^2.1.0",
53
53
  "sequelize": "6.18.0",
54
54
  "sqlite3": "^5.0.8",
55
- "waait": "^1.0.5"
55
+ "waait": "^1.0.5",
56
+ "web3-eth-abi": "^1.7.3",
57
+ "web3-utils": "^1.7.3"
56
58
  },
57
59
  "bin": {
58
60
  "interop-x": "bin/interop-x",
@@ -0,0 +1,14 @@
1
+ export * as connectorsV1 from './v1'
2
+ export * as connectorsV2_M1 from './v2'
3
+
4
+ import * as connectorsV1 from './v1'
5
+ import { connectorsV2_M1 } from './v2'
6
+
7
+ export type Connector = keyof typeof connectorsV1 | keyof typeof connectorsV2_M1
8
+
9
+ export const connectors = {
10
+ versions: {
11
+ 1: connectorsV1,
12
+ 2: connectorsV2_M1
13
+ }
14
+ }