From 1f4ace1bee8d89a10cbd54b65c8d2878d7cca09d Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 4 May 2021 21:01:38 -0700 Subject: [PATCH] add evmDeprecated and update evm-call --- commands/evm-call.js | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/commands/evm-call.js b/commands/evm-call.js index d9f3b7ed..62459206 100644 --- a/commands/evm-call.js +++ b/commands/evm-call.js @@ -1,8 +1,4 @@ -const exitOnError = require('../utils/exit-on-error'); -const web3 = require('web3'); -const { NearProvider, utils } = require('near-web3-provider'); -const assert = require('assert'); -const checkCredentials = require('../utils/check-credentials'); +const { evmDeprecated } = require('../utils/deprecation-warning'); module.exports = { command: 'evm-call [args]', @@ -33,27 +29,5 @@ module.exports = { desc: 'Path to ABI for given contract', type: 'string', }), - handler: exitOnError(scheduleEVMFunctionCall) + handler: () => console.log(evmDeprecated) }; - -async function scheduleEVMFunctionCall(options) { - await checkCredentials(options.accountId, options.networkId, options.keyStore); - const args = JSON.parse(options.args || '[]'); - console.log(`Scheduling a call inside ${options.evmAccount} EVM:`); - console.log(`${options.contractName}.${options.methodName}()` + - (options.amount && options.amount !== '0' ? ` with attached ${options.amount} NEAR` : '')); - console.log(' with args', args); - const web = new web3(); - web.setProvider(new NearProvider({ - nodeUrl: options.nodeUrl, - // TODO: make sure near-api-js has the same version between near-web3-provider. - // keyStore: options.keyStore, - masterAccountId: options.accountId, - networkId: options.networkId, - evmAccountId: options.evmAccount, - keyPath: options.keyPath, - })); - const contract = new web.eth.Contract(options.abi, options.contractName); - assert(options.methodName in contract.methods, `${options.methodName} is not present in ABI`); - await contract.methods[options.methodName](...args).send({ from: utils.nearAccountToEvmAddress(options.accountId) }); -}