From ca756ac2f42f1571903b9887ab2e94eb27eb4685 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 14 Jan 2021 10:57:52 +0100 Subject: [PATCH 01/52] refactor_send_txs --- apps/remix-ide/src/app/tabs/network-module.js | 12 - .../src/app/tabs/runTab/model/recorder.js | 4 +- apps/remix-ide/src/blockchain/blockchain.js | 69 ++-- apps/remix-ide/src/blockchain/providers/vm.js | 8 +- .../src/blockchain/txResultHelper.js | 46 --- jest.config.js | 15 +- .../src/execution/execution-context.ts | 36 +- libs/remix-lib/src/execution/txExecution.ts | 10 +- libs/remix-lib/src/execution/txFormat.ts | 2 +- libs/remix-lib/src/execution/txListener.ts | 37 +- libs/remix-lib/src/execution/txRunner.ts | 252 +----------- libs/remix-lib/src/execution/txRunnerVM.ts | 120 ++++++ libs/remix-lib/src/execution/txRunnerWeb3.ts | 156 +++++++ libs/remix-lib/src/helpers/txResultHelper.ts | 8 +- libs/remix-lib/src/index.ts | 18 +- libs/remix-lib/src/universalDapp.ts | 379 ------------------ .../src/web3Provider/web3VmProvider.ts | 6 + libs/remix-lib/test/txFormat.ts | 4 +- libs/remix-lib/test/txResultHelper.ts | 37 +- libs/remix-simulator/src/genesis.ts | 8 +- libs/remix-simulator/src/index.ts | 2 +- libs/remix-simulator/src/methods/accounts.ts | 16 +- libs/remix-simulator/src/methods/blocks.ts | 18 +- libs/remix-simulator/src/methods/debug.ts | 12 +- libs/remix-simulator/src/methods/filters.ts | 24 +- .../src/methods/transactions.ts | 69 +++- libs/remix-simulator/src/methods/txProcess.ts | 25 +- libs/remix-simulator/src/provider.ts | 57 ++- libs/remix-simulator/src/vm-context.ts | 147 +++++++ libs/remix-tests/jest.config.js | 4 +- libs/remix-tests/src/deployer.ts | 2 +- libs/remix-tests/tests/testRunner.cli.spec.ts | 8 +- libs/remix-tests/tsconfig.json | 2 +- libs/remix-tests/tsconfig.lib.json | 27 +- libs/remix-tests/tsconfig.spec.json | 29 +- 35 files changed, 770 insertions(+), 899 deletions(-) delete mode 100644 apps/remix-ide/src/blockchain/txResultHelper.js create mode 100644 libs/remix-lib/src/execution/txRunnerVM.ts create mode 100644 libs/remix-lib/src/execution/txRunnerWeb3.ts delete mode 100644 libs/remix-lib/src/universalDapp.ts create mode 100644 libs/remix-simulator/src/vm-context.ts diff --git a/apps/remix-ide/src/app/tabs/network-module.js b/apps/remix-ide/src/app/tabs/network-module.js index fdae172c15..c1cc1e12b5 100644 --- a/apps/remix-ide/src/app/tabs/network-module.js +++ b/apps/remix-ide/src/app/tabs/network-module.js @@ -22,18 +22,6 @@ export class NetworkModule extends Plugin { this.blockchain.event.register('contextChanged', (provider) => { this.emit('providerChanged', provider) }) - /* - // Events that could be implemented later - executionContext.event.register('removeProvider', (provider) => { - this.events.emit('networkRemoved', provider) - }) - executionContext.event.register('addProvider', (provider) => { - this.events.emit('networkAdded', provider) - }) - executionContext.event.register('web3EndpointChanged', (provider) => { - this.events.emit('web3EndpointChanged', provider) - }) - */ } /** Return the current network provider (web3, vm, injected) */ diff --git a/apps/remix-ide/src/app/tabs/runTab/model/recorder.js b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js index 126b354927..f9a5d9aa78 100644 --- a/apps/remix-ide/src/app/tabs/runTab/model/recorder.js +++ b/apps/remix-ide/src/app/tabs/runTab/model/recorder.js @@ -63,10 +63,10 @@ class Recorder { } }) - this.blockchain.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp, _payload, rawAddress) => { + this.blockchain.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp, _payload) => { if (error) return console.log(error) if (call) return - + const rawAddress = txResult.receipt.contractAddress if (!rawAddress) return // not a contract creation const address = helper.addressToString(rawAddress) // save back created addresses for the convertion from tokens to real adresses diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 84062f7ac4..09ca8a05a2 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -3,7 +3,8 @@ const txFormat = remixLib.execution.txFormat const txExecution = remixLib.execution.txExecution const typeConversion = remixLib.execution.typeConversion const Txlistener = remixLib.execution.txListener -const TxRunner = remixLib.execution.txRunner +const TxRunner = remixLib.execution.TxRunner +const TxRunnerWeb3 = remixLib.execution.TxRunnerWeb3 const txHelper = remixLib.execution.txHelper const EventManager = remixLib.EventManager const executionContext = remixLib.execution.executionContext @@ -12,7 +13,7 @@ const Web3 = require('web3') const async = require('async') const { EventEmitter } = require('events') -const { resultToRemixTx } = require('./txResultHelper') +const { resultToRemixTx } = remixLib.helpers.txResultHelper const VMProvider = require('./providers/vm.js') const InjectedProvider = require('./providers/injected.js') @@ -26,8 +27,7 @@ class Blockchain { this.events = new EventEmitter() this.config = config - - this.txRunner = new TxRunner({}, { + const web3Runner = new TxRunnerWeb3({ config: config, detectNetwork: (cb) => { this.executionContext.detectNetwork(cb) @@ -35,7 +35,9 @@ class Blockchain { personalMode: () => { return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false } - }, this.executionContext) + }, _ => this.executionContext.web3(), _ => this.executionContext.currentblockGasLimit()) + this.txRunner = new TxRunner(web3Runner, { runAsync: true }) + this.executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) this.networkcallid = 0 @@ -123,7 +125,7 @@ class Blockchain { if (error) { return finalCb(`creation of ${selectedContract.name} errored: ${(error.message ? error.message : error)}`) } - if (txResult.result.status && txResult.result.status === '0x0') { + if (txResult.receipt.status === false || txResult.receipt.status === '0x0') { return finalCb(`creation of ${selectedContract.name} errored: transaction execution failed`) } finalCb(null, selectedContract, address) @@ -309,18 +311,17 @@ class Blockchain { resetEnvironment () { this.getCurrentProvider().resetEnvironment() // TODO: most params here can be refactored away in txRunner - // this.txRunner = new TxRunner(this.providers.vm.accounts, { - this.txRunner = new TxRunner(this.providers.vm.RemixSimulatorProvider.Accounts.accounts, { - // TODO: only used to check value of doNotShowTransactionConfirmationAgain property + const web3Runner = new TxRunnerWeb3({ config: this.config, - // TODO: to refactor, TxRunner already has access to executionContext detectNetwork: (cb) => { this.executionContext.detectNetwork(cb) }, personalMode: () => { return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false } - }, this.executionContext) + }, _ => this.executionContext.web3(), _ => this.executionContext.currentblockGasLimit()) + + this.txRunner = new TxRunner(web3Runner, { runAsync: true }) this.txRunner.event.register('transactionBroadcasted', (txhash) => { this.executionContext.detectNetwork((error, network) => { if (error || !network) return @@ -372,10 +373,11 @@ class Blockchain { (network, tx, gasEstimation, continueTxExecution, cancelCb) => { continueTxExecution() }, (error, continueTxExecution, cancelCb) => { if (error) { reject(error) } else { continueTxExecution() } }, (okCb, cancelCb) => { okCb() }, - (error, result) => { + async (error, result) => { if (error) return reject(error) try { - resolve(resultToRemixTx(result)) + const execResult = await this.web3().eth.getExecutionResultFromSimulator(result.transactionHash) + resolve(resultToRemixTx(result, execResult)) } catch (e) { reject(e) } @@ -429,19 +431,24 @@ class Blockchain { function runTransaction (fromAddress, value, gasLimit, next) { const tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall, from: fromAddress, value: value, gasLimit: gasLimit, timestamp: args.data.timestamp } const payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs, contractBytecode: args.data.contractBytecode, contractName: args.data.contractName, contractABI: args.data.contractABI, linkReferences: args.data.linkReferences } - let timestamp = Date.now() - if (tx.timestamp) { - timestamp = tx.timestamp - } + if (!tx.timestamp) tx.timestamp = Date.now() + const timestamp = tx.timestamp self.event.trigger('initiatingTransaction', [timestamp, tx, payLoad]) self.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb, - function (error, result) { + async (error, result) => { if (error) return next(error) - const rawAddress = self.executionContext.isVM() ? (result.result.createdAddress && result.result.createdAddress.toBuffer()) : result.result.contractAddress + const isVM = self.executionContext.isVM() + if (isVM && tx.useCall) { + try { + result.transactionHash = await self.web3().eth.getHashFromTagBySimulator(timestamp) + } catch (e) { + console.log('unable to retrieve back the "call" hash', e) + } + } const eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted') - self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad, rawAddress]) + self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad]) if (error && (typeof (error) !== 'string')) { if (error.message) error = error.message @@ -454,25 +461,29 @@ class Blockchain { ) } ], - (error, txResult) => { + async (error, txResult) => { if (error) { return cb(error) } const isVM = this.executionContext.isVM() + let execResult + let returnValue = null if (isVM) { - const vmError = txExecution.checkVMError(txResult) - if (vmError.error) { - return cb(vmError.message) + execResult = await this.web3().eth.getExecutionResultFromSimulator(txResult.transactionHash) + if (execResult) { + // if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value. + returnValue = (execResult && isVM) ? execResult.returnValue : txResult + const vmError = txExecution.checkVMError(execResult) + if (vmError.error) { + return cb(vmError.message) + } } } let address = null - let returnValue = null - if (txResult && txResult.result) { - address = isVM ? (txResult.result.createdAddress && txResult.result.createdAddress.toBuffer()) : txResult.result.contractAddress - // if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value. - returnValue = (txResult.result.execResult && isVM) ? txResult.result.execResult.returnValue : txResult.result + if (txResult && txResult.receipt) { + address = txResult.receipt.contractAddress } cb(error, txResult, address, returnValue) diff --git a/apps/remix-ide/src/blockchain/providers/vm.js b/apps/remix-ide/src/blockchain/providers/vm.js index 8ec6583ff7..c251743e2b 100644 --- a/apps/remix-ide/src/blockchain/providers/vm.js +++ b/apps/remix-ide/src/blockchain/providers/vm.js @@ -1,14 +1,16 @@ const Web3 = require('web3') -const { BN, privateToAddress, hashPersonalMessage } = require('ethereumjs-util') -const RemixSimulator = require('@remix-project/remix-simulator') +const { BN, privateToAddress, stripHexPrefix, hashPersonalMessage } = require('ethereumjs-util') +const { Provider, extend } = require('@remix-project/remix-simulator') class VMProvider { constructor (executionContext) { this.executionContext = executionContext - this.RemixSimulatorProvider = new RemixSimulator.Provider({ executionContext: this.executionContext }) + this.RemixSimulatorProvider = new Provider({}) this.RemixSimulatorProvider.init() this.web3 = new Web3(this.RemixSimulatorProvider) + extend(this.web3) this.accounts = {} + this.executionContext.setWeb3('vm', this.web3) } getAccounts (cb) { diff --git a/apps/remix-ide/src/blockchain/txResultHelper.js b/apps/remix-ide/src/blockchain/txResultHelper.js deleted file mode 100644 index f608324062..0000000000 --- a/apps/remix-ide/src/blockchain/txResultHelper.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict' -const { bufferToHex, isHexString } = require('ethereumjs-util') - -function convertToPrefixedHex (input) { - if (input === undefined || input === null || isHexString(input)) { - return input - } else if (Buffer.isBuffer(input)) { - return bufferToHex(input) - } - return '0x' + input.toString(16) -} - -/* - txResult.result can be 3 different things: - - VM call or tx: ethereumjs-vm result object - - Node transaction: object returned from eth.getTransactionReceipt() - - Node call: return value from function call (not an object) - - Also, VM results use BN and Buffers, Node results use hex strings/ints, - So we need to normalize the values to prefixed hex strings -*/ -function resultToRemixTx (txResult) { - const { result, transactionHash } = txResult - const { status, execResult, gasUsed, createdAddress, contractAddress } = result - let returnValue, errorMessage - - if (isHexString(result)) { - returnValue = result - } else if (execResult !== undefined) { - returnValue = execResult.returnValue - errorMessage = execResult.exceptionError - } - - return { - transactionHash, - status, - gasUsed: convertToPrefixedHex(gasUsed), - error: errorMessage, - return: convertToPrefixedHex(returnValue), - createdAddress: convertToPrefixedHex(createdAddress || contractAddress) - } -} - -module.exports = { - resultToRemixTx -} diff --git a/jest.config.js b/jest.config.js index 30b91f3cbe..4b90409756 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,5 +5,18 @@ module.exports = { }, resolver: '@nrwl/jest/plugins/resolver', moduleFileExtensions: ['ts', 'js', 'html'], - coverageReporters: ['html'] + coverageReporters: ['html'], + moduleNameMapper:{ + "@remix-project/remix-analyzer": "/../../dist/libs/remix-analyzer/index.js", + "@remix-project/remix-astwalker": "/../../dist/libs/remix-astwalker/index.js", + "@remix-project/remix-debug": "/../../dist/libs/remix-debug/src/index.js", + "@remix-project/remix-lib": "/../../dist/libs/remix-lib/src/index.js", + "@remix-project/remix-simulator": "/../../dist/libs/remix-simulator/src/index.js", + "@remix-project/remix-solidity": "/../../dist/libs/remix-solidity/index.js", + "@remix-project/remix-tests": "/../../dist/libs/remix-tests/src/index.js", + "@remix-project/remix-url-resolver": + "/../../dist/libs/remix-url-resolver/index.js" + , + "@remix-project/remixd": "/../../dist/libs/remixd/index.js" + } }; diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index 31212412ff..ba067e7035 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -4,7 +4,6 @@ import Web3 from 'web3' import { EventManager } from '../eventManager' import { rlp, keccak, bufferToHex } from 'ethereumjs-util' import { Web3VmProvider } from '../web3Provider/web3VmProvider' -import { LogsManager } from './logsManager' import VM from '@ethereumjs/vm' import Common from '@ethereumjs/common' import StateManager from '@ethereumjs/vm/dist/state/stateManager' @@ -100,22 +99,21 @@ class StateManagerCommonStorageDump extends StateManager { */ export class ExecutionContext { event - logsManager - blockGasLimitDefault - blockGasLimit + blockGasLimitDefault: number + blockGasLimit: number customNetWorks blocks latestBlockNumber txs - executionContext + executionContext: string listenOnLastBlockId currentFork: string vms mainNetGenesisHash: string + customWeb3: { [key: string]: Web3 } constructor () { this.event = new EventManager() - this.logsManager = new LogsManager() this.executionContext = null this.blockGasLimitDefault = 4300000 this.blockGasLimit = this.blockGasLimitDefault @@ -134,6 +132,7 @@ export class ExecutionContext { this.blocks = {} this.latestBlockNumber = 0 this.txs = {} + this.customWeb3 = {} // mapping between a context name and a web3.js instance } init (config) { @@ -172,7 +171,12 @@ export class ExecutionContext { return this.executionContext === 'vm' } + setWeb3 (context: string, web3: Web3) { + this.customWeb3[context] = web3 + } + web3 () { + if (this.customWeb3[this.executionContext]) return this.customWeb3[this.executionContext] return this.isVM() ? this.vms[this.currentFork].web3vm : web3 } @@ -339,23 +343,5 @@ export class ExecutionContext { if (transactionDetailsLinks[network]) { return transactionDetailsLinks[network] + hash } - } - - addBlock (block) { - let blockNumber = '0x' + block.header.number.toString('hex') - if (blockNumber === '0x') { - blockNumber = '0x0' - } - blockNumber = web3.utils.toHex(web3.utils.toBN(blockNumber)) - - this.blocks['0x' + block.hash().toString('hex')] = block - this.blocks[blockNumber] = block - this.latestBlockNumber = blockNumber - - this.logsManager.checkBlock(blockNumber, block, this.web3()) - } - - trackTx (tx, block) { - this.txs[tx] = block - } + } } diff --git a/libs/remix-lib/src/execution/txExecution.ts b/libs/remix-lib/src/execution/txExecution.ts index 84edfc1f8e..8eb1c927dd 100644 --- a/libs/remix-lib/src/execution/txExecution.ts +++ b/libs/remix-lib/src/execution/txExecution.ts @@ -53,10 +53,10 @@ export function callFunction (from, to, data, value, gasLimit, funAbi, txRunner, /** * check if the vm has errored * - * @param {Object} txResult - the value returned by the vm + * @param {Object} execResult - execution result given by the VM * @return {Object} - { error: true/false, message: DOMNode } */ -export function checkVMError (txResult) { +export function checkVMError (execResult) { const errorCode = { OUT_OF_GAS: 'out of gas', STACK_UNDERFLOW: 'stack underflow', @@ -74,10 +74,10 @@ export function checkVMError (txResult) { error: false, message: '' } - if (!txResult.result.execResult.exceptionError) { + if (!execResult.exceptionError) { return ret } - const exceptionError = txResult.result.execResult.exceptionError.error || '' + const exceptionError = execResult.exceptionError.error || '' const error = `VM error: ${exceptionError}.\n` let msg if (exceptionError === errorCode.INVALID_OPCODE) { @@ -87,7 +87,7 @@ export function checkVMError (txResult) { msg = '\tThe transaction ran out of gas. Please increase the Gas Limit.\n' ret.error = true } else if (exceptionError === errorCode.REVERT) { - const returnData = txResult.result.execResult.returnValue + const returnData = execResult.returnValue // It is the hash of Error(string) if (returnData && (returnData.slice(0, 4).toString('hex') === '08c379a0')) { const abiCoder = new ethers.utils.AbiCoder() diff --git a/libs/remix-lib/src/execution/txFormat.ts b/libs/remix-lib/src/execution/txFormat.ts index 7d3188a1d0..62f90be1a8 100644 --- a/libs/remix-lib/src/execution/txFormat.ts +++ b/libs/remix-lib/src/execution/txFormat.ts @@ -314,7 +314,7 @@ export function deployLibrary (libraryName, libraryShortName, library, contracts if (err) { return callback(err) } - const address = txResult.result.createdAddress || txResult.result.contractAddress + const address = txResult.receipt.contractAddress library.address = address callback(err, address) }) diff --git a/libs/remix-lib/src/execution/txListener.ts b/libs/remix-lib/src/execution/txListener.ts index fea5cdf270..967b8ee3a8 100644 --- a/libs/remix-lib/src/execution/txListener.ts +++ b/libs/remix-lib/src/execution/txListener.ts @@ -8,13 +8,13 @@ import { ExecutionContext } from './execution-context' import { decodeResponse } from './txFormat' import { getFunction, getReceiveInterface, getConstructorInterface, visitContracts, makeFullTypeDefinition } from './txHelper' -function addExecutionCosts (txResult, tx) { - if (txResult && txResult.result) { - if (txResult.result.execResult) { - tx.returnValue = txResult.result.execResult.returnValue - if (txResult.result.execResult.gasUsed) tx.executionCost = txResult.result.execResult.gasUsed.toString(10) +function addExecutionCosts (txResult, tx, execResult) { + if (txResult) { + if (execResult) { + tx.returnValue = execResult.returnValue + if (execResult.gasUsed) tx.executionCost = execResult.gasUsed.toString(10) } - if (txResult.result.gasUsed) tx.transactionCost = txResult.result.gasUsed.toString(10) + if (txResult.receipt && txResult.receipt.gasUsed) tx.transactionCost = txResult.receipt.gasUsed.toString(10) } } @@ -55,7 +55,7 @@ export class TxListener { } }) - opt.event.udapp.register('callExecuted', (error, from, to, data, lookupOnly, txResult) => { + opt.event.udapp.register('callExecuted', async (error, from, to, data, lookupOnly, txResult) => { if (error) return // we go for that case if // in VM mode @@ -63,17 +63,25 @@ export class TxListener { if (!this._isListening) return // we don't listen if (this._loopId && this.executionContext.getProvider() !== 'vm') return // we seems to already listen on a "web3" network + let returnValue + let execResult + if (this.executionContext.isVM()) { + execResult = await this.executionContext.web3().eth.getExecutionResultFromSimulator(txResult.transactionHash) + returnValue = execResult.returnValue + } else { + returnValue = toBuffer(txResult.result) + } const call = { from: from, to: to, input: data, hash: txResult.transactionHash ? txResult.transactionHash : 'call' + (from || '') + to + data, isCall: true, - returnValue: this.executionContext.isVM() ? txResult.result.execResult.returnValue : toBuffer(txResult.result), + returnValue, envMode: this.executionContext.getProvider() } - addExecutionCosts(txResult, call) + addExecutionCosts(txResult, call, execResult) this._resolveTx(call, call, (error, resolvedData) => { if (!error) { this.event.trigger('newCall', [call]) @@ -89,12 +97,17 @@ export class TxListener { // in web3 mode && listen remix txs only if (!this._isListening) return // we don't listen if (this._loopId && this.executionContext.getProvider() !== 'vm') return // we seems to already listen on a "web3" network - this.executionContext.web3().eth.getTransaction(txResult.transactionHash, (error, tx) => { + this.executionContext.web3().eth.getTransaction(txResult.transactionHash, async (error, tx) => { if (error) return console.log(error) - addExecutionCosts(txResult, tx) + let execResult + if (this.executionContext.isVM()) { + execResult = await this.executionContext.web3().eth.getExecutionResultFromSimulator(txResult.transactionHash) + } + + addExecutionCosts(txResult, tx, execResult) tx.envMode = this.executionContext.getProvider() - tx.status = txResult.result.status // 0x0 or 0x1 + tx.status = txResult.receipt.status // 0x0 or 0x1 this._resolve([tx], () => { }) }) diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index ddc2456fb5..254b4b0474 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -1,91 +1,26 @@ 'use strict' -import { Transaction } from '@ethereumjs/tx' -import { Block } from '@ethereumjs/block' -import { BN, bufferToHex, Address } from 'ethereumjs-util' -import { ExecutionContext } from './execution-context' import { EventManager } from '../eventManager' export class TxRunner { event - executionContext - _api - blockNumber runAsync pendingTxs - vmaccounts queusTxs - blocks - commonContext - - constructor (vmaccounts, api, executionContext) { + opt + internalRunner + constructor (internalRunner, opt) { + this.opt = opt || {} + this.internalRunner = internalRunner this.event = new EventManager() - // has a default for now for backwards compatability - this.executionContext = executionContext || new ExecutionContext() - this.commonContext = this.executionContext.vmObject().common - this._api = api - this.blockNumber = 0 - this.runAsync = true - if (this.executionContext.isVM()) { - // this.blockNumber = 1150000 // The VM is running in Homestead mode, which started at this block. - this.blockNumber = 0 // The VM is running in Homestead mode, which started at this block. - this.runAsync = false // We have to run like this cause the VM Event Manager does not support running multiple txs at the same time. - } + + this.runAsync = this.opt.runAsync || true // We have to run like this cause the VM Event Manager does not support running multiple txs at the same time. + this.pendingTxs = {} - this.vmaccounts = vmaccounts this.queusTxs = [] - this.blocks = [] } rawRun (args, confirmationCb, gasEstimationForceSend, promptCb, cb) { - let timestamp = Date.now() - if (args.timestamp) { - timestamp = args.timestamp - } - run(this, args, timestamp, confirmationCb, gasEstimationForceSend, promptCb, cb) - } - - _executeTx (tx, gasPrice, api, promptCb, callback) { - if (gasPrice) tx.gasPrice = this.executionContext.web3().utils.toHex(gasPrice) - if (api.personalMode()) { - promptCb( - (value) => { - this._sendTransaction(this.executionContext.web3().personal.sendTransaction, tx, value, callback) - }, - () => { - return callback('Canceled by user.') - } - ) - } else { - this._sendTransaction(this.executionContext.web3().eth.sendTransaction, tx, null, callback) - } - } - - _sendTransaction (sendTx, tx, pass, callback) { - const cb = (err, resp) => { - if (err) { - return callback(err, resp) - } - this.event.trigger('transactionBroadcasted', [resp]) - var listenOnResponse = () => { - // eslint-disable-next-line no-async-promise-executor - return new Promise(async (resolve, reject) => { - const result = await tryTillReceiptAvailable(resp, this.executionContext) - tx = await tryTillTxAvailable(resp, this.executionContext) - resolve({ - result, - tx, - transactionHash: result ? result['transactionHash'] : null - }) - }) - } - listenOnResponse().then((txData) => { callback(null, txData) }).catch((error) => { callback(error) }) - } - const args = pass !== null ? [tx, pass, cb] : [tx, cb] - try { - sendTx.apply({}, args) - } catch (e) { - return callback(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) - } + run(this, args, args.timestamp || Date.now(), confirmationCb, gasEstimationForceSend, promptCb, cb) } execute (args, confirmationCb, gasEstimationForceSend, promptCb, callback) { @@ -93,175 +28,10 @@ export class TxRunner { if (data.slice(0, 2) !== '0x') { data = '0x' + data } - - if (!this.executionContext.isVM()) { - return this.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, confirmationCb, gasEstimationForceSend, promptCb, callback) - } - try { - this.runInVm(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, callback) - } catch (e) { - callback(e, null) - } + this.internalRunner.execute(args, confirmationCb, gasEstimationForceSend, promptCb, callback) } - - runInVm (from, to, data, value, gasLimit, useCall, timestamp, callback) { - const self = this - const account = self.vmaccounts[from] - if (!account) { - return callback('Invalid account selected') - } - - if (Number.isInteger(gasLimit)) { - gasLimit = '0x' + gasLimit.toString(16) - } - - this.executionContext.vm().stateManager.getAccount(Address.fromString(from)).then((res) => { - // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor - // for initialization fields and their types - value = value ? parseInt(value) : 0 - const tx = Transaction.fromTxData({ - nonce: new BN(res.nonce), - gasPrice: '0x1', - gasLimit: gasLimit, - to: to, - value: value, - data: Buffer.from(data.slice(2), 'hex') - }, { common: this.commonContext }).sign(account.privateKey) - - const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] - const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)] - - var block = Block.fromBlockData({ - header: { - timestamp: timestamp || (new Date().getTime() / 1000 | 0), - number: self.blockNumber, - coinbase: coinbases[self.blockNumber % coinbases.length], - difficulty: difficulties[self.blockNumber % difficulties.length], - gasLimit: new BN(gasLimit.replace('0x', ''), 16).imuln(2) - }, - transactions: [tx] - }, { common: this.commonContext }) - - if (!useCall) { - ++self.blockNumber - this.runBlockInVm(tx, block, callback) - } else { - this.executionContext.vm().stateManager.checkpoint().then(() => { - this.runBlockInVm(tx, block, (err, result) => { - this.executionContext.vm().stateManager.revert().then(() => { - callback(err, result) - }) - }) - }) - } - }).catch((e) => { - callback(e) - }) - } - - runBlockInVm (tx, block, callback) { - this.executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then((results) => { - const result = results.results[0] - if (result) { - const status = result.execResult.exceptionError ? 0 : 1 - result.status = `0x${status}` - } - this.executionContext.addBlock(block) - this.executionContext.trackTx('0x' + tx.hash().toString('hex'), block) - callback(null, { - result: result, - transactionHash: bufferToHex(Buffer.from(tx.hash())) - }) - }).catch((err) => { - callback(err) - }) - } - - runInNode (from, to, data, value, gasLimit, useCall, confirmCb, gasEstimationForceSend, promptCb, callback) { - const tx = { from: from, to: to, data: data, value: value } - - if (useCall) { - tx['gas'] = gasLimit - return this.executionContext.web3().eth.call(tx, function (error, result) { - callback(error, { - result: result, - transactionHash: result ? result.transactionHash : null - }) - }) - } - this.executionContext.web3().eth.estimateGas(tx, (err, gasEstimation) => { - if (err && err.message.indexOf('Invalid JSON RPC response') !== -1) { - // // @todo(#378) this should be removed when https://github.com/WalletConnect/walletconnect-monorepo/issues/334 is fixed - err = 'Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.' - } - gasEstimationForceSend(err, () => { - // callback is called whenever no error - tx['gas'] = !gasEstimation ? gasLimit : gasEstimation - - if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { - return this._executeTx(tx, null, this._api, promptCb, callback) - } - - this._api.detectNetwork((err, network) => { - if (err) { - console.log(err) - return - } - - confirmCb(network, tx, tx['gas'], (gasPrice) => { - return this._executeTx(tx, gasPrice, this._api, promptCb, callback) - }, (error) => { - callback(error) - }) - }) - }, () => { - const blockGasLimit = this.executionContext.currentblockGasLimit() - // NOTE: estimateGas very likely will return a large limit if execution of the code failed - // we want to be able to run the code in order to debug and find the cause for the failure - if (err) return callback(err) - - let warnEstimation = ' An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that\'s also the reason of strong gas estimation). ' - warnEstimation += ' ' + err - - if (gasEstimation > gasLimit) { - return callback('Gas required exceeds limit: ' + gasLimit + '. ' + warnEstimation) - } - if (gasEstimation > blockGasLimit) { - return callback('Gas required exceeds block gas limit: ' + gasLimit + '. ' + warnEstimation) - } - }) - }) - } -} - -async function tryTillReceiptAvailable (txhash, executionContext) { - return new Promise((resolve, reject) => { - executionContext.web3().eth.getTransactionReceipt(txhash, async (err, receipt) => { - if (err || !receipt) { - // Try again with a bit of delay if error or if result still null - await pause() - return resolve(await tryTillReceiptAvailable(txhash, executionContext)) - } - return resolve(receipt) - }) - }) } -async function tryTillTxAvailable (txhash, executionContext) { - return new Promise((resolve, reject) => { - executionContext.web3().eth.getTransaction(txhash, async (err, tx) => { - if (err || !tx) { - // Try again with a bit of delay if error or if result still null - await pause() - return resolve(await tryTillTxAvailable(txhash, executionContext)) - } - return resolve(tx) - }) - }) -} - -async function pause () { return new Promise((resolve, reject) => { setTimeout(resolve, 500) }) } - function run (self, tx, stamp, confirmationCb, gasEstimationForceSend = null, promptCb = null, callback = null) { if (!self.runAsync && Object.keys(self.pendingTxs).length) { return self.queusTxs.push({ tx, stamp, callback }) @@ -275,4 +45,4 @@ function run (self, tx, stamp, confirmationCb, gasEstimationForceSend = null, pr run(self, next.tx, next.stamp, next.callback) } }) -} +} \ No newline at end of file diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts new file mode 100644 index 0000000000..3b221f8b75 --- /dev/null +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -0,0 +1,120 @@ +'use strict' +import { Transaction } from 'ethereumjs-tx' +import Block from 'ethereumjs-block' +import { BN, bufferToHex } from 'ethereumjs-util' +import { EventManager } from '../eventManager' +import { LogsManager } from './logsManager' + +export class TxRunnerVM { + event + _api + blockNumber + runAsync + pendingTxs + vmaccounts + queusTxs + blocks + txs + logsManager + getVM: () => any + + constructor (vmaccounts, api, getVM) { + this.event = new EventManager() + this.logsManager = new LogsManager() + // has a default for now for backwards compatability + this.getVM = getVM + this._api = api + this.blockNumber = 0 + this.runAsync = true + this.blockNumber = 0 // The VM is running in Homestead mode, which started at this block. + this.runAsync = false // We have to run like this cause the VM Event Manager does not support running multiple txs at the same time. + this.pendingTxs = {} + this.vmaccounts = vmaccounts + this.queusTxs = [] + this.blocks = [] + } + + execute (args, confirmationCb, gasEstimationForceSend, promptCb, callback) { + let data = args.data + if (data.slice(0, 2) !== '0x') { + data = '0x' + data + } + + try { + this.runInVm(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, callback) + } catch (e) { + callback(e, null) + } + } + + runInVm (from, to, data, value, gasLimit, useCall, timestamp, callback) { + const self = this + const account = self.vmaccounts[from] + if (!account) { + return callback('Invalid account selected') + } + + this.getVM().stateManager.getAccount(Buffer.from(from.replace('0x', ''), 'hex'), (err, res) => { + if (err) { + callback('Account not found') + } else { + // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor + // for initialization fields and their types + value = value ? parseInt(value) : 0 + const tx = new Transaction({ + nonce: new BN(res.nonce), + gasPrice: '0x1', + gasLimit: gasLimit, + to: to, + value: value, + data: Buffer.from(data.slice(2), 'hex') + }) + tx.sign(account.privateKey) + const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] + const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)] + const block = new Block({ + header: { + timestamp: timestamp || (new Date().getTime() / 1000 | 0), + number: self.blockNumber, + coinbase: coinbases[self.blockNumber % coinbases.length], + difficulty: difficulties[self.blockNumber % difficulties.length], + gasLimit: new BN(gasLimit, 10).imuln(2) + }, + transactions: [tx], + uncleHeaders: [] + }) + if (!useCall) { + ++self.blockNumber + this.runBlockInVm(tx, block, callback) + } else { + this.getVM().stateManager.checkpoint(() => { + this.runBlockInVm(tx, block, (err, result) => { + this.getVM().stateManager.revert(() => { + callback(err, result) + }) + }) + }) + } + } + }) + } + + runBlockInVm (tx, block, callback) { + this.getVM().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then((results) => { + const result = results.results[0] + if (result) { + const status = result.execResult.exceptionError ? 0 : 1 + result.status = `0x${status}` + } + callback(null, { + result: result, + transactionHash: bufferToHex(Buffer.from(tx.hash())), + block, + tx, + }) + }).catch(function (err) { + callback(err) + }) + } +} + diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts new file mode 100644 index 0000000000..f735b3401c --- /dev/null +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -0,0 +1,156 @@ +'use strict' +import { EventManager } from '../eventManager' +import Web3 from 'web3' + +export class TxRunnerWeb3 { + event + _api + getWeb3: () => Web3 + currentblockGasLimit: () => number + + constructor (api, getWeb3, currentblockGasLimit) { + this.event = new EventManager() + this.getWeb3 = getWeb3 + this.currentblockGasLimit = currentblockGasLimit + this._api = api + } + + _executeTx (tx, gasPrice, api, promptCb, callback) { + if (gasPrice) tx.gasPrice = this.getWeb3().utils.toHex(gasPrice) + if (api.personalMode()) { + promptCb( + (value) => { + this._sendTransaction((this.getWeb3() as any).personal.sendTransaction, tx, value, callback) + }, + () => { + return callback('Canceled by user.') + } + ) + } else { + this._sendTransaction(this.getWeb3().eth.sendTransaction, tx, null, callback) + } + } + + _sendTransaction (sendTx, tx, pass, callback) { + const cb = (err, resp) => { + if (err) { + return callback(err, resp) + } + this.event.trigger('transactionBroadcasted', [resp]) + var listenOnResponse = () => { + // eslint-disable-next-line no-async-promise-executor + return new Promise(async (resolve, reject) => { + const receipt = await tryTillReceiptAvailable(resp, this.getWeb3()) + tx = await tryTillTxAvailable(resp, this.getWeb3()) + resolve({ + receipt, + tx, + transactionHash: receipt ? receipt['transactionHash'] : null + }) + }) + } + listenOnResponse().then((txData) => { callback(null, txData) }).catch((error) => { callback(error) }) + } + const args = pass !== null ? [tx, pass, cb] : [tx, cb] + try { + sendTx.apply({}, args) + } catch (e) { + return callback(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) + } + } + + execute (args, confirmationCb, gasEstimationForceSend, promptCb, callback) { + let data = args.data + if (data.slice(0, 2) !== '0x') { + data = '0x' + data + } + + return this.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, confirmationCb, gasEstimationForceSend, promptCb, callback) + } + + runInNode (from, to, data, value, gasLimit, useCall, timestamp, confirmCb, gasEstimationForceSend, promptCb, callback) { + const tx = { from: from, to: to, data: data, value: value } + + if (useCall) { + const tag = Date.now() // for e2e reference + tx['gas'] = gasLimit + tx['timestamp'] = timestamp + return this.getWeb3().eth.call(tx, function (error, result: any) { + if (error) return callback(error) + callback(null, { + result: result + }) + }) + } + this.getWeb3().eth.estimateGas(tx, (err, gasEstimation) => { + if (err && err.message.indexOf('Invalid JSON RPC response') !== -1) { + // // @todo(#378) this should be removed when https://github.com/WalletConnect/walletconnect-monorepo/issues/334 is fixed + new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.') + } + gasEstimationForceSend(err, () => { + // callback is called whenever no error + tx['gas'] = !gasEstimation ? gasLimit : gasEstimation + + if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { + return this._executeTx(tx, null, this._api, promptCb, callback) + } + + this._api.detectNetwork((err, network) => { + if (err) { + console.log(err) + return + } + + confirmCb(network, tx, tx['gas'], (gasPrice) => { + return this._executeTx(tx, gasPrice, this._api, promptCb, callback) + }, (error) => { + callback(error) + }) + }) + }, () => { + const blockGasLimit = this.currentblockGasLimit() + // NOTE: estimateGas very likely will return a large limit if execution of the code failed + // we want to be able to run the code in order to debug and find the cause for the failure + if (err) return callback(err) + + let warnEstimation = ' An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that\'s also the reason of strong gas estimation). ' + warnEstimation += ' ' + err + + if (gasEstimation > gasLimit) { + return callback('Gas required exceeds limit: ' + gasLimit + '. ' + warnEstimation) + } + if (gasEstimation > blockGasLimit) { + return callback('Gas required exceeds block gas limit: ' + gasLimit + '. ' + warnEstimation) + } + }) + }) + } +} + +async function tryTillReceiptAvailable (txhash, web3) { + return new Promise((resolve, reject) => { + web3.eth.getTransactionReceipt(txhash, async (err, receipt) => { + if (err || !receipt) { + // Try again with a bit of delay if error or if result still null + await pause() + return resolve(await tryTillReceiptAvailable(txhash, web3)) + } + return resolve(receipt) + }) + }) +} + +async function tryTillTxAvailable (txhash, web3) { + return new Promise((resolve, reject) => { + web3.eth.getTransaction(txhash, async (err, tx) => { + if (err || !tx) { + // Try again with a bit of delay if error or if result still null + await pause() + return resolve(await tryTillTxAvailable(txhash, web3)) + } + return resolve(tx) + }) + }) +} + +async function pause () { return new Promise((resolve, reject) => { setTimeout(resolve, 500) }) } diff --git a/libs/remix-lib/src/helpers/txResultHelper.ts b/libs/remix-lib/src/helpers/txResultHelper.ts index 7aa7967f0d..3264e5b771 100644 --- a/libs/remix-lib/src/helpers/txResultHelper.ts +++ b/libs/remix-lib/src/helpers/txResultHelper.ts @@ -20,9 +20,9 @@ function convertToPrefixedHex (input) { Also, VM results use BN and Buffers, Node results use hex strings/ints, So we need to normalize the values to prefixed hex strings */ -export function resultToRemixTx (txResult) { - const { result, transactionHash } = txResult - const { status, execResult, gasUsed, createdAddress, contractAddress } = result +export function resultToRemixTx (txResult, execResult) { + const { receipt, transactionHash, result } = txResult + const { status, gasUsed, contractAddress } = receipt let returnValue, errorMessage if (isHexString(result)) { @@ -38,6 +38,6 @@ export function resultToRemixTx (txResult) { gasUsed: convertToPrefixedHex(gasUsed), error: errorMessage, return: convertToPrefixedHex(returnValue), - createdAddress: convertToPrefixedHex(createdAddress || contractAddress) + createdAddress: convertToPrefixedHex(contractAddress) } } diff --git a/libs/remix-lib/src/index.ts b/libs/remix-lib/src/index.ts index 5b1108ff70..afcd0beae6 100644 --- a/libs/remix-lib/src/index.ts +++ b/libs/remix-lib/src/index.ts @@ -12,9 +12,12 @@ import * as txHelper from './execution/txHelper' import * as txFormat from './execution/txFormat' import { TxListener } from './execution/txListener' import { TxRunner } from './execution/txRunner' +import { LogsManager } from './execution/logsManager' import { ExecutionContext } from './execution/execution-context' import * as typeConversion from './execution/typeConversion' -import { UniversalDApp } from './universalDapp' +import { TxRunnerVM } from './execution/txRunnerVM' +import { TxRunnerWeb3 } from './execution/txRunnerWeb3' +import * as txResultHelper from './helpers/txResultHelper' export = modules() @@ -23,7 +26,8 @@ function modules () { EventManager: EventManager, helpers: { ui: uiHelper, - compiler: compilerHelper + compiler: compilerHelper, + txResultHelper }, vm: { Web3Providers: Web3Providers, @@ -39,9 +43,11 @@ function modules () { executionContext: new ExecutionContext(), txFormat: txFormat, txListener: TxListener, - txRunner: TxRunner, - typeConversion: typeConversion - }, - UniversalDApp: UniversalDApp + TxRunner: TxRunner, + TxRunnerWeb3: TxRunnerWeb3, + TxRunnerVM: TxRunnerVM, + typeConversion: typeConversion, + LogsManager + } } } diff --git a/libs/remix-lib/src/universalDapp.ts b/libs/remix-lib/src/universalDapp.ts deleted file mode 100644 index 030a8da811..0000000000 --- a/libs/remix-lib/src/universalDapp.ts +++ /dev/null @@ -1,379 +0,0 @@ -import { waterfall } from 'async' -import { BN, privateToAddress, isValidPrivate, toChecksumAddress, Address } from 'ethereumjs-util' -import { randomBytes } from 'crypto' -import { EventEmitter } from 'events' -import { TxRunner } from './execution/txRunner' -import { sortAbiFunction, getFallbackInterface, getReceiveInterface, inputParametersDeclarationToString } from './execution/txHelper' -import { EventManager } from './eventManager' -import { ExecutionContext } from './execution/execution-context' -import { resultToRemixTx } from './helpers/txResultHelper' - -export class UniversalDApp { - events - event - executionContext - config - txRunner - accounts - transactionContextAPI - - constructor (config, executionContext) { - this.events = new EventEmitter() - this.event = new EventManager() - // has a default for now for backwards compatability - this.executionContext = executionContext || new ExecutionContext() - this.config = config - - this.txRunner = new TxRunner({}, { - config: config, - detectNetwork: (cb) => { - this.executionContext.detectNetwork(cb) - }, - personalMode: () => { - return this.executionContext.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false - } - }, this.executionContext) - this.accounts = {} - this.executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) - } - - // TODO : event should be triggered by Udapp instead of TxListener - /** Listen on New Transaction. (Cannot be done inside constructor because txlistener doesn't exist yet) */ - startListening (txlistener) { - txlistener.event.register('newTransaction', (tx) => { - this.events.emit('newTransaction', tx) - }) - } - - resetEnvironment () { - this.accounts = {} - if (this.executionContext.isVM()) { - this._addAccount('3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511', '0x56BC75E2D63100000') - this._addAccount('2ac6c190b09897cd8987869cc7b918cfea07ee82038d492abce033c75c1b1d0c', '0x56BC75E2D63100000') - this._addAccount('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', '0x56BC75E2D63100000') - this._addAccount('d74aa6d18aa79a05f3473dd030a97d3305737cbc8337d940344345c1f6b72eea', '0x56BC75E2D63100000') - this._addAccount('71975fbf7fe448e004ac7ae54cad0a383c3906055a65468714156a07385e96ce', '0x56BC75E2D63100000') - } - // TODO: most params here can be refactored away in txRunner - this.txRunner = new TxRunner(this.accounts, { - // TODO: only used to check value of doNotShowTransactionConfirmationAgain property - config: this.config, - // TODO: to refactor, TxRunner already has access to executionContext - detectNetwork: (cb) => { - this.executionContext.detectNetwork(cb) - }, - personalMode: () => { - return this.executionContext.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false - } - }, this.executionContext) - this.txRunner.event.register('transactionBroadcasted', (txhash) => { - this.executionContext.detectNetwork((error, network) => { - if (error || !network) return - this.event.trigger('transactionBroadcasted', [txhash, network.name]) - }) - }) - } - - resetAPI (transactionContextAPI) { - this.transactionContextAPI = transactionContextAPI - } - - /** - * Create a VM Account - * @param {{privateKey: string, balance: string}} newAccount The new account to create - */ - createVMAccount (newAccount) { - const { privateKey, balance } = newAccount - if (this.executionContext.getProvider() !== 'vm') { - throw new Error('plugin API does not allow creating a new account through web3 connection. Only vm mode is allowed') - } - this._addAccount(privateKey, balance) - const privKey = Buffer.from(privateKey, 'hex') - return '0x' + privateToAddress(privKey).toString('hex') - } - - newAccount (password, passwordPromptCb, cb) { - if (!this.executionContext.isVM()) { - if (!this.config.get('settings/personal-mode')) { - return cb('Not running in personal mode') - } - return passwordPromptCb((passphrase) => { - this.executionContext.web3().personal.newAccount(passphrase, cb) - }) - } - let privateKey - do { - privateKey = randomBytes(32) - } while (!isValidPrivate(privateKey)) - this._addAccount(privateKey, '0x56BC75E2D63100000') - cb(null, '0x' + privateToAddress(privateKey).toString('hex')) - } - - /** Add an account to the list of account (only for Javascript VM) */ - _addAccount (privateKey, balance) { - if (!this.executionContext.isVM()) { - throw new Error('_addAccount() cannot be called in non-VM mode') - } - - if (!this.accounts) { - return - } - privateKey = Buffer.from(privateKey, 'hex') - const address = privateToAddress(privateKey) - - // FIXME: we don't care about the callback, but we should still make this proper - const stateManager = this.executionContext.vm().stateManager - stateManager.getAccount(address).then((account) => { - account.balance = new BN(balance.replace('0x', '') || 'f00000000000000001', 16) - stateManager.putAccount(address, account).catch((error) => { - console.log(error) - }) - }).catch((error) => { - console.log(error) - }) - - this.accounts[toChecksumAddress('0x' + address.toString('hex'))] = { privateKey, nonce: 0 } - } - - /** Return the list of accounts */ - getAccounts (cb) { - return new Promise((resolve, reject) => { - const provider = this.executionContext.getProvider() - switch (provider) { - case 'vm': - if (!this.accounts) { - if (cb) cb('No accounts?') - reject(new Error('No accounts?')) - return - } - if (cb) cb(null, Object.keys(this.accounts)) - resolve(Object.keys(this.accounts)) - break - case 'web3': - if (this.config.get('settings/personal-mode')) { - return this.executionContext.web3().personal.getListAccounts((error, accounts) => { - if (cb) cb(error, accounts) - if (error) return reject(error) - resolve(accounts) - }) - } else { - this.executionContext.web3().eth.getAccounts((error, accounts) => { - if (cb) cb(error, accounts) - if (error) return reject(error) - resolve(accounts) - }) - } - break - case 'injected': { - this.executionContext.web3().eth.getAccounts((error, accounts) => { - if (cb) cb(error, accounts) - if (error) return reject(error) - resolve(accounts) - }) - } - } - }) - } - - /** Get the balance of an address */ - getBalance (address, cb) { - if (!this.executionContext.isVM()) { - return this.executionContext.web3().eth.getBalance(address, (err, res) => { - if (err) { - return cb(err) - } - cb(null, res.toString(10)) - }) - } - if (!this.accounts) { - return cb('No accounts?') - } - - this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((res) => { - cb(null, new BN(res.balance).toString(10)) - }).catch(() => { - cb('Account not found') - }) - } - - /** Get the balance of an address, and convert wei to ether */ - getBalanceInEther (address, callback) { - this.getBalance(address, (error, balance) => { - if (error) { - return callback(error) - } - callback(null, this.executionContext.web3().utils.fromWei(balance, 'ether')) - }) - } - - pendingTransactionsCount () { - return Object.keys(this.txRunner.pendingTxs).length - } - - /** - * deploy the given contract - * - * @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ). - * @param {Function} callback - callback. - */ - createContract (data, confirmationCb, continueCb, promptCb, callback) { - this.runTx({ data: data, useCall: false }, confirmationCb, continueCb, promptCb, callback) - } - - /** - * call the current given contract - * - * @param {String} to - address of the contract to call. - * @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ). - * @param {Object} funAbi - abi definition of the function to call. - * @param {Function} callback - callback. - */ - callFunction (to, data, funAbi, confirmationCb, continueCb, promptCb, callback) { - const useCall = funAbi.stateMutability === 'view' || funAbi.stateMutability === 'pure' - this.runTx({ to, data, useCall }, confirmationCb, continueCb, promptCb, callback) - } - - /** - * call the current given contract - * - * @param {String} to - address of the contract to call. - * @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ). - * @param {Function} callback - callback. - */ - sendRawTransaction (to, data, confirmationCb, continueCb, promptCb, callback) { - this.runTx({ to, data, useCall: false }, confirmationCb, continueCb, promptCb, callback) - } - - context () { - return (this.executionContext.isVM() ? 'memory' : 'blockchain') - } - - getABI (contract) { - return sortAbiFunction(contract.abi) - } - - getFallbackInterface (contractABI) { - return getFallbackInterface(contractABI) - } - - getReceiveInterface (contractABI) { - return getReceiveInterface(contractABI) - } - - getInputs (funABI) { - if (!funABI.inputs) { - return '' - } - return inputParametersDeclarationToString(funABI.inputs) - } - - /** - * This function send a tx only to javascript VM or testnet, will return an error for the mainnet - * SHOULD BE TAKEN CAREFULLY! - * - * @param {Object} tx - transaction. - */ - sendTransaction (tx) { - return new Promise((resolve, reject) => { - this.executionContext.detectNetwork((error, network) => { - if (error) return reject(error) - if (network.name === 'Main' && network.id === '1') { - return reject(new Error('It is not allowed to make this action against mainnet')) - } - this.silentRunTx(tx, (error, result) => { - if (error) return reject(error) - try { - resolve(resultToRemixTx(result)) - } catch (e) { - reject(e) - } - }) - }) - }) - } - - /** - * This function send a tx without alerting the user (if mainnet or if gas estimation too high). - * SHOULD BE TAKEN CAREFULLY! - * - * @param {Object} tx - transaction. - * @param {Function} callback - callback. - */ - silentRunTx (tx, cb) { - this.txRunner.rawRun( - tx, - (network, tx, gasEstimation, continueTxExecution, cancelCb) => { continueTxExecution() }, - (error, continueTxExecution, cancelCb) => { if (error) { cb(error) } else { continueTxExecution() } }, - (okCb, cancelCb) => { okCb() }, - cb - ) - } - - runTx (args, confirmationCb, continueCb, promptCb, cb) { - const self = this - waterfall([ - function getGasLimit (next) { - if (self.transactionContextAPI.getGasLimit) { - return self.transactionContextAPI.getGasLimit(next) - } - next(null, 3000000) - }, - function queryValue (gasLimit, next) { - if (args.value) { - return next(null, args.value, gasLimit) - } - if (args.useCall || !self.transactionContextAPI.getValue) { - return next(null, 0, gasLimit) - } - self.transactionContextAPI.getValue(function (err, value) { - next(err, value, gasLimit) - }) - }, - function getAccount (value, gasLimit, next) { - if (args.from) { - return next(null, args.from, value, gasLimit) - } - if (self.transactionContextAPI.getAddress) { - return self.transactionContextAPI.getAddress(function (err, address) { - next(err, address, value, gasLimit) - }) - } - self.getAccounts(function (err, accounts) { - const address = accounts[0] - - if (err) return next(err) - if (!address) return next('No accounts available') - if (self.executionContext.isVM() && !self.accounts[address]) { - return next('Invalid account selected') - } - next(null, address, value, gasLimit) - }) - }, - function runTransaction (fromAddress, value, gasLimit, next) { - const tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall, from: fromAddress, value: value, gasLimit: gasLimit, timestamp: args.data.timestamp } - const payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs, contractBytecode: args.data.contractBytecode, contractName: args.data.contractName, contractABI: args.data.contractABI, linkReferences: args.data.linkReferences } - let timestamp = Date.now() - if (tx.timestamp) { - timestamp = tx.timestamp - } - - self.event.trigger('initiatingTransaction', [timestamp, tx, payLoad]) - self.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb, - function (error, result) { - const eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted') - self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad]) - - if (error && (typeof (error) !== 'string')) { - if (error.message) error = error.message - else { - // eslint-disable-next-line no-empty - try { error = 'error: ' + JSON.stringify(error) } catch (e) {} - } - } - next(error, result) - } - ) - } - ], cb) - } -} diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index 367370f928..361c2b7161 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -31,6 +31,9 @@ export class Web3VmProvider { toBigNumber isAddress utils + txsMapBlock + blocks + latestBlockNumber constructor () { this.web3 = new Web3() @@ -69,6 +72,9 @@ export class Web3VmProvider { this.toBigNumber = (...args) => this.web3.utils.toBN(...args) this.isAddress = (...args) => this.web3.utils.isAddress(...args) this.utils = Web3.utils || [] + this.txsMapBlock = {} + this.blocks = {} + this.latestBlockNumber } setVM (vm) { diff --git a/libs/remix-lib/test/txFormat.ts b/libs/remix-lib/test/txFormat.ts index d33760f9f9..2ab4a59b63 100644 --- a/libs/remix-lib/test/txFormat.ts +++ b/libs/remix-lib/test/txFormat.ts @@ -161,8 +161,8 @@ tape('ContractParameters - (TxFormat.buildData) - link Libraries', function (t) } const callbackDeployLibraries = (param, callback) => { callback(null, { - result: { - createdAddress: fakeDeployedContracts[param.data.contractName] + receipt: { + contractAddress: fakeDeployedContracts[param.data.contractName] } }) } // fake diff --git a/libs/remix-lib/test/txResultHelper.ts b/libs/remix-lib/test/txResultHelper.ts index 8fa2e5cdf2..67a136dc84 100644 --- a/libs/remix-lib/test/txResultHelper.ts +++ b/libs/remix-lib/test/txResultHelper.ts @@ -18,12 +18,13 @@ const GAS_USED_INT = 75427 const GAS_USED_HEX = '0x126a3' const NODE_CALL_RESULT = { + receipt: {}, result: RETURN_VALUE_HEX, transactionHash: undefined } const NODE_TX_RESULT = { - result: { + receipt: { blockHash: '0x380485a4e6372a42e36489783c7f7cb66257612133cd245859c206fd476e9c44', blockNumber: 5994, contractAddress: CONTRACT_ADDRESS_HEX, @@ -39,26 +40,31 @@ const NODE_TX_RESULT = { } const VM_RESULT = { - result: { + receipt: { amountSpent: new BN(1), - createdAddress: CONTRACT_ADDRESS_BUFFER, + contractAddress: CONTRACT_ADDRESS_BUFFER, gasRefund: new BN(0), gasUsed: new BN(GAS_USED_INT), status: STATUS_OK, - execResult: { - exceptionError: null, - gasRefund: new BN(0), - gasUsed: new BN(GAS_USED_INT), - returnValue: RETURN_VALUE_BUFFER - } }, transactionHash: TRANSACTION_HASH } +const EXEC_RESULT = { + exceptionError: null, + gasRefund: new BN(0), + gasUsed: new BN(GAS_USED_INT), + returnValue: RETURN_VALUE_BUFFER +} + +const EXEC_RESULT_ERROR = { + exceptionError: 'this is an error' +} + tape('converts node transaction result to RemixTx', function (t) { // contract creation let txResult = { ...NODE_TX_RESULT } - let remixTx = resultToRemixTx(txResult) + let remixTx = resultToRemixTx(txResult, {}) t.equal(remixTx.transactionHash, TRANSACTION_HASH) t.equal(remixTx.createdAddress, CONTRACT_ADDRESS_HEX) @@ -68,8 +74,8 @@ tape('converts node transaction result to RemixTx', function (t) { t.equal(remixTx.error, undefined) // contract method tx - txResult.result.contractAddress = null - remixTx = resultToRemixTx(txResult) + txResult.receipt.contractAddress = null + remixTx = resultToRemixTx(txResult, {}) t.equal(remixTx.createdAddress, null) t.end() @@ -77,7 +83,7 @@ tape('converts node transaction result to RemixTx', function (t) { tape('converts node call result to RemixTx', function (t) { let txResult = { ...NODE_CALL_RESULT } - let remixTx = resultToRemixTx(txResult) + let remixTx = resultToRemixTx(txResult, {}) t.equal(remixTx.transactionHash, undefined) t.equal(remixTx.createdAddress, undefined) @@ -91,7 +97,7 @@ tape('converts node call result to RemixTx', function (t) { tape('converts VM result to RemixTx', function (t) { let txResult = { ...VM_RESULT } - let remixTx = resultToRemixTx(txResult) + let remixTx = resultToRemixTx(txResult, EXEC_RESULT) t.equal(remixTx.transactionHash, TRANSACTION_HASH) @@ -101,8 +107,7 @@ tape('converts VM result to RemixTx', function (t) { t.equal(remixTx.return, RETURN_VALUE_HEX) t.equal(remixTx.error, null) - txResult.result.execResult.exceptionError = 'this is an error' - remixTx = resultToRemixTx(txResult) + remixTx = resultToRemixTx(VM_RESULT, EXEC_RESULT_ERROR) t.equal(remixTx.error, 'this is an error') t.end() diff --git a/libs/remix-simulator/src/genesis.ts b/libs/remix-simulator/src/genesis.ts index f3d7d0509e..839a0c4cb6 100644 --- a/libs/remix-simulator/src/genesis.ts +++ b/libs/remix-simulator/src/genesis.ts @@ -1,7 +1,7 @@ import { Block } from '@ethereumjs/block' import { BN } from 'ethereumjs-util' -export function generateBlock (executionContext) { +export function generateBlock (vmContext) { return new Promise((resolve, reject) => { const block: Block = Block.fromBlockData({ header: { @@ -11,10 +11,10 @@ export function generateBlock (executionContext) { difficulty: new BN('69762765929000', 10), gasLimit: new BN('8000000').imuln(1) } - }, { common: executionContext.vmObject().common }) + }, { common: vmContext.vmObject().common }) - executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => { - executionContext.addBlock(block) + vmContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then(() => { + vmContext.addBlock(block) resolve({}) }).catch((e) => reject(e)) }) diff --git a/libs/remix-simulator/src/index.ts b/libs/remix-simulator/src/index.ts index fd73199808..19ca3ab802 100644 --- a/libs/remix-simulator/src/index.ts +++ b/libs/remix-simulator/src/index.ts @@ -1 +1 @@ -export { Provider } from './provider' +export { Provider, extend } from './provider' diff --git a/libs/remix-simulator/src/methods/accounts.ts b/libs/remix-simulator/src/methods/accounts.ts index 6fd359594b..8d18498afc 100644 --- a/libs/remix-simulator/src/methods/accounts.ts +++ b/libs/remix-simulator/src/methods/accounts.ts @@ -6,22 +6,20 @@ export class Accounts { web3 accounts: Record accountsKeys: Record - executionContext + vmContext - constructor (executionContext) { + constructor (vmContext) { this.web3 = new Web3() - this.executionContext = executionContext + this.vmContext = vmContext // TODO: make it random and/or use remix-libs this.accounts = {} this.accountsKeys = {} - this.executionContext.init({ get: () => { return true } }) } async resetAccounts (): Promise { - // TODO: setting this to {} breaks the app currently, unclear why still - // this.accounts = {} - // this.accountsKeys = {} + this.accounts = {} + this.accountsKeys = {} await this._addAccount('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', '0x56BC75E2D63100000') await this._addAccount('7e5bfb82febc4c2c8529167104271ceec190eafdca277314912eaabdb67c6e5f', '0x56BC75E2D63100000') await this._addAccount('cc6d63f85de8fef05446ebdd3c537c72152d0fc437fd7aa62b3019b79bd1fdd4', '0x56BC75E2D63100000') @@ -47,7 +45,7 @@ export class Accounts { this.accounts[addressStr] = { privateKey, nonce: 0 } this.accountsKeys[addressStr] = '0x' + privateKey.toString('hex') - const stateManager = this.executionContext.vm().stateManager + const stateManager = this.vmContext.vm().stateManager stateManager.getAccount(Address.fromString(addressStr)).then((account) => { account.balance = new BN(balance.replace('0x', '') || 'f00000000000000001', 16) stateManager.putAccount(Address.fromString(addressStr), account).catch((error) => { @@ -85,7 +83,7 @@ export class Accounts { eth_getBalance (payload, cb) { const address = payload.params[0] - this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { + this.vmContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { cb(null, new BN(account.balance).toString(10)) }).catch((error) => { cb(error) diff --git a/libs/remix-simulator/src/methods/blocks.ts b/libs/remix-simulator/src/methods/blocks.ts index bfed840284..7ac7bc179f 100644 --- a/libs/remix-simulator/src/methods/blocks.ts +++ b/libs/remix-simulator/src/methods/blocks.ts @@ -1,10 +1,10 @@ export class Blocks { - executionContext + vmContext coinbase: string blockNumber: number - constructor (executionContext, _options) { - this.executionContext = executionContext + constructor (vmContext, _options) { + this.vmContext = vmContext const options = _options || {} this.coinbase = options.coinbase || '0x0000000000000000000000000000000000000000' this.blockNumber = 0 @@ -28,13 +28,13 @@ export class Blocks { eth_getBlockByNumber (payload, cb) { let blockIndex = payload.params[0] if (blockIndex === 'latest') { - blockIndex = this.executionContext.latestBlockNumber + blockIndex = this.vmContext.latestBlockNumber } if (Number.isInteger(blockIndex)) { blockIndex = '0x' + blockIndex.toString(16) } - const block = this.executionContext.blocks[blockIndex] + const block = this.vmContext.blocks[blockIndex] if (!block) { return cb(new Error('block not found')) @@ -70,7 +70,7 @@ export class Blocks { } eth_getBlockByHash (payload, cb) { - const block = this.executionContext.blocks[payload.params[0]] + const block = this.vmContext.blocks[payload.params[0]] const b = { number: this.toHex(block.header.number), @@ -109,13 +109,13 @@ export class Blocks { } eth_getBlockTransactionCountByHash (payload, cb) { - const block = this.executionContext.blocks[payload.params[0]] + const block = this.vmContext.blocks[payload.params[0]] cb(null, block.transactions.length) } eth_getBlockTransactionCountByNumber (payload, cb) { - const block = this.executionContext.blocks[payload.params[0]] + const block = this.vmContext.blocks[payload.params[0]] cb(null, block.transactions.length) } @@ -131,7 +131,7 @@ export class Blocks { eth_getStorageAt (payload, cb) { const [address, position, blockNumber] = payload.params - this.executionContext.web3().debug.storageRangeAt(blockNumber, 'latest', address.toLowerCase(), position, 1, (err, result) => { + this.vmContext.web3().debug.storageRangeAt(blockNumber, 'latest', address.toLowerCase(), position, 1, (err, result) => { if (err || (result.storage && Object.values(result.storage).length === 0)) { return cb(err, '') } diff --git a/libs/remix-simulator/src/methods/debug.ts b/libs/remix-simulator/src/methods/debug.ts index ae7f3067b8..b9bf886e50 100644 --- a/libs/remix-simulator/src/methods/debug.ts +++ b/libs/remix-simulator/src/methods/debug.ts @@ -1,8 +1,8 @@ export class Debug { - executionContext + vmContext - constructor (executionContext) { - this.executionContext = executionContext + constructor (vmContext) { + this.vmContext = vmContext } methods () { @@ -14,15 +14,15 @@ export class Debug { } debug_traceTransaction (payload, cb) { - this.executionContext.web3().debug.traceTransaction(payload.params[0], {}, cb) + this.vmContext.web3().debug.traceTransaction(payload.params[0], {}, cb) } debug_preimage (payload, cb) { - this.executionContext.web3().debug.preimage(payload.params[0], cb) + this.vmContext.web3().debug.preimage(payload.params[0], cb) } debug_storageRangeAt (payload, cb) { - this.executionContext.web3().debug.storageRangeAt( + this.vmContext.web3().debug.storageRangeAt( payload.params[0], payload.params[1], payload.params[2], diff --git a/libs/remix-simulator/src/methods/filters.ts b/libs/remix-simulator/src/methods/filters.ts index c27cc49bd6..43404a1c31 100644 --- a/libs/remix-simulator/src/methods/filters.ts +++ b/libs/remix-simulator/src/methods/filters.ts @@ -1,8 +1,8 @@ export class Filters { - executionContext + vmContext - constructor (executionContext) { - this.executionContext = executionContext + constructor (vmContext) { + this.vmContext = vmContext } methods () { @@ -14,49 +14,49 @@ export class Filters { } eth_getLogs (payload, cb) { - const results = this.executionContext.logsManager.getLogsFor(payload.params[0]) + const results = this.vmContext.logsManager.getLogsFor(payload.params[0]) cb(null, results) } eth_subscribe (payload, cb) { - const subscriptionId = this.executionContext.logsManager.subscribe(payload.params) + const subscriptionId = this.vmContext.logsManager.subscribe(payload.params) cb(null, subscriptionId) } eth_unsubscribe (payload, cb) { - this.executionContext.logsManager.unsubscribe(payload.params[0]) + this.vmContext.logsManager.unsubscribe(payload.params[0]) cb(null, true) } eth_newFilter (payload, cb) { - const filterId = this.executionContext.logsManager.newFilter('filter', payload.params[0]) + const filterId = this.vmContext.logsManager.newFilter('filter', payload.params[0]) cb(null, filterId) } eth_newBlockFilter (payload, cb) { - const filterId = this.executionContext.logsManager.newFilter('block') + const filterId = this.vmContext.logsManager.newFilter('block') cb(null, filterId) } eth_newPendingTransactionFilter (payload, cb) { - const filterId = this.executionContext.logsManager.newFilter('pendingTransactions') + const filterId = this.vmContext.logsManager.newFilter('pendingTransactions') cb(null, filterId) } eth_uninstallfilter (payload, cb) { - const result = this.executionContext.logsManager.uninstallFilter(payload.params[0]) + const result = this.vmContext.logsManager.uninstallFilter(payload.params[0]) cb(null, result) } eth_getFilterChanges (payload, cb) { const filterId = payload.params[0] - const results = this.executionContext.logsManager.getLogsForFilter(filterId) + const results = this.vmContext.logsManager.getLogsForFilter(filterId) cb(null, results) } eth_getFilterLogs (payload, cb) { const filterId = payload.params[0] - const results = this.executionContext.logsManager.getLogsForFilter(filterId, true) + const results = this.vmContext.logsManager.getLogsForFilter(filterId, true) cb(null, results) } } diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index f3e8ca3f43..04ef986403 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -3,11 +3,14 @@ import { toChecksumAddress, BN, Address } from 'ethereumjs-util' import { processTx } from './txProcess' export class Transactions { - executionContext + vmContext accounts + tags - constructor (executionContext) { - this.executionContext = executionContext + + constructor (vmContext) { + this.vmContext = vmContext + this.tags = {} } init (accounts) { @@ -24,7 +27,9 @@ export class Transactions { eth_getTransactionCount: this.eth_getTransactionCount.bind(this), eth_getTransactionByHash: this.eth_getTransactionByHash.bind(this), eth_getTransactionByBlockHashAndIndex: this.eth_getTransactionByBlockHashAndIndex.bind(this), - eth_getTransactionByBlockNumberAndIndex: this.eth_getTransactionByBlockNumberAndIndex.bind(this) + eth_getTransactionByBlockNumberAndIndex: this.eth_getTransactionByBlockNumberAndIndex.bind(this), + eth_getExecutionResultFromSimulator: this.eth_getExecutionResultFromSimulator.bind(this), + eth_getHashFromTagBySimulator: this.eth_getHashFromTagBySimulator.bind(this) } } @@ -33,16 +38,30 @@ export class Transactions { if (payload.params && payload.params.length > 0 && payload.params[0].from) { payload.params[0].from = toChecksumAddress(payload.params[0].from) } - processTx(this.executionContext, this.accounts, payload, false, cb) + processTx(this.vmContext, this.accounts, payload, false, (error, result) => { + if (!error && result) { + this.vmContext.addBlock(result.block) + const hash = '0x' + result.tx.hash().toString('hex') + this.vmContext.trackTx(hash, result.block) + this.vmContext.trackExecResult(hash, result.result.execResult) + return cb (null, result.transactionHash) + } + cb(error) + }) + } + + eth_getExecutionResultFromSimulator (payload, cb) { + const txHash = payload.params[0] + cb(null, this.vmContext.exeResults[txHash]) } eth_getTransactionReceipt (payload, cb) { - this.executionContext.web3().eth.getTransactionReceipt(payload.params[0], (error, receipt) => { + this.vmContext.web3().eth.getTransactionReceipt(payload.params[0], (error, receipt) => { if (error) { return cb(error) } - const txBlock = this.executionContext.txs[receipt.hash] + const txBlock = this.vmContext.txs[receipt.hash] const r: Record = { transactionHash: receipt.hash, @@ -72,7 +91,7 @@ export class Transactions { eth_getCode (payload, cb) { const address = payload.params[0] - this.executionContext.web3().eth.getCode(address, (error, result) => { + this.vmContext.web3().eth.getCode(address, (error, result) => { if (error) { console.dir('error getting code') console.dir(error) @@ -91,14 +110,32 @@ export class Transactions { } payload.params[0].value = undefined + + const tag = payload.params[0].timestamp // e2e reference + + processTx(this.vmContext, this.accounts, payload, true, (error, result) => { + if (!error && result) { + this.vmContext.addBlock(result.block) + const hash = '0x' + result.tx.hash().toString('hex') + this.vmContext.trackTx(hash, result.block) + this.vmContext.trackExecResult(hash, result.result.execResult) + this.tags[tag] = result.transactionHash + // calls are not supposed to return a transaction hash. we do this for keeping track of it and allowing debugging calls. + const returnValue = `0x${result.result.execResult.returnValue.toString('hex') || '0'}` + return cb (null, returnValue) + } + cb(error) + }) + } - processTx(this.executionContext, this.accounts, payload, true, cb) + eth_getHashFromTagBySimulator (payload, cb) { + return cb(null, this.tags[payload.params[0]]) } eth_getTransactionCount (payload, cb) { const address = payload.params[0] - this.executionContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { + this.vmContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { const nonce = new BN(account.nonce).toString(10) cb(null, nonce) }).catch((error) => { @@ -109,12 +146,12 @@ export class Transactions { eth_getTransactionByHash (payload, cb) { const address = payload.params[0] - this.executionContext.web3().eth.getTransactionReceipt(address, (error, receipt) => { + this.vmContext.web3().eth.getTransactionReceipt(address, (error, receipt) => { if (error) { return cb(error) } - const txBlock = this.executionContext.txs[receipt.transactionHash] + const txBlock = this.vmContext.txs[receipt.transactionHash] // TODO: params to add later const r: Record = { @@ -154,10 +191,10 @@ export class Transactions { eth_getTransactionByBlockHashAndIndex (payload, cb) { const txIndex = payload.params[1] - const txBlock = this.executionContext.blocks[payload.params[0]] + const txBlock = this.vmContext.blocks[payload.params[0]] const txHash = '0x' + txBlock.transactions[Web3.utils.toDecimal(txIndex)].hash().toString('hex') - this.executionContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { + this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { if (error) { return cb(error) } @@ -196,10 +233,10 @@ export class Transactions { eth_getTransactionByBlockNumberAndIndex (payload, cb) { const txIndex = payload.params[1] - const txBlock = this.executionContext.blocks[payload.params[0]] + const txBlock = this.vmContext.blocks[payload.params[0]] const txHash = '0x' + txBlock.transactions[Web3.utils.toDecimal(txIndex)].hash().toString('hex') - this.executionContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { + this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { if (error) { return cb(error) } diff --git a/libs/remix-simulator/src/methods/txProcess.ts b/libs/remix-simulator/src/methods/txProcess.ts index 8f8acb5b2f..821206eae8 100644 --- a/libs/remix-simulator/src/methods/txProcess.ts +++ b/libs/remix-simulator/src/methods/txProcess.ts @@ -1,15 +1,15 @@ import { execution } from '@remix-project/remix-lib' const TxExecution = execution.txExecution -const TxRunner = execution.txRunner +const TxRunnerVM = execution.TxRunnerVM +const TxRunner = execution.TxRunner + function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks, callback) { const finalCallback = function (err, result) { if (err) { return callback(err) - } - const returnValue = result.result.execResult.returnValue.toString('hex') - const toReturn = `0x${returnValue || '0'}` - return callback(null, toReturn) + } + return callback(null, result) } TxExecution.callFunction(from, to, data, value, gasLimit, { constant: true }, txRunner, callbacks, finalCallback) @@ -20,7 +20,7 @@ function runTx (payload, from, to, data, value, gasLimit, txRunner, callbacks, c if (err) { return callback(err) } - callback(null, result.transactionHash) + callback(null, result) } TxExecution.callFunction(from, to, data, value, gasLimit, { constant: false }, txRunner, callbacks, finalCallback) @@ -31,15 +31,16 @@ function createContract (payload, from, data, value, gasLimit, txRunner, callbac if (err) { return callback(err) } - callback(null, result.transactionHash) + callback(null, result) } TxExecution.createContract(from, data, value, gasLimit, txRunner, callbacks, finalCallback) } +let txRunnerVMInstance let txRunnerInstance -export function processTx (executionContext, accounts, payload, isCall, callback) { +export function processTx (vmContext, accounts, payload, isCall, callback) { const api = { logMessage: (msg) => { }, @@ -61,11 +62,11 @@ export function processTx (executionContext, accounts, payload, isCall, callback } } - executionContext.init(api.config) - - // let txRunner = new TxRunner(accounts, api) + if (!txRunnerVMInstance) { + txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => vmContext.vm()) + } if (!txRunnerInstance) { - txRunnerInstance = new TxRunner(accounts, api, executionContext) + txRunnerInstance = new TxRunner(txRunnerVMInstance, { runAsync: false }) } txRunnerInstance.vmaccounts = accounts let { from, to, data, value, gas } = payload.params[0] diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index 8fdb5b5aba..5046660d7f 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -1,5 +1,4 @@ import { Blocks } from './methods/blocks' -import { execution } from '@remix-project/remix-lib' import { info } from './utils/logs' import merge from 'merge' @@ -11,11 +10,11 @@ import { methods as netMethods } from './methods/net' import { Transactions } from './methods/transactions' import { Debug } from './methods/debug' import { generateBlock } from './genesis' -const { executionContext } = execution +import { VMContext } from './vm-context' export class Provider { options: Record - executionContext + vmContext Accounts Transactions methods @@ -26,23 +25,23 @@ export class Provider { this.options = options this.host = host this.connected = true - // TODO: init executionContext here - this.executionContext = executionContext - this.Accounts = new Accounts(this.executionContext) - this.Transactions = new Transactions(this.executionContext) + this.vmContext = new VMContext() + + this.Accounts = new Accounts(this.vmContext) + this.Transactions = new Transactions(this.vmContext) this.methods = {} this.methods = merge(this.methods, this.Accounts.methods()) - this.methods = merge(this.methods, (new Blocks(this.executionContext, options)).methods()) + this.methods = merge(this.methods, (new Blocks(this.vmContext, options)).methods()) this.methods = merge(this.methods, miscMethods()) - this.methods = merge(this.methods, (new Filters(this.executionContext)).methods()) + this.methods = merge(this.methods, (new Filters(this.vmContext)).methods()) this.methods = merge(this.methods, netMethods()) this.methods = merge(this.methods, this.Transactions.methods()) - this.methods = merge(this.methods, (new Debug(this.executionContext)).methods()) + this.methods = merge(this.methods, (new Debug(this.vmContext)).methods()) } async init () { - await generateBlock(this.executionContext) + await generateBlock(this.vmContext) await this.Accounts.resetAccounts() this.Transactions.init(this.Accounts.accounts) } @@ -87,6 +86,40 @@ export class Provider { }; on (type, cb) { - this.executionContext.logsManager.addListener(type, cb) + this.vmContext.logsManager.addListener(type, cb) } } + +export function extend (web3) { + if (!web3.extend) { + return + } + // DEBUG + const methods = [] + if (!(web3.eth && web3.eth.getExecutionResultFromSimulator)) { + methods.push(new web3.extend.Method({ + name: 'getExecutionResultFromSimulator', + call: 'eth_getExecutionResultFromSimulator', + inputFormatter: [null], + params: 1 + })) + } + + if (!(web3.eth && web3.eth.getHashFromTagBySimulator)) { + methods.push(new web3.extend.Method({ + name: 'getHashFromTagBySimulator', + call: 'eth_getHashFromTagBySimulator', + inputFormatter: [null], + params: 1 + })) + } + + if (methods.length > 0) { + web3.extend({ + property: 'eth', + methods: methods, + properties: [] + }) + } +} + diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts new file mode 100644 index 0000000000..481f5f4057 --- /dev/null +++ b/libs/remix-simulator/src/vm-context.ts @@ -0,0 +1,147 @@ +/* global ethereum */ +'use strict' +import Web3 from 'web3' +import { rlp, keccak, bufferToHex } from 'ethereumjs-util' +import { vm, execution } from '@remix-project/remix-lib' +const EthJSVM = require('ethereumjs-vm').default +const StateManager = require('ethereumjs-vm/dist/state/stateManager').default + +/* + extend vm state manager and instanciate VM +*/ + +class StateManagerCommonStorageDump extends StateManager { + constructor (arg) { + super(arg) + this.keyHashes = {} + } + + putContractStorage (address, key, value, cb) { + this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) + super.putContractStorage(address, key, value, cb) + } + + dumpStorage (address, cb) { + this._getStorageTrie(address, (err, trie) => { + if (err) { + return cb(err) + } + const storage = {} + const stream = trie.createReadStream() + stream.on('data', (val) => { + const value = rlp.decode(val.value) + storage['0x' + val.key.toString('hex')] = { + key: this.keyHashes[val.key.toString('hex')], + value: '0x' + value.toString('hex') + } + }) + stream.on('end', function () { + cb(storage) + }) + }) + } + + getStateRoot (cb) { + const checkpoint = this._checkpointCount + this._checkpointCount = 0 + super.getStateRoot((err, stateRoot) => { + this._checkpointCount = checkpoint + cb(err, stateRoot) + }) + } + + setStateRoot (stateRoot, cb) { + const checkpoint = this._checkpointCount + this._checkpointCount = 0 + super.setStateRoot(stateRoot, (err) => { + this._checkpointCount = checkpoint + cb(err) + }) + } +} + +/* + trigger contextChanged, web3EndpointChanged +*/ +export class VMContext { + currentFork: string + blockGasLimitDefault: number + blockGasLimit: number + customNetWorks + blocks + latestBlockNumber + txs + vms + web3vm + logsManager + exeResults + + constructor () { + this.blockGasLimitDefault = 4300000 + this.blockGasLimit = this.blockGasLimitDefault + this.currentFork = 'muirGlacier' + this.vms = { + /* + byzantium: createVm('byzantium'), + constantinople: createVm('constantinople'), + petersburg: createVm('petersburg'), + istanbul: createVm('istanbul'), + */ + muirGlacier: this.createVm('muirGlacier') + } + this.blocks = {} + this.latestBlockNumber = 0 + this.txs = {} + this.exeResults = {} + this.logsManager = new execution.LogsManager() + + } + + createVm (hardfork) { + const stateManager = new StateManagerCommonStorageDump({}) + stateManager.checkpoint(() => {}) + const ethvm = new EthJSVM({ + activatePrecompiles: true, + blockchain: stateManager.blockchain, + stateManager: stateManager, + hardfork: hardfork + }) + ethvm.blockchain.validate = false + this.web3vm = new vm.Web3VMProvider() + this.web3vm.setVM(ethvm) + return { vm: ethvm, web3vm: this.web3vm, stateManager } + } + + web3 () { + return this.web3vm + } + + blankWeb3 () { + return new Web3() + } + + vm () { + return this.vms[this.currentFork].vm + } + + addBlock (block) { + let blockNumber = '0x' + block.header.number.toString('hex') + if (blockNumber === '0x') { + blockNumber = '0x0' + } + + this.blocks['0x' + block.hash().toString('hex')] = block + this.blocks[blockNumber] = block + this.latestBlockNumber = blockNumber + + this.logsManager.checkBlock(blockNumber, block, this.web3vm) + } + + trackTx (tx, block) { + this.txs[tx] = block + } + + trackExecResult (tx, execReult) { + this.exeResults[tx] = execReult + } +} diff --git a/libs/remix-tests/jest.config.js b/libs/remix-tests/jest.config.js index 7923ddf044..dcbd823a5c 100644 --- a/libs/remix-tests/jest.config.js +++ b/libs/remix-tests/jest.config.js @@ -1,7 +1,7 @@ module.exports = { name: 'remix-tests', preset: '../../jest.config.js', - verbose: true, + verbose: false, silent: false, // Silent console messages, specially the 'remix-simulator' ones transform: { '^.+\\.[tj]sx?$': 'ts-jest', @@ -18,6 +18,6 @@ module.exports = { "!src/types.ts", "!src/logger.ts" ], - coverageDirectory: '../../coverage/libs/remix-tests', + coverageDirectory: '../../coverage/libs/remix-tests' }; \ No newline at end of file diff --git a/libs/remix-tests/src/deployer.ts b/libs/remix-tests/src/deployer.ts index c6e00456fa..1e3fcb8d88 100644 --- a/libs/remix-tests/src/deployer.ts +++ b/libs/remix-tests/src/deployer.ts @@ -79,7 +79,7 @@ export function deployAll (compileResult: compilationInterface, web3: Web3, with contracts[contractName] = contractObject contracts[contractName].filename = filename - callback(null, { result: { createdAddress: receipt.contractAddress } }) // TODO this will only work with JavaScriptV VM + callback(null, { receipt: { contractAddress: receipt.contractAddress } }) // TODO this will only work with JavaScriptV VM }).on('error', function (err) { console.error(err) callback(err) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 3d906095f3..a865bbc649 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -3,17 +3,23 @@ import { resolve } from 'path' describe('testRunner: remix-tests CLI', () => { // remix-tests binary, after build, is used as executable + const executablePath = resolve(__dirname + '/../../../dist/libs/remix-tests/bin/remix-tests') + const result = spawnSync('ls', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') }) if(result) { const dirContent = result.stdout.toString() // Install dependencies if 'node_modules' is not already present - if(!dirContent.includes('node_modules')) execSync('npm install', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') }) + if(!dirContent.includes('node_modules')) execSync( + 'ln -s ' + __dirname + '/../../../node_modules node_modules', + { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') }) } + describe('test various CLI options', () => { test('remix-tests version', () => { const res = spawnSync(executablePath, ['-V']) + console.log(res.stdout.toString()) expect(res.stdout.toString().trim()).toBe(require('../package.json').version) }) diff --git a/libs/remix-tests/tsconfig.json b/libs/remix-tests/tsconfig.json index 4422abf942..cf7076c1d1 100644 --- a/libs/remix-tests/tsconfig.json +++ b/libs/remix-tests/tsconfig.json @@ -3,9 +3,9 @@ "compilerOptions": { "types": ["node", "jest"], "module": "commonjs", + "esModuleInterop": true, "allowJs": true, "rootDir": "./", - "esModuleInterop": true }, "include": ["**/*.ts"] } \ No newline at end of file diff --git a/libs/remix-tests/tsconfig.lib.json b/libs/remix-tests/tsconfig.lib.json index ac117282b1..aec3a4c785 100644 --- a/libs/remix-tests/tsconfig.lib.json +++ b/libs/remix-tests/tsconfig.lib.json @@ -1,16 +1,15 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, - "rootDir": "./", - "types": ["node"] - }, - "exclude": [ - "**/*.spec.ts", - "tests/" - ], - "include": ["**/*.ts"] + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../dist/out-tsc", + "declaration": true, + "rootDir": "./", + "types": ["node"] + }, + "exclude": [ + "**/*.spec.ts", + "test/" + ], + "include": ["**/*.ts"] } - \ No newline at end of file diff --git a/libs/remix-tests/tsconfig.spec.json b/libs/remix-tests/tsconfig.spec.json index 118a64f08e..559410b96a 100644 --- a/libs/remix-tests/tsconfig.spec.json +++ b/libs/remix-tests/tsconfig.spec.json @@ -1,16 +1,15 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "**/*.spec.ts", - "**/*.spec.tsx", - "**/*.spec.js", - "**/*.spec.jsx", - "**/*.d.ts" - ] - } - \ No newline at end of file + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.spec.js", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} From a1769914f1bc44fa29b29fcd538de601893bfda8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 10 Mar 2021 12:57:39 +0100 Subject: [PATCH 02/52] linting --- .../src/execution/execution-context.ts | 2 +- libs/remix-lib/src/execution/txRunnerVM.ts | 7 ++--- libs/remix-lib/src/execution/txRunnerWeb3.ts | 10 +++---- .../src/web3Provider/web3VmProvider.ts | 2 +- .../src/methods/transactions.ts | 7 ++--- libs/remix-simulator/src/methods/txProcess.ts | 3 +- libs/remix-simulator/src/provider.ts | 9 +++--- libs/remix-simulator/src/vm-context.ts | 29 +++++++++---------- 8 files changed, 32 insertions(+), 37 deletions(-) diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index ba067e7035..7644081040 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -343,5 +343,5 @@ export class ExecutionContext { if (transactionDetailsLinks[network]) { return transactionDetailsLinks[network] + hash } - } + } } diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index 3b221f8b75..bc7e1403a7 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -27,7 +27,7 @@ export class TxRunnerVM { this.blockNumber = 0 this.runAsync = true this.blockNumber = 0 // The VM is running in Homestead mode, which started at this block. - this.runAsync = false // We have to run like this cause the VM Event Manager does not support running multiple txs at the same time. + this.runAsync = false // We have to run like this cause the VM Event Manager does not support running multiple txs at the same time. this.pendingTxs = {} this.vmaccounts = vmaccounts this.queusTxs = [] @@ -110,11 +110,10 @@ export class TxRunnerVM { result: result, transactionHash: bufferToHex(Buffer.from(tx.hash())), block, - tx, + tx }) }).catch(function (err) { callback(err) }) - } + } } - diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index f735b3401c..4554c396e8 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -65,8 +65,8 @@ export class TxRunnerWeb3 { data = '0x' + data } - return this.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, confirmationCb, gasEstimationForceSend, promptCb, callback) - } + return this.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, confirmationCb, gasEstimationForceSend, promptCb, callback) + } runInNode (from, to, data, value, gasLimit, useCall, timestamp, confirmCb, gasEstimationForceSend, promptCb, callback) { const tx = { from: from, to: to, data: data, value: value } @@ -76,16 +76,16 @@ export class TxRunnerWeb3 { tx['gas'] = gasLimit tx['timestamp'] = timestamp return this.getWeb3().eth.call(tx, function (error, result: any) { - if (error) return callback(error) + if (error) return callback(error) callback(null, { - result: result + result: result }) }) } this.getWeb3().eth.estimateGas(tx, (err, gasEstimation) => { if (err && err.message.indexOf('Invalid JSON RPC response') !== -1) { // // @todo(#378) this should be removed when https://github.com/WalletConnect/walletconnect-monorepo/issues/334 is fixed - new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.') + callback(new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.')) } gasEstimationForceSend(err, () => { // callback is called whenever no error diff --git a/libs/remix-lib/src/web3Provider/web3VmProvider.ts b/libs/remix-lib/src/web3Provider/web3VmProvider.ts index 361c2b7161..59b0e7e909 100644 --- a/libs/remix-lib/src/web3Provider/web3VmProvider.ts +++ b/libs/remix-lib/src/web3Provider/web3VmProvider.ts @@ -74,7 +74,7 @@ export class Web3VmProvider { this.utils = Web3.utils || [] this.txsMapBlock = {} this.blocks = {} - this.latestBlockNumber + this.latestBlockNumber = 0 } setVM (vm) { diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index 04ef986403..969eb0ff6f 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -7,7 +7,6 @@ export class Transactions { accounts tags - constructor (vmContext) { this.vmContext = vmContext this.tags = {} @@ -44,7 +43,7 @@ export class Transactions { const hash = '0x' + result.tx.hash().toString('hex') this.vmContext.trackTx(hash, result.block) this.vmContext.trackExecResult(hash, result.result.execResult) - return cb (null, result.transactionHash) + return cb(null, result.transactionHash) } cb(error) }) @@ -110,7 +109,7 @@ export class Transactions { } payload.params[0].value = undefined - + const tag = payload.params[0].timestamp // e2e reference processTx(this.vmContext, this.accounts, payload, true, (error, result) => { @@ -122,7 +121,7 @@ export class Transactions { this.tags[tag] = result.transactionHash // calls are not supposed to return a transaction hash. we do this for keeping track of it and allowing debugging calls. const returnValue = `0x${result.result.execResult.returnValue.toString('hex') || '0'}` - return cb (null, returnValue) + return cb(null, returnValue) } cb(error) }) diff --git a/libs/remix-simulator/src/methods/txProcess.ts b/libs/remix-simulator/src/methods/txProcess.ts index 821206eae8..d51bbf9c73 100644 --- a/libs/remix-simulator/src/methods/txProcess.ts +++ b/libs/remix-simulator/src/methods/txProcess.ts @@ -3,12 +3,11 @@ const TxExecution = execution.txExecution const TxRunnerVM = execution.TxRunnerVM const TxRunner = execution.TxRunner - function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks, callback) { const finalCallback = function (err, result) { if (err) { return callback(err) - } + } return callback(null, result) } diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index 5046660d7f..276b66ca15 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -26,7 +26,7 @@ export class Provider { this.host = host this.connected = true this.vmContext = new VMContext() - + this.Accounts = new Accounts(this.vmContext) this.Transactions = new Transactions(this.vmContext) @@ -102,7 +102,7 @@ export function extend (web3) { call: 'eth_getExecutionResultFromSimulator', inputFormatter: [null], params: 1 - })) + })) } if (!(web3.eth && web3.eth.getHashFromTagBySimulator)) { @@ -111,9 +111,9 @@ export function extend (web3) { call: 'eth_getHashFromTagBySimulator', inputFormatter: [null], params: 1 - })) + })) } - + if (methods.length > 0) { web3.extend({ property: 'eth', @@ -122,4 +122,3 @@ export function extend (web3) { }) } } - diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index 481f5f4057..e59eb68cdd 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -75,8 +75,8 @@ export class VMContext { web3vm logsManager exeResults - - constructor () { + + constructor () { this.blockGasLimitDefault = 4300000 this.blockGasLimit = this.blockGasLimitDefault this.currentFork = 'muirGlacier' @@ -94,7 +94,6 @@ export class VMContext { this.txs = {} this.exeResults = {} this.logsManager = new execution.LogsManager() - } createVm (hardfork) { @@ -124,20 +123,20 @@ export class VMContext { return this.vms[this.currentFork].vm } - addBlock (block) { - let blockNumber = '0x' + block.header.number.toString('hex') - if (blockNumber === '0x') { - blockNumber = '0x0' - } - - this.blocks['0x' + block.hash().toString('hex')] = block - this.blocks[blockNumber] = block - this.latestBlockNumber = blockNumber + addBlock (block) { + let blockNumber = '0x' + block.header.number.toString('hex') + if (blockNumber === '0x') { + blockNumber = '0x0' + } + + this.blocks['0x' + block.hash().toString('hex')] = block + this.blocks[blockNumber] = block + this.latestBlockNumber = blockNumber - this.logsManager.checkBlock(blockNumber, block, this.web3vm) - } + this.logsManager.checkBlock(blockNumber, block, this.web3vm) + } - trackTx (tx, block) { + trackTx (tx, block) { this.txs[tx] = block } From 2736a3e8dfa80854124c6a907fe41fc2539ea544 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Mar 2021 13:02:39 +0100 Subject: [PATCH 03/52] fix tests --- .circleci/config.yml | 1 + libs/remix-simulator/package.json | 2 +- libs/remix-solidity/package.json | 2 +- libs/remix-tests/jest.config.js | 3 ++- libs/remix-tests/package.json | 6 +++--- libs/remix-tests/tests/testRunner.cli.spec.ts | 4 +--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab5e15436f..49aada7eb0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,7 @@ jobs: - checkout - run: npm install - run: npm run build:libs + - run: export NODE_OPTIONS="--max_old_space_size=8192" - run: npm run test:libs remix-ide-chrome-1: diff --git a/libs/remix-simulator/package.json b/libs/remix-simulator/package.json index eb09b20106..b39deedf5a 100644 --- a/libs/remix-simulator/package.json +++ b/libs/remix-simulator/package.json @@ -14,7 +14,7 @@ ], "main": "src/index.js", "dependencies": { - "@remix-project/remix-lib": "^0.4.34", + "@remix-project/remix-lib": "../remix-lib", "ansi-gray": "^0.1.1", "async": "^3.1.0", "body-parser": "^1.18.2", diff --git a/libs/remix-solidity/package.json b/libs/remix-solidity/package.json index ddb834e951..7a54cfe8d7 100644 --- a/libs/remix-solidity/package.json +++ b/libs/remix-solidity/package.json @@ -15,7 +15,7 @@ } ], "dependencies": { - "@remix-project/remix-lib": "^0.4.34", + "@remix-project/remix-lib": "../remix-lib", "eslint-scope": "^5.0.0", "@ethereumjs/vm": "^5.3.2", "@ethereumjs/block": "^3.2.1", diff --git a/libs/remix-tests/jest.config.js b/libs/remix-tests/jest.config.js index dcbd823a5c..0f08d413b7 100644 --- a/libs/remix-tests/jest.config.js +++ b/libs/remix-tests/jest.config.js @@ -1,11 +1,12 @@ module.exports = { name: 'remix-tests', preset: '../../jest.config.js', - verbose: false, + verbose: true, silent: false, // Silent console messages, specially the 'remix-simulator' ones transform: { '^.+\\.[tj]sx?$': 'ts-jest', }, + transformIgnorePatterns: ["/node_modules/", "\\.pnp\\.[^\\\/]+$"], rootDir: "./", testTimeout: 40000, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html', 'json'], diff --git a/libs/remix-tests/package.json b/libs/remix-tests/package.json index a2480bfa46..9adf364e2d 100644 --- a/libs/remix-tests/package.json +++ b/libs/remix-tests/package.json @@ -35,9 +35,9 @@ }, "homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-tests#readme", "dependencies": { - "@remix-project/remix-lib": "^0.4.34", - "@remix-project/remix-simulator": "^0.1.10-beta.0", - "@remix-project/remix-solidity": "^0.3.35", + "@remix-project/remix-lib": "../remix-lib", + "@remix-project/remix-simulator": "../remix-simulator", + "@remix-project/remix-solidity": "../remix-solidity", "ansi-gray": "^0.1.1", "async": "^2.6.0", "axios": ">=0.21.1", diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index a865bbc649..21ce34afdb 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -10,9 +10,7 @@ describe('testRunner: remix-tests CLI', () => { if(result) { const dirContent = result.stdout.toString() // Install dependencies if 'node_modules' is not already present - if(!dirContent.includes('node_modules')) execSync( - 'ln -s ' + __dirname + '/../../../node_modules node_modules', - { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') }) + if(!dirContent.includes('node_modules')) execSync('npm install', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') }) } From d67fdca939bf8fb0cfed2a3707d276c51b4ac95a Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Mar 2021 14:17:47 +0100 Subject: [PATCH 04/52] linting --- .vscode/settings.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..2fb99dc19e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "ethcode.keystore.keyStorePath": "/home/yann/.vscode/extensions/ethential.ethcode-0.2.2", + "ethcode.userConfig.defaultAccount": null +} \ No newline at end of file From 88713868605f91f8c652eaec9b6ecdc5eb5fc98e Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 11 Mar 2021 14:42:28 +0100 Subject: [PATCH 05/52] fix e2e tests --- apps/remix-ide-e2e/src/tests/terminal.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 448642f4b5..dc4fc9d462 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -62,7 +62,8 @@ module.exports = { 'Call web3.eth.getAccounts() using JavaScript VM': function (browser: NightwatchBrowser) { browser .executeScript('web3.eth.getAccounts()') - .waitForElementContainsText('*[data-id="terminalJournal"]', '[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]', 60000) + .pause(2000) + .waitForElementContainsText('*[data-id="terminalJournal"]', '[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]', 60000) }, 'Call web3.eth.getAccounts() using Web3 Provider': function (browser: NightwatchBrowser) { From d485ccb77a7d28b290b18e531978976f776cb9f9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 15 Mar 2021 11:13:47 +0100 Subject: [PATCH 06/52] move execution-context --- apps/remix-ide/src/blockchain/blockchain.js | 4 +- .../src/blockchain/execution-context.js | 39 ++++++------------- libs/remix-lib/src/execution/txListener.ts | 3 +- libs/remix-lib/src/index.ts | 2 - libs/remix-lib/test/txFormat.ts | 3 -- 5 files changed, 15 insertions(+), 36 deletions(-) rename libs/remix-lib/src/execution/execution-context.ts => apps/remix-ide/src/blockchain/execution-context.js (90%) diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 09ca8a05a2..973e267683 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -7,7 +7,7 @@ const TxRunner = remixLib.execution.TxRunner const TxRunnerWeb3 = remixLib.execution.TxRunnerWeb3 const txHelper = remixLib.execution.txHelper const EventManager = remixLib.EventManager -const executionContext = remixLib.execution.executionContext +const { ExecutionContext } = require('./execution-context') const Web3 = require('web3') const async = require('async') @@ -23,7 +23,7 @@ class Blockchain { // NOTE: the config object will need to be refactored out in remix-lib constructor (config) { this.event = new EventManager() - this.executionContext = executionContext + this.executionContext = new ExecutionContext() this.events = new EventEmitter() this.config = config diff --git a/libs/remix-lib/src/execution/execution-context.ts b/apps/remix-ide/src/blockchain/execution-context.js similarity index 90% rename from libs/remix-lib/src/execution/execution-context.ts rename to apps/remix-ide/src/blockchain/execution-context.js index 7644081040..df2d9421bb 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/apps/remix-ide/src/blockchain/execution-context.js @@ -1,19 +1,17 @@ /* global ethereum */ 'use strict' import Web3 from 'web3' -import { EventManager } from '../eventManager' +import EventManager from '../lib/events' import { rlp, keccak, bufferToHex } from 'ethereumjs-util' import { Web3VmProvider } from '../web3Provider/web3VmProvider' import VM from '@ethereumjs/vm' import Common from '@ethereumjs/common' import StateManager from '@ethereumjs/vm/dist/state/stateManager' -import { StorageDump } from '@ethereumjs/vm/dist/state/interface' -declare let ethereum: any let web3 -if (typeof window !== 'undefined' && typeof window['ethereum'] !== 'undefined') { - var injectedProvider = window['ethereum'] +if (typeof window !== 'undefined' && typeof window.ethereum !== 'undefined') { + var injectedProvider = window.ethereum web3 = new Web3(injectedProvider) } else { web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) @@ -24,12 +22,13 @@ if (typeof window !== 'undefined' && typeof window['ethereum'] !== 'undefined') */ class StateManagerCommonStorageDump extends StateManager { - /* - * dictionary containing keccak(b) as key and b as value. used to get the initial value from its hash - */ - keyHashes: { [key: string]: string } + constructor () { super() + /* + * dictionary containing keccak(b) as key and b as value. used to get the initial value from its hash. + * type: { [key: string]: string } + */ this.keyHashes = {} } @@ -46,7 +45,7 @@ class StateManagerCommonStorageDump extends StateManager { console.log(e) throw e } - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { try { const storage = {} const stream = trie.createReadStream() @@ -66,14 +65,14 @@ class StateManagerCommonStorageDump extends StateManager { }) } - async getStateRoot (force: boolean = false): Promise { + async getStateRoot (force = false) { await this._cache.flush() const stateRoot = this._trie.root return stateRoot } - async setStateRoot (stateRoot: Buffer): Promise { + async setStateRoot (stateRoot) { await this._cache.flush() if (stateRoot === this._trie.EMPTY_TRIE_ROOT) { @@ -98,20 +97,6 @@ class StateManagerCommonStorageDump extends StateManager { trigger contextChanged, web3EndpointChanged */ export class ExecutionContext { - event - blockGasLimitDefault: number - blockGasLimit: number - customNetWorks - blocks - latestBlockNumber - txs - executionContext: string - listenOnLastBlockId - currentFork: string - vms - mainNetGenesisHash: string - customWeb3: { [key: string]: Web3 } - constructor () { this.event = new EventManager() this.executionContext = null @@ -171,7 +156,7 @@ export class ExecutionContext { return this.executionContext === 'vm' } - setWeb3 (context: string, web3: Web3) { + setWeb3 (context, web3) { this.customWeb3[context] = web3 } diff --git a/libs/remix-lib/src/execution/txListener.ts b/libs/remix-lib/src/execution/txListener.ts index 967b8ee3a8..2ec85c3fc9 100644 --- a/libs/remix-lib/src/execution/txListener.ts +++ b/libs/remix-lib/src/execution/txListener.ts @@ -4,7 +4,6 @@ import { ethers } from 'ethers' import { toBuffer } from 'ethereumjs-util' import { EventManager } from '../eventManager' import { compareByteCode } from '../util' -import { ExecutionContext } from './execution-context' import { decodeResponse } from './txFormat' import { getFunction, getReceiveInterface, getConstructorInterface, visitContracts, makeFullTypeDefinition } from './txHelper' @@ -40,7 +39,7 @@ export class TxListener { constructor (opt, executionContext) { this.event = new EventManager() // has a default for now for backwards compatability - this.executionContext = executionContext || new ExecutionContext() + this.executionContext = executionContext this._api = opt.api this._resolvedTransactions = {} this._resolvedContracts = {} diff --git a/libs/remix-lib/src/index.ts b/libs/remix-lib/src/index.ts index afcd0beae6..ae3864a8c9 100644 --- a/libs/remix-lib/src/index.ts +++ b/libs/remix-lib/src/index.ts @@ -13,7 +13,6 @@ import * as txFormat from './execution/txFormat' import { TxListener } from './execution/txListener' import { TxRunner } from './execution/txRunner' import { LogsManager } from './execution/logsManager' -import { ExecutionContext } from './execution/execution-context' import * as typeConversion from './execution/typeConversion' import { TxRunnerVM } from './execution/txRunnerVM' import { TxRunnerWeb3 } from './execution/txRunnerWeb3' @@ -40,7 +39,6 @@ function modules () { EventsDecoder: EventsDecoder, txExecution: txExecution, txHelper: txHelper, - executionContext: new ExecutionContext(), txFormat: txFormat, txListener: TxListener, TxRunner: TxRunner, diff --git a/libs/remix-lib/test/txFormat.ts b/libs/remix-lib/test/txFormat.ts index 2ab4a59b63..8bff069fc2 100644 --- a/libs/remix-lib/test/txFormat.ts +++ b/libs/remix-lib/test/txFormat.ts @@ -5,8 +5,6 @@ import * as txHelper from '../src/execution/txHelper' import { hexToIntArray } from '../src/util' let compiler = require('solc') import { compilerInput } from '../src/helpers/compilerHelper' -import { ExecutionContext } from '../src/execution/execution-context' -const executionContext = new ExecutionContext() const solidityVersion = 'v0.6.0+commit.26b70077' /* tape *********************************************************** */ @@ -151,7 +149,6 @@ function testInvalidTupleInput (st, params) { /* tape *********************************************************** */ tape('ContractParameters - (TxFormat.buildData) - link Libraries', function (t) { - executionContext.setContext('vm', null, null, null) const compileData = compiler.compile(compilerInput(deploySimpleLib)) const fakeDeployedContracts = { From 20cc1997953b2f4caade8f4e03e7e124be7ccc2f Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 15 Mar 2021 13:44:16 +0100 Subject: [PATCH 07/52] remove uneeded execution-context reference --- .../src/methods/transactions.ts | 33 +++++++++++++++-- libs/remix-simulator/src/methods/txProcess.ts | 35 +------------------ 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index 969eb0ff6f..ef72acfe09 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -1,11 +1,16 @@ import Web3 from 'web3' import { toChecksumAddress, BN, Address } from 'ethereumjs-util' import { processTx } from './txProcess' +import { execution } from '@remix-project/remix-lib' +const TxRunnerVM = execution.TxRunnerVM +const TxRunner = execution.TxRunner export class Transactions { vmContext accounts tags + txRunnerVMInstance + txRunnerInstance constructor (vmContext) { this.vmContext = vmContext @@ -14,6 +19,30 @@ export class Transactions { init (accounts) { this.accounts = accounts + const api = { + logMessage: (msg) => { + }, + logHtmlMessage: (msg) => { + }, + config: { + getUnpersistedProperty: (key) => { + return true + }, + get: () => { + return true + } + }, + detectNetwork: (cb) => { + cb() + }, + personalMode: () => { + return false + } + } + + this.txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => this.vmContext.vm()) + this.txRunnerInstance = new TxRunner(this.txRunnerVMInstance, { runAsync: false }) + this.txRunnerInstance.vmaccounts = accounts } methods () { @@ -37,7 +66,7 @@ export class Transactions { if (payload.params && payload.params.length > 0 && payload.params[0].from) { payload.params[0].from = toChecksumAddress(payload.params[0].from) } - processTx(this.vmContext, this.accounts, payload, false, (error, result) => { + processTx(this.txRunnerInstance, payload, false, (error, result) => { if (!error && result) { this.vmContext.addBlock(result.block) const hash = '0x' + result.tx.hash().toString('hex') @@ -112,7 +141,7 @@ export class Transactions { const tag = payload.params[0].timestamp // e2e reference - processTx(this.vmContext, this.accounts, payload, true, (error, result) => { + processTx(this.txRunnerInstance, payload, true, (error, result) => { if (!error && result) { this.vmContext.addBlock(result.block) const hash = '0x' + result.tx.hash().toString('hex') diff --git a/libs/remix-simulator/src/methods/txProcess.ts b/libs/remix-simulator/src/methods/txProcess.ts index d51bbf9c73..75173af309 100644 --- a/libs/remix-simulator/src/methods/txProcess.ts +++ b/libs/remix-simulator/src/methods/txProcess.ts @@ -1,7 +1,5 @@ import { execution } from '@remix-project/remix-lib' const TxExecution = execution.txExecution -const TxRunnerVM = execution.TxRunnerVM -const TxRunner = execution.TxRunner function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks, callback) { const finalCallback = function (err, result) { @@ -36,38 +34,7 @@ function createContract (payload, from, data, value, gasLimit, txRunner, callbac TxExecution.createContract(from, data, value, gasLimit, txRunner, callbacks, finalCallback) } -let txRunnerVMInstance -let txRunnerInstance - -export function processTx (vmContext, accounts, payload, isCall, callback) { - const api = { - logMessage: (msg) => { - }, - logHtmlMessage: (msg) => { - }, - config: { - getUnpersistedProperty: (key) => { - return true - }, - get: () => { - return true - } - }, - detectNetwork: (cb) => { - cb() - }, - personalMode: () => { - return false - } - } - - if (!txRunnerVMInstance) { - txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => vmContext.vm()) - } - if (!txRunnerInstance) { - txRunnerInstance = new TxRunner(txRunnerVMInstance, { runAsync: false }) - } - txRunnerInstance.vmaccounts = accounts +export function processTx (txRunnerInstance, payload, isCall, callback) { let { from, to, data, value, gas } = payload.params[0] gas = gas || 3000000 From ebf0e2cedec5f16be1a64ede04cc858c8729f98a Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 15 Mar 2021 13:55:30 +0100 Subject: [PATCH 08/52] linting --- libs/remix-simulator/src/methods/transactions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index ef72acfe09..fee5059d96 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -39,7 +39,7 @@ export class Transactions { return false } } - + this.txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => this.vmContext.vm()) this.txRunnerInstance = new TxRunner(this.txRunnerVMInstance, { runAsync: false }) this.txRunnerInstance.vmaccounts = accounts From dd6cc654ad9782686c7925e17d3c2a280c7bb8dd Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 15 Mar 2021 15:35:20 +0100 Subject: [PATCH 09/52] fix e2e --- apps/remix-ide-e2e/src/tests/terminal.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index dc4fc9d462..2a17251179 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -63,7 +63,7 @@ module.exports = { browser .executeScript('web3.eth.getAccounts()') .pause(2000) - .waitForElementContainsText('*[data-id="terminalJournal"]', '[ "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", "0x78731D3Ca6b7E34aC0F824c42a7cC18A495cabaB", "0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2", "0x617F2E2fD72FD9D5503197092aC168c91465E7f2", "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "0x17F6AD8Ef982297579C203069C1DbfFE4348c372", "0x5c6B0f7Bf3E7ce046039Bd8FABdfD3f9F5021678", "0x03C6FcED478cBbC9a4FAB34eF9f40767739D1Ff7", "0x1aE0EA34a72D944a8C7603FfB3eC30a6669E454C", "0x0A098Eda01Ce92ff4A4CCb7A4fFFb5A43EBC70DC", "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148" ]', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', '"0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148"', 60000) }, 'Call web3.eth.getAccounts() using Web3 Provider': function (browser: NightwatchBrowser) { From 43f164eaddae7fa0f54a49f943d7561503bbece2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 3 May 2021 15:35:26 +0200 Subject: [PATCH 10/52] fix vmContext & txRunnerVM --- .../src/blockchain/execution-context.js | 112 ---------------- libs/remix-lib/src/execution/txRunnerVM.ts | 96 ++++++------- .../src/methods/transactions.ts | 2 +- libs/remix-simulator/src/vm-context.ts | 126 +++++++++++------- 4 files changed, 125 insertions(+), 211 deletions(-) diff --git a/apps/remix-ide/src/blockchain/execution-context.js b/apps/remix-ide/src/blockchain/execution-context.js index df2d9421bb..41588e3708 100644 --- a/apps/remix-ide/src/blockchain/execution-context.js +++ b/apps/remix-ide/src/blockchain/execution-context.js @@ -2,11 +2,6 @@ 'use strict' import Web3 from 'web3' import EventManager from '../lib/events' -import { rlp, keccak, bufferToHex } from 'ethereumjs-util' -import { Web3VmProvider } from '../web3Provider/web3VmProvider' -import VM from '@ethereumjs/vm' -import Common from '@ethereumjs/common' -import StateManager from '@ethereumjs/vm/dist/state/stateManager' let web3 @@ -17,82 +12,6 @@ if (typeof window !== 'undefined' && typeof window.ethereum !== 'undefined') { web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) } -/* - extend vm state manager and instanciate VM -*/ - -class StateManagerCommonStorageDump extends StateManager { - - constructor () { - super() - /* - * dictionary containing keccak(b) as key and b as value. used to get the initial value from its hash. - * type: { [key: string]: string } - */ - this.keyHashes = {} - } - - putContractStorage (address, key, value) { - this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) - return super.putContractStorage(address, key, value) - } - - async dumpStorage (address) { - let trie - try { - trie = await this._getStorageTrie(address) - } catch (e) { - console.log(e) - throw e - } - return new Promise((resolve, reject) => { - try { - const storage = {} - const stream = trie.createReadStream() - stream.on('data', (val) => { - const value = rlp.decode(val.value) - storage['0x' + val.key.toString('hex')] = { - key: this.keyHashes[val.key.toString('hex')], - value: '0x' + value.toString('hex') - } - }) - stream.on('end', function () { - resolve(storage) - }) - } catch (e) { - reject(e) - } - }) - } - - async getStateRoot (force = false) { - await this._cache.flush() - - const stateRoot = this._trie.root - return stateRoot - } - - async setStateRoot (stateRoot) { - await this._cache.flush() - - if (stateRoot === this._trie.EMPTY_TRIE_ROOT) { - this._trie.root = stateRoot - this._cache.clear() - this._storageTries = {} - return - } - - const hasRoot = await this._trie.checkRoot(stateRoot) - if (!hasRoot) { - throw new Error('State trie does not contain state root') - } - - this._trie.root = stateRoot - this._cache.clear() - this._storageTries = {} - } -} - /* trigger contextChanged, web3EndpointChanged */ @@ -103,15 +22,6 @@ export class ExecutionContext { this.blockGasLimitDefault = 4300000 this.blockGasLimit = this.blockGasLimitDefault this.currentFork = 'berlin' - this.vms = { - /* - byzantium: createVm('byzantium'), - constantinople: createVm('constantinople'), - petersburg: createVm('petersburg'), - istanbul: createVm('istanbul'), - */ - berlin: this.createVm('berlin') - } this.mainNetGenesisHash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' this.customNetWorks = {} this.blocks = {} @@ -129,20 +39,6 @@ export class ExecutionContext { } } - createVm (hardfork) { - const stateManager = new StateManagerCommonStorageDump() - const common = new Common({ chain: 'mainnet', hardfork }) - const vm = new VM({ - common, - activatePrecompiles: true, - stateManager: stateManager - }) - - const web3vm = new Web3VmProvider() - web3vm.setVM(vm) - return { vm, web3vm, stateManager, common } - } - askPermission () { // metamask if (ethereum && typeof ethereum.enable === 'function') ethereum.enable() @@ -217,14 +113,6 @@ export class ExecutionContext { return new Web3() } - vm () { - return this.vms[this.currentFork].vm - } - - vmObject () { - return this.vms[this.currentFork] - } - setContext (context, endPointUrl, confirmCb, infoCb) { this.executionContext = context this.executionContextChange(context, endPointUrl, confirmCb, infoCb, null) diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index bc7e1403a7..ba021a7d0e 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -1,13 +1,12 @@ 'use strict' -import { Transaction } from 'ethereumjs-tx' -import Block from 'ethereumjs-block' -import { BN, bufferToHex } from 'ethereumjs-util' +import { Transaction } from '@ethereumjs/tx' +import { Block } from '@ethereumjs/block' +import { BN, bufferToHex, Address } from 'ethereumjs-util' import { EventManager } from '../eventManager' import { LogsManager } from './logsManager' export class TxRunnerVM { event - _api blockNumber runAsync pendingTxs @@ -16,14 +15,15 @@ export class TxRunnerVM { blocks txs logsManager - getVM: () => any + commonContext + getVMObject: () => any - constructor (vmaccounts, api, getVM) { + constructor (vmaccounts, api, getVMObject) { this.event = new EventManager() this.logsManager = new LogsManager() // has a default for now for backwards compatability - this.getVM = getVM - this._api = api + this.getVMObject = getVMObject + this.commonContext = this.getVMObject().common this.blockNumber = 0 this.runAsync = true this.blockNumber = 0 // The VM is running in Homestead mode, which started at this block. @@ -53,54 +53,56 @@ export class TxRunnerVM { if (!account) { return callback('Invalid account selected') } + if (Number.isInteger(gasLimit)) { + gasLimit = '0x' + gasLimit.toString(16) + } + + this.getVMObject().stateManager.getAccount(Address.fromString(from)).then((res) => { + // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor + // for initialization fields and their types + value = value ? parseInt(value) : 0 + const tx = Transaction.fromTxData({ + nonce: new BN(res.nonce), + gasPrice: '0x1', + gasLimit: gasLimit, + to: to, + value: value, + data: Buffer.from(data.slice(2), 'hex') + }, { common: this.commonContext }).sign(account.privateKey) + + const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] + const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)] + + var block = Block.fromBlockData({ + header: { + timestamp: timestamp || (new Date().getTime() / 1000 | 0), + number: self.blockNumber, + coinbase: coinbases[self.blockNumber % coinbases.length], + difficulty: difficulties[self.blockNumber % difficulties.length], + gasLimit: new BN(gasLimit.replace('0x', ''), 16).imuln(2) + }, + transactions: [tx] + }, { common: this.commonContext }) - this.getVM().stateManager.getAccount(Buffer.from(from.replace('0x', ''), 'hex'), (err, res) => { - if (err) { - callback('Account not found') + if (!useCall) { + ++self.blockNumber + this.runBlockInVm(tx, block, callback) } else { - // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor - // for initialization fields and their types - value = value ? parseInt(value) : 0 - const tx = new Transaction({ - nonce: new BN(res.nonce), - gasPrice: '0x1', - gasLimit: gasLimit, - to: to, - value: value, - data: Buffer.from(data.slice(2), 'hex') - }) - tx.sign(account.privateKey) - const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] - const difficulties = [new BN('69762765929000', 10), new BN('70762765929000', 10), new BN('71762765929000', 10)] - const block = new Block({ - header: { - timestamp: timestamp || (new Date().getTime() / 1000 | 0), - number: self.blockNumber, - coinbase: coinbases[self.blockNumber % coinbases.length], - difficulty: difficulties[self.blockNumber % difficulties.length], - gasLimit: new BN(gasLimit, 10).imuln(2) - }, - transactions: [tx], - uncleHeaders: [] - }) - if (!useCall) { - ++self.blockNumber - this.runBlockInVm(tx, block, callback) - } else { - this.getVM().stateManager.checkpoint(() => { - this.runBlockInVm(tx, block, (err, result) => { - this.getVM().stateManager.revert(() => { - callback(err, result) - }) + this.getVMObject().stateManager.checkpoint().then(() => { + this.runBlockInVm(tx, block, (err, result) => { + this.getVMObject().stateManager.revert().then(() => { + callback(err, result) }) }) - } + }) } + }).catch((e) => { + callback(e) }) } runBlockInVm (tx, block, callback) { - this.getVM().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then((results) => { + this.getVMObject().vm.runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }).then((results) => { const result = results.results[0] if (result) { const status = result.execResult.exceptionError ? 0 : 1 diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index fee5059d96..c3a43f5bc4 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -40,7 +40,7 @@ export class Transactions { } } - this.txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => this.vmContext.vm()) + this.txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => this.vmContext.vmObject()) this.txRunnerInstance = new TxRunner(this.txRunnerVMInstance, { runAsync: false }) this.txRunnerInstance.vmaccounts = accounts } diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index e59eb68cdd..43f5f6f8c9 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -2,61 +2,82 @@ 'use strict' import Web3 from 'web3' import { rlp, keccak, bufferToHex } from 'ethereumjs-util' -import { vm, execution } from '@remix-project/remix-lib' -const EthJSVM = require('ethereumjs-vm').default -const StateManager = require('ethereumjs-vm/dist/state/stateManager').default +import { vm as remixLibVm, execution } from '@remix-project/remix-lib' +import VM from '@ethereumjs/vm' +import Common from '@ethereumjs/common' +import StateManager from '@ethereumjs/vm/dist/state/stateManager' +import { StorageDump } from '@ethereumjs/vm/dist/state/interface' /* extend vm state manager and instanciate VM */ class StateManagerCommonStorageDump extends StateManager { - constructor (arg) { - super(arg) + + keyHashes: { [key: string]: string } + constructor () { + super() this.keyHashes = {} } - putContractStorage (address, key, value, cb) { + putContractStorage (address, key, value) { this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key) - super.putContractStorage(address, key, value, cb) + return super.putContractStorage(address, key, value) } - dumpStorage (address, cb) { - this._getStorageTrie(address, (err, trie) => { - if (err) { - return cb(err) + async dumpStorage (address) { + let trie + try { + trie = await this._getStorageTrie(address) + } catch (e) { + console.log(e) + throw e + } + return new Promise((resolve, reject) => { + try { + const storage = {} + const stream = trie.createReadStream() + stream.on('data', (val) => { + const value = rlp.decode(val.value) + storage['0x' + val.key.toString('hex')] = { + key: this.keyHashes[val.key.toString('hex')], + value: '0x' + value.toString('hex') + } + }) + stream.on('end', function () { + resolve(storage) + }) + } catch (e) { + reject(e) } - const storage = {} - const stream = trie.createReadStream() - stream.on('data', (val) => { - const value = rlp.decode(val.value) - storage['0x' + val.key.toString('hex')] = { - key: this.keyHashes[val.key.toString('hex')], - value: '0x' + value.toString('hex') - } - }) - stream.on('end', function () { - cb(storage) - }) }) } - getStateRoot (cb) { - const checkpoint = this._checkpointCount - this._checkpointCount = 0 - super.getStateRoot((err, stateRoot) => { - this._checkpointCount = checkpoint - cb(err, stateRoot) - }) + async getStateRoot (force = false) { + await this._cache.flush() + + const stateRoot = this._trie.root + return stateRoot } - setStateRoot (stateRoot, cb) { - const checkpoint = this._checkpointCount - this._checkpointCount = 0 - super.setStateRoot(stateRoot, (err) => { - this._checkpointCount = checkpoint - cb(err) - }) + async setStateRoot (stateRoot) { + await this._cache.flush() + + if (stateRoot === this._trie.EMPTY_TRIE_ROOT) { + this._trie.root = stateRoot + this._cache.clear() + this._storageTries = {} + return + } + + const hasRoot = await this._trie.checkRoot(stateRoot) + if (!hasRoot) { + throw new Error('State trie does not contain state root') + } + + this._trie.root = stateRoot + this._cache.clear() + this._storageTries = {} } } @@ -79,7 +100,7 @@ export class VMContext { constructor () { this.blockGasLimitDefault = 4300000 this.blockGasLimit = this.blockGasLimitDefault - this.currentFork = 'muirGlacier' + this.currentFork = 'berlin' this.vms = { /* byzantium: createVm('byzantium'), @@ -87,7 +108,7 @@ export class VMContext { petersburg: createVm('petersburg'), istanbul: createVm('istanbul'), */ - muirGlacier: this.createVm('muirGlacier') + berlin: this.createVm('berlin') } this.blocks = {} this.latestBlockNumber = 0 @@ -97,22 +118,21 @@ export class VMContext { } createVm (hardfork) { - const stateManager = new StateManagerCommonStorageDump({}) - stateManager.checkpoint(() => {}) - const ethvm = new EthJSVM({ + const stateManager = new StateManagerCommonStorageDump() + const common = new Common({ chain: 'mainnet', hardfork }) + const vm = new VM({ + common, activatePrecompiles: true, - blockchain: stateManager.blockchain, - stateManager: stateManager, - hardfork: hardfork + stateManager: stateManager }) - ethvm.blockchain.validate = false - this.web3vm = new vm.Web3VMProvider() - this.web3vm.setVM(ethvm) - return { vm: ethvm, web3vm: this.web3vm, stateManager } + + const web3vm = new remixLibVm.Web3VMProvider() + web3vm.setVM(vm) + return { vm, web3vm, stateManager, common } } web3 () { - return this.web3vm + return this.vms[this.currentFork].web3vm } blankWeb3 () { @@ -123,6 +143,10 @@ export class VMContext { return this.vms[this.currentFork].vm } + vmObject () { + return this.vms[this.currentFork] + } + addBlock (block) { let blockNumber = '0x' + block.header.number.toString('hex') if (blockNumber === '0x') { @@ -133,7 +157,7 @@ export class VMContext { this.blocks[blockNumber] = block this.latestBlockNumber = blockNumber - this.logsManager.checkBlock(blockNumber, block, this.web3vm) + this.logsManager.checkBlock(blockNumber, block, this.web3()) } trackTx (tx, block) { From 2c8d244df26a2ca4983bb33945254bbfd8d19d4f Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 3 May 2021 15:50:36 +0200 Subject: [PATCH 11/52] linting --- libs/remix-lib/src/execution/txRunner.ts | 2 +- libs/remix-simulator/src/vm-context.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index 254b4b0474..e58ac62d5e 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -45,4 +45,4 @@ function run (self, tx, stamp, confirmationCb, gasEstimationForceSend = null, pr run(self, next.tx, next.stamp, next.callback) } }) -} \ No newline at end of file +} diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index 43f5f6f8c9..a72be89d1e 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -13,7 +13,6 @@ import { StorageDump } from '@ethereumjs/vm/dist/state/interface' */ class StateManagerCommonStorageDump extends StateManager { - keyHashes: { [key: string]: string } constructor () { super() From 87ee5f0d9bad257124a15993be98ea6f3e72e9d3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 3 May 2021 15:57:04 +0200 Subject: [PATCH 12/52] linting --- .vscode/settings.json | 4 ---- apps/remix-ide/src/blockchain/providers/vm.js | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 2fb99dc19e..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "ethcode.keystore.keyStorePath": "/home/yann/.vscode/extensions/ethential.ethcode-0.2.2", - "ethcode.userConfig.defaultAccount": null -} \ No newline at end of file diff --git a/apps/remix-ide/src/blockchain/providers/vm.js b/apps/remix-ide/src/blockchain/providers/vm.js index c251743e2b..e01b7b08d2 100644 --- a/apps/remix-ide/src/blockchain/providers/vm.js +++ b/apps/remix-ide/src/blockchain/providers/vm.js @@ -1,5 +1,5 @@ const Web3 = require('web3') -const { BN, privateToAddress, stripHexPrefix, hashPersonalMessage } = require('ethereumjs-util') +const { BN, privateToAddress, hashPersonalMessage } = require('ethereumjs-util') const { Provider, extend } = require('@remix-project/remix-simulator') class VMProvider { From b46be41835cbf4e6c22fc6bac97c277f19df6b3a Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 4 May 2021 14:37:59 +0200 Subject: [PATCH 13/52] update e2e tests --- apps/remix-ide-e2e/src/tests/terminal.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 2a17251179..a7d43153fa 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -62,8 +62,7 @@ module.exports = { 'Call web3.eth.getAccounts() using JavaScript VM': function (browser: NightwatchBrowser) { browser .executeScript('web3.eth.getAccounts()') - .pause(2000) - .waitForElementContainsText('*[data-id="terminalJournal"]', '"0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148"', 60000) + .waitForElementContainsText('*[data-id="terminalJournal"]', '"0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x583031D1113aD414F02576BD6afaBfb302140225", "0xdD870fA1b7C4700F2BD7f44238821C26f7392148"', 80000) }, 'Call web3.eth.getAccounts() using Web3 Provider': function (browser: NightwatchBrowser) { From e6d63c306f54f4d0a0ee7cd46dc7aa7cbb193020 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Mon, 17 May 2021 14:52:20 +0100 Subject: [PATCH 14/52] Expand props --- .../file-explorer/src/lib/file-explorer.tsx | 152 +++++------------- .../src/lib/remix-ui-modal-dialog.tsx | 18 +-- .../modal-dialog/src/lib/types/index.ts | 6 +- libs/remix-ui/toaster/src/lib/toaster.tsx | 6 +- .../workspace/src/lib/remix-ui-workspace.tsx | 55 ++----- 5 files changed, 76 insertions(+), 161 deletions(-) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index fc8c89450a..d925bc3f0b 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -88,14 +88,10 @@ export const FileExplorer = (props: FileExplorerProps) => { hide: true, title: '', message: '', - ok: { - label: '', - fn: () => {} - }, - cancel: { - label: '', - fn: () => {} - }, + okLabel: '', + okFn: () => {}, + cancelLabel: '', + cancelFn: () => {}, handleHide: null }, modals: [], @@ -122,13 +118,7 @@ export const FileExplorer = (props: FileExplorerProps) => { useEffect(() => { if (fileSystem.notification.message) { - modal(fileSystem.notification.title, fileSystem.notification.message, { - label: fileSystem.notification.labelOk, - fn: fileSystem.notification.actionOk - }, { - label: fileSystem.notification.labelCancel, - fn: fileSystem.notification.actionCancel - }) + modal(fileSystem.notification.title, fileSystem.notification.message, fileSystem.notification.labelOk, fileSystem.notification.actionOk, fileSystem.notification.labelCancel, fileSystem.notification.actionCancel) } }, [fileSystem.notification.message]) @@ -201,8 +191,10 @@ export const FileExplorer = (props: FileExplorerProps) => { hide: false, title: prevState.modals[0].title, message: prevState.modals[0].message, - ok: prevState.modals[0].ok, - cancel: prevState.modals[0].cancel, + okLabel: prevState.modals[0].okLabel, + okFn: prevState.modals[0].okFn, + cancelLabel: prevState.modals[0].cancelLabel, + cancelFn: prevState.modals[0].cancelFn, handleHide: prevState.modals[0].handleHide } @@ -248,10 +240,7 @@ export const FileExplorer = (props: FileExplorerProps) => { }) } } catch (error) { - return modal('File Creation Failed', typeof error === 'string' ? error : error.message, { - label: 'Close', - fn: async () => {} - }, null) + return modal('File Creation Failed', typeof error === 'string' ? error : error.message, 'Close', async () => {}) } } @@ -263,20 +252,14 @@ export const FileExplorer = (props: FileExplorerProps) => { const exists = await fileManager.exists(dirName) if (exists) { - return modal('Rename File Failed', `A file or folder ${extractNameFromKey(newFolderPath)} already exists at this location. Please choose a different name.`, { - label: 'Close', - fn: () => {} - }, null) + return modal('Rename File Failed', `A file or folder ${extractNameFromKey(newFolderPath)} already exists at this location. Please choose a different name.`, 'Close', () => {}) } await fileManager.mkdir(dirName) setState(prevState => { return { ...prevState, focusElement: [{ key: newFolderPath, type: 'folder' }] } }) } catch (e) { - return modal('Folder Creation Failed', typeof e === 'string' ? e : e.message, { - label: 'Close', - fn: async () => {} - }, null) + return modal('Folder Creation Failed', typeof e === 'string' ? e : e.message, 'Close', async () => {}) } } @@ -288,21 +271,15 @@ export const FileExplorer = (props: FileExplorerProps) => { } const isDir = state.fileManager.isDirectory(path) - modal(`Delete ${isDir ? 'folder' : 'file'}`, `Are you sure you want to delete ${path} ${isDir ? 'folder' : 'file'}?`, { - label: 'OK', - fn: async () => { - try { - const fileManager = state.fileManager + modal(`Delete ${isDir ? 'folder' : 'file'}`, `Are you sure you want to delete ${path} ${isDir ? 'folder' : 'file'}?`, 'OK', async () => { + try { + const fileManager = state.fileManager - await fileManager.remove(path) - } catch (e) { - toast(`Failed to remove ${isDir ? 'folder' : 'file'} ${path}.`) - } + await fileManager.remove(path) + } catch (e) { + toast(`Failed to remove ${isDir ? 'folder' : 'file'} ${path}.`) } - }, { - label: 'Cancel', - fn: () => {} - }) + }, 'Cancel', () => {}) } const renamePath = async (oldPath: string, newPath: string) => { @@ -311,18 +288,12 @@ export const FileExplorer = (props: FileExplorerProps) => { const exists = await fileManager.exists(newPath) if (exists) { - modal('Rename File Failed', `A file or folder ${extractNameFromKey(newPath)} already exists at this location. Please choose a different name.`, { - label: 'Close', - fn: () => {} - }, null) + modal('Rename File Failed', `A file or folder ${extractNameFromKey(newPath)} already exists at this location. Please choose a different name.`, 'Close', () => {}) } else { await fileManager.rename(oldPath, newPath) } } catch (error) { - modal('Rename File Failed', 'Unexpected error while renaming: ' + typeof error === 'string' ? error : error.message, { - label: 'Close', - fn: async () => {} - }, null) + modal('Rename File Failed', 'Unexpected error while renaming: ' + typeof error === 'string' ? error : error.message, 'Close', async () => {}) } } @@ -345,19 +316,13 @@ export const FileExplorer = (props: FileExplorerProps) => { fileReader.onload = async function (event) { if (helper.checkSpecialChars(file.name)) { - modal('File Upload Failed', 'Special characters are not allowed', { - label: 'Close', - fn: async () => {} - }, null) + modal('File Upload Failed', 'Special characters are not allowed', 'Close', async () => {}) return } const success = await filesProvider.set(name, event.target.result) if (!success) { - return modal('File Upload Failed', 'Failed to create file ' + name, { - label: 'Close', - fn: async () => {} - }, null) + return modal('File Upload Failed', 'Failed to create file ' + name, 'Close', async () => {}) } const config = registry.get('config').api const editor = registry.get('editor').api @@ -374,15 +339,9 @@ export const FileExplorer = (props: FileExplorerProps) => { if (!exist) { loadFile(name) } else { - modal('Confirm overwrite', `The file ${name} already exists! Would you like to overwrite it?`, { - label: 'OK', - fn: () => { - loadFile(name) - } - }, { - label: 'Cancel', - fn: () => {} - }) + modal('Confirm overwrite', `The file ${name} already exists! Would you like to overwrite it?`, 'OK', () => { + loadFile(name) + }, 'Cancel', () => {}) } }).catch(error => { if (error) console.log(error) @@ -391,41 +350,23 @@ export const FileExplorer = (props: FileExplorerProps) => { } const publishToGist = () => { - modal('Create a public gist', `Are you sure you want to anonymously publish all your files in the ${name} workspace as a public gist on github.com?`, { - label: 'OK', - fn: toGist - }, { - label: 'Cancel', - fn: () => {} - }) + modal('Create a public gist', `Are you sure you want to anonymously publish all your files in the ${name} workspace as a public gist on github.com?`, 'OK', toGist, 'Cancel', () => {}) } const toGist = (id?: string) => { const filesProvider = fileSystem.provider.provider const proccedResult = function (error, data) { if (error) { - modal('Publish to gist Failed', 'Failed to manage gist: ' + error, { - label: 'Close', - fn: async () => {} - }, null) + modal('Publish to gist Failed', 'Failed to manage gist: ' + error, 'Close', () => {}) } else { if (data.html_url) { - modal('Gist is ready', `The gist is at ${data.html_url}. Would you like to open it in a new window?`, { - label: 'OK', - fn: () => { - window.open(data.html_url, '_blank') - } - }, { - label: 'Cancel', - fn: () => {} - }) + modal('Gist is ready', `The gist is at ${data.html_url}. Would you like to open it in a new window?`, 'OK', () => { + window.open(data.html_url, '_blank') + }, 'Cancel', () => {}) } else { const error = JSON.stringify(data.errors, null, '\t') || '' const message = data.message === 'Not Found' ? data.message + '. Please make sure the API token has right to create a gist.' : data.message - modal('Publish to gist Failed', message + ' ' + data.documentation_url + ' ' + error, { - label: 'Close', - fn: async () => {} - }, null) + modal('Publish to gist Failed', message + ' ' + data.documentation_url + ' ' + error, 'Close', () => {}) } } } @@ -451,20 +392,14 @@ export const FileExplorer = (props: FileExplorerProps) => { packageFiles(filesProvider, folder, async (error, packaged) => { if (error) { console.log(error) - modal('Publish to gist Failed', 'Failed to create gist: ' + error.message, { - label: 'Close', - fn: async () => {} - }, null) + modal('Publish to gist Failed', 'Failed to create gist: ' + error.message, 'Close', async () => {}) } else { // check for token const config = registry.get('config').api const accessToken = config.get('settings/gist-access-token') if (!accessToken) { - modal('Authorize Token', 'Remix requires an access token (which includes gists creation permission). Please go to the settings tab to create one.', { - label: 'Close', - fn: async () => {} - }, null) + modal('Authorize Token', 'Remix requires an access token (which includes gists creation permission). Please go to the settings tab to create one.', 'Close', () => {}) } else { const description = 'Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=' + queryParams.get().version + '&optimize=' + queryParams.get().optimize + '&runs=' + queryParams.get().runs + '&gist=' @@ -536,7 +471,7 @@ export const FileExplorer = (props: FileExplorerProps) => { }) } - const modal = (title: string, message: string, ok: { label: string, fn: () => void }, cancel: { label: string, fn: () => void }) => { + const modal = (title: string, message: string, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => { setState(prevState => { return { ...prevState, @@ -544,8 +479,10 @@ export const FileExplorer = (props: FileExplorerProps) => { { message, title, - ok, - cancel, + okLabel, + okFn, + cancelLabel, + cancelFn, handleHide: handleHideModal }] } @@ -644,10 +581,7 @@ export const FileExplorer = (props: FileExplorerProps) => { }) } if (helper.checkSpecialChars(content)) { - modal('Validation Error', 'Special characters are not allowed', { - label: 'OK', - fn: () => {} - }, null) + modal('Validation Error', 'Special characters are not allowed', 'OK', () => {}) } else { if (state.focusEdit.isNew) { state.focusEdit.type === 'file' ? createNewFile(joinPath(parentFolder, content)) : createNewFolder(joinPath(parentFolder, content)) @@ -865,8 +799,10 @@ export const FileExplorer = (props: FileExplorerProps) => { title={ state.focusModal.title } message={ state.focusModal.message } hide={ state.focusModal.hide } - ok={ state.focusModal.ok } - cancel={ state.focusModal.cancel } + okLabel={ state.focusModal.okLabel } + okFn={ state.focusModal.okFn } + cancelLabel={ state.focusModal.cancelLabel } + cancelFn={ state.focusModal.cancelFn } handleHide={ handleHideModal } /> } diff --git a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx index 2caa41219d..ec016068e9 100644 --- a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx +++ b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx @@ -18,7 +18,7 @@ export const ModalDialog = (props: ModalDialogProps) => { const modalKeyEvent = (keyCode) => { if (keyCode === 27) { // Esc - if (props.cancel && props.cancel.fn) props.cancel.fn() + if (props.cancelFn) props.cancelFn() handleHide() } else if (keyCode === 13) { // Enter enterHandler() @@ -33,9 +33,9 @@ export const ModalDialog = (props: ModalDialogProps) => { const enterHandler = () => { if (state.toggleBtn) { - if (props.ok && props.ok.fn) props.ok.fn() + if (props.okFn) props.okFn() } else { - if (props.cancel && props.cancel.fn) props.cancel.fn() + if (props.cancelFn) props.cancelFn() } handleHide() } @@ -79,29 +79,29 @@ export const ModalDialog = (props: ModalDialogProps) => {
{/* todo add autofocus ^^ */} - { props.ok && + { props.okLabel && { - if (props.ok.fn) props.ok.fn() + if (props.okFn) props.okFn() handleHide() }} > - { props.ok.label ? props.ok.label : 'OK' } + { props.okLabel ? props.okLabel : 'OK' } } - { props.cancel && + { props.cancelLabel && { - if (props.cancel.fn) props.cancel.fn() + if (props.cancelFn) props.cancelFn() handleHide() }} > - { props.cancel.label ? props.cancel.label : 'Cancel' } + { props.cancelLabel ? props.cancelLabel : 'Cancel' } }
diff --git a/libs/remix-ui/modal-dialog/src/lib/types/index.ts b/libs/remix-ui/modal-dialog/src/lib/types/index.ts index 29c4d39505..58d15cdb87 100644 --- a/libs/remix-ui/modal-dialog/src/lib/types/index.ts +++ b/libs/remix-ui/modal-dialog/src/lib/types/index.ts @@ -2,8 +2,10 @@ export interface ModalDialogProps { id?: string title?: string, message?: string, - ok?: { label: string, fn: () => void }, - cancel: { label: string, fn: () => void }, + okLabel?: string, + okFn?: () => void, + cancelLabel?: string, + cancelFn?: () => void, modalClass?: string, showCancelIcon?: boolean, hide: boolean, diff --git a/libs/remix-ui/toaster/src/lib/toaster.tsx b/libs/remix-ui/toaster/src/lib/toaster.tsx index b7573f72cc..d3cd160c5c 100644 --- a/libs/remix-ui/toaster/src/lib/toaster.tsx +++ b/libs/remix-ui/toaster/src/lib/toaster.tsx @@ -91,10 +91,8 @@ export const Toaster = (props: ToasterProps) => { <> {} - }} + cancelLabel='Close' + cancelFn={() => {}} hide={!state.showModal} handleHide={hideFullMessage} /> diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 1baca04eb7..8286163970 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -145,14 +145,10 @@ export const Workspace = (props: WorkspaceProps) => { hide: true, title: '', message: null, - ok: { - label: '', - fn: () => {} - }, - cancel: { - label: '', - fn: () => {} - }, + okLabel: '', + okFn: () => {}, + cancelLabel: '', + cancelFn: () => {}, handleHide: null }, loadingLocalhost: false, @@ -168,41 +164,20 @@ export const Workspace = (props: WorkspaceProps) => { /* workspace creation, renaming and deletion */ const renameCurrentWorkspace = () => { - modal('Rename Current Workspace', renameModalMessage(), { - label: 'OK', - fn: onFinishRenameWorkspace - }, { - label: '', - fn: () => {} - }) + modal('Rename Current Workspace', renameModalMessage(), 'OK', onFinishRenameWorkspace, '', () => {}) } const createWorkspace = () => { - modal('Create Workspace', createModalMessage(), { - label: 'OK', - fn: onFinishCreateWorkspace - }, { - label: '', - fn: () => {} - }) + modal('Create Workspace', createModalMessage(), 'OK', onFinishCreateWorkspace, '', () => {}) } const deleteCurrentWorkspace = () => { - modal('Delete Current Workspace', 'Are you sure to delete the current workspace?', { - label: 'OK', - fn: onFinishDeleteWorkspace - }, { - label: '', - fn: () => {} - }) + modal('Delete Current Workspace', 'Are you sure to delete the current workspace?', 'OK', onFinishDeleteWorkspace, '', () => {}) } const modalMessage = (title: string, body: string) => { setTimeout(() => { // wait for any previous modal a chance to close - modal(title, body, { - label: 'OK', - fn: () => {} - }, null) + modal(title, body, 'OK', () => {}, '', null) }, 200) } @@ -297,7 +272,7 @@ export const Workspace = (props: WorkspaceProps) => { }) } - const modal = async (title: string, message: string | JSX.Element, ok: { label: string, fn: () => void }, cancel: { label: string, fn: () => void }) => { + const modal = async (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel: string, cancelFn: () => void) => { await setState(prevState => { return { ...prevState, @@ -306,8 +281,10 @@ export const Workspace = (props: WorkspaceProps) => { hide: false, message, title, - ok, - cancel, + okLabel, + okFn, + cancelLabel, + cancelFn, handleHide: handleHideModal } } @@ -339,8 +316,10 @@ export const Workspace = (props: WorkspaceProps) => { title={ state.modal.title } message={ state.modal.message } hide={ state.modal.hide } - ok={ state.modal.ok } - cancel={ state.modal.cancel } + okLabel={ state.modal.okLabel } + okFn={ state.modal.okFn } + cancelLabel={ state.modal.cancelLabel } + cancelFn={ state.modal.cancelFn } handleHide={ handleHideModal }> { (typeof state.modal.message !== 'string') && state.modal.message } From 3ef90763555920702fda6b7430ab05c39a12a09f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 17 May 2021 12:55:22 +0530 Subject: [PATCH 15/52] check if remixd activated before switching --- .../workspace/src/lib/remix-ui-workspace.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 1baca04eb7..51516d87f5 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -272,11 +272,13 @@ export const Workspace = (props: WorkspaceProps) => { const remixdExplorer = { hide: async () => { - await setWorkspace(NO_WORKSPACE) - props.fileManager.setMode('browser') - setState(prevState => { - return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } - }) + if (props.fileManager.mode === 'localhost') { + await setWorkspace(NO_WORKSPACE) + props.fileManager.setMode('browser') + setState(prevState => { + return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } + }) + } }, show: () => { props.fileManager.setMode('localhost') From b29c66de726ba0acaf55d45bad80b024be2447b6 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 17 May 2021 13:03:05 +0530 Subject: [PATCH 16/52] hide spinner --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 51516d87f5..2774a75cd4 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -278,6 +278,10 @@ export const Workspace = (props: WorkspaceProps) => { setState(prevState => { return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } }) + } else { + setState(prevState => { + return { ...prevState, loadingLocalhost: false } + }) } }, show: () => { From e92f5acbb4d23e93ef0c0d08e5491bc19fb2e2ce Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 17 May 2021 13:55:59 +0530 Subject: [PATCH 17/52] switch to previous workspace from localhost --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 2774a75cd4..f7d9994211 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -91,6 +91,7 @@ export const Workspace = (props: WorkspaceProps) => { const localhostDisconnect = () => { if (state.currentWorkspace === LOCALHOST) setWorkspace(props.workspaces.length > 0 ? props.workspaces[0] : NO_WORKSPACE) + else setWorkspace(state.currentWorkspace) // Useful to switch to last selcted workspace when remixd is disconnected } props.localhost.event.unregister('disconnected', localhostDisconnect) props.localhost.event.register('disconnected', localhostDisconnect) @@ -272,6 +273,7 @@ export const Workspace = (props: WorkspaceProps) => { const remixdExplorer = { hide: async () => { + // If 'connect to localhost' is clicked from home tab, mode is not 'localhost' if (props.fileManager.mode === 'localhost') { await setWorkspace(NO_WORKSPACE) props.fileManager.setMode('browser') @@ -279,6 +281,7 @@ export const Workspace = (props: WorkspaceProps) => { return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } }) } else { + // Hide spinner in file explorer setState(prevState => { return { ...prevState, loadingLocalhost: false } }) From cb3f39ba0ac1acb204830cf35a633ac772de942a Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Mon, 17 May 2021 17:51:31 +0100 Subject: [PATCH 18/52] Catch reserved keywords and display modal --- .../file-explorer/src/lib/file-explorer.tsx | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index d925bc3f0b..4ce0c9cace 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -584,15 +584,31 @@ export const FileExplorer = (props: FileExplorerProps) => { modal('Validation Error', 'Special characters are not allowed', 'OK', () => {}) } else { if (state.focusEdit.isNew) { - state.focusEdit.type === 'file' ? createNewFile(joinPath(parentFolder, content)) : createNewFolder(joinPath(parentFolder, content)) - removeInputField(parentFolder)(dispatch) + if ((content === props.name) || (content.indexOf('gist-') === 0)) { + removeInputField(parentFolder)(dispatch) + modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, { + label: 'Close', + fn: () => {} + }, null) + } else { + state.focusEdit.type === 'file' ? createNewFile(joinPath(parentFolder, content)) : createNewFolder(joinPath(parentFolder, content)) + removeInputField(parentFolder)(dispatch) + } } else { - const oldPath: string = state.focusEdit.element - const oldName = extractNameFromKey(oldPath) - const newPath = oldPath.replace(oldName, content) + if ((content === props.name) || (content.indexOf('gist-') === 0)) { + editRef.current.textContent = state.focusEdit.lastEdit + modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, { + label: 'Close', + fn: () => {} + }, null) + } else { + const oldPath: string = state.focusEdit.element + const oldName = extractNameFromKey(oldPath) + const newPath = oldPath.replace(oldName, content) - editRef.current.textContent = extractNameFromKey(oldPath) - renamePath(oldPath, newPath) + editRef.current.textContent = extractNameFromKey(oldPath) + renamePath(oldPath, newPath) + } } setState(prevState => { return { ...prevState, focusEdit: { element: null, isNew: false, type: '', lastEdit: '' } } From ebb0c674bb4c4e77f9dc5f8239ccd3bbe576e7fd Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 18 May 2021 10:46:08 +0100 Subject: [PATCH 19/52] Optimised mode for managing reserved words --- .../remix-ui/file-explorer/src/lib/file-explorer.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index 4ce0c9cace..57eda46094 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -97,7 +97,8 @@ export const FileExplorer = (props: FileExplorerProps) => { modals: [], toasterMsg: '', mouseOverElement: null, - showContextMenu: false + showContextMenu: false, + reservedKeywords: [name, 'gist-'] }) const [fileSystem, dispatch] = useReducer(fileSystemReducer, fileSystemInitialState) const editRef = useRef(null) @@ -222,6 +223,11 @@ export const FileExplorer = (props: FileExplorerProps) => { return keyPath.join('/') } + const hasReservedKeyword = (content: string): boolean => { + if (state.reservedKeywords.findIndex(value => content.startsWith(value)) !== -1) return true + else return false + } + const createNewFile = async (newFilePath: string) => { const fileManager = state.fileManager @@ -584,7 +590,7 @@ export const FileExplorer = (props: FileExplorerProps) => { modal('Validation Error', 'Special characters are not allowed', 'OK', () => {}) } else { if (state.focusEdit.isNew) { - if ((content === props.name) || (content.indexOf('gist-') === 0)) { + if (hasReservedKeyword(content)) { removeInputField(parentFolder)(dispatch) modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, { label: 'Close', @@ -595,7 +601,7 @@ export const FileExplorer = (props: FileExplorerProps) => { removeInputField(parentFolder)(dispatch) } } else { - if ((content === props.name) || (content.indexOf('gist-') === 0)) { + if (hasReservedKeyword(content)) { editRef.current.textContent = state.focusEdit.lastEdit modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, { label: 'Close', From 6850d0cc46752dda2031887cc666c64c766cccd7 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 18 May 2021 11:56:42 +0100 Subject: [PATCH 20/52] Update modal parameters --- libs/remix-ui/file-explorer/src/lib/file-explorer.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index 57eda46094..c471449ac4 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -592,10 +592,7 @@ export const FileExplorer = (props: FileExplorerProps) => { if (state.focusEdit.isNew) { if (hasReservedKeyword(content)) { removeInputField(parentFolder)(dispatch) - modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, { - label: 'Close', - fn: () => {} - }, null) + modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, 'Close', () => {}) } else { state.focusEdit.type === 'file' ? createNewFile(joinPath(parentFolder, content)) : createNewFolder(joinPath(parentFolder, content)) removeInputField(parentFolder)(dispatch) @@ -603,10 +600,7 @@ export const FileExplorer = (props: FileExplorerProps) => { } else { if (hasReservedKeyword(content)) { editRef.current.textContent = state.focusEdit.lastEdit - modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, { - label: 'Close', - fn: () => {} - }, null) + modal('Reserved Keyword', `File name contains remix reserved keywords. '${content}'`, 'Close', () => {}) } else { const oldPath: string = state.focusEdit.element const oldName = extractNameFromKey(oldPath) From 3e26c3f21a078adadd17a7eb9295525ea5f72376 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 11 May 2021 13:16:44 +0530 Subject: [PATCH 21/52] compile with hardhat and remixd --- .../remix-ide/src/app/files/remixDProvider.js | 5 + apps/remix-ide/src/app/files/remixd-handle.js | 2 +- .../src/app/tabs/compileTab/compileTab.js | 5 + libs/remixd/src/services/remixdClient.ts | 9 +- package-lock.json | 1008 +++++++++++++++-- package.json | 1 + 6 files changed, 955 insertions(+), 75 deletions(-) diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js index 60337c11e4..044e46a165 100644 --- a/apps/remix-ide/src/app/files/remixDProvider.js +++ b/apps/remix-ide/src/app/files/remixDProvider.js @@ -50,6 +50,11 @@ module.exports = class RemixDProvider extends FileProvider { return this._isReady } + async compileWithHardhat () { + console.log('Inside compileWithHardhat, calling hardhatCompile using _appManager') + return await this._appManager.call('remixd', 'hardhatCompile', {}) + } + close (cb) { this._isReady = false cb() diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index 3ec635040c..e8145f58d8 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -22,7 +22,7 @@ const profile = { name: 'remixd', displayName: 'RemixD', url: 'ws://127.0.0.1:65520', - methods: ['folderIsReadOnly', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir'], + methods: ['folderIsReadOnly', 'hardhatCompile', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir'], events: [], description: 'Using Remixd daemon, allow to access file system', kind: 'other', diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index 79228d1663..ea7377c3fd 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -80,6 +80,11 @@ class CompileTab { runCompiler () { try { + console.log('mode is - ', this.fileManager.mode) + if(this.fileManager.mode === 'localhost') { + console.log('calling compilehardhat') + this.fileProvider.compileWithHardhat().then(console.log) + } this.fileManager.saveCurrentFile() this.miscApi.clearAnnotations() var currentFile = this.config.get('currentFile') diff --git a/libs/remixd/src/services/remixdClient.ts b/libs/remixd/src/services/remixdClient.ts index 31588628ea..42752c3adc 100644 --- a/libs/remixd/src/services/remixdClient.ts +++ b/libs/remixd/src/services/remixdClient.ts @@ -5,6 +5,7 @@ import * as utils from '../utils' import * as chokidar from 'chokidar' import * as fs from 'fs-extra' import * as isbinaryfile from 'isbinaryfile' +const hre = require("hardhat"); export class RemixdClient extends PluginClient { methods: Array @@ -14,7 +15,7 @@ export class RemixdClient extends PluginClient { constructor (private readOnly = false) { super() - this.methods = ['folderIsReadOnly', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir', 'canDeactivate'] + this.methods = ['folderIsReadOnly', 'hardhatCompile', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir', 'canDeactivate'] } setWebSocket (websocket: WS): void { @@ -26,6 +27,12 @@ export class RemixdClient extends PluginClient { if (this.isLoaded) this.emit('rootFolderChanged') } + async hardhatCompile() { + console.log('inside hardhatCompile') + console.log('here is hre-->', hre.tasks) + // await hre.tasks.accounts.action(); + } + list (): Filelist { try { return utils.walkSync(this.currentSharedFolder, {}, this.currentSharedFolder) diff --git a/package-lock.json b/package-lock.json index d74204bd8f..ad004a82fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7796,6 +7796,112 @@ "any-observable": "^0.3.0" } }, + "@sentry/core": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", + "integrity": "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==", + "requires": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/hub": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.30.0.tgz", + "integrity": "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ==", + "requires": { + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/minimal": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", + "integrity": "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw==", + "requires": { + "@sentry/hub": "5.30.0", + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/node": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.30.0.tgz", + "integrity": "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg==", + "requires": { + "@sentry/core": "5.30.0", + "@sentry/hub": "5.30.0", + "@sentry/tracing": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + }, + "dependencies": { + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + } + } + }, + "@sentry/tracing": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-5.30.0.tgz", + "integrity": "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw==", + "requires": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.30.0.tgz", + "integrity": "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==" + }, + "@sentry/utils": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.30.0.tgz", + "integrity": "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww==", + "requires": { + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + } + }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -7810,6 +7916,11 @@ "type-detect": "4.0.8" } }, + "@solidity-parser/parser": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.11.1.tgz", + "integrity": "sha512-H8BSBoKE8EubJa0ONqecA2TviT3TnHeC4NpgnAHSUiuhZoQBfPB4L2P9bs8R6AoTW10Endvh3vc+fomVMIDIYQ==" + }, "@svgr/babel-plugin-add-jsx-attribute": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-5.4.0.tgz", @@ -8299,6 +8410,11 @@ "@types/node": "*" } }, + "@types/lru-cache": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.0.tgz", + "integrity": "sha512-RaE0B+14ToE4l6UqdarKPnXwVDuigfFv+5j9Dze/Nqr23yyuqdNvzcZi3xB+3Agvi5R4EOgAksfv3lXX4vBt9w==" + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -8976,11 +9092,22 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dev": true, "requires": { "event-target-shim": "^5.0.0" } }, + "abstract-leveldown": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz", + "integrity": "sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -9081,6 +9208,11 @@ "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", "dev": true }, + "adm-zip": { + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", + "integrity": "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==" + }, "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", @@ -11177,8 +11309,7 @@ "binary-extensions": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", - "dev": true + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" }, "bindings": { "version": "1.5.0", @@ -11560,8 +11691,7 @@ "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" }, "browserify": { "version": "16.5.1", @@ -12471,8 +12601,7 @@ "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "buffer-indexof": { "version": "1.1.1", @@ -12621,7 +12750,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -13418,8 +13546,7 @@ "command-exists": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", - "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", - "dev": true + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" }, "commander": { "version": "2.20.3", @@ -14917,8 +15044,7 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, "decamelize-keys": { "version": "1.1.0", @@ -15239,6 +15365,29 @@ "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" }, + "deferred-leveldown": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", + "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "inherits": "^2.0.3" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + } + } + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -15884,8 +16033,7 @@ "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, "emojis-list": { "version": "3.0.0", @@ -15923,6 +16071,17 @@ } } }, + "encoding-down": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz", + "integrity": "sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==", + "requires": { + "abstract-leveldown": "^6.2.1", + "inherits": "^2.0.3", + "level-codec": "^9.0.0", + "level-errors": "^2.0.0" + } + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -15942,6 +16101,21 @@ "tapable": "^1.0.0" } }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "requires": { + "ansi-colors": "^4.1.1" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==" + } + } + }, "ent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", @@ -15957,8 +16131,7 @@ "env-paths": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz", - "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==", - "dev": true + "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==" }, "envinfo": { "version": "7.5.1", @@ -16825,6 +16998,38 @@ } } }, + "eth-sig-util": { + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-2.5.4.tgz", + "integrity": "sha512-aCMBwp8q/4wrW4QLsF/HYBOSA7TpLKmkVwP3pYQNkEEseW2Rr8Z5Uxc9/h6HX+OG3tuHo+2bINVSihIeBfym6A==", + "requires": { + "ethereumjs-abi": "0.6.8", + "ethereumjs-util": "^5.1.1", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.0" + }, + "dependencies": { + "ethereumjs-util": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz", + "integrity": "sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "elliptic": "^6.5.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "^0.1.3", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1" + } + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + } + } + }, "ethereum-bloom-filters": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.9.tgz", @@ -16883,6 +17088,31 @@ } } }, + "ethereumjs-abi": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz", + "integrity": "sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA==", + "requires": { + "bn.js": "^4.11.8", + "ethereumjs-util": "^6.0.0" + }, + "dependencies": { + "ethereumjs-util": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", + "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", + "requires": { + "@types/bn.js": "^4.11.3", + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "elliptic": "^6.5.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.3" + } + } + } + }, "ethereumjs-common": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.1.tgz", @@ -17014,8 +17244,7 @@ "event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "dev": true + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, "eventemitter2": { "version": "6.4.2", @@ -17891,7 +18120,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", - "dev": true, "requires": { "is-buffer": "~2.0.3" }, @@ -17899,8 +18127,7 @@ "is-buffer": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", - "dev": true + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" } } }, @@ -18107,6 +18334,11 @@ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, + "fp-ts": { + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", + "integrity": "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==" + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -19151,7 +19383,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -19851,7 +20082,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", - "dev": true, "requires": { "is-glob": "^4.0.1" } @@ -20257,8 +20487,7 @@ "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" }, "growly": { "version": "1.3.0", @@ -20594,6 +20823,495 @@ "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", "dev": true }, + "hardhat": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.2.1.tgz", + "integrity": "sha512-8s7MtGXdh0NDwQKdlA8m8QdloVIN1+hv5aFpn0G5Ljj9vfNY9kUoc0a9pMboeGbd9WrS+XrZs5YlsPgQjaW/Tg==", + "requires": { + "@ethereumjs/block": "^3.2.1", + "@ethereumjs/blockchain": "^5.2.1", + "@ethereumjs/common": "^2.2.0", + "@ethereumjs/tx": "^3.1.3", + "@ethereumjs/vm": "^5.3.2", + "@sentry/node": "^5.18.1", + "@solidity-parser/parser": "^0.11.0", + "@types/bn.js": "^5.1.0", + "@types/lru-cache": "^5.1.0", + "abort-controller": "^3.0.0", + "adm-zip": "^0.4.16", + "ansi-escapes": "^4.3.0", + "chalk": "^2.4.2", + "chokidar": "^3.4.0", + "ci-info": "^2.0.0", + "debug": "^4.1.1", + "enquirer": "^2.3.0", + "env-paths": "^2.2.0", + "eth-sig-util": "^2.5.2", + "ethereum-cryptography": "^0.1.2", + "ethereumjs-abi": "^0.6.8", + "ethereumjs-util": "^7.0.10", + "find-up": "^2.1.0", + "fp-ts": "1.19.3", + "fs-extra": "^7.0.1", + "glob": "^7.1.3", + "immutable": "^4.0.0-rc.12", + "io-ts": "1.10.4", + "lodash": "^4.17.11", + "merkle-patricia-tree": "^4.1.0", + "mnemonist": "^0.38.0", + "mocha": "^7.1.2", + "node-fetch": "^2.6.0", + "qs": "^6.7.0", + "raw-body": "^2.4.1", + "resolve": "1.17.0", + "semver": "^6.3.0", + "slash": "^3.0.0", + "solc": "0.7.3", + "source-map-support": "^0.5.13", + "stacktrace-parser": "^0.1.10", + "true-case-path": "^2.2.1", + "tsort": "0.0.1", + "uuid": "^3.3.2", + "ws": "^7.2.1" + }, + "dependencies": { + "@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "requires": { + "@types/node": "*" + } + }, + "ansi-colors": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", + "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==" + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + }, + "chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.3.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + } + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "commander": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "http-errors": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", + "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "mocha": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", + "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", + "requires": { + "ansi-colors": "3.2.3", + "browser-stdout": "1.3.1", + "chokidar": "3.3.0", + "debug": "3.2.6", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "find-up": "3.0.0", + "glob": "7.1.3", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", + "minimatch": "3.0.4", + "mkdirp": "0.5.5", + "ms": "2.1.1", + "node-environment-flags": "1.0.6", + "object.assign": "4.1.0", + "strip-json-comments": "2.0.1", + "supports-color": "6.0.0", + "which": "1.3.1", + "wide-align": "1.1.3", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" + }, + "dependencies": { + "chokidar": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", + "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.1", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.2.0" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "optional": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + }, + "readdirp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", + "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", + "requires": { + "picomatch": "^2.0.4" + } + } + } + }, + "node-environment-flags": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "requires": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "object-inspect": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", + "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==" + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "qs": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "raw-body": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz", + "integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==", + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.3", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "requires": { + "picomatch": "^2.2.1" + } + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "solc": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", + "integrity": "sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA==", + "requires": { + "command-exists": "^1.2.8", + "commander": "3.0.2", + "follow-redirects": "^1.12.1", + "fs-extra": "^0.30.0", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "require-from-string": "^2.0.0", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "dependencies": { + "fs-extra": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-color": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", + "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "harmony-reflect": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.1.tgz", @@ -21118,6 +21836,11 @@ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" }, + "immutable": { + "version": "4.0.0-rc.12", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.0.0-rc.12.tgz", + "integrity": "sha512-0M2XxkZLx/mi3t8NVwIm1g8nHoEmM9p9UBl/G9k4+hm0kBgOVdMV/B3CY5dQ8qG8qc80NN4gDV4HQv6FTJ5q7A==" + }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -21413,6 +22136,14 @@ "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, + "io-ts": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", + "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", + "requires": { + "fp-ts": "^1.0.0" + } + }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -21680,7 +22411,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, "requires": { "binary-extensions": "^2.0.0" } @@ -21822,8 +22552,7 @@ "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, "is-function": { "version": "1.0.2", @@ -24611,7 +25340,6 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "dev": true, "requires": { "graceful-fs": "^4.1.9" } @@ -24831,11 +25559,55 @@ } } }, + "level-codec": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", + "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", + "requires": { + "buffer": "^5.6.0" + } + }, "level-concat-iterator": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==" }, + "level-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", + "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", + "requires": { + "errno": "~0.1.1" + } + }, + "level-iterator-stream": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz", + "integrity": "sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.4.0", + "xtend": "^4.0.2" + } + }, + "level-mem": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/level-mem/-/level-mem-5.0.1.tgz", + "integrity": "sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg==", + "requires": { + "level-packager": "^5.0.3", + "memdown": "^5.0.0" + } + }, + "level-packager": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz", + "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==", + "requires": { + "encoding-down": "^6.3.0", + "levelup": "^4.3.2" + } + }, "level-supports": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", @@ -24851,6 +25623,28 @@ } } }, + "level-ws": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/level-ws/-/level-ws-2.0.0.tgz", + "integrity": "sha512-1iv7VXx0G9ec1isqQZ7y5LmoZo/ewAsyDHNA8EFDW5hqH2Kqovm33nSFkSdnLLAK+I5FlT+lo5Cw9itGe+CpQA==", + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^3.1.0", + "xtend": "^4.0.1" + } + }, + "levelup": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", + "integrity": "sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==", + "requires": { + "deferred-leveldown": "~5.3.0", + "level-errors": "~2.0.0", + "level-iterator-stream": "~4.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -25349,7 +26143,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, "requires": { "chalk": "^2.4.2" } @@ -25505,6 +26298,11 @@ "yallist": "^3.0.2" } }, + "lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=" + }, "ltgt": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", @@ -25906,6 +26704,38 @@ "p-is-promise": "^2.0.0" } }, + "memdown": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/memdown/-/memdown-5.1.0.tgz", + "integrity": "sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw==", + "requires": { + "abstract-leveldown": "~6.2.1", + "functional-red-black-tree": "~1.0.1", + "immediate": "~3.2.3", + "inherits": "~2.0.1", + "ltgt": "~2.2.0", + "safe-buffer": "~5.2.0" + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", + "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", + "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", + "xtend": "~4.0.0" + } + }, + "immediate": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", + "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=" + } + } + }, "memoize-one": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.1.1.tgz", @@ -25962,8 +26792,7 @@ "memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", - "dev": true + "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=" }, "meow": { "version": "7.0.1", @@ -26235,6 +27064,20 @@ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, + "merkle-patricia-tree": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.1.0.tgz", + "integrity": "sha512-vmP1J7FwIpprFMVjjSMM1JAwFce85Q+tp0TYIedYv8qaMh2oLUZ3ETXn9wbgi9S6elySzKzGa+Ai6VNKGEwSlg==", + "requires": { + "@types/levelup": "^4.3.0", + "ethereumjs-util": "^7.0.8", + "level-mem": "^5.0.1", + "level-ws": "^2.0.0", + "readable-stream": "^3.6.0", + "rlp": "^2.2.3", + "semaphore-async-await": "^1.5.1" + } + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -26661,6 +27504,14 @@ "integrity": "sha1-67Opd+evHGg65v2hK1Raa6bFhT0=", "dev": true }, + "mnemonist": { + "version": "0.38.3", + "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.3.tgz", + "integrity": "sha512-2K9QYubXx/NAjv4VLq1d1Ly8pWNC5L3BrixtdkyTegXWJIqY+zLNDhhX/A+ZwWt70tB1S8H4BE8FLYEFyNoOBw==", + "requires": { + "obliterator": "^1.6.1" + } + }, "mocha": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", @@ -32763,6 +33614,11 @@ "has": "^1.0.3" } }, + "obliterator": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-1.6.1.tgz", + "integrity": "sha512-9WXswnqINnnhOG/5SLimUlzuU1hFJUc8zkwyD59Sd+dPOMf05PmnYG/d6Q7HZ+KmgkZJa1PxRso6QdM3sTNHig==" + }, "oboe": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", @@ -33611,8 +34467,7 @@ "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "osenv": { "version": "0.1.5", @@ -36434,14 +37289,12 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" }, "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" }, "require-main-filename": { "version": "1.0.1", @@ -36615,7 +37468,6 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -37506,8 +38358,7 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-immediate-shim": { "version": "1.0.1", @@ -38035,7 +38886,6 @@ "version": "0.5.19", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -38044,8 +38894,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" } } }, @@ -38235,6 +39084,21 @@ "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", "dev": true }, + "stacktrace-parser": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz", + "integrity": "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==", + "requires": { + "type-fest": "^0.7.1" + }, + "dependencies": { + "type-fest": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", + "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==" + } + } + }, "standard": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/standard/-/standard-12.0.1.tgz", @@ -38944,7 +39808,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" @@ -38953,14 +39816,12 @@ "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, "requires": { "ansi-regex": "^3.0.0" } @@ -39975,7 +40836,6 @@ "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, "requires": { "os-tmpdir": "~1.0.2" } @@ -40172,6 +41032,11 @@ "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" }, + "true-case-path": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-2.2.1.tgz", + "integrity": "sha512-0z3j8R7MCjy10kc/g+qg7Ln3alJTodw9aDuVWZa3uiWqfuBMKeAeP2ocWcxoyM3D73yz3Jt/Pu4qPr4wHSdB/Q==" + }, "truncate-utf8-bytes": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", @@ -40344,6 +41209,11 @@ } } }, + "tsort": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", + "integrity": "sha1-4igPXoF/i/QnVlf9D5rr1E9aJ4Y=" + }, "tsutils": { "version": "3.17.1", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", @@ -40372,6 +41242,11 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, + "tweetnacl-util": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", + "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==" + }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -42806,14 +43681,12 @@ "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, "requires": { "string-width": "^1.0.2 || 2" } @@ -43276,11 +44149,15 @@ "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=", "dev": true }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" }, "yaeti": { "version": "0.0.6", @@ -43377,7 +44254,6 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", - "dev": true, "requires": { "flat": "^4.1.0", "lodash": "^4.17.15", @@ -43387,14 +44263,12 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, "requires": { "string-width": "^3.1.0", "strip-ansi": "^5.2.0", @@ -43405,7 +44279,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, "requires": { "locate-path": "^3.0.0" } @@ -43413,14 +44286,12 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, "requires": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" @@ -43430,7 +44301,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, "requires": { "p-try": "^2.0.0" } @@ -43439,7 +44309,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, "requires": { "p-limit": "^2.0.0" } @@ -43447,20 +44316,17 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -43471,7 +44337,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, "requires": { "ansi-regex": "^4.1.0" } @@ -43480,7 +44345,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, "requires": { "ansi-styles": "^3.2.0", "string-width": "^3.0.0", @@ -43491,7 +44355,6 @@ "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, "requires": { "cliui": "^5.0.0", "find-up": "^3.0.0", @@ -43509,7 +44372,6 @@ "version": "13.1.2", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" diff --git a/package.json b/package.json index 0e3b262c5e..26bf88ca92 100644 --- a/package.json +++ b/package.json @@ -155,6 +155,7 @@ "ethers": "^5.1.4", "express-ws": "^4.0.0", "fs-extra": "^3.0.1", + "hardhat": "^2.2.1", "http-server": "^0.11.1", "isbinaryfile": "^3.0.2", "jquery": "^3.3.1", From a7488f09cfdbafb541575084a064c0cc71341c08 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 11 May 2021 14:53:30 +0530 Subject: [PATCH 22/52] hardhat websocket plugin --- .../remix-ide/src/app/files/hardhat-handle.js | 18 ++++++ .../remix-ide/src/app/files/remixDProvider.js | 5 -- apps/remix-ide/src/app/files/remixd-handle.js | 2 +- .../src/app/tabs/compileTab/compileTab.js | 2 +- libs/remixd/src/bin/remixd.ts | 8 ++- libs/remixd/src/index.ts | 4 +- libs/remixd/src/serviceList.ts | 1 + libs/remixd/src/services/hardhatClient.ts | 55 +++++++++++++++++++ libs/remixd/src/services/remixdClient.ts | 8 +-- 9 files changed, 87 insertions(+), 16 deletions(-) create mode 100644 apps/remix-ide/src/app/files/hardhat-handle.js create mode 100644 libs/remixd/src/services/hardhatClient.ts diff --git a/apps/remix-ide/src/app/files/hardhat-handle.js b/apps/remix-ide/src/app/files/hardhat-handle.js new file mode 100644 index 0000000000..9f95211b76 --- /dev/null +++ b/apps/remix-ide/src/app/files/hardhat-handle.js @@ -0,0 +1,18 @@ +import { WebsocketPlugin } from '@remixproject/engine-web' +import * as packageJson from '../../../../../package.json' + +const profile = { + name: 'hardhat', + displayName: 'Hardhat', + url: 'ws://127.0.0.1:65522', + methods: ['compile'], + description: 'Using Remixd daemon, allow to access hardhat API', + kind: 'other', + version: packageJson.version +} + +export class hardhatHandle extends WebsocketPlugin { + constructor () { + super(profile) + } +} diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js index 044e46a165..60337c11e4 100644 --- a/apps/remix-ide/src/app/files/remixDProvider.js +++ b/apps/remix-ide/src/app/files/remixDProvider.js @@ -50,11 +50,6 @@ module.exports = class RemixDProvider extends FileProvider { return this._isReady } - async compileWithHardhat () { - console.log('Inside compileWithHardhat, calling hardhatCompile using _appManager') - return await this._appManager.call('remixd', 'hardhatCompile', {}) - } - close (cb) { this._isReady = false cb() diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index e8145f58d8..3ec635040c 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -22,7 +22,7 @@ const profile = { name: 'remixd', displayName: 'RemixD', url: 'ws://127.0.0.1:65520', - methods: ['folderIsReadOnly', 'hardhatCompile', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir'], + methods: ['folderIsReadOnly', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir'], events: [], description: 'Using Remixd daemon, allow to access file system', kind: 'other', diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index ea7377c3fd..c80514370b 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -83,7 +83,7 @@ class CompileTab { console.log('mode is - ', this.fileManager.mode) if(this.fileManager.mode === 'localhost') { console.log('calling compilehardhat') - this.fileProvider.compileWithHardhat().then(console.log) + // this.fileProvider.compileWithHardhat().then(console.log) } this.fileManager.saveCurrentFile() this.miscApi.clearAnnotations() diff --git a/libs/remixd/src/bin/remixd.ts b/libs/remixd/src/bin/remixd.ts index 5b7076fd0d..8d2ebe9bb2 100644 --- a/libs/remixd/src/bin/remixd.ts +++ b/libs/remixd/src/bin/remixd.ts @@ -24,16 +24,18 @@ async function warnLatestVersion () { const services = { git: (readOnly: boolean) => new servicesList.GitClient(readOnly), + hardhat: (readOnly: boolean) => new servicesList.HardhatClient(readOnly), folder: (readOnly: boolean) => new servicesList.Sharedfolder(readOnly) } const ports = { git: 65521, + hardhat: 65522, folder: 65520 } const killCallBack: Array = [] -function startService (service: S, callback: (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => void) { +function startService (service: S, callback: (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => void) { const socket = new WebSocket(ports[service], { remixIdeUrl: program.remixIde }, () => services[service](program.readOnly || false)) socket.start(callback) killCallBack.push(socket.close.bind(socket)) @@ -78,6 +80,10 @@ function startService (service: S, callback: (ws: WS sharedFolderClient.setupNotifications(program.sharedFolder) sharedFolderClient.sharedFolder(program.sharedFolder) }) + startService('hardhat', (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => { + sharedFolderClient.setWebSocket(ws) + sharedFolderClient.sharedFolder(program.sharedFolder) + }) /* startService('git', (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => { sharedFolderClient.setWebSocket(ws) diff --git a/libs/remixd/src/index.ts b/libs/remixd/src/index.ts index 04725c14f2..849f35b6fa 100644 --- a/libs/remixd/src/index.ts +++ b/libs/remixd/src/index.ts @@ -1,6 +1,7 @@ 'use strict' import { RemixdClient as sharedFolder } from './services/remixdClient' import { GitClient } from './services/gitClient' +import { HardhatClient } from './services/hardhatClient' import Websocket from './websocket' import * as utils from './utils' @@ -9,6 +10,7 @@ module.exports = { utils, services: { sharedFolder, - GitClient + GitClient, + HardhatClient } } diff --git a/libs/remixd/src/serviceList.ts b/libs/remixd/src/serviceList.ts index 5db445ee66..19d613b7c2 100644 --- a/libs/remixd/src/serviceList.ts +++ b/libs/remixd/src/serviceList.ts @@ -1,2 +1,3 @@ export { RemixdClient as Sharedfolder } from './services/remixdClient' export { GitClient } from './services/gitClient' +export { HardhatClient } from './services/hardhatClient' diff --git a/libs/remixd/src/services/hardhatClient.ts b/libs/remixd/src/services/hardhatClient.ts new file mode 100644 index 0000000000..3b86a2e637 --- /dev/null +++ b/libs/remixd/src/services/hardhatClient.ts @@ -0,0 +1,55 @@ +import * as WS from 'ws' // eslint-disable-line +import { PluginClient } from '@remixproject/plugin' +const { spawn } = require('child_process') + +export class HardhatClient extends PluginClient { + methods: Array + websocket: WS + currentSharedFolder: string + + constructor (private readOnly = false) { + super() + console.log('this is HardhatClient constructor') + this.methods = ['compile'] + } + + setWebSocket (websocket: WS): void { + this.websocket = websocket + } + + sharedFolder (currentSharedFolder: string): void { + this.currentSharedFolder = currentSharedFolder + } + + compile (cmd: string) { + // assertCommand(cmd) + const options = { cwd: this.currentSharedFolder, shell: true } + const child = spawn(cmd, options) + let result = '' + let error = '' + return new Promise((resolve, reject) => { + child.stdout.on('data', (data) => { + console.log('data in compile in HardhatClient', data) + result += data.toString() + }) + child.stderr.on('data', (err) => { + error += err.toString() + }) + child.on('close', () => { + if (error) reject(error) + else resolve(result) + }) + }) + } +} + +/** + * Validate that command can be run by service + * @param cmd + */ +function assertCommand (cmd) { + const regex = '^hardhat\\s[^&|;]*$' + if (!RegExp(regex).test(cmd)) { // git then space and then everything else + throw new Error('Invalid command for service!') + } +} diff --git a/libs/remixd/src/services/remixdClient.ts b/libs/remixd/src/services/remixdClient.ts index 42752c3adc..7fb5062335 100644 --- a/libs/remixd/src/services/remixdClient.ts +++ b/libs/remixd/src/services/remixdClient.ts @@ -15,7 +15,7 @@ export class RemixdClient extends PluginClient { constructor (private readOnly = false) { super() - this.methods = ['folderIsReadOnly', 'hardhatCompile', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir', 'canDeactivate'] + this.methods = ['folderIsReadOnly', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir', 'canDeactivate'] } setWebSocket (websocket: WS): void { @@ -27,12 +27,6 @@ export class RemixdClient extends PluginClient { if (this.isLoaded) this.emit('rootFolderChanged') } - async hardhatCompile() { - console.log('inside hardhatCompile') - console.log('here is hre-->', hre.tasks) - // await hre.tasks.accounts.action(); - } - list (): Filelist { try { return utils.walkSync(this.currentSharedFolder, {}, this.currentSharedFolder) From 4a1d58ac7672007537d0668223bf7ecc63d962e9 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 11 May 2021 21:05:00 +0530 Subject: [PATCH 23/52] compile using hardhat --- apps/remix-ide/src/app.js | 3 ++- apps/remix-ide/src/app/files/fileManager.js | 5 +++++ apps/remix-ide/src/app/files/hardhat-handle.js | 2 +- apps/remix-ide/src/app/files/remixd-handle.js | 2 +- apps/remix-ide/src/app/panels/file-panel.js | 2 ++ apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 2 +- libs/remixd/src/services/remixdClient.ts | 1 - 7 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index b05b4ef488..a22f388004 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -436,7 +436,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org analysis, test, filePanel.remixdHandle, - filePanel.gitHandle + filePanel.gitHandle, + filePanel.hardhatHandle ]) if (isElectron()) { diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index fd74b1722d..10f89a4759 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -57,6 +57,11 @@ class FileManager extends Plugin { this.mode = mode } + async compileWithHardhat (cmd) { + console.log('Inside compileWithHardhat, calling hardhat compile using appManager') + return await this.appManager.call('hardhat', 'compile', cmd) + } + limitPluginScope (path) { return path.replace(/^\/browser\//, '').replace(/^browser\//, '') // forbids plugin to access the root filesystem } diff --git a/apps/remix-ide/src/app/files/hardhat-handle.js b/apps/remix-ide/src/app/files/hardhat-handle.js index 9f95211b76..e9e8b770ef 100644 --- a/apps/remix-ide/src/app/files/hardhat-handle.js +++ b/apps/remix-ide/src/app/files/hardhat-handle.js @@ -11,7 +11,7 @@ const profile = { version: packageJson.version } -export class hardhatHandle extends WebsocketPlugin { +export class HardhatHandle extends WebsocketPlugin { constructor () { super(profile) } diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index 3ec635040c..8b8cfd8b98 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -81,7 +81,7 @@ export class RemixdHandle extends WebsocketPlugin { } }, 3000) this.locahostProvider.init(() => {}) - // this.call('manager', 'activatePlugin', 'git') + this.call('manager', 'activatePlugin', 'hardhat') } } if (this.locahostProvider.isConnected()) { diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 991108285c..6bdef578d6 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -9,6 +9,7 @@ import { checkSpecialChars, checkSlash } from '../../lib/helper' var EventManager = require('../../lib/events') var { RemixdHandle } = require('../files/remixd-handle.js') var { GitHandle } = require('../files/git-handle.js') +var { HardhatHandle } = require('../files/hardhat-handle.js') var globalRegistry = require('../../global/registry') var examples = require('../editor/examples') var GistHandler = require('../../lib/gist-handler') @@ -60,6 +61,7 @@ module.exports = class Filepanel extends ViewPlugin { this.remixdHandle = new RemixdHandle(this._deps.fileProviders.localhost, appManager) this.gitHandle = new GitHandle() + this.hardhatHandle = new HardhatHandle() this.registeredMenuItems = [] this.request = {} this.workspaces = [] diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index c80514370b..2d2ff32217 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -83,7 +83,7 @@ class CompileTab { console.log('mode is - ', this.fileManager.mode) if(this.fileManager.mode === 'localhost') { console.log('calling compilehardhat') - // this.fileProvider.compileWithHardhat().then(console.log) + this.fileManager.compileWithHardhat('npx hardhat compile').then(console.log) } this.fileManager.saveCurrentFile() this.miscApi.clearAnnotations() diff --git a/libs/remixd/src/services/remixdClient.ts b/libs/remixd/src/services/remixdClient.ts index 7fb5062335..31588628ea 100644 --- a/libs/remixd/src/services/remixdClient.ts +++ b/libs/remixd/src/services/remixdClient.ts @@ -5,7 +5,6 @@ import * as utils from '../utils' import * as chokidar from 'chokidar' import * as fs from 'fs-extra' import * as isbinaryfile from 'isbinaryfile' -const hre = require("hardhat"); export class RemixdClient extends PluginClient { methods: Array From 2ec13f13277fc8cd2cf1060b317a1aec0e688420 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 11 May 2021 21:07:48 +0530 Subject: [PATCH 24/52] linting fix --- apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index 2d2ff32217..87cdc1b9a1 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -81,7 +81,7 @@ class CompileTab { runCompiler () { try { console.log('mode is - ', this.fileManager.mode) - if(this.fileManager.mode === 'localhost') { + if (this.fileManager.mode === 'localhost') { console.log('calling compilehardhat') this.fileManager.compileWithHardhat('npx hardhat compile').then(console.log) } From 919fd6bd0edd3fb63eb0c7917be09acce284f447 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 12 May 2021 10:10:40 +0530 Subject: [PATCH 25/52] assertCommand removed --- libs/remixd/src/services/hardhatClient.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/libs/remixd/src/services/hardhatClient.ts b/libs/remixd/src/services/hardhatClient.ts index 3b86a2e637..e2f58ee624 100644 --- a/libs/remixd/src/services/hardhatClient.ts +++ b/libs/remixd/src/services/hardhatClient.ts @@ -22,7 +22,6 @@ export class HardhatClient extends PluginClient { } compile (cmd: string) { - // assertCommand(cmd) const options = { cwd: this.currentSharedFolder, shell: true } const child = spawn(cmd, options) let result = '' @@ -42,14 +41,3 @@ export class HardhatClient extends PluginClient { }) } } - -/** - * Validate that command can be run by service - * @param cmd - */ -function assertCommand (cmd) { - const regex = '^hardhat\\s[^&|;]*$' - if (!RegExp(regex).test(cmd)) { // git then space and then everything else - throw new Error('Invalid command for service!') - } -} From 829461b37f8aec05789d13a1df0e0a199309ad53 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 12 May 2021 11:23:13 +0530 Subject: [PATCH 26/52] compiler configuration from remix IDE --- apps/remix-ide/src/app/files/fileManager.js | 7 ++++--- .../remix-ide/src/app/tabs/compileTab/compileTab.js | 13 ++++++++++++- libs/remixd/src/services/hardhatClient.ts | 3 ++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 10f89a4759..0ba692c32e 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -57,9 +57,10 @@ class FileManager extends Plugin { this.mode = mode } - async compileWithHardhat (cmd) { - console.log('Inside compileWithHardhat, calling hardhat compile using appManager') - return await this.appManager.call('hardhat', 'compile', cmd) + async compileWithHardhat (fileContent) { + const configFilePath = 'remixCompiler.config.js' + this.setFileContent(configFilePath, fileContent) + return await this.appManager.call('hardhat', 'compile', configFilePath) } limitPluginScope (path) { diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index 87cdc1b9a1..b4367cbb70 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -83,7 +83,18 @@ class CompileTab { console.log('mode is - ', this.fileManager.mode) if (this.fileManager.mode === 'localhost') { console.log('calling compilehardhat') - this.fileManager.compileWithHardhat('npx hardhat compile').then(console.log) + const { currentVersion, optimize, runs } = this.compiler.state + const fileContent = `module.exports = { + solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}', + settings: { + optimizer: { + enabled: ${optimize}, + runs: ${runs} + } + } + } + ` + this.fileManager.compileWithHardhat(fileContent).then(console.log) } this.fileManager.saveCurrentFile() this.miscApi.clearAnnotations() diff --git a/libs/remixd/src/services/hardhatClient.ts b/libs/remixd/src/services/hardhatClient.ts index e2f58ee624..b03fa19cab 100644 --- a/libs/remixd/src/services/hardhatClient.ts +++ b/libs/remixd/src/services/hardhatClient.ts @@ -21,7 +21,8 @@ export class HardhatClient extends PluginClient { this.currentSharedFolder = currentSharedFolder } - compile (cmd: string) { + compile (configPath: string) { + const cmd = `npx hardhat compile --config ${configPath}` const options = { cwd: this.currentSharedFolder, shell: true } const child = spawn(cmd, options) let result = '' From 2a0bdd4b692b26a09b7cdfa82be7e0d0d6343ed7 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 12 May 2021 21:45:03 +0530 Subject: [PATCH 27/52] enable checkbox UI --- apps/remix-ide/src/app/tabs/compile-tab.js | 6 ++++++ apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 7 ++++++- .../remix-ide/src/app/tabs/compileTab/compilerContainer.js | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 12b93ff594..1ced69c7d7 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -90,6 +90,12 @@ class CompileTab extends ViewPlugin { */ listenToEvents () { + this.on('filePanel', 'setWorkspace', (workspace) => { + this.compileTabLogic.isHardhatProject().then((result) => { + if (result) this.compilerContainer.hardhatCompilation.style.display = 'flex' + }) + }) + this.data.eventHandlers.onContentChanged = () => { this.emit('statusChanged', { key: 'edited', title: 'the content has changed, needs recompilation', type: 'info' }) } diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index b4367cbb70..c469870904 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -78,11 +78,16 @@ class CompileTab { }) } + async isHardhatProject () { + if (this.fileManager.mode === 'localhost') { + return await this.fileManager.exists('hardhat.config.js') + } else return false + } + runCompiler () { try { console.log('mode is - ', this.fileManager.mode) if (this.fileManager.mode === 'localhost') { - console.log('calling compilehardhat') const { currentVersion, optimize, runs } = this.compiler.state const fileContent = `module.exports = { solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}', diff --git a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js index 88880bff22..ac8b0a0d1e 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js @@ -183,6 +183,10 @@ class CompilerContainer { } }) + this.hardhatCompilation = yo`` this._view.warnCompilationSlow = yo`` this._view.compileIcon = yo`` this._view.autoCompile = yo` this.updateAutoCompile()} data-id="compilerContainerAutoCompile" id="autoCompile" type="checkbox" title="Auto compile">` @@ -299,6 +303,7 @@ class CompilerContainer { + ${this.hardhatCompilation} ${this._view.compilationButton} From 57d91cbe28446d4995160d73423c5296fe17933b Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 13 May 2021 10:12:47 +0530 Subject: [PATCH 28/52] compile only when enabled --- apps/remix-ide/src/app/tabs/compile-tab.js | 1 + apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 4 ++-- .../src/app/tabs/compileTab/compilerContainer.js | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 1ced69c7d7..930430260d 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -93,6 +93,7 @@ class CompileTab extends ViewPlugin { this.on('filePanel', 'setWorkspace', (workspace) => { this.compileTabLogic.isHardhatProject().then((result) => { if (result) this.compilerContainer.hardhatCompilation.style.display = 'flex' + else this.compilerContainer.hardhatCompilation.style.display = 'none' }) }) diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index c469870904..d6359836dd 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -84,10 +84,10 @@ class CompileTab { } else return false } - runCompiler () { + runCompiler (hhCompilation) { try { console.log('mode is - ', this.fileManager.mode) - if (this.fileManager.mode === 'localhost') { + if (this.fileManager.mode === 'localhost' && hhCompilation) { const { currentVersion, optimize, runs } = this.compiler.state const fileContent = `module.exports = { solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}', diff --git a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js index ac8b0a0d1e..73d0802bf4 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js @@ -15,6 +15,7 @@ class CompilerContainer { this.editor = editor this.config = config this.queryParams = queryParams + this.hhCompilation = false this.data = { hideWarnings: config.get('hideWarnings') || false, @@ -184,7 +185,7 @@ class CompilerContainer { }) this.hardhatCompilation = yo`` this._view.warnCompilationSlow = yo`` @@ -331,12 +332,16 @@ class CompilerContainer { this.config.set('autoCompile', this._view.autoCompile.checked) } + updatehhCompilation (event) { + this.hhCompilation = event.target.checked + } + compile (event) { const currentFile = this.config.get('currentFile') if (!this.isSolFileSelected()) return this._setCompilerVersionFromPragma(currentFile) - this.compileTabLogic.runCompiler() + this.compileTabLogic.runCompiler(this.hhCompilation) } compileIfAutoCompileOn () { From a3e239b3ab2abddbaf9001fea54e73691b5a82c1 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 13 May 2021 10:46:47 +0530 Subject: [PATCH 29/52] do not compile in read only mode --- libs/remixd/src/services/hardhatClient.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/remixd/src/services/hardhatClient.ts b/libs/remixd/src/services/hardhatClient.ts index b03fa19cab..216e853a0a 100644 --- a/libs/remixd/src/services/hardhatClient.ts +++ b/libs/remixd/src/services/hardhatClient.ts @@ -9,7 +9,6 @@ export class HardhatClient extends PluginClient { constructor (private readOnly = false) { super() - console.log('this is HardhatClient constructor') this.methods = ['compile'] } @@ -22,12 +21,13 @@ export class HardhatClient extends PluginClient { } compile (configPath: string) { - const cmd = `npx hardhat compile --config ${configPath}` - const options = { cwd: this.currentSharedFolder, shell: true } - const child = spawn(cmd, options) - let result = '' - let error = '' return new Promise((resolve, reject) => { + if (this.readOnly) return reject(new Error('Cannot run Hardhat compilation in read-only mode')) + const cmd = `npx hardhat compile --config ${configPath}` + const options = { cwd: this.currentSharedFolder, shell: true } + const child = spawn(cmd, options) + let result = '' + let error = '' child.stdout.on('data', (data) => { console.log('data in compile in HardhatClient', data) result += data.toString() From 4bb083fb9454ba578c6021397b26b4dbf4d488ba Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 13 May 2021 10:56:45 +0530 Subject: [PATCH 30/52] hardhat npm dep removed --- package-lock.json | 1008 ++++----------------------------------------- package.json | 1 - 2 files changed, 73 insertions(+), 936 deletions(-) diff --git a/package-lock.json b/package-lock.json index ad004a82fc..d74204bd8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7796,112 +7796,6 @@ "any-observable": "^0.3.0" } }, - "@sentry/core": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", - "integrity": "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==", - "requires": { - "@sentry/hub": "5.30.0", - "@sentry/minimal": "5.30.0", - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/hub": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.30.0.tgz", - "integrity": "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ==", - "requires": { - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/minimal": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", - "integrity": "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw==", - "requires": { - "@sentry/hub": "5.30.0", - "@sentry/types": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/node": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.30.0.tgz", - "integrity": "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg==", - "requires": { - "@sentry/core": "5.30.0", - "@sentry/hub": "5.30.0", - "@sentry/tracing": "5.30.0", - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "cookie": "^0.4.1", - "https-proxy-agent": "^5.0.0", - "lru_map": "^0.3.3", - "tslib": "^1.9.3" - }, - "dependencies": { - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "requires": { - "debug": "4" - } - }, - "cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "requires": { - "agent-base": "6", - "debug": "4" - } - } - } - }, - "@sentry/tracing": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-5.30.0.tgz", - "integrity": "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw==", - "requires": { - "@sentry/hub": "5.30.0", - "@sentry/minimal": "5.30.0", - "@sentry/types": "5.30.0", - "@sentry/utils": "5.30.0", - "tslib": "^1.9.3" - } - }, - "@sentry/types": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.30.0.tgz", - "integrity": "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==" - }, - "@sentry/utils": { - "version": "5.30.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.30.0.tgz", - "integrity": "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww==", - "requires": { - "@sentry/types": "5.30.0", - "tslib": "^1.9.3" - } - }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -7916,11 +7810,6 @@ "type-detect": "4.0.8" } }, - "@solidity-parser/parser": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.11.1.tgz", - "integrity": "sha512-H8BSBoKE8EubJa0ONqecA2TviT3TnHeC4NpgnAHSUiuhZoQBfPB4L2P9bs8R6AoTW10Endvh3vc+fomVMIDIYQ==" - }, "@svgr/babel-plugin-add-jsx-attribute": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-5.4.0.tgz", @@ -8410,11 +8299,6 @@ "@types/node": "*" } }, - "@types/lru-cache": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.0.tgz", - "integrity": "sha512-RaE0B+14ToE4l6UqdarKPnXwVDuigfFv+5j9Dze/Nqr23yyuqdNvzcZi3xB+3Agvi5R4EOgAksfv3lXX4vBt9w==" - }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -9092,22 +8976,11 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, "requires": { "event-target-shim": "^5.0.0" } }, - "abstract-leveldown": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz", - "integrity": "sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ==", - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -9208,11 +9081,6 @@ "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", "dev": true }, - "adm-zip": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", - "integrity": "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==" - }, "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", @@ -11309,7 +11177,8 @@ "binary-extensions": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", - "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "dev": true }, "bindings": { "version": "1.5.0", @@ -11691,7 +11560,8 @@ "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==" + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true }, "browserify": { "version": "16.5.1", @@ -12601,7 +12471,8 @@ "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true }, "buffer-indexof": { "version": "1.1.1", @@ -12750,6 +12621,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -13546,7 +13418,8 @@ "command-exists": { "version": "1.2.9", "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", - "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true }, "commander": { "version": "2.20.3", @@ -15044,7 +14917,8 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true }, "decamelize-keys": { "version": "1.1.0", @@ -15365,29 +15239,6 @@ "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" }, - "deferred-leveldown": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", - "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", - "requires": { - "abstract-leveldown": "~6.2.1", - "inherits": "^2.0.3" - }, - "dependencies": { - "abstract-leveldown": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", - "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - } - } - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -16033,7 +15884,8 @@ "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "emojis-list": { "version": "3.0.0", @@ -16071,17 +15923,6 @@ } } }, - "encoding-down": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/encoding-down/-/encoding-down-6.3.0.tgz", - "integrity": "sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw==", - "requires": { - "abstract-leveldown": "^6.2.1", - "inherits": "^2.0.3", - "level-codec": "^9.0.0", - "level-errors": "^2.0.0" - } - }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -16101,21 +15942,6 @@ "tapable": "^1.0.0" } }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "requires": { - "ansi-colors": "^4.1.1" - }, - "dependencies": { - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==" - } - } - }, "ent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", @@ -16131,7 +15957,8 @@ "env-paths": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz", - "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==" + "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==", + "dev": true }, "envinfo": { "version": "7.5.1", @@ -16998,38 +16825,6 @@ } } }, - "eth-sig-util": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-2.5.4.tgz", - "integrity": "sha512-aCMBwp8q/4wrW4QLsF/HYBOSA7TpLKmkVwP3pYQNkEEseW2Rr8Z5Uxc9/h6HX+OG3tuHo+2bINVSihIeBfym6A==", - "requires": { - "ethereumjs-abi": "0.6.8", - "ethereumjs-util": "^5.1.1", - "tweetnacl": "^1.0.3", - "tweetnacl-util": "^0.15.0" - }, - "dependencies": { - "ethereumjs-util": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz", - "integrity": "sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ==", - "requires": { - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "elliptic": "^6.5.2", - "ethereum-cryptography": "^0.1.3", - "ethjs-util": "^0.1.3", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1" - } - }, - "tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" - } - } - }, "ethereum-bloom-filters": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.9.tgz", @@ -17088,31 +16883,6 @@ } } }, - "ethereumjs-abi": { - "version": "0.6.8", - "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz", - "integrity": "sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA==", - "requires": { - "bn.js": "^4.11.8", - "ethereumjs-util": "^6.0.0" - }, - "dependencies": { - "ethereumjs-util": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", - "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", - "requires": { - "@types/bn.js": "^4.11.3", - "bn.js": "^4.11.0", - "create-hash": "^1.1.2", - "elliptic": "^6.5.2", - "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", - "rlp": "^2.2.3" - } - } - } - }, "ethereumjs-common": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.1.tgz", @@ -17244,7 +17014,8 @@ "event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true }, "eventemitter2": { "version": "6.4.2", @@ -18120,6 +17891,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, "requires": { "is-buffer": "~2.0.3" }, @@ -18127,7 +17899,8 @@ "is-buffer": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", - "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true } } }, @@ -18334,11 +18107,6 @@ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, - "fp-ts": { - "version": "1.19.3", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", - "integrity": "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==" - }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -19383,6 +19151,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -20082,6 +19851,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, "requires": { "is-glob": "^4.0.1" } @@ -20487,7 +20257,8 @@ "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==" + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true }, "growly": { "version": "1.3.0", @@ -20823,495 +20594,6 @@ "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", "dev": true }, - "hardhat": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.2.1.tgz", - "integrity": "sha512-8s7MtGXdh0NDwQKdlA8m8QdloVIN1+hv5aFpn0G5Ljj9vfNY9kUoc0a9pMboeGbd9WrS+XrZs5YlsPgQjaW/Tg==", - "requires": { - "@ethereumjs/block": "^3.2.1", - "@ethereumjs/blockchain": "^5.2.1", - "@ethereumjs/common": "^2.2.0", - "@ethereumjs/tx": "^3.1.3", - "@ethereumjs/vm": "^5.3.2", - "@sentry/node": "^5.18.1", - "@solidity-parser/parser": "^0.11.0", - "@types/bn.js": "^5.1.0", - "@types/lru-cache": "^5.1.0", - "abort-controller": "^3.0.0", - "adm-zip": "^0.4.16", - "ansi-escapes": "^4.3.0", - "chalk": "^2.4.2", - "chokidar": "^3.4.0", - "ci-info": "^2.0.0", - "debug": "^4.1.1", - "enquirer": "^2.3.0", - "env-paths": "^2.2.0", - "eth-sig-util": "^2.5.2", - "ethereum-cryptography": "^0.1.2", - "ethereumjs-abi": "^0.6.8", - "ethereumjs-util": "^7.0.10", - "find-up": "^2.1.0", - "fp-ts": "1.19.3", - "fs-extra": "^7.0.1", - "glob": "^7.1.3", - "immutable": "^4.0.0-rc.12", - "io-ts": "1.10.4", - "lodash": "^4.17.11", - "merkle-patricia-tree": "^4.1.0", - "mnemonist": "^0.38.0", - "mocha": "^7.1.2", - "node-fetch": "^2.6.0", - "qs": "^6.7.0", - "raw-body": "^2.4.1", - "resolve": "1.17.0", - "semver": "^6.3.0", - "slash": "^3.0.0", - "solc": "0.7.3", - "source-map-support": "^0.5.13", - "stacktrace-parser": "^0.1.10", - "true-case-path": "^2.2.1", - "tsort": "0.0.1", - "uuid": "^3.3.2", - "ws": "^7.2.1" - }, - "dependencies": { - "@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "requires": { - "@types/node": "*" - } - }, - "ansi-colors": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", - "integrity": "sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==" - }, - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "requires": { - "type-fest": "^0.21.3" - } - }, - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" - }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" - }, - "chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "optional": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" - }, - "http-errors": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", - "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - } - }, - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "mocha": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.2.0.tgz", - "integrity": "sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ==", - "requires": { - "ansi-colors": "3.2.3", - "browser-stdout": "1.3.1", - "chokidar": "3.3.0", - "debug": "3.2.6", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "find-up": "3.0.0", - "glob": "7.1.3", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", - "minimatch": "3.0.4", - "mkdirp": "0.5.5", - "ms": "2.1.1", - "node-environment-flags": "1.0.6", - "object.assign": "4.1.0", - "strip-json-comments": "2.0.1", - "supports-color": "6.0.0", - "which": "1.3.1", - "wide-align": "1.1.3", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" - }, - "dependencies": { - "chokidar": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.0.tgz", - "integrity": "sha512-dGmKLDdT3Gdl7fBUe8XK+gAtGmzy5Fn0XkkWQuYxGIgWVPPse2CxFA5mtrlD0TOHaHjEUqkWNyP1XdHoJES/4A==", - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.1.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.2.0" - } - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "requires": { - "ms": "^2.1.1" - } - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "requires": { - "locate-path": "^3.0.0" - } - }, - "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "optional": true - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - }, - "readdirp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.2.0.tgz", - "integrity": "sha512-crk4Qu3pmXwgxdSgGhgA/eXiJAPQiX4GMOZZMXnqKxHX7TaoL+3gQVo/WeuAiogr07DpnfjIMpXXa+PAIvwPGQ==", - "requires": { - "picomatch": "^2.0.4" - } - } - } - }, - "node-environment-flags": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", - "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", - "requires": { - "object.getownpropertydescriptors": "^2.0.3", - "semver": "^5.7.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" - } - } - }, - "object-inspect": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", - "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==" - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" - }, - "qs": { - "version": "6.10.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", - "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", - "requires": { - "side-channel": "^1.0.4" - } - }, - "raw-body": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz", - "integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==", - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.3", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "requires": { - "picomatch": "^2.2.1" - } - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" - }, - "solc": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", - "integrity": "sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA==", - "requires": { - "command-exists": "^1.2.8", - "commander": "3.0.2", - "follow-redirects": "^1.12.1", - "fs-extra": "^0.30.0", - "js-sha3": "0.8.0", - "memorystream": "^0.3.1", - "require-from-string": "^2.0.0", - "semver": "^5.5.0", - "tmp": "0.0.33" - }, - "dependencies": { - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" - } - } - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "supports-color": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz", - "integrity": "sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==", - "requires": { - "has-flag": "^3.0.0" - } - }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "requires": { - "locate-path": "^3.0.0" - } - } - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, "harmony-reflect": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.1.tgz", @@ -21836,11 +21118,6 @@ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.3.0.tgz", "integrity": "sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q==" }, - "immutable": { - "version": "4.0.0-rc.12", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.0.0-rc.12.tgz", - "integrity": "sha512-0M2XxkZLx/mi3t8NVwIm1g8nHoEmM9p9UBl/G9k4+hm0kBgOVdMV/B3CY5dQ8qG8qc80NN4gDV4HQv6FTJ5q7A==" - }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -22136,14 +21413,6 @@ "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, - "io-ts": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", - "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", - "requires": { - "fp-ts": "^1.0.0" - } - }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -22411,6 +21680,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, "requires": { "binary-extensions": "^2.0.0" } @@ -22552,7 +21822,8 @@ "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "is-function": { "version": "1.0.2", @@ -25340,6 +24611,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "dev": true, "requires": { "graceful-fs": "^4.1.9" } @@ -25559,55 +24831,11 @@ } } }, - "level-codec": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-9.0.2.tgz", - "integrity": "sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ==", - "requires": { - "buffer": "^5.6.0" - } - }, "level-concat-iterator": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==" }, - "level-errors": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", - "integrity": "sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw==", - "requires": { - "errno": "~0.1.1" - } - }, - "level-iterator-stream": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz", - "integrity": "sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q==", - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.4.0", - "xtend": "^4.0.2" - } - }, - "level-mem": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/level-mem/-/level-mem-5.0.1.tgz", - "integrity": "sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg==", - "requires": { - "level-packager": "^5.0.3", - "memdown": "^5.0.0" - } - }, - "level-packager": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz", - "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==", - "requires": { - "encoding-down": "^6.3.0", - "levelup": "^4.3.2" - } - }, "level-supports": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", @@ -25623,28 +24851,6 @@ } } }, - "level-ws": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/level-ws/-/level-ws-2.0.0.tgz", - "integrity": "sha512-1iv7VXx0G9ec1isqQZ7y5LmoZo/ewAsyDHNA8EFDW5hqH2Kqovm33nSFkSdnLLAK+I5FlT+lo5Cw9itGe+CpQA==", - "requires": { - "inherits": "^2.0.3", - "readable-stream": "^3.1.0", - "xtend": "^4.0.1" - } - }, - "levelup": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", - "integrity": "sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ==", - "requires": { - "deferred-leveldown": "~5.3.0", - "level-errors": "~2.0.0", - "level-iterator-stream": "~4.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -26143,6 +25349,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, "requires": { "chalk": "^2.4.2" } @@ -26298,11 +25505,6 @@ "yallist": "^3.0.2" } }, - "lru_map": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", - "integrity": "sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=" - }, "ltgt": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ltgt/-/ltgt-2.2.1.tgz", @@ -26704,38 +25906,6 @@ "p-is-promise": "^2.0.0" } }, - "memdown": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/memdown/-/memdown-5.1.0.tgz", - "integrity": "sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw==", - "requires": { - "abstract-leveldown": "~6.2.1", - "functional-red-black-tree": "~1.0.1", - "immediate": "~3.2.3", - "inherits": "~2.0.1", - "ltgt": "~2.2.0", - "safe-buffer": "~5.2.0" - }, - "dependencies": { - "abstract-leveldown": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", - "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, - "immediate": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", - "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=" - } - } - }, "memoize-one": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-5.1.1.tgz", @@ -26792,7 +25962,8 @@ "memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=" + "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", + "dev": true }, "meow": { "version": "7.0.1", @@ -27064,20 +26235,6 @@ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true }, - "merkle-patricia-tree": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-4.1.0.tgz", - "integrity": "sha512-vmP1J7FwIpprFMVjjSMM1JAwFce85Q+tp0TYIedYv8qaMh2oLUZ3ETXn9wbgi9S6elySzKzGa+Ai6VNKGEwSlg==", - "requires": { - "@types/levelup": "^4.3.0", - "ethereumjs-util": "^7.0.8", - "level-mem": "^5.0.1", - "level-ws": "^2.0.0", - "readable-stream": "^3.6.0", - "rlp": "^2.2.3", - "semaphore-async-await": "^1.5.1" - } - }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -27504,14 +26661,6 @@ "integrity": "sha1-67Opd+evHGg65v2hK1Raa6bFhT0=", "dev": true }, - "mnemonist": { - "version": "0.38.3", - "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.3.tgz", - "integrity": "sha512-2K9QYubXx/NAjv4VLq1d1Ly8pWNC5L3BrixtdkyTegXWJIqY+zLNDhhX/A+ZwWt70tB1S8H4BE8FLYEFyNoOBw==", - "requires": { - "obliterator": "^1.6.1" - } - }, "mocha": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", @@ -33614,11 +32763,6 @@ "has": "^1.0.3" } }, - "obliterator": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-1.6.1.tgz", - "integrity": "sha512-9WXswnqINnnhOG/5SLimUlzuU1hFJUc8zkwyD59Sd+dPOMf05PmnYG/d6Q7HZ+KmgkZJa1PxRso6QdM3sTNHig==" - }, "oboe": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", @@ -34467,7 +33611,8 @@ "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true }, "osenv": { "version": "0.1.5", @@ -37289,12 +36434,14 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true }, "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true }, "require-main-filename": { "version": "1.0.1", @@ -37468,6 +36615,7 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, "requires": { "glob": "^7.1.3" } @@ -38358,7 +37506,8 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true }, "set-immediate-shim": { "version": "1.0.1", @@ -38886,6 +38035,7 @@ "version": "0.5.19", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -38894,7 +38044,8 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, @@ -39084,21 +38235,6 @@ "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", "dev": true }, - "stacktrace-parser": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz", - "integrity": "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==", - "requires": { - "type-fest": "^0.7.1" - }, - "dependencies": { - "type-fest": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", - "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==" - } - } - }, "standard": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/standard/-/standard-12.0.1.tgz", @@ -39808,6 +38944,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" @@ -39816,12 +38953,14 @@ "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true }, "strip-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, "requires": { "ansi-regex": "^3.0.0" } @@ -40836,6 +39975,7 @@ "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, "requires": { "os-tmpdir": "~1.0.2" } @@ -41032,11 +40172,6 @@ "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" }, - "true-case-path": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-2.2.1.tgz", - "integrity": "sha512-0z3j8R7MCjy10kc/g+qg7Ln3alJTodw9aDuVWZa3uiWqfuBMKeAeP2ocWcxoyM3D73yz3Jt/Pu4qPr4wHSdB/Q==" - }, "truncate-utf8-bytes": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", @@ -41209,11 +40344,6 @@ } } }, - "tsort": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", - "integrity": "sha1-4igPXoF/i/QnVlf9D5rr1E9aJ4Y=" - }, "tsutils": { "version": "3.17.1", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", @@ -41242,11 +40372,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, - "tweetnacl-util": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", - "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==" - }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -43681,12 +42806,14 @@ "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, "requires": { "string-width": "^1.0.2 || 2" } @@ -44149,15 +43276,11 @@ "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=", "dev": true }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" - }, "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true }, "yaeti": { "version": "0.0.6", @@ -44254,6 +43377,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "dev": true, "requires": { "flat": "^4.1.0", "lodash": "^4.17.15", @@ -44263,12 +43387,14 @@ "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, "requires": { "string-width": "^3.1.0", "strip-ansi": "^5.2.0", @@ -44279,6 +43405,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, "requires": { "locate-path": "^3.0.0" } @@ -44286,12 +43413,14 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, "requires": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" @@ -44301,6 +43430,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, "requires": { "p-try": "^2.0.0" } @@ -44309,6 +43439,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, "requires": { "p-limit": "^2.0.0" } @@ -44316,17 +43447,20 @@ "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, "requires": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -44337,6 +43471,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "requires": { "ansi-regex": "^4.1.0" } @@ -44345,6 +43480,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, "requires": { "ansi-styles": "^3.2.0", "string-width": "^3.0.0", @@ -44355,6 +43491,7 @@ "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, "requires": { "cliui": "^5.0.0", "find-up": "^3.0.0", @@ -44372,6 +43509,7 @@ "version": "13.1.2", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" diff --git a/package.json b/package.json index 26bf88ca92..0e3b262c5e 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,6 @@ "ethers": "^5.1.4", "express-ws": "^4.0.0", "fs-extra": "^3.0.1", - "hardhat": "^2.2.1", "http-server": "^0.11.1", "isbinaryfile": "^3.0.2", "jquery": "^3.3.1", From 4f4c15b34654c3581de49f9d888c02744cc21eb1 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 13 May 2021 12:07:11 +0530 Subject: [PATCH 31/52] logging for hardhat conmpilation --- libs/remixd/src/services/hardhatClient.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/remixd/src/services/hardhatClient.ts b/libs/remixd/src/services/hardhatClient.ts index 216e853a0a..7c2efd463a 100644 --- a/libs/remixd/src/services/hardhatClient.ts +++ b/libs/remixd/src/services/hardhatClient.ts @@ -22,17 +22,22 @@ export class HardhatClient extends PluginClient { compile (configPath: string) { return new Promise((resolve, reject) => { - if (this.readOnly) return reject(new Error('Cannot run Hardhat compilation in read-only mode')) + if (this.readOnly) { + const errMsg = '[Hardhat Compilation]: Cannot compile in read-only mode' + console.log('\x1b[31m%s\x1b[0m', `${errMsg}`) + return reject(new Error(errMsg)) + } const cmd = `npx hardhat compile --config ${configPath}` const options = { cwd: this.currentSharedFolder, shell: true } const child = spawn(cmd, options) let result = '' let error = '' child.stdout.on('data', (data) => { - console.log('data in compile in HardhatClient', data) + console.log('\x1b[32m%s\x1b[0m', `[Hardhat Compilation]: ${data.toString()}`) result += data.toString() }) child.stderr.on('data', (err) => { + console.log('\x1b[31m%s\x1b[0m', `[Hardhat Compilation]: ${err.toString()}`) error += err.toString() }) child.on('close', () => { From 4b66dbcea112a18fd4c2e1be634e28b9ffbde7e7 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 13 May 2021 12:24:30 +0530 Subject: [PATCH 32/52] removed console --- apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index d6359836dd..ad1be493ed 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -86,7 +86,6 @@ class CompileTab { runCompiler (hhCompilation) { try { - console.log('mode is - ', this.fileManager.mode) if (this.fileManager.mode === 'localhost' && hhCompilation) { const { currentVersion, optimize, runs } = this.compiler.state const fileContent = `module.exports = { From df20c84b7d8f87cf9684d9279d6a6917fada2e50 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 18 May 2021 11:33:48 +0530 Subject: [PATCH 33/52] compileWithHardhat moved to compileTab --- apps/remix-ide/src/app/files/fileManager.js | 6 ------ apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 0ba692c32e..fd74b1722d 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -57,12 +57,6 @@ class FileManager extends Plugin { this.mode = mode } - async compileWithHardhat (fileContent) { - const configFilePath = 'remixCompiler.config.js' - this.setFileContent(configFilePath, fileContent) - return await this.appManager.call('hardhat', 'compile', configFilePath) - } - limitPluginScope (path) { return path.replace(/^\/browser\//, '').replace(/^browser\//, '') // forbids plugin to access the root filesystem } diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index ad1be493ed..69390b68e9 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -98,7 +98,9 @@ class CompileTab { } } ` - this.fileManager.compileWithHardhat(fileContent).then(console.log) + const configFilePath = 'remix-compiler.config.js' + this.fileManager.setFileContent(configFilePath, fileContent) + this.fileManager.appManager.call('hardhat', 'compile', configFilePath) } this.fileManager.saveCurrentFile() this.miscApi.clearAnnotations() From 2b2c9e493ba3ab3f283d0861c3b0e72cb3dc3fb2 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 18 May 2021 11:40:00 +0530 Subject: [PATCH 34/52] deactivatePlugin hardhat --- apps/remix-ide/src/app/files/remixd-handle.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index 8b8cfd8b98..a2d94eb3ea 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -39,6 +39,7 @@ export class RemixdHandle extends WebsocketPlugin { deactivate () { if (super.socket) super.deactivate() // this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 + this.appManager.deactivatePlugin('hardhat') this.locahostProvider.close((error) => { if (error) console.log(error) }) @@ -51,6 +52,7 @@ export class RemixdHandle extends WebsocketPlugin { async canceled () { // await this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342 await this.appManager.deactivatePlugin('remixd') + await this.appManager.deactivatePlugin('hardhat') } /** From 7ddf6b3012cf3df29127695ef2abaac64b8a5a24 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 18 May 2021 13:22:08 +0530 Subject: [PATCH 35/52] handled checkbox display on switching from localhost --- apps/remix-ide/src/app/tabs/compile-tab.js | 2 +- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 930430260d..790202688c 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -92,7 +92,7 @@ class CompileTab extends ViewPlugin { listenToEvents () { this.on('filePanel', 'setWorkspace', (workspace) => { this.compileTabLogic.isHardhatProject().then((result) => { - if (result) this.compilerContainer.hardhatCompilation.style.display = 'flex' + if (result && workspace.isLocalhost) this.compilerContainer.hardhatCompilation.style.display = 'flex' else this.compilerContainer.hardhatCompilation.style.display = 'none' }) }) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 883f5c1785..59bda8e917 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -91,7 +91,11 @@ export const Workspace = (props: WorkspaceProps) => { const localhostDisconnect = () => { if (state.currentWorkspace === LOCALHOST) setWorkspace(props.workspaces.length > 0 ? props.workspaces[0] : NO_WORKSPACE) - else setWorkspace(state.currentWorkspace) // Useful to switch to last selcted workspace when remixd is disconnected + // This should be removed some time after refactoring: https://github.com/ethereum/remix-project/issues/1197 + else { + setWorkspace(state.currentWorkspace) // Useful to switch to last selcted workspace when remixd is disconnected + props.fileManager.setMode('browser') + } } props.localhost.event.unregister('disconnected', localhostDisconnect) props.localhost.event.register('disconnected', localhostDisconnect) @@ -251,6 +255,7 @@ export const Workspace = (props: WorkspaceProps) => { // If 'connect to localhost' is clicked from home tab, mode is not 'localhost' if (props.fileManager.mode === 'localhost') { await setWorkspace(NO_WORKSPACE) + console.log('remixdExplorer.hide') props.fileManager.setMode('browser') setState(prevState => { return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } From ffc99a643e77d2fea8febe35f3943f3d20c6ecb0 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 18 May 2021 18:44:03 +0530 Subject: [PATCH 36/52] updated hardhat API call --- apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index 69390b68e9..a3010dbc2d 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -100,7 +100,7 @@ class CompileTab { ` const configFilePath = 'remix-compiler.config.js' this.fileManager.setFileContent(configFilePath, fileContent) - this.fileManager.appManager.call('hardhat', 'compile', configFilePath) + this.fileManager.call('hardhat', 'compile', configFilePath) } this.fileManager.saveCurrentFile() this.miscApi.clearAnnotations() From 3d91fd5ccc562730726b50a3e7f4dc1b62b49aff Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 18 May 2021 18:56:36 +0530 Subject: [PATCH 37/52] hardhat as dependentModule --- apps/remix-ide/src/remixAppManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index b495f53c81..650a87b14d 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -11,7 +11,7 @@ const requiredModules = [ // services + layout views + system views 'fileManager', 'contentImport', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp'] -const dependentModules = ['git'] // module which shouldn't be manually activated (e.g git is activated by remixd) +const dependentModules = ['git', 'hardhat'] // module which shouldn't be manually activated (e.g git is activated by remixd) export function isNative (name) { const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons'] From d67ffdaf5a1682f5da96c8f561fa0f7a895fbf91 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 18 May 2021 19:02:52 +0530 Subject: [PATCH 38/52] removed console --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 59bda8e917..3feff714c1 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -255,7 +255,6 @@ export const Workspace = (props: WorkspaceProps) => { // If 'connect to localhost' is clicked from home tab, mode is not 'localhost' if (props.fileManager.mode === 'localhost') { await setWorkspace(NO_WORKSPACE) - console.log('remixdExplorer.hide') props.fileManager.setMode('browser') setState(prevState => { return { ...prevState, hideRemixdExplorer: true, loadingLocalhost: false } From e62d210a65730dd98ec82339bf2086dda28a710e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 May 2021 16:30:31 +0200 Subject: [PATCH 39/52] fix runCompiler parameter --- apps/remix-ide/src/app/tabs/compile-tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 790202688c..fe49f60037 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -206,7 +206,7 @@ class CompileTab extends ViewPlugin { // ctrl+s or command+s if ((e.metaKey || e.ctrlKey) && e.keyCode === 83) { e.preventDefault() - this.compileTabLogic.runCompiler() + this.compileTabLogic.runCompiler(this.compilerContainer.hhCompilation) } }) } From 4f932c9748b043ad7630484c3698b43065de21cb Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 May 2021 16:31:47 +0200 Subject: [PATCH 40/52] make compileTabLogic a plugin --- apps/remix-ide/src/app.js | 1 + apps/remix-ide/src/app/tabs/compile-tab.js | 9 +++------ .../src/app/tabs/compileTab/compileTab.js | 19 ++++++++++++++----- apps/remix-ide/src/remixAppManager.js | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index a22f388004..93dd6753b5 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -431,6 +431,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org engine.register([ compileTab, + compileTab.compileTabLogic, run, debug, analysis, diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index fe49f60037..400ef25d76 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -65,15 +65,10 @@ class CompileTab extends ViewPlugin { eventHandlers: {}, loading: false } + this.compileTabLogic = new CompileTabLogic(this.queryParams, this.fileManager, this.editor, this.config, this.fileProvider, this.contentImport) } onActivationInternal () { - const miscApi = { - clearAnnotations: () => { - this.call('editor', 'clearAnnotations') - } - } - this.compileTabLogic = new CompileTabLogic(this.queryParams, this.fileManager, this.editor, this.config, this.fileProvider, this.contentImport, miscApi) this.compiler = this.compileTabLogic.compiler this.compileTabLogic.init() @@ -486,6 +481,7 @@ class CompileTab extends ViewPlugin { } onActivation () { + this.call('manager', 'activatePlugin', 'solidity-logic') this.listenToEvents() } @@ -499,6 +495,7 @@ class CompileTab extends ViewPlugin { this.fileManager.events.removeListener('noFileSelected', this.data.eventHandlers.onNoFileSelected) this.compiler.event.unregister('compilationFinished', this.data.eventHandlers.onCompilationFinished) globalRegistry.get('themeModule').api.events.removeListener('themeChanged', this.data.eventHandlers.onThemeChanged) + this.call('manager', 'deactivatePlugin', 'solidity-logic') } } diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index a3010dbc2d..d5b1168b93 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -1,10 +1,19 @@ const EventEmitter = require('events') var Compiler = require('@remix-project/remix-solidity').Compiler +import * as packageJson from '../../../../../../package.json' +import { Plugin } from '@remixproject/engine' -class CompileTab { - constructor (queryParams, fileManager, editor, config, fileProvider, contentImport, miscApi) { +const profile = { + name: 'solidity-logic', + displayName: 'Solidity compiler logic', + description: 'Compile solidity contracts - Logic', + version: packageJson.version +} + +class CompileTab extends Plugin { + constructor (queryParams, fileManager, editor, config, fileProvider, contentImport) { + super(profile) this.event = new EventEmitter() - this.miscApi = miscApi this.queryParams = queryParams this.compilerImport = contentImport this.compiler = new Compiler((url, cb) => this.compilerImport.resolveAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message))) @@ -100,10 +109,10 @@ class CompileTab { ` const configFilePath = 'remix-compiler.config.js' this.fileManager.setFileContent(configFilePath, fileContent) - this.fileManager.call('hardhat', 'compile', configFilePath) + this.call('hardhat', 'compile', configFilePath) } this.fileManager.saveCurrentFile() - this.miscApi.clearAnnotations() + this.call('editor', 'clearAnnotations') var currentFile = this.config.get('currentFile') return this.compileFile(currentFile) } catch (err) { diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 650a87b14d..7e7f9cd10f 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -14,7 +14,7 @@ const requiredModules = [ // services + layout views + system views const dependentModules = ['git', 'hardhat'] // module which shouldn't be manually activated (e.g git is activated by remixd) export function isNative (name) { - const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons'] + const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity'] return nativePlugins.includes(name) || requiredModules.includes(name) } From a2e4d37a3c2b56285b2c48f30a88e104945e51c5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 18 May 2021 16:51:57 +0200 Subject: [PATCH 41/52] linting --- apps/remix-ide/src/app/tabs/compileTab/compileTab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js index d5b1168b93..1e5de9d5c7 100644 --- a/apps/remix-ide/src/app/tabs/compileTab/compileTab.js +++ b/apps/remix-ide/src/app/tabs/compileTab/compileTab.js @@ -1,7 +1,7 @@ -const EventEmitter = require('events') -var Compiler = require('@remix-project/remix-solidity').Compiler import * as packageJson from '../../../../../../package.json' import { Plugin } from '@remixproject/engine' +const EventEmitter = require('events') +var Compiler = require('@remix-project/remix-solidity').Compiler const profile = { name: 'solidity-logic', From 734d6b971f788a135afef2a8566811e71259f0b2 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 14 Apr 2021 21:43:59 +0200 Subject: [PATCH 42/52] refactors events --- apps/remix-ide/src/app/files/fileManager.js | 24 +++++++++---------- apps/remix-ide/src/app/files/fileProvider.js | 16 ++++++------- .../remix-ide/src/app/files/remixDProvider.js | 24 +++++++++---------- .../src/app/files/workspaceFileProvider.js | 4 ++-- .../workspace/src/lib/remix-ui-workspace.tsx | 12 +++++----- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index fd74b1722d..44e33ff0d2 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -329,18 +329,18 @@ class FileManager extends Plugin { workspaceExplorer: this._components.registry.get('fileproviders/workspace').api, filesProviders: this._components.registry.get('fileproviders').api } - this._deps.browserExplorer.event.register('fileChanged', (path) => { this.fileChangedEvent(path) }) - this._deps.browserExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) - this._deps.localhostExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) - this._deps.browserExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) - this._deps.browserExplorer.event.register('fileAdded', (path) => { this.fileAddedEvent(path) }) - this._deps.localhostExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) - this._deps.localhostExplorer.event.register('errored', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) - this._deps.localhostExplorer.event.register('closed', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) - this._deps.workspaceExplorer.event.register('fileChanged', (path) => { this.fileChangedEvent(path) }) - this._deps.workspaceExplorer.event.register('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) - this._deps.workspaceExplorer.event.register('fileRemoved', (path) => { this.fileRemovedEvent(path) }) - this._deps.workspaceExplorer.event.register('fileAdded', (path) => { this.fileAddedEvent(path) }) + this._deps.browserExplorer.event.on('fileChanged', (path) => { this.fileChangedEvent(path) }) + this._deps.browserExplorer.event.on('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) + this._deps.localhostExplorer.event.on('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) + this._deps.browserExplorer.event.on('fileRemoved', (path) => { this.fileRemovedEvent(path) }) + this._deps.browserExplorer.event.on('fileAdded', (path) => { this.fileAddedEvent(path) }) + this._deps.localhostExplorer.event.on('fileRemoved', (path) => { this.fileRemovedEvent(path) }) + this._deps.localhostExplorer.event.on('errored', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) + this._deps.localhostExplorer.event.on('closed', (event) => { this.removeTabsOf(this._deps.localhostExplorer) }) + this._deps.workspaceExplorer.event.on('fileChanged', (path) => { this.fileChangedEvent(path) }) + this._deps.workspaceExplorer.event.on('fileRenamed', (oldName, newName, isFolder) => { this.fileRenamedEvent(oldName, newName, isFolder) }) + this._deps.workspaceExplorer.event.on('fileRemoved', (path) => { this.fileRemovedEvent(path) }) + this._deps.workspaceExplorer.event.on('fileAdded', (path) => { this.fileAddedEvent(path) }) this.getCurrentFile = this.file this.getFile = this.readFile diff --git a/apps/remix-ide/src/app/files/fileProvider.js b/apps/remix-ide/src/app/files/fileProvider.js index 521dcec453..5d152ec74b 100644 --- a/apps/remix-ide/src/app/files/fileProvider.js +++ b/apps/remix-ide/src/app/files/fileProvider.js @@ -1,7 +1,7 @@ 'use strict' const CompilerImport = require('../compiler/compiler-imports') -const EventManager = require('../../lib/events') +const EventManager = require('events') const modalDialogCustom = require('../ui/modal-dialog-custom') const tooltip = require('../ui/tooltip') const remixLib = require('@remix-project/remix-lib') @@ -111,9 +111,9 @@ class FileProvider { return false } if (!exists) { - this.event.trigger('fileAdded', [this._normalizePath(unprefixedpath), false]) + this.event.emit('fileAdded', this._normalizePath(unprefixedpath), false) } else { - this.event.trigger('fileChanged', [this._normalizePath(unprefixedpath)]) + this.event.emit('fileChanged', this._normalizePath(unprefixedpath)) } cb() return true @@ -128,7 +128,7 @@ class FileProvider { currentCheck = currentCheck + '/' + value if (!window.remixFileSystem.existsSync(currentCheck)) { window.remixFileSystem.mkdirSync(currentCheck) - this.event.trigger('folderAdded', [this._normalizePath(currentCheck)]) + this.event.emit('folderAdded', this._normalizePath(currentCheck)) } }) if (cb) cb() @@ -184,7 +184,7 @@ class FileProvider { // folder is empty window.remixFileSystem.rmdirSync(path, console.log) } - this.event.trigger('fileRemoved', [this._normalizePath(path)]) + this.event.emit('fileRemoved', this._normalizePath(path)) } } catch (e) { console.log(e) @@ -249,7 +249,7 @@ class FileProvider { path = this.removePrefix(path) if (window.remixFileSystem.existsSync(path) && !window.remixFileSystem.statSync(path).isDirectory()) { window.remixFileSystem.unlinkSync(path, console.log) - this.event.trigger('fileRemoved', [this._normalizePath(path)]) + this.event.emit('fileRemoved', this._normalizePath(path)) return true } else return false } @@ -259,11 +259,11 @@ class FileProvider { var unprefixednewPath = this.removePrefix(newPath) if (this._exists(unprefixedoldPath)) { window.remixFileSystem.renameSync(unprefixedoldPath, unprefixednewPath) - this.event.trigger('fileRenamed', [ + this.event.emit('fileRenamed', this._normalizePath(unprefixedoldPath), this._normalizePath(unprefixednewPath), isFolder - ]) + ) return true } return false diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js index 60337c11e4..bc59bfe90b 100644 --- a/apps/remix-ide/src/app/files/remixDProvider.js +++ b/apps/remix-ide/src/app/files/remixDProvider.js @@ -17,32 +17,32 @@ module.exports = class RemixDProvider extends FileProvider { var remixdEvents = ['connecting', 'connected', 'errored', 'closed'] remixdEvents.forEach((value) => { this._appManager.on('remixd', value, (event) => { - this.event.trigger(value, [event]) + this.event.emit(value, event) }) }) this._appManager.on('remixd', 'folderAdded', (path) => { - this.event.trigger('folderAdded', [path]) + this.event.emit('folderAdded', path) }) this._appManager.on('remixd', 'fileAdded', (path) => { - this.event.trigger('fileAdded', [path]) + this.event.emit('fileAdded', path) }) this._appManager.on('remixd', 'fileChanged', (path) => { - this.event.trigger('fileChanged', [path]) + this.event.emit('fileChanged', path) }) this._appManager.on('remixd', 'fileRemoved', (path) => { - this.event.trigger('fileRemoved', [path]) + this.event.emit('fileRemoved', path) }) this._appManager.on('remixd', 'fileRenamed', (oldPath, newPath) => { - this.event.trigger('fileRemoved', [oldPath, newPath]) + this.event.emit('fileRemoved', oldPath, newPath) }) this._appManager.on('remixd', 'rootFolderChanged', () => { - this.event.trigger('rootFolderChanged', []) + this.event.emit('rootFolderChanged') }) } @@ -53,11 +53,11 @@ module.exports = class RemixDProvider extends FileProvider { close (cb) { this._isReady = false cb() - this.event.trigger('disconnected') + this.event.emit('disconnected') } preInit () { - this.event.trigger('loading') + this.event.emit('loading') } init (cb) { @@ -67,7 +67,7 @@ module.exports = class RemixDProvider extends FileProvider { this._isReady = true this._readOnlyMode = result this._registerEvent() - this.event.trigger('connected') + this.event.emit('connected') cb && cb() }).catch((error) => { cb && cb(error) @@ -164,13 +164,13 @@ module.exports = class RemixDProvider extends FileProvider { this.filesContent[newPath] = this.filesContent[oldPath] delete this.filesContent[oldPath] this.init(() => { - this.event.trigger('fileRenamed', [oldPath, newPath, isFolder]) + this.event.emit('fileRenamed', oldPath, newPath, isFolder) }) return result }).catch(error => { console.log(error) if (this.error[error.code]) error = this.error[error.code] - this.event.trigger('fileRenamedError', [this.error[error.code]]) + this.event.emit('fileRenamedError', this.error[error.code]) }) } diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index 156723b622..4b0ac2af2e 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -1,6 +1,6 @@ 'use strict' -const EventManager = require('../../lib/events') +const EventManager = require('events') const FileProvider = require('./fileProvider') const pathModule = require('path') @@ -82,7 +82,7 @@ class WorkspaceFileProvider extends FileProvider { createWorkspace (name) { if (!name) name = 'default_workspace' - this.event.trigger('createWorkspace', [name]) + this.event.emit('createWorkspace', name) } } diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 3feff714c1..1c7e063aa3 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -97,24 +97,24 @@ export const Workspace = (props: WorkspaceProps) => { props.fileManager.setMode('browser') } } - props.localhost.event.unregister('disconnected', localhostDisconnect) - props.localhost.event.register('disconnected', localhostDisconnect) + props.localhost.event.off('disconnected', localhostDisconnect) + props.localhost.event.on('disconnected', localhostDisconnect) useEffect(() => { - props.localhost.event.register('connected', () => { + props.localhost.event.on('connected', () => { remixdExplorer.show() setWorkspace(LOCALHOST) }) - props.localhost.event.register('disconnected', () => { + props.localhost.event.on('disconnected', () => { remixdExplorer.hide() }) - props.localhost.event.register('loading', () => { + props.localhost.event.on('loading', () => { remixdExplorer.loading() }) - props.workspace.event.register('createWorkspace', (name) => { + props.workspace.event.on('createWorkspace', (name) => { createNewWorkspace(name) }) From 1940d96c8808788a380894ee008cef432e318761 Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 15 Apr 2021 17:20:38 +0200 Subject: [PATCH 43/52] updated require --- apps/remix-ide/src/app/files/file-explorer.js | 2 +- apps/remix-ide/src/app/panels/file-panel.js | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/apps/remix-ide/src/app/files/file-explorer.js b/apps/remix-ide/src/app/files/file-explorer.js index 9f5f3e3f69..cc9986aebf 100644 --- a/apps/remix-ide/src/app/files/file-explorer.js +++ b/apps/remix-ide/src/app/files/file-explorer.js @@ -9,7 +9,7 @@ const helper = require('../../lib/helper') const yo = require('yo-yo') const Treeview = require('../ui/TreeView') const modalDialog = require('../ui/modaldialog') -const EventManager = require('../../lib/events') +const EventManager = require('events') const contextMenu = require('../ui/contextMenu') const css = require('./styles/file-explorer-styles') const globalRegistry = require('../../global/registry') diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 6bdef578d6..020c02a62d 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -6,14 +6,13 @@ import ReactDOM from 'react-dom' import { Workspace } from '@remix-ui/workspace' // eslint-disable-line import { bufferToHex, keccakFromString } from 'ethereumjs-util' import { checkSpecialChars, checkSlash } from '../../lib/helper' -var EventManager = require('../../lib/events') -var { RemixdHandle } = require('../files/remixd-handle.js') -var { GitHandle } = require('../files/git-handle.js') -var { HardhatHandle } = require('../files/hardhat-handle.js') -var globalRegistry = require('../../global/registry') -var examples = require('../editor/examples') -var GistHandler = require('../../lib/gist-handler') -var QueryParams = require('../../lib/query-params') +const { RemixdHandle } = require('../files/remixd-handle.js') +const { GitHandle } = require('../files/git-handle.js') +const { HardhatHandle } = require('../files/hardhat-handle.js') +const globalRegistry = require('../../global/registry') +const examples = require('../editor/examples') +const GistHandler = require('../../lib/gist-handler') +const QueryParams = require('../../lib/query-params') const modalDialogCustom = require('../ui/modal-dialog-custom') /* Overview of APIs: @@ -48,7 +47,7 @@ const profile = { module.exports = class Filepanel extends ViewPlugin { constructor (appManager) { super(profile) - this.event = new EventManager() + this.event = new EventEmitter() this._components = {} this._components.registry = globalRegistry this._deps = { From 2ff189f7acfb0d3a91c5f99b531c2b8181c82fec Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 19 Apr 2021 13:30:42 +0200 Subject: [PATCH 44/52] fixed event listening for file explorer --- apps/remix-ide/src/app/files/file-explorer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/files/file-explorer.js b/apps/remix-ide/src/app/files/file-explorer.js index cc9986aebf..cef877b68b 100644 --- a/apps/remix-ide/src/app/files/file-explorer.js +++ b/apps/remix-ide/src/app/files/file-explorer.js @@ -94,11 +94,11 @@ function fileExplorer (localRegistry, files, menuItems, plugin) { }) // register to event of the file provider - files.event.register('fileRemoved', fileRemoved) - files.event.register('fileRenamed', fileRenamed) - files.event.register('fileRenamedError', fileRenamedError) - files.event.register('fileAdded', fileAdded) - files.event.register('folderAdded', folderAdded) + files.event.on('fileRemoved', fileRemoved) + files.event.on('fileRenamed', fileRenamed) + files.event.on('fileRenamedError', fileRenamedError) + files.event.on('fileAdded', fileAdded) + files.event.on('folderAdded', folderAdded) function fileRenamedError (error) { modalDialogCustom.alert(error) From 6757d21ab7d0ecd471a7b4f3bd03613454f58a10 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 May 2021 10:52:55 +0200 Subject: [PATCH 45/52] fix some event definitions --- apps/remix-ide/src/app/panels/file-panel.js | 1 - apps/remix-ide/src/app/tabs/test-tab.js | 2 +- .../file-explorer/src/lib/actions/fileSystem.ts | 16 ++++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 020c02a62d..ac7ae97089 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -47,7 +47,6 @@ const profile = { module.exports = class Filepanel extends ViewPlugin { constructor (appManager) { super(profile) - this.event = new EventEmitter() this._components = {} this._components.registry = globalRegistry this._deps = { diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index eb6edd4efb..652be0b9c9 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -52,7 +52,7 @@ module.exports = class TestTab extends ViewPlugin { } listenToEvents () { - this.filePanel.event.register('newTestFileCreated', file => { + this.on('filePanel', 'newTestFileCreated', file => { var testList = this._view.el.querySelector("[class^='testList']") var test = this.createSingleTest(file) testList.appendChild(test) diff --git a/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts b/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts index 8e3bc9f1c4..8a397cfd91 100644 --- a/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts +++ b/libs/remix-ui/file-explorer/src/lib/actions/fileSystem.ts @@ -181,35 +181,35 @@ export const fileRenamedSuccess = (path: string, removePath: string, files) => { export const init = (provider, workspaceName: string, plugin, registry) => (dispatch: React.Dispatch) => { if (provider) { - provider.event.register('fileAdded', async (filePath) => { + provider.event.on('fileAdded', async (filePath) => { if (extractParentFromKey(filePath) === '/.workspaces') return const path = extractParentFromKey(filePath) || provider.workspace || provider.type || '' const data = await fetchDirectoryContent(provider, path) dispatch(fileAddedSuccess(path, data)) if (filePath.includes('_test.sol')) { - plugin.event.trigger('newTestFileCreated', [filePath]) + plugin.emit('newTestFileCreated', filePath) } }) - provider.event.register('folderAdded', async (folderPath) => { + provider.event.on('folderAdded', async (folderPath) => { if (extractParentFromKey(folderPath) === '/.workspaces') return const path = extractParentFromKey(folderPath) || provider.workspace || provider.type || '' const data = await fetchDirectoryContent(provider, path) dispatch(folderAddedSuccess(path, data)) }) - provider.event.register('fileRemoved', async (removePath) => { + provider.event.on('fileRemoved', async (removePath) => { const path = extractParentFromKey(removePath) || provider.workspace || provider.type || '' dispatch(fileRemovedSuccess(path, removePath)) }) - provider.event.register('fileRenamed', async (oldPath) => { + provider.event.on('fileRenamed', async (oldPath) => { const path = extractParentFromKey(oldPath) || provider.workspace || provider.type || '' const data = await fetchDirectoryContent(provider, path) dispatch(fileRenamedSuccess(path, oldPath, data)) }) - provider.event.register('fileExternallyChanged', async (path: string, file: { content: string }) => { + provider.event.on('fileExternallyChanged', async (path: string, file: { content: string }) => { const config = registry.get('config').api const editor = registry.get('editor').api @@ -225,10 +225,10 @@ export const init = (provider, workspaceName: string, plugin, registry) => (disp )) } }) - provider.event.register('fileRenamedError', async () => { + provider.event.on('fileRenamedError', async () => { dispatch(displayNotification('File Renamed Failed', '', 'Ok', 'Cancel')) }) - provider.event.register('rootFolderChanged', async () => { + provider.event.on('rootFolderChanged', async () => { workspaceName = provider.workspace || provider.type || '' fetchDirectory(provider, workspaceName)(dispatch) }) From 87596a023eebebebf4ef21eff9c1e3c65c30670f Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 May 2021 12:43:57 +0200 Subject: [PATCH 46/52] remove promise --- libs/remix-lib/src/execution/txRunnerWeb3.ts | 31 +++++++------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 4554c396e8..ddef31cb50 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -128,29 +128,20 @@ export class TxRunnerWeb3 { } async function tryTillReceiptAvailable (txhash, web3) { - return new Promise((resolve, reject) => { - web3.eth.getTransactionReceipt(txhash, async (err, receipt) => { - if (err || !receipt) { - // Try again with a bit of delay if error or if result still null - await pause() - return resolve(await tryTillReceiptAvailable(txhash, web3)) - } - return resolve(receipt) - }) - }) + try { + const receipt = await web3.eth.getTransactionReceipt(txhash) + if (receipt) return receipt + } catch (e) {} + await pause() + return await tryTillReceiptAvailable(txhash, web3) } async function tryTillTxAvailable (txhash, web3) { - return new Promise((resolve, reject) => { - web3.eth.getTransaction(txhash, async (err, tx) => { - if (err || !tx) { - // Try again with a bit of delay if error or if result still null - await pause() - return resolve(await tryTillTxAvailable(txhash, web3)) - } - return resolve(tx) - }) - }) + try { + const tx = await web3.eth.getTransaction(txhash) + if (tx) return tx + } catch (e) {} + return await tryTillTxAvailable(txhash, web3) } async function pause () { return new Promise((resolve, reject) => { setTimeout(resolve, 500) }) } From 91b100e79bd00dd81dcd34ddfabf793f8f6dd791 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 May 2021 12:44:10 +0200 Subject: [PATCH 47/52] fix directory name --- libs/remix-tests/tsconfig.lib.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-tests/tsconfig.lib.json b/libs/remix-tests/tsconfig.lib.json index aec3a4c785..7b4b23c716 100644 --- a/libs/remix-tests/tsconfig.lib.json +++ b/libs/remix-tests/tsconfig.lib.json @@ -9,7 +9,7 @@ }, "exclude": [ "**/*.spec.ts", - "test/" + "tests/" ], "include": ["**/*.ts"] } From a4d34dcfd9ef5e99c982d4cb8243fd1d110ca8ae Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 May 2021 12:44:20 +0200 Subject: [PATCH 48/52] remove log --- libs/remix-tests/tests/testRunner.cli.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 21ce34afdb..91174355af 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -17,7 +17,6 @@ describe('testRunner: remix-tests CLI', () => { describe('test various CLI options', () => { test('remix-tests version', () => { const res = spawnSync(executablePath, ['-V']) - console.log(res.stdout.toString()) expect(res.stdout.toString().trim()).toBe(require('../package.json').version) }) From 3066e509806b31d6ac79b76fa30814db923f3f08 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 May 2021 12:46:18 +0200 Subject: [PATCH 49/52] remove uneeded CI config --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 49aada7eb0..ab5e15436f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,7 +51,6 @@ jobs: - checkout - run: npm install - run: npm run build:libs - - run: export NODE_OPTIONS="--max_old_space_size=8192" - run: npm run test:libs remix-ide-chrome-1: From 57be7101a5e7a8742a47aff602db67b9f3e1de22 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 19 May 2021 13:53:43 +0200 Subject: [PATCH 50/52] linting --- libs/remix-lib/src/execution/txRunnerWeb3.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index ddef31cb50..650593dfbc 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -141,7 +141,7 @@ async function tryTillTxAvailable (txhash, web3) { const tx = await web3.eth.getTransaction(txhash) if (tx) return tx } catch (e) {} - return await tryTillTxAvailable(txhash, web3) + return await tryTillTxAvailable(txhash, web3) } async function pause () { return new Promise((resolve, reject) => { setTimeout(resolve, 500) }) } From 9fe23b2adebca2ac3800a3b4f6315e3ed802e486 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 12 May 2021 18:25:06 +0200 Subject: [PATCH 51/52] reset results for compiler tab for change workspace --- apps/remix-ide/src/app/tabs/compile-tab.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 400ef25d76..6475bd0bae 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -80,6 +80,15 @@ class CompileTab extends ViewPlugin { ) } + resetResults () { + if (this._view.errorContainer) { + this._view.errorContainer.innerHTML = '' + } + this.compilerContainer.currentFile = '' + this.data.contractsDetails = {} + yo.update(this._view.contractSelection, this.contractSelection()) + } + /************ * EVENTS */ @@ -115,6 +124,9 @@ class CompileTab extends ViewPlugin { } this.emit('statusChanged', { key: 'loading', title: 'compiling...', type: 'info' }) } + + this.on('filePanel', 'setWorkspace', () => this.resetResults()) + this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation) this.data.eventHandlers.onCurrentFileChanged = (name) => { From 7f897c2665b82e660cc1e6004e35ccf1d41a2700 Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 17 May 2021 09:37:19 +0200 Subject: [PATCH 52/52] removed the status badge on workspace change --- apps/remix-ide/src/app/tabs/compile-tab.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 6475bd0bae..8bb5b48575 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -87,6 +87,7 @@ class CompileTab extends ViewPlugin { this.compilerContainer.currentFile = '' this.data.contractsDetails = {} yo.update(this._view.contractSelection, this.contractSelection()) + this.emit('statusChanged', { key: 'none' }) } /************