@instadapp/interop-x 0.0.0-dev.c2272fd → 0.0.0-dev.dc4f10a

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.c2272fd",
3
+ "version": "0.0.0-dev.dc4f10a",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
package/dist/src/index.js CHANGED
@@ -40,7 +40,7 @@ catch (e) {
40
40
  logger.error('Invalid private key');
41
41
  process.exit(1);
42
42
  }
43
- logger.debug(`Starting Interop X Node (v${package_json_1.default.version} - rev.c2272fd)`);
43
+ logger.debug(`Starting Interop X Node (v${package_json_1.default.version} - rev.dc4f10a)`);
44
44
  const tasks_1 = require("@/tasks");
45
45
  const net_1 = require("@/net");
46
46
  const api_1 = require("@/api");
@@ -138,7 +138,9 @@ class ProcessWithdrawEvents extends BaseTask_1.BaseTask {
138
138
  }
139
139
  async start() {
140
140
  this.logger.info(`Starting execution watcher on interop chain`);
141
+ this.contractAddress = constants_1.addresses[this.chainId].interopXGateway;
141
142
  this.provider = new ethers_1.ethers.providers.JsonRpcProvider((0, utils_1.getRpcProviderUrl)(this.chainId));
143
+ this.contract = (0, utils_1.getContract)(this.contractAddress, abi_1.default.interopXGateway, new ethers_1.ethers.Wallet(config_1.default.privateKey, this.provider));
142
144
  await super.start();
143
145
  }
144
146
  }
@@ -157,7 +157,7 @@ const buildWithdrawDataForTransaction = async (transaction, type) => {
157
157
  if (!transaction.submitEvent) {
158
158
  throw Error('Cannot build data for transaction without submitEvent');
159
159
  }
160
- const { to, amount, chainId, itoken: itokenAddress } = transaction.submitEvent;
160
+ const { to, amount, chainId, itokenAddress } = transaction.submitEvent;
161
161
  const itoken = constants_1.itokens[transaction.sourceChainId].find(token => token.address.toLowerCase() === itokenAddress.toLowerCase());
162
162
  if (!itoken) {
163
163
  throw Error('Cannot build data for transaction without itoken');
@@ -170,7 +170,7 @@ const buildWithdrawDataForTransaction = async (transaction, type) => {
170
170
  const targetWallet = new ethers_1.ethers.Wallet(config_1.default.privateKey, targetChainProvider);
171
171
  const gatewayAddress = constants_1.addresses[chainId].interopXGateway;
172
172
  const interopBridgeContract = getContract(gatewayAddress, abi_1.default.interopXGateway, targetWallet);
173
- const { data } = await interopBridgeContract.populateTransaction.systemWithdraw(ethers_1.ethers.BigNumber.from(amount.toString()), to, token.address, ethers_1.ethers.BigNumber.from(transaction.sourceChainId.toString()), transaction.submitTransactionHash);
173
+ const { data } = await interopBridgeContract.populateTransaction.systemWithdraw(ethers_1.ethers.BigNumber.from(amount.toString()), to, token.address, ethers_1.ethers.BigNumber.from(transaction.submitEvent.sourceChainId.toString()), transaction.submitTransactionHash);
174
174
  transactions.push({
175
175
  to: gatewayAddress,
176
176
  data: data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/interop-x",
3
- "version": "0.0.0-dev.c2272fd",
3
+ "version": "0.0.0-dev.dc4f10a",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -54,7 +54,9 @@ const generateGnosisTransaction = async (transactionData: any, safeContract: Gno
54
54
  }
55
55
 
56
56
  class ProcessWithdrawEvents extends BaseTask {
57
+ contractAddress: string;
57
58
  provider: ethers.providers.JsonRpcProvider;
59
+ contract: InteropXGateway;
58
60
  chainId: ChainId;
59
61
  leadNodeOnly = true
60
62
 
@@ -220,10 +222,18 @@ class ProcessWithdrawEvents extends BaseTask {
220
222
  async start(): Promise<void> {
221
223
  this.logger.info(`Starting execution watcher on interop chain`);
222
224
 
225
+ this.contractAddress = addresses[this.chainId].interopXGateway;
226
+
223
227
  this.provider = new ethers.providers.JsonRpcProvider(
224
228
  getRpcProviderUrl(this.chainId)
225
229
  );
226
230
 
231
+ this.contract = getContract<InteropXGateway>(
232
+ this.contractAddress,
233
+ abi.interopXGateway,
234
+ new ethers.Wallet(config.privateKey!, this.provider)
235
+ );
236
+
227
237
  await super.start()
228
238
  }
229
239
  }
@@ -210,7 +210,7 @@ export const buildWithdrawDataForTransaction = async (transaction: Transaction,
210
210
  throw Error('Cannot build data for transaction without submitEvent');
211
211
  }
212
212
 
213
- const { to, amount, chainId, itoken: itokenAddress } = transaction.submitEvent;
213
+ const { to, amount, chainId, itokenAddress } = transaction.submitEvent;
214
214
 
215
215
  const itoken = itokens[transaction.sourceChainId].find(token => token.address.toLowerCase() === itokenAddress.toLowerCase());
216
216
 
@@ -233,7 +233,7 @@ export const buildWithdrawDataForTransaction = async (transaction: Transaction,
233
233
  ethers.BigNumber.from(amount.toString()),
234
234
  to,
235
235
  token.address,
236
- ethers.BigNumber.from(transaction.sourceChainId.toString()),
236
+ ethers.BigNumber.from(transaction.submitEvent.sourceChainId.toString()),
237
237
  transaction.submitTransactionHash,
238
238
  );
239
239