diff --git a/README.md b/README.md index 00ebb8c51dc..a1c4a4e1b6d 100644 --- a/README.md +++ b/README.md @@ -279,7 +279,6 @@ parameters: default: true ``` - ## Important Links - Official website: https://remix-project.org diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index f3f3de32734..c2a79e94909 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -34,7 +34,7 @@ module.exports = { .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) }, @@ -87,7 +87,7 @@ module.exports = { .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .testFunction('last', { - status: 'false Transaction mined but execution failed', + status: '0x0 Transaction mined but execution failed', 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) }, diff --git a/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts b/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts index 85c7aa75e98..09398a89687 100644 --- a/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot_0_4_14.test.ts @@ -43,7 +43,7 @@ module.exports = { .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) }, @@ -83,7 +83,7 @@ module.exports = { .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) }, diff --git a/apps/remix-ide-e2e/src/tests/erc721.test.ts b/apps/remix-ide-e2e/src/tests/erc721.test.ts index d88e3dae9b5..373477f064a 100644 --- a/apps/remix-ide-e2e/src/tests/erc721.test.ts +++ b/apps/remix-ide-e2e/src/tests/erc721.test.ts @@ -61,7 +61,7 @@ module.exports = { .createContract('') .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded input': {} }).end() } diff --git a/apps/remix-ide-e2e/src/tests/plugin_api.ts b/apps/remix-ide-e2e/src/tests/plugin_api.ts index 79cc466c76b..c0bbb316e95 100644 --- a/apps/remix-ide-e2e/src/tests/plugin_api.ts +++ b/apps/remix-ide-e2e/src/tests/plugin_api.ts @@ -31,12 +31,7 @@ const debugValues = async function (browser: NightwatchBrowser, field: string, e return } browser.waitForElementVisible(`//*[@id="${field}"]`).getText(`//*[@id="${field}"]`, (result) => { - console.log(result) if (!result.value.toString().includes(expected)) { - console.log('Actual result:') - console.log(result.value.toString()) - console.log('Expected result:') - console.log(expected) getBrowserLogs(browser) browser.assert.ok(false, 'Returned value from call does not match expected value.') } else { diff --git a/apps/remix-ide-e2e/src/tests/recorder.test.ts b/apps/remix-ide-e2e/src/tests/recorder.test.ts index 17363edbfcb..0d7b038b26d 100644 --- a/apps/remix-ide-e2e/src/tests/recorder.test.ts +++ b/apps/remix-ide-e2e/src/tests/recorder.test.ts @@ -96,7 +96,7 @@ module.exports = { .pause(1000) .clickFunction('set2 - transact (not payable)', { types: 'uint256 _po', values: '10' }) .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded input': { 'uint256 _po': '10' } }) }, diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index e8155e05e68..758e436001e 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -250,7 +250,7 @@ module.exports = { .createContract('') .testFunction('last', { - status: 'true Transaction mined and execution succeed' + status: '0x1 Transaction mined and execution succeed' }) diff --git a/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts b/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts index 1b382a4290a..1cc93342bc3 100644 --- a/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts +++ b/apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts @@ -61,7 +61,7 @@ module.exports = { .click('*[data-id="Deploy - transact (not payable)"]') .pause(5000) .testFunction('last', { - status: 'true Transaction mined and execution succeed' + status: '0x1 Transaction mined and execution succeed' }) }, @@ -95,7 +95,7 @@ module.exports = { .click('*[data-id="pluginManagerSettingsDeployAndRunLLTxSendTransaction"]') .pause(5000) .testFunction('last', { - status: 'true Transaction mined and execution succeed' + status: '0x1 Transaction mined and execution succeed' }) // When this is removed and tests are running by connecting to metamask // Consider adding tests to check return value of contract call diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 949cfbf9131..8585a4ec2fb 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -757,7 +757,7 @@ const scriptBlockAndTransaction = ` (async () => { try { web3.eth.getTransaction('0x022ccd55747677ac50f8d9dfd1bf5b843fa2f36438a28c1d0a0958e057bb3e2a').then(console.log) - web3.eth.getBlock('7367447').then(console.log); + web3.eth.getBlock(7367447).then(console.log); let ethersProvider = new ethers.providers.Web3Provider(web3Provider) ethersProvider.getBlock(7367447).then(console.log) } catch (e) { diff --git a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts index c5fc0d88150..78718b9b024 100644 --- a/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts +++ b/apps/remix-ide-e2e/src/tests/transactionExecution.test.ts @@ -20,13 +20,13 @@ module.exports = { .clickFunction('f - transact (not payable)') .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded output': { 0: 'uint256: 8' } }) .clickFunction('g - transact (not payable)') .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded output': { 0: 'uint256: 345', 1: 'string: comment_comment_', @@ -45,7 +45,7 @@ module.exports = { .clickFunction('retunValues1 - transact (not payable)') .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded output': { 0: 'bool: _b true', 1: 'uint256: _u 345', @@ -56,7 +56,7 @@ module.exports = { .clickFunction('retunValues2 - transact (not payable)') .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded output': { 0: 'bytes1: _b 0x12', 1: 'bytes2: _b2 0x1223', @@ -73,7 +73,7 @@ module.exports = { .clickFunction('retunValues3 - transact (not payable)') .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded output': { 0: 'uint8: _en 2', 1: 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7' @@ -89,7 +89,7 @@ module.exports = { .clickFunction('inputValue1 - transact (not payable)', { types: 'uint256 _u, int256 _i, string _str', values: '"2343242", "-4324324", "string _ string _ string _ string _ string _ string _ string _ string _ string _ string _"' }) .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded output': { 0: 'uint256: _uret 2343242', 1: 'int256: _iret -4324324', @@ -99,7 +99,7 @@ module.exports = { .pause(500) .clickFunction('inputValue2 - transact (not payable)', { types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234000000000000", "0x1234000000000000","0x1234000000000000","0x1234000000000000"]' }) .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded output': { 0: 'uint256[3]: _nret 1,2,3', 1: 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000' @@ -222,7 +222,7 @@ module.exports = { .clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '24' }) .testFunction('last', // we check if the contract is actually reachable. { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded input': { 'uint256 num': '24' } diff --git a/apps/remix-ide-e2e/src/tests/txListener.test.ts b/apps/remix-ide-e2e/src/tests/txListener.test.ts index 8a3b5d79992..2bc0b6e391a 100644 --- a/apps/remix-ide-e2e/src/tests/txListener.test.ts +++ b/apps/remix-ide-e2e/src/tests/txListener.test.ts @@ -31,7 +31,7 @@ module.exports = { .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .testFunction('last', { - status: 'true Transaction mined and execution succeed', + status: '0x1 Transaction mined and execution succeed', 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) .clickLaunchIcon('solidity') @@ -40,7 +40,7 @@ module.exports = { .clickFunction('delegate - transact (not payable)', { types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"' }) .testFunction('last', { - status: 'false Transaction mined but execution failed', + status: '0x0 Transaction mined but execution failed', 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } }) .end() diff --git a/apps/remix-ide/src/app/plugins/solidity-script.tsx b/apps/remix-ide/src/app/plugins/solidity-script.tsx index a19ca834dfd..4da5425a341 100644 --- a/apps/remix-ide/src/app/plugins/solidity-script.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-script.tsx @@ -2,7 +2,7 @@ import React from 'react' // eslint-disable-line import {format} from 'util' import {Plugin} from '@remixproject/engine' import {compile} from '@remix-project/remix-solidity' -import {TransactionConfig} from 'web3-core' +import {Transaction} from 'web3-types' const _paq = (window._paq = window._paq || []) //eslint-disable-line const profile = { @@ -69,7 +69,7 @@ export class SolidityScript extends Plugin { } // deploy the contract - let tx: TransactionConfig = { + let tx: Transaction = { from: accounts[0], data: bytecode } @@ -81,7 +81,7 @@ export class SolidityScript extends Plugin { } const receiptCall = await web3.eth.sendTransaction(tx) - const hhlogs = await web3.eth.getHHLogsForTx(receiptCall.transactionHash) + const hhlogs = await web3.remix.getHHLogsForTx(receiptCall.transactionHash) if (hhlogs && hhlogs.length) { const finalLogs = ( diff --git a/apps/remix-ide/src/app/providers/injected-provider.tsx b/apps/remix-ide/src/app/providers/injected-provider.tsx index c1ac29256eb..1e2482fd6ca 100644 --- a/apps/remix-ide/src/app/providers/injected-provider.tsx +++ b/apps/remix-ide/src/app/providers/injected-provider.tsx @@ -86,12 +86,8 @@ export abstract class InjectedProvider extends Plugin implements IProvider { } try { let resultData - if (web3Provider.send) resultData = await web3Provider.send(data.method, data.params) - else if (web3Provider.request) - resultData = await web3Provider.request({ - method: data.method, - params: data.params - }) + if (web3Provider.request) resultData = await web3Provider.request({method: data.method, params: data.params}) + else if (web3Provider.send) resultData = await web3Provider.send(data.method, data.params) else { resolve({jsonrpc: '2.0', error: 'provider not valid', id: data.id}) return diff --git a/apps/remix-ide/src/app/tabs/debugger-tab.js b/apps/remix-ide/src/app/tabs/debugger-tab.js index 03bd6721105..9c99051ef8d 100644 --- a/apps/remix-ide/src/app/tabs/debugger-tab.js +++ b/apps/remix-ide/src/app/tabs/debugger-tab.js @@ -86,9 +86,9 @@ export class DebuggerTab extends DebuggerApiMixin(ViewPlugin) { 'timestamp': block.timestamp, } if (block.baseFeePerGas) { - blockContext['basefee'] = Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` + blockContext['basefee'] = Web3.utils.toBigInt(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` } - const msg = { + const msg = { 'sender': tx.from, 'sig': tx.input.substring(0, 10), 'value': tx.value + ' Wei' @@ -97,7 +97,7 @@ export class DebuggerTab extends DebuggerApiMixin(ViewPlugin) { const txOrigin = { 'origin': tx.from } - + return { block: blockContext, msg, diff --git a/apps/remix-ide/src/app/tabs/network-module.js b/apps/remix-ide/src/app/tabs/network-module.js index ea7a1c0c6ef..10520e679dc 100644 --- a/apps/remix-ide/src/app/tabs/network-module.js +++ b/apps/remix-ide/src/app/tabs/network-module.js @@ -1,6 +1,7 @@ import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' import { Web3 } from 'web3' +import IpcProvider from 'web3-providers-ipc' export const profile = { name: 'network', @@ -49,7 +50,7 @@ export class NetworkModule extends Plugin { /** Add a custom network to the list of available networks */ addNetwork (network) { // { name, url } - const provider = network.url === 'ipc' ? new Web3.providers.IpcProvider() : new Web3.providers.HttpProvider(network.url) + const provider = network.url === 'ipc' ? new IpcProvider() : new Web3.providers.HttpProvider(network.url) this.blockchain.addProvider({ name: network.name, provider }) } diff --git a/apps/remix-ide/src/app/tabs/web3-provider.js b/apps/remix-ide/src/app/tabs/web3-provider.js index 0158ff11f94..1d4655667bf 100644 --- a/apps/remix-ide/src/app/tabs/web3-provider.js +++ b/apps/remix-ide/src/app/tabs/web3-provider.js @@ -1,5 +1,6 @@ import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' +import {isBigInt} from 'web3-validator' export const profile = { name: 'web3Provider', @@ -10,6 +11,11 @@ export const profile = { kind: 'provider' } +const replacer = (key, value) => { + if (isBigInt(value)) value = value.toString() + return value +} + export class Web3ProviderModule extends Plugin { constructor(blockchain) { super(profile) @@ -23,12 +29,11 @@ export class Web3ProviderModule extends Plugin { sendAsync(payload) { return new Promise((resolve, reject) => { - this.askUserPermission('sendAsync', `Calling ${payload.method} with parameters ${JSON.stringify(payload.params, null, '\t')}`).then( + this.askUserPermission('sendAsync', `Calling ${payload.method} with parameters ${JSON.stringify(payload.params, replacer, '\t')}`).then( async (result) => { if (result) { const provider = this.blockchain.web3().currentProvider - // see https://github.com/ethereum/web3.js/pull/1018/files#diff-d25786686c1053b786cc2626dc6e048675050593c0ebaafbf0814e1996f22022R129 - provider[provider.sendAsync ? 'sendAsync' : 'send'](payload, async (error, message) => { + const resultFn = async (error, message) => { if (error) { // Handle 'The method "debug_traceTransaction" does not exist / is not available.' error if(error.message && error.code && error.code === -32601) { @@ -55,7 +60,12 @@ export class Web3ProviderModule extends Plugin { } } resolve(message) - }) + } + try { + resultFn(null, await provider.sendAsync(payload)) + } catch (e) { + resultFn(e.message) + } } else { reject(new Error('User denied permission')) } diff --git a/apps/remix-ide/src/app/udapp/make-udapp.js b/apps/remix-ide/src/app/udapp/make-udapp.js index 0b8b13433a2..f2980e02635 100644 --- a/apps/remix-ide/src/app/udapp/make-udapp.js +++ b/apps/remix-ide/src/app/udapp/make-udapp.js @@ -10,13 +10,21 @@ export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) { if (_transactionReceipts[tx.hash]) { return cb(null, _transactionReceipts[tx.hash]) } - blockchain.web3().eth.getTransactionReceipt(tx.hash, (error, receipt) => { + let res = blockchain.web3().eth.getTransactionReceipt(tx.hash, (error, receipt) => { if (error) { return cb(error) } _transactionReceipts[tx.hash] = receipt cb(null, receipt) }) + if(res && typeof res.then ==='function'){ + res.then((receipt)=>{ + _transactionReceipts[tx.hash] = receipt + cb(null, receipt) + }).catch((error)=>{ + cb(error) + }) + } } const txlistener = blockchain.getTxListener({ diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js index cb6a47b835c..6352e9636f0 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.js +++ b/apps/remix-ide/src/app/udapp/run-tab.js @@ -133,13 +133,9 @@ export class RunTab extends ViewPlugin { } }, provider: { - async sendAsync(payload, callback) { - try { - const result = await udapp.call(name, 'sendAsync', payload) - callback(null, result) - } catch (e) { - callback(e) - } + + async sendAsync (payload) { + return udapp.call(name, 'sendAsync', payload) } } }) diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx index c698fd9c40c..3abd4ce1e21 100644 --- a/apps/remix-ide/src/blockchain/blockchain.tsx +++ b/apps/remix-ide/src/blockchain/blockchain.tsx @@ -1,5 +1,5 @@ import React from 'react' // eslint-disable-line -import Web3 from 'web3' +import {fromWei, toBigInt, toWei} from 'web3-utils' import {Plugin} from '@remixproject/engine' import {toBuffer, addHexPrefix} from '@ethereumjs/util' import {EventEmitter} from 'events' @@ -244,7 +244,7 @@ export class Blockchain extends Plugin { const proxyModal = { id: 'confirmProxyDeployment', title: 'Confirm Deploy Proxy (ERC1967)', - message: `Confirm you want to deploy an ERC1967 proxy contract that is connected to your implementation. + message: `Confirm you want to deploy an ERC1967 proxy contract that is connected to your implementation. For more info on ERC1967, see: https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Proxy`, modalType: 'modal', okLabel: 'OK', @@ -477,17 +477,17 @@ export class Blockchain extends Plugin { fromWei(value, doTypeConversion, unit) { if (doTypeConversion) { - return Web3.utils.fromWei(typeConversion.toInt(value), unit || 'ether') + return fromWei(typeConversion.toInt(value), unit || 'ether') } - return Web3.utils.fromWei(value.toString(10), unit || 'ether') + return fromWei(value.toString(10), unit || 'ether') } toWei(value, unit) { - return Web3.utils.toWei(value, unit || 'gwei') + return toWei(value, unit || 'gwei') } calculateFee(gas, gasPrice, unit?) { - return Web3.utils.toBN(gas).mul(Web3.utils.toBN(Web3.utils.toWei(gasPrice.toString(10) as string, unit || 'gwei'))) + return toBigInt(gas) * toBigInt(toWei(gasPrice.toString(10) as string, unit || 'gwei')) } determineGasFees(tx) { @@ -552,7 +552,6 @@ export class Blockchain extends Plugin { } web3() { - // @todo(https://github.com/ethereum/remix-project/issues/431) const isVM = this.executionContext.isVM() if (isVM) { return (this.providers.vm as VMProvider).web3 @@ -749,7 +748,7 @@ export class Blockchain extends Plugin { if (error) return reject(error) try { if (this.executionContext.isVM()) { - const execResult = await this.web3().eth.getExecutionResultFromSimulator(result.transactionHash) + const execResult = await this.web3().remix.getExecutionResultFromSimulator(result.transactionHash) resolve(resultToRemixTx(result, execResult)) } else resolve(resultToRemixTx(result)) } catch (e) { @@ -870,7 +869,7 @@ export class Blockchain extends Plugin { const isVM = this.executionContext.isVM() if (isVM && tx.useCall) { try { - result.transactionHash = await this.web3().eth.getHashFromTagBySimulator(timestamp) + result.transactionHash = await this.web3().remix.getHashFromTagBySimulator(timestamp) } catch (e) { console.log('unable to retrieve back the "call" hash', e) } @@ -911,7 +910,7 @@ export class Blockchain extends Plugin { let execResult let returnValue = null if (isVM) { - const hhlogs = await this.web3().eth.getHHLogsForTx(txResult.transactionHash) + const hhlogs = await this.web3().remix.getHHLogsForTx(txResult.transactionHash) if (hhlogs && hhlogs.length) { const finalLogs = ( @@ -937,7 +936,8 @@ export class Blockchain extends Plugin { _paq.push(['trackEvent', 'udapp', 'hardhat', 'console.log']) this.call('terminal', 'logHtml', finalLogs) } - execResult = await this.web3().eth.getExecutionResultFromSimulator(txResult.transactionHash) + execResult = await this.web3().remix.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 diff --git a/apps/remix-ide/src/blockchain/execution-context.js b/apps/remix-ide/src/blockchain/execution-context.js index d730a130e3a..85c68a21602 100644 --- a/apps/remix-ide/src/blockchain/execution-context.js +++ b/apps/remix-ide/src/blockchain/execution-context.js @@ -36,7 +36,7 @@ export class ExecutionContext { init (config) { this.executionContext = 'vm-shanghai' this.event.trigger('contextChanged', [this.executionContext]) - } + } getProvider () { return this.executionContext @@ -74,7 +74,7 @@ export class ExecutionContext { if (!web3.currentProvider) { return callback('No provider set') } - web3.eth.net.getId((err, id) => { + const cb = (err, id) => { let name = null if (err) name = 'Unknown' // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md @@ -95,7 +95,11 @@ export class ExecutionContext { } else { callback(err, { id, name, lastBlock: this.lastBlock, currentFork: this.currentFork }) } - }) + } + const res = web3.eth.net.getId(cb) + if(res && typeof res.then ==='function'){ + res.then(id=>cb(null,id)).catch(err=>cb(err)) + } } } @@ -117,7 +121,7 @@ export class ExecutionContext { internalWeb3 () { return web3 } - + setContext (context, endPointUrl, confirmCb, infoCb) { this.executionContext = context this.executionContextChange(context, endPointUrl, confirmCb, infoCb, null) @@ -128,9 +132,9 @@ export class ExecutionContext { const context = value.context if (!cb) cb = () => { /* Do nothing. */ } if (!confirmCb) confirmCb = () => { /* Do nothing. */ } - if (!infoCb) infoCb = () => { /* Do nothing. */ } + if (!infoCb) infoCb = () => { /* Do nothing. */ } if (this.customNetWorks[context]) { - var network = this.customNetWorks[context] + var network = this.customNetWorks[context] await network.init() this.currentFork = network.fork this.executionContext = context @@ -156,7 +160,7 @@ export class ExecutionContext { try { const block = await web3.eth.getBlock('latest') // we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506 - this.blockGasLimit = (block && block.gasLimit) ? Math.floor(block.gasLimit - (5 * block.gasLimit) / 1024) : this.blockGasLimitDefault + this.blockGasLimit = (block && block.gasLimit) ? Math.floor(web3.utils.toNumber(block.gasLimit) - (5 * web3.utils.toNumber(block.gasLimit) / 1024)) : web3.utils.toNumber(this.blockGasLimitDefault) this.lastBlock = block try { this.currentFork = execution.forkAt(await web3.eth.net.getId(), block.number) diff --git a/apps/remix-ide/src/blockchain/providers/injected.ts b/apps/remix-ide/src/blockchain/providers/injected.ts index bc6ab49e7f1..ce6ae9912bf 100644 --- a/apps/remix-ide/src/blockchain/providers/injected.ts +++ b/apps/remix-ide/src/blockchain/providers/injected.ts @@ -1,5 +1,5 @@ import Web3 from 'web3' -import { hashPersonalMessage } from '@ethereumjs/util' +import { hashPersonalMessage, isHexString } from '@ethereumjs/util' import { ExecutionContext } from '../execution-context' export class InjectedProvider { @@ -20,7 +20,7 @@ export class InjectedProvider { } async resetEnvironment () { - /* Do nothing. */ + /* Do nothing. */ } async getBalanceInEther (address) { @@ -35,6 +35,7 @@ export class InjectedProvider { signMessage (message, account, _passphrase, cb) { const messageHash = hashPersonalMessage(Buffer.from(message)) try { + message = isHexString(message) ? message : Web3.utils.utf8ToHex(message) this.executionContext.web3().eth.personal.sign(message, account, (error, signedData) => { cb(error, '0x' + messageHash.toString('hex'), signedData) }) diff --git a/apps/remix-ide/src/blockchain/providers/node.ts b/apps/remix-ide/src/blockchain/providers/node.ts index 65116b4923e..1dcf1b6c401 100644 --- a/apps/remix-ide/src/blockchain/providers/node.ts +++ b/apps/remix-ide/src/blockchain/providers/node.ts @@ -1,5 +1,5 @@ import Web3 from 'web3' -import { hashPersonalMessage } from '@ethereumjs/util' +import { hashPersonalMessage, isHexString } from '@ethereumjs/util' import { Personal } from 'web3-eth-personal' import { ExecutionContext } from '../execution-context' import Config from '../../config' @@ -15,9 +15,9 @@ export class NodeProvider { getAccounts (cb) { if (this.config.get('settings/personal-mode')) { - return this.executionContext.web3().eth.personal.getAccounts(cb) + return this.executionContext.web3().eth.personal.getAccounts().then(res => cb(null, res)).catch(err => cb(err)) } - return this.executionContext.web3().eth.getAccounts(cb) + return this.executionContext.web3().eth.getAccounts().then(res => cb(null, res)).catch(err => cb(err)) } newAccount (passwordPromptCb, cb) { @@ -25,7 +25,7 @@ export class NodeProvider { return cb('Not running in personal mode') } passwordPromptCb((passphrase) => { - this.executionContext.web3().eth.personal.newAccount(passphrase, cb) + this.executionContext.web3().eth.personal.newAccount(passphrase).then(res => cb(null, res)).catch(err => cb(err)) }) } @@ -39,16 +39,17 @@ export class NodeProvider { } getGasPrice (cb) { - this.executionContext.web3().eth.getGasPrice(cb) + this.executionContext.web3().eth.getGasPrice().then(res => cb(null, res)).catch(err => cb(err)) } signMessage (message, account, passphrase, cb) { const messageHash = hashPersonalMessage(Buffer.from(message)) try { const personal = new Personal(this.executionContext.web3().currentProvider) - personal.sign(message, account, passphrase, (error, signedData) => { - cb(error, '0x' + messageHash.toString('hex'), signedData) - }) + message = isHexString(message) ? message : Web3.utils.utf8ToHex(message) + personal.sign(message, account, passphrase) + .then(signedData => cb(undefined, '0x' + messageHash.toString('hex'), signedData)) + .catch(error => cb(error, '0x' + messageHash.toString('hex'), undefined)) } catch (e) { cb(e.message) } diff --git a/apps/remix-ide/src/blockchain/providers/vm.ts b/apps/remix-ide/src/blockchain/providers/vm.ts index 4234e42616a..da6731d6969 100644 --- a/apps/remix-ide/src/blockchain/providers/vm.ts +++ b/apps/remix-ide/src/blockchain/providers/vm.ts @@ -1,6 +1,6 @@ -import Web3 from 'web3' -import { privateToAddress, hashPersonalMessage } from '@ethereumjs/util' -import BN from 'bn.js' +import Web3, { FMT_BYTES, FMT_NUMBER, LegacySendAsyncProvider } from 'web3' +import { fromWei, toBigInt } from 'web3-utils' +import { privateToAddress, hashPersonalMessage, isHexString } from '@ethereumjs/util' import { extend, JSONRPCRequestPayload, JSONRPCResponseCallback } from '@remix-project/remix-simulator' import { ExecutionContext } from '../execution-context' @@ -14,6 +14,7 @@ export class VMProvider { newAccountCallback: {[stamp: number]: (error: Error, address: string) => void} constructor (executionContext: ExecutionContext) { + this.executionContext = executionContext this.worker = null this.provider = null @@ -21,12 +22,11 @@ export class VMProvider { } getAccounts (cb) { - this.web3.eth.getAccounts((err, accounts) => { - if (err) { - return cb('No accounts?') - } - return cb(null, accounts) - }) + this.web3.eth.getAccounts() + .then(accounts => cb(null, accounts)) + .catch(err => { + cb('No accounts?') + }) } async resetEnvironment () { @@ -36,22 +36,32 @@ export class VMProvider { let incr = 0 const stamps = {} - - return new Promise((resolve, reject) => { + + return new Promise((resolve, reject) => { this.worker.addEventListener('message', (msg) => { if (msg.data.cmd === 'sendAsyncResult' && stamps[msg.data.stamp]) { - stamps[msg.data.stamp](msg.data.error, msg.data.result) + if (stamps[msg.data.stamp].callback) { + stamps[msg.data.stamp].callback(msg.data.error, msg.data.result) + return + } + if (msg.data.error) { + stamps[msg.data.stamp].reject(msg.data.error) + } else { + stamps[msg.data.stamp].resolve(msg.data.result) + } } else if (msg.data.cmd === 'initiateResult') { if (!msg.data.error) { this.provider = { sendAsync: (query, callback) => { - const stamp = Date.now() + incr - incr++ - stamps[stamp] = callback - this.worker.postMessage({ cmd: 'sendAsync', query, stamp }) + return new Promise((resolve, reject) => { + const stamp = Date.now() + incr + incr++ + stamps[stamp] = { callback, resolve, reject } + this.worker.postMessage({ cmd: 'sendAsync', query, stamp }) + }) } } - this.web3 = new Web3(this.provider) + this.web3 = new Web3(this.provider as LegacySendAsyncProvider) extend(this.web3) this.executionContext.setWeb3(this.executionContext.getProvider(), this.web3) resolve({}) @@ -85,8 +95,8 @@ export class VMProvider { } async getBalanceInEther (address) { - const balance = await this.web3.eth.getBalance(address) - return Web3.utils.fromWei(new BN(balance).toString(10), 'ether') + const balance = await this.web3.eth.getBalance(address, undefined, { number: FMT_NUMBER.HEX, bytes: FMT_BYTES.HEX }) + return fromWei(toBigInt(balance).toString(10), 'ether') } getGasPrice (cb) { @@ -95,12 +105,10 @@ export class VMProvider { signMessage (message, account, _passphrase, cb) { const messageHash = hashPersonalMessage(Buffer.from(message)) - this.web3.eth.sign(message, account, (error, signedData) => { - if (error) { - return cb(error) - } - cb(null, '0x' + messageHash.toString('hex'), signedData) - }) + message = isHexString(message) ? message : Web3.utils.utf8ToHex(message) + this.web3.eth.sign(message, account) + .then(signedData => cb(null, '0x' + messageHash.toString('hex'), signedData)) + .catch(error => cb(error)) } getProvider () { diff --git a/libs/ghaction-helper/package.json b/libs/ghaction-helper/package.json index bf4fe18c4c5..317bde707ed 100644 --- a/libs/ghaction-helper/package.json +++ b/libs/ghaction-helper/package.json @@ -28,8 +28,9 @@ "@remix-project/remix-simulator": "^0.2.33", "chai": "^4.3.7", "ethers": "^5.7.2", - "web3": "^1.5.3" + "web3": "^4.1.1" }, "types": "./src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220" -} \ No newline at end of file +} + diff --git a/libs/remix-analyzer/package.json b/libs/remix-analyzer/package.json index 781a3a3bdca..c1934128e85 100644 --- a/libs/remix-analyzer/package.json +++ b/libs/remix-analyzer/package.json @@ -31,7 +31,7 @@ "ethers": "^5.4.2", "ethjs-util": "^0.1.6", "string-similarity": "^4.0.4", - "web3": "^1.5.1" + "web3": "^4.1.1" }, "publishConfig": { "access": "public" @@ -52,4 +52,4 @@ "typings": "src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220", "main": "./src/index.js" -} \ No newline at end of file +} diff --git a/libs/remix-astwalker/package.json b/libs/remix-astwalker/package.json index 636700b3608..b0ed444540e 100644 --- a/libs/remix-astwalker/package.json +++ b/libs/remix-astwalker/package.json @@ -47,7 +47,7 @@ "tape": "^4.10.1", "ts-node": "^8.0.3", "typescript": "^3.4.3", - "web3": "^1.5.1" + "web3": "^4.1.1" }, "devDependencies": { "tap-spec": "^5.0.0" @@ -55,4 +55,4 @@ "typings": "src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220", "types": "./src/index.d.ts" -} \ No newline at end of file +} diff --git a/libs/remix-debug/package.json b/libs/remix-debug/package.json index 32799caf494..4061d3349b6 100644 --- a/libs/remix-debug/package.json +++ b/libs/remix-debug/package.json @@ -41,7 +41,7 @@ "merge": "^2.1.1", "string-similarity": "^4.0.4", "time-stamp": "^2.2.0", - "web3": "^1.5.1" + "web3": "^4.1.1" }, "devDependencies": { "@babel/core": "^7.4.5", @@ -71,4 +71,4 @@ "typings": "src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220", "types": "./src/index.d.ts" -} \ No newline at end of file +} diff --git a/libs/remix-debug/src/code/codeManager.ts b/libs/remix-debug/src/code/codeManager.ts index 6d644a8eba2..5dd998a70e6 100644 --- a/libs/remix-debug/src/code/codeManager.ts +++ b/libs/remix-debug/src/code/codeManager.ts @@ -26,12 +26,9 @@ export class CodeManager { this.codeResolver = new CodeResolver({ getCode: async (address) => { return new Promise((resolve, reject) => { - this.traceManager.web3.eth.getCode(address, (error, code) => { - if (error) { - return reject(error) - } - return resolve(code) - }) + this.traceManager.web3.eth.getCode(address) + .then(code => resolve(code)) + .catch(error => reject(error)) }) }, fork: this.traceManager.getCurrentFork() diff --git a/libs/remix-debug/src/init.ts b/libs/remix-debug/src/init.ts index fab25c50391..2cd616226de 100644 --- a/libs/remix-debug/src/init.ts +++ b/libs/remix-debug/src/init.ts @@ -1,18 +1,20 @@ 'use strict' -import Web3 from 'web3' +import Web3, { Web3PluginBase } from 'web3' + +export function extendWeb3 (web3) { + if(!web3.debug){ + web3.registerPlugin(new Web3DebugPlugin()) + } +} export function loadWeb3 (url) { if (!url) url = 'http://localhost:8545' const web3 = new Web3() web3.setProvider(new Web3.providers.HttpProvider(url)) - extend(web3) + extendWeb3(web3) return web3 } -export function extendWeb3 (web3) { - extend(web3) -} - export function setProvider (web3, url) { web3.setProvider(new web3.providers.HttpProvider(url)) } @@ -31,43 +33,33 @@ export function web3DebugNode (network) { return null } -export function extend (web3) { - if (!web3.extend) { - return - } - // DEBUG - const methods = [] - if (!(web3.debug && web3.debug.preimage)) { - methods.push(new web3.extend.Method({ - name: 'preimage', - call: 'debug_preimage', - inputFormatter: [null], - params: 1 - })) - } +class Web3DebugPlugin extends Web3PluginBase { + public pluginNamespace = 'debug' - if (!(web3.debug && web3.debug.traceTransaction)) { - methods.push(new web3.extend.Method({ - name: 'traceTransaction', - call: 'debug_traceTransaction', - inputFormatter: [null, null], - params: 2 - })) + public preimage(key, cb) { + this.requestManager.send({ + method: 'debug_preimage', + params: [key] + }) + .then(result => cb(null, result)) + .catch(error => cb(error)) } - if (!(web3.debug && web3.debug.storageRangeAt)) { - methods.push(new web3.extend.Method({ - name: 'storageRangeAt', - call: 'debug_storageRangeAt', - inputFormatter: [null, null, null, null, null], - params: 5 - })) + public traceTransaction(txHash, options, cb) { + this.requestManager.send({ + method: 'debug_traceTransaction', + params: [txHash, options] + }) + .then(result => cb(null, result)) + .catch(error => cb(error)) } - if (methods.length > 0) { - web3.extend({ - property: 'debug', - methods: methods, - properties: [] + + public storageRangeAt(txBlockHash, txIndex, address, start, maxSize, cb) { + this.requestManager.send({ + method: 'debug_storageRangeAt', + params: [txBlockHash, txIndex, address, start, maxSize] }) + .then(result => cb(null, result)) + .catch(error => cb(error)) } } diff --git a/libs/remix-debug/test/debugger.ts b/libs/remix-debug/test/debugger.ts index e573f3e1376..4c93d17f184 100644 --- a/libs/remix-debug/test/debugger.ts +++ b/libs/remix-debug/test/debugger.ts @@ -156,15 +156,13 @@ contract Ballot { output = JSON.parse(output) const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000' const web3 = await vmCall.getWeb3() - vmCall.sendTx(web3, {nonce: 0, privateKey: privateKey}, null, 0, output.contracts['test.sol']['Ballot'].evm.bytecode.object + param, (error, hash) => { + vmCall.sendTx(web3, {nonce: 0, privateKey: privateKey}, undefined, 0, output.contracts['test.sol']['Ballot'].evm.bytecode.object + param, (error, hash) => { console.log(error, hash) if (error) { throw error } else { - web3.eth.getTransaction(hash, (error, tx) => { - if (error) { - throw error - } else { + web3.eth.getTransaction(hash) + .then(tx => { const sources = { target: 'test.sol', sources: { 'test.sol': { content: ballot } } @@ -193,8 +191,8 @@ contract Ballot { }) debugManager.debug(tx) - } - }) + }) + .catch(error => { throw error }) } }) })() diff --git a/libs/remix-debug/test/decoder/localsTests/calldata.ts b/libs/remix-debug/test/decoder/localsTests/calldata.ts index c198840b7a0..213fd5d96bb 100644 --- a/libs/remix-debug/test/decoder/localsTests/calldata.ts +++ b/libs/remix-debug/test/decoder/localsTests/calldata.ts @@ -15,7 +15,7 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe let web3 try { web3 = await (vmCall as any).getWeb3() - const hash = await (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode) + const hash = await (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, undefined, 0, contractBytecode) const receipt = await web3.eth.getTransactionReceipt(hash) const to = receipt.contractAddress console.log('to', to) @@ -25,52 +25,51 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe return st.fail(e) } return new Promise((resolve) => { - web3.eth.getTransaction(txHash, function (error, tx) { - if (error) { - return st.fail(error) - } - const traceManager = new TraceManager({ web3 }) - const codeManager = new CodeManager(traceManager) - codeManager.clear() - const solidityProxy = new SolidityProxy({ - getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), - getCode: codeManager.getCode.bind(codeManager), - compilationResult: () => compilationResult - }) - const debuggerEvent = new EventManager() - const offsetToLineColumnConverter = { - offsetToLineColumn: (rawLocation) => { - return new Promise((resolve) => { - const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) - resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) - }) - } - } - const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) - callTree.event.register('callTreeBuildFailed', (error) => { - st.fail(error) - }) - callTree.event.register('callTreeNotReady', (reason) => { - st.fail(reason) - }) - callTree.event.register('callTreeReady', (scopes, scopeStarts) => { - helper.decodeLocals(st, 140, traceManager, callTree, function (locals) { - try { - const expected = {"p":{"value":"45","type":"uint256"},"foo":{"length":"1","value":[{"value":"3","type":"uint8"}],"type":"uint8[1]"},"boo":{"length":"1","value":[{"length":"2","value":[{"value":"R","type":"string"},{"value":"T","type":"string"}],"type":"string[2]"}],"type":"string[2][1]"}} - st.deepEqual(locals, expected) - } catch (e) { - st.fail(e.message) + web3.eth.getTransaction(txHash) + .then(tx => { + const traceManager = new TraceManager({ web3 }) + const codeManager = new CodeManager(traceManager) + codeManager.clear() + const solidityProxy = new SolidityProxy({ + getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), + getCode: codeManager.getCode.bind(codeManager), + compilationResult: () => compilationResult + }) + const debuggerEvent = new EventManager() + const offsetToLineColumnConverter = { + offsetToLineColumn: (rawLocation) => { + return new Promise((resolve) => { + const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) + resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) + }) } - resolve({}) + } + const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) + callTree.event.register('callTreeBuildFailed', (error) => { + st.fail(error) }) - }) - + callTree.event.register('callTreeNotReady', (reason) => { + st.fail(reason) + }) + callTree.event.register('callTreeReady', (scopes, scopeStarts) => { + helper.decodeLocals(st, 140, traceManager, callTree, function (locals) { + try { + const expected = {"p":{"value":"45","type":"uint256"},"foo":{"length":"1","value":[{"value":"3","type":"uint8"}],"type":"uint8[1]"},"boo":{"length":"1","value":[{"length":"2","value":[{"value":"R","type":"string"},{"value":"T","type":"string"}],"type":"string[2]"}],"type":"string[2][1]"}} + st.deepEqual(locals, expected) + } catch (e) { + st.fail(e.message) + } + resolve({}) + }) + }) + - traceManager.resolveTrace(tx).then(() => { - debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) - }).catch((error) => { - st.fail(error) + traceManager.resolveTrace(tx).then(() => { + debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) + }).catch((error) => { + st.fail(error) + }) }) - }) + .catch(error => st.fail(error)) }) } \ No newline at end of file diff --git a/libs/remix-debug/test/decoder/localsTests/int.ts b/libs/remix-debug/test/decoder/localsTests/int.ts index 4b74e5085ea..fa52b55714d 100644 --- a/libs/remix-debug/test/decoder/localsTests/int.ts +++ b/libs/remix-debug/test/decoder/localsTests/int.ts @@ -14,141 +14,140 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult, // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve) => { const web3 = await (vmCall as any).getWeb3(); - (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) { + (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, undefined, 0, contractBytecode, function (error, hash) { if (error) { return st.fail(error) } - web3.eth.getTransaction(hash, function (error, tx) { - if (error) { - return st.fail(error) - } - tx.to = contractCreationToken('0') - const traceManager = new TraceManager({ web3 }) - const codeManager = new CodeManager(traceManager) - codeManager.clear() - const solidityProxy = new SolidityProxy({ - getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), - getCode: codeManager.getCode.bind(codeManager), - compilationResult: () => compilationResult - }) - const debuggerEvent = new EventManager() - const offsetToLineColumnConverter = { - offsetToLineColumn: (rawLocation) => { - return new Promise((resolve) => { - const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) - resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) - }) + web3.eth.getTransaction(hash) + .then(tx => { + tx.to = contractCreationToken('0') + const traceManager = new TraceManager({ web3 }) + const codeManager = new CodeManager(traceManager) + codeManager.clear() + const solidityProxy = new SolidityProxy({ + getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), + getCode: codeManager.getCode.bind(codeManager), + compilationResult: () => compilationResult + }) + const debuggerEvent = new EventManager() + const offsetToLineColumnConverter = { + offsetToLineColumn: (rawLocation) => { + return new Promise((resolve) => { + const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) + resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) + }) + } } - } - const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) - callTree.event.register('callTreeBuildFailed', (error) => { - st.fail(error) - }) - callTree.event.register('callTreeNotReady', (reason) => { - st.fail(reason) - }) - callTree.event.register('callTreeReady', async (scopes, scopeStarts) => { - try { - - // test gas cost per line - st.equals((await callTree.getGasCostPerLine(0, 16)).gasCost, 11) - st.equals((await callTree.getGasCostPerLine(0, 32)).gasCost, 84) - - const functions1 = callTree.retrieveFunctionsStack(103) - const functions2 = callTree.retrieveFunctionsStack(116) - const functions3 = callTree.retrieveFunctionsStack(13) - - st.equals(functions1.length, 2) - st.equals(functions2.length, 3) - st.equals(functions3.length, 1) - - st.equal(functions1[0].gasCost, 54) - st.equal(functions1[1].gasCost, 436) - - st.equal(functions2[0].gasCost, 23) - st.equal(functions2[1].gasCost, 54) - st.equal(functions2[2].gasCost, 436) - - st.equals(Object.keys(functions1[0])[0], 'functionDefinition') - st.equals(Object.keys(functions1[0])[1], 'inputs') - st.equals(functions1[0].inputs[0], 'foo') - st.equals(Object.keys(functions2[0])[0], 'functionDefinition') - st.equals(Object.keys(functions2[0])[1], 'inputs') - st.equals(Object.keys(functions2[1])[0], 'functionDefinition') - st.equals(Object.keys(functions2[1])[1], 'inputs') - st.equals(functions2[0].inputs[0], 'asd') - st.equals(functions2[1].inputs[0], 'foo') + const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) + callTree.event.register('callTreeBuildFailed', (error) => { + st.fail(error) + }) + callTree.event.register('callTreeNotReady', (reason) => { + st.fail(reason) + }) + callTree.event.register('callTreeReady', async (scopes, scopeStarts) => { + try { - st.equals(functions1[0].functionDefinition.name, 'level11') - st.equals(functions2[0].functionDefinition.name, 'level12') - st.equals(functions2[1].functionDefinition.name, 'level11') - - st.equals(scopeStarts[0], '1') - st.equals(scopeStarts[10], '1.1') - st.equals(scopeStarts[102], '1.1.1') - st.equals(scopeStarts[115], '1.1.1.1') - st.equals(scopeStarts[136], '1.1.2') - st.equals(scopeStarts[153], '1.1.3') - st.equals(scopeStarts[166], '1.1.3.1') - st.equals(scopes['1.1'].locals['ui8'].type.typeName, 'uint8') - st.equals(scopes['1.1'].locals['ui16'].type.typeName, 'uint16') - st.equals(scopes['1.1'].locals['ui32'].type.typeName, 'uint32') - st.equals(scopes['1.1'].locals['ui64'].type.typeName, 'uint64') - st.equals(scopes['1.1'].locals['ui128'].type.typeName, 'uint128') - st.equals(scopes['1.1'].locals['ui256'].type.typeName, 'uint256') - st.equals(scopes['1.1'].locals['ui'].type.typeName, 'uint256') - st.equals(scopes['1.1'].locals['i8'].type.typeName, 'int8') - st.equals(scopes['1.1'].locals['i16'].type.typeName, 'int16') - st.equals(scopes['1.1'].locals['i32'].type.typeName, 'int32') - st.equals(scopes['1.1'].locals['i64'].type.typeName, 'int64') - st.equals(scopes['1.1'].locals['i128'].type.typeName, 'int128') - st.equals(scopes['1.1'].locals['i256'].type.typeName, 'int256') - st.equals(scopes['1.1'].locals['i'].type.typeName, 'int256') - st.equals(scopes['1.1'].locals['ishrink'].type.typeName, 'int32') - st.equals(scopes['1.1.1'].locals['ui8'].type.typeName, 'uint8') - st.equals(scopes['1.1.1.1'].locals['ui81'].type.typeName, 'uint8') - st.equals(scopes['1.1.2'].locals['ui81'].type.typeName, 'uint8') - st.equals(scopes['1.1.3'].locals['ui8'].type.typeName, 'uint8') - st.equals(scopes['1.1.3.1'].locals['ui81'].type.typeName, 'uint8') - } catch (e) { - st.fail(e.message) - } + // test gas cost per line + st.equals((await callTree.getGasCostPerLine(0, 16)).gasCost, 11) + st.equals((await callTree.getGasCostPerLine(0, 32)).gasCost, 84) + + const functions1 = callTree.retrieveFunctionsStack(103) + const functions2 = callTree.retrieveFunctionsStack(116) + const functions3 = callTree.retrieveFunctionsStack(13) - helper.decodeLocals(st, 95, traceManager, callTree, function (locals) { - st.equals(Object.keys(locals).length, 16) - st.equals(locals['ui8'].value, '130') - st.equals(locals['ui16'].value, '456') - st.equals(locals['ui32'].value, '4356') - st.equals(locals['ui64'].value, '3543543543') - st.equals(locals['ui128'].value, '234567') - st.equals(locals['ui256'].value, '115792089237316195423570985008687907853269984665640564039457584007880697216513') - st.equals(locals['ui'].value, '123545666') - st.equals(locals['i8'].value, '-45') - st.equals(locals['i16'].value, '-1234') - st.equals(locals['i32'].value, '3455') - st.equals(locals['i64'].value, '-35566') - st.equals(locals['i128'].value, '-444444') - st.equals(locals['i256'].value, '3434343') - st.equals(locals['i'].value, '-32432423423') - st.equals(locals['ishrink'].value, '2') - }) + st.equals(functions1.length, 2) + st.equals(functions2.length, 3) + st.equals(functions3.length, 1) - helper.decodeLocals(st, 106, traceManager, callTree, function (locals) { - try { - st.equals(locals['ui8'].value, '123') - st.equals(Object.keys(locals).length, 2) + st.equal(functions1[0].gasCost, 54) + st.equal(functions1[1].gasCost, 436) + + st.equal(functions2[0].gasCost, 23) + st.equal(functions2[1].gasCost, 54) + st.equal(functions2[2].gasCost, 436) + + st.equals(Object.keys(functions1[0])[0], 'functionDefinition') + st.equals(Object.keys(functions1[0])[1], 'inputs') + st.equals(functions1[0].inputs[0], 'foo') + st.equals(Object.keys(functions2[0])[0], 'functionDefinition') + st.equals(Object.keys(functions2[0])[1], 'inputs') + st.equals(Object.keys(functions2[1])[0], 'functionDefinition') + st.equals(Object.keys(functions2[1])[1], 'inputs') + st.equals(functions2[0].inputs[0], 'asd') + st.equals(functions2[1].inputs[0], 'foo') + + st.equals(functions1[0].functionDefinition.name, 'level11') + st.equals(functions2[0].functionDefinition.name, 'level12') + st.equals(functions2[1].functionDefinition.name, 'level11') + + st.equals(scopeStarts[0], '1') + st.equals(scopeStarts[10], '1.1') + st.equals(scopeStarts[102], '1.1.1') + st.equals(scopeStarts[115], '1.1.1.1') + st.equals(scopeStarts[136], '1.1.2') + st.equals(scopeStarts[153], '1.1.3') + st.equals(scopeStarts[166], '1.1.3.1') + st.equals(scopes['1.1'].locals['ui8'].type.typeName, 'uint8') + st.equals(scopes['1.1'].locals['ui16'].type.typeName, 'uint16') + st.equals(scopes['1.1'].locals['ui32'].type.typeName, 'uint32') + st.equals(scopes['1.1'].locals['ui64'].type.typeName, 'uint64') + st.equals(scopes['1.1'].locals['ui128'].type.typeName, 'uint128') + st.equals(scopes['1.1'].locals['ui256'].type.typeName, 'uint256') + st.equals(scopes['1.1'].locals['ui'].type.typeName, 'uint256') + st.equals(scopes['1.1'].locals['i8'].type.typeName, 'int8') + st.equals(scopes['1.1'].locals['i16'].type.typeName, 'int16') + st.equals(scopes['1.1'].locals['i32'].type.typeName, 'int32') + st.equals(scopes['1.1'].locals['i64'].type.typeName, 'int64') + st.equals(scopes['1.1'].locals['i128'].type.typeName, 'int128') + st.equals(scopes['1.1'].locals['i256'].type.typeName, 'int256') + st.equals(scopes['1.1'].locals['i'].type.typeName, 'int256') + st.equals(scopes['1.1'].locals['ishrink'].type.typeName, 'int32') + st.equals(scopes['1.1.1'].locals['ui8'].type.typeName, 'uint8') + st.equals(scopes['1.1.1.1'].locals['ui81'].type.typeName, 'uint8') + st.equals(scopes['1.1.2'].locals['ui81'].type.typeName, 'uint8') + st.equals(scopes['1.1.3'].locals['ui8'].type.typeName, 'uint8') + st.equals(scopes['1.1.3.1'].locals['ui81'].type.typeName, 'uint8') } catch (e) { st.fail(e.message) } - resolve({}) + + helper.decodeLocals(st, 95, traceManager, callTree, function (locals) { + st.equals(Object.keys(locals).length, 16) + st.equals(locals['ui8'].value, '130') + st.equals(locals['ui16'].value, '456') + st.equals(locals['ui32'].value, '4356') + st.equals(locals['ui64'].value, '3543543543') + st.equals(locals['ui128'].value, '234567') + st.equals(locals['ui256'].value, '115792089237316195423570985008687907853269984665640564039457584007880697216513') + st.equals(locals['ui'].value, '123545666') + st.equals(locals['i8'].value, '-45') + st.equals(locals['i16'].value, '-1234') + st.equals(locals['i32'].value, '3455') + st.equals(locals['i64'].value, '-35566') + st.equals(locals['i128'].value, '-444444') + st.equals(locals['i256'].value, '3434343') + st.equals(locals['i'].value, '-32432423423') + st.equals(locals['ishrink'].value, '2') + }) + + helper.decodeLocals(st, 106, traceManager, callTree, function (locals) { + try { + st.equals(locals['ui8'].value, '123') + st.equals(Object.keys(locals).length, 2) + } catch (e) { + st.fail(e.message) + } + resolve({}) + }) + }) + traceManager.resolveTrace(tx).then(() => { + debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) + }).catch((error) => { + st.fail(error) }) }) - traceManager.resolveTrace(tx).then(() => { - debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) - }).catch((error) => { - st.fail(error) - }) - }) + .catch(error => st.fail(error)) }) }) } diff --git a/libs/remix-debug/test/decoder/localsTests/misc.ts b/libs/remix-debug/test/decoder/localsTests/misc.ts index 6ea357fc420..c7f7c329bf0 100644 --- a/libs/remix-debug/test/decoder/localsTests/misc.ts +++ b/libs/remix-debug/test/decoder/localsTests/misc.ts @@ -13,77 +13,76 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult, // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve) => { const web3 = await (vmCall as any).getWeb3(); - (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) { + (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, undefined, 0, contractBytecode, function (error, hash) { if (error) { return st.fail(error) } - web3.eth.getTransaction(hash, function (error, tx) { - if (error) { - return st.fail(error) - } - tx.to = contractCreationToken('0') - const traceManager = new TraceManager({ web3 }) - const codeManager = new CodeManager(traceManager) - codeManager.clear() - const solidityProxy = new SolidityProxy({ - getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), - getCode: codeManager.getCode.bind(codeManager), - compilationResult: () => compilationResult - }) - const debuggerEvent = new EventManager() - const offsetToLineColumnConverter = { - offsetToLineColumn: (rawLocation) => { - return new Promise((resolve) => { - const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) - resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) - }) - } - } - const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) - callTree.event.register('callTreeBuildFailed', (error) => { - st.fail(error) - }) - callTree.event.register('callTreeReady', (scopes, scopeStarts) => { - helper.decodeLocals(st, 70, traceManager, callTree, function (locals) { - try { - st.equals(locals['boolFalse'].value, false) - st.equals(locals['boolTrue'].value, true) - st.equals(locals['testEnum'].value, 'three') - st.equals(locals['sender'].value, '0x5B38DA6A701C568545DCFCB03FCB875F56BEDDC4') - st.equals(locals['_bytes1'].value, '0x99') - st.equals(locals['__bytes1'].value, '0x99') - st.equals(locals['__bytes2'].value, '0x99AB') - st.equals(locals['__bytes4'].value, '0x99FA0000') - st.equals(locals['__bytes6'].value, '0x990000000000') - st.equals(locals['__bytes7'].value, '0x99356700000000') - st.equals(locals['__bytes8'].value, '0x99ABD41700000000') - st.equals(locals['__bytes9'].value, '0x99156744AF00000000') - st.equals(locals['__bytes13'].value, '0x99123423425300000000000000') - st.equals(locals['__bytes16'].value, '0x99AFAD23432400000000000000000000') - st.equals(locals['__bytes24'].value, '0x99AFAD234324000000000000000000000000000000000000') - st.equals(locals['__bytes32'].value, '0x9999ABD41799ABD4170000000000000000000000000000000000000000000000') - st.equals(Object.keys(locals).length, 16) - } catch (e) { - st.fail(e.message) - } + web3.eth.getTransaction(hash) + .then(tx => { + tx.to = contractCreationToken('0') + const traceManager = new TraceManager({ web3 }) + const codeManager = new CodeManager(traceManager) + codeManager.clear() + const solidityProxy = new SolidityProxy({ + getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), + getCode: codeManager.getCode.bind(codeManager), + compilationResult: () => compilationResult }) - - helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { - try { - // st.equals(Object.keys(locals).length, 0) - st.equals(0, 0) - } catch (e) { - st.fail(e.message) + const debuggerEvent = new EventManager() + const offsetToLineColumnConverter = { + offsetToLineColumn: (rawLocation) => { + return new Promise((resolve) => { + const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) + resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) + }) } - resolve({}) + } + const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) + callTree.event.register('callTreeBuildFailed', (error) => { + st.fail(error) + }) + callTree.event.register('callTreeReady', (scopes, scopeStarts) => { + helper.decodeLocals(st, 70, traceManager, callTree, function (locals) { + try { + st.equals(locals['boolFalse'].value, false) + st.equals(locals['boolTrue'].value, true) + st.equals(locals['testEnum'].value, 'three') + st.equals(locals['sender'].value, '0x5B38DA6A701C568545DCFCB03FCB875F56BEDDC4') + st.equals(locals['_bytes1'].value, '0x99') + st.equals(locals['__bytes1'].value, '0x99') + st.equals(locals['__bytes2'].value, '0x99AB') + st.equals(locals['__bytes4'].value, '0x99FA0000') + st.equals(locals['__bytes6'].value, '0x990000000000') + st.equals(locals['__bytes7'].value, '0x99356700000000') + st.equals(locals['__bytes8'].value, '0x99ABD41700000000') + st.equals(locals['__bytes9'].value, '0x99156744AF00000000') + st.equals(locals['__bytes13'].value, '0x99123423425300000000000000') + st.equals(locals['__bytes16'].value, '0x99AFAD23432400000000000000000000') + st.equals(locals['__bytes24'].value, '0x99AFAD234324000000000000000000000000000000000000') + st.equals(locals['__bytes32'].value, '0x9999ABD41799ABD4170000000000000000000000000000000000000000000000') + st.equals(Object.keys(locals).length, 16) + } catch (e) { + st.fail(e.message) + } + }) + + helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { + try { + // st.equals(Object.keys(locals).length, 0) + st.equals(0, 0) + } catch (e) { + st.fail(e.message) + } + resolve({}) + }) + }) + traceManager.resolveTrace(tx).then(() => { + debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) + }).catch((error) => { + st.fail(error) }) }) - traceManager.resolveTrace(tx).then(() => { - debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) - }).catch((error) => { - st.fail(error) - }) - }) + .catch(error => st.fail(error)) }) }) } diff --git a/libs/remix-debug/test/decoder/localsTests/misc2.ts b/libs/remix-debug/test/decoder/localsTests/misc2.ts index 4f4342c8b53..d92d2c59a95 100644 --- a/libs/remix-debug/test/decoder/localsTests/misc2.ts +++ b/libs/remix-debug/test/decoder/localsTests/misc2.ts @@ -13,63 +13,62 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult, // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve) => { const web3 = await (vmCall as any).getWeb3(); - (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) { + (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, undefined, 0, contractBytecode, function (error, hash) { if (error) { return st.fail(error) } - web3.eth.getTransaction(hash, function (error, tx) { - if (error) { - return st.fail(error) - } - tx.to = contractCreationToken('0') - const traceManager = new TraceManager({ web3 }) - const codeManager = new CodeManager(traceManager) - codeManager.clear() - const solidityProxy = new SolidityProxy({ - getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), - getCode: codeManager.getCode.bind(codeManager), - compilationResult: () => compilationResult - }) - const debuggerEvent = new EventManager() - const offsetToLineColumnConverter = { - offsetToLineColumn: (rawLocation) => { - return new Promise((resolve) => { - const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) - resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) - }) - } - } - const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) - callTree.event.register('callTreeBuildFailed', (error) => { - st.fail(error) - }) - callTree.event.register('callTreeReady', (scopes, scopeStarts) => { - helper.decodeLocals(st, 49, traceManager, callTree, function (locals) { - try { - st.equals(locals['dynbytes'].value, '0x64796e616d69636279746573') - st.equals(locals['smallstring'].value, 'test_test_test') - st.equals(Object.keys(locals).length, 2) - } catch (e) { - st.fail(e.message) - } + web3.eth.getTransaction(hash) + .then(tx => { + tx.to = contractCreationToken('0') + const traceManager = new TraceManager({ web3 }) + const codeManager = new CodeManager(traceManager) + codeManager.clear() + const solidityProxy = new SolidityProxy({ + getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), + getCode: codeManager.getCode.bind(codeManager), + compilationResult: () => compilationResult }) - - helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { - try { - // st.equals(Object.keys(locals).length, 0) - st.equals(0, 0) - } catch (e) { - st.fail(e.message) + const debuggerEvent = new EventManager() + const offsetToLineColumnConverter = { + offsetToLineColumn: (rawLocation) => { + return new Promise((resolve) => { + const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) + resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) + }) } - resolve({}) + } + const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) + callTree.event.register('callTreeBuildFailed', (error) => { + st.fail(error) + }) + callTree.event.register('callTreeReady', (scopes, scopeStarts) => { + helper.decodeLocals(st, 49, traceManager, callTree, function (locals) { + try { + st.equals(locals['dynbytes'].value, '0x64796e616d69636279746573') + st.equals(locals['smallstring'].value, 'test_test_test') + st.equals(Object.keys(locals).length, 2) + } catch (e) { + st.fail(e.message) + } + }) + + helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { + try { + // st.equals(Object.keys(locals).length, 0) + st.equals(0, 0) + } catch (e) { + st.fail(e.message) + } + resolve({}) + }) + }) + traceManager.resolveTrace(tx).then(() => { + debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) + }).catch((error) => { + st.fail(error) }) }) - traceManager.resolveTrace(tx).then(() => { - debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) - }).catch((error) => { - st.fail(error) - }) - }) + .catch(error => st.fail(error)) }) }) } diff --git a/libs/remix-debug/test/decoder/localsTests/structArray.ts b/libs/remix-debug/test/decoder/localsTests/structArray.ts index f060199cbe0..6324377a480 100644 --- a/libs/remix-debug/test/decoder/localsTests/structArray.ts +++ b/libs/remix-debug/test/decoder/localsTests/structArray.ts @@ -13,123 +13,122 @@ module.exports = function (st, privateKey, contractBytecode, compilationResult,c // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve) => { const web3 = await (vmCall as any).getWeb3(); - (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, hash) { + (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, undefined, 0, contractBytecode, function (error, hash) { if (error) { return st.fail(error) } - web3.eth.getTransaction(hash, function (error, tx) { - if (error) { - return st.fail(error) - } - tx.to = contractCreationToken('0') - const traceManager = new TraceManager({ web3 }) - const codeManager = new CodeManager(traceManager) - codeManager.clear() - const solidityProxy = new SolidityProxy({ - getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), - getCode: codeManager.getCode.bind(codeManager), - compilationResult: () => compilationResult - }) - const debuggerEvent = new EventManager() - const offsetToLineColumnConverter = { - offsetToLineColumn: (rawLocation) => { - return new Promise((resolve) => { - const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) - resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) - }) + web3.eth.getTransaction(hash) + .then(tx => { + tx.to = contractCreationToken('0') + const traceManager = new TraceManager({ web3 }) + const codeManager = new CodeManager(traceManager) + codeManager.clear() + const solidityProxy = new SolidityProxy({ + getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), + getCode: codeManager.getCode.bind(codeManager), + compilationResult: () => compilationResult + }) + const debuggerEvent = new EventManager() + const offsetToLineColumnConverter = { + offsetToLineColumn: (rawLocation) => { + return new Promise((resolve) => { + const lineBreaks = sourceMappingDecoder.getLinebreakPositions(contractCode) + resolve(sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, lineBreaks)) + }) + } } - } - const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) - callTree.event.register('callTreeBuildFailed', (error) => { - st.fail(error) - }) - callTree.event.register('callTreeReady', (scopes, scopeStarts) => { - helper.decodeLocals(st, 1622, traceManager, callTree, function (locals) { - try { - console.log('at 1622', locals) - st.equals(locals['bytesSimple'].length, '0x14') - st.equals(locals['bytesSimple'].value, '0x746573745f7375706572') - st.equals(locals['e'].value['a'].value, 'test') - st.equals(locals['e'].value['a'].length, '0x8') - st.equals(locals['e'].value['a'].raw, '0x74657374') - st.equals(locals['e'].value['b'].value, '5') - st.equals(locals['e'].value['c'].length, '0x220') - st.equals(locals['e'].value['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374') - st.equals(locals['e'].value['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test') - st.equals(locals['e'].value['d'].value, '3') - st.equals(locals['f'].length, '0x1b8') - st.equals(locals['f'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f') - st.equals(locals['f'].value, 'test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_') - st.equals(locals['e'].value['e'].value, true) - - st.equals(locals['simpleArray'].value[0].value, '45') - st.equals(locals['simpleArray'].value[1].value, '324324') - st.equals(locals['simpleArray'].value[2].value, '-333') - st.equals(locals['simpleArray'].value[3].value, '5656') - st.equals(locals['simpleArray'].value[4].value, '-1111') - - st.equals(locals['stringArray'].value[0].value, 'long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_') - st.equals(locals['stringArray'].value[1].value, 'two') - st.equals(locals['stringArray'].value[2].value, 'three') - - st.equals(locals['dynArray'].value[0].value[0].value, '3423423532') - st.equals(locals['dynArray'].value[1].value[0].value, '-342343323532') - st.equals(locals['dynArray'].value[1].value[1].value, '23432') - st.equals(locals['dynArray'].value[2].value[0].value, '-432432') - st.equals(locals['dynArray'].value[2].value[1].value, '3423423532') - st.equals(locals['dynArray'].value[2].value[2].value, '-432432') - - st.equals(locals['structArray'].value[0].value['a'].value, 'test') - st.equals(locals['structArray'].value[0].value['a'].length, '0x8') - st.equals(locals['structArray'].value[0].value['a'].raw, '0x74657374') - st.equals(locals['structArray'].value[0].value['b'].value, '5') - st.equals(locals['structArray'].value[0].value['c'].length, '0x220') - st.equals(locals['structArray'].value[0].value['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374') - st.equals(locals['structArray'].value[0].value['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test') - st.equals(locals['structArray'].value[0].value['d'].value, '3') - st.equals(locals['structArray'].value[0].value['e'].value, true) - - st.equals(locals['structArray'].value[1].value['a'].value, 'item1 a') - st.equals(locals['structArray'].value[1].value['b'].value, '20') - st.equals(locals['structArray'].value[1].value['c'].value, 'item1 c') - st.equals(locals['structArray'].value[1].value['d'].value, '-45') - st.equals(locals['structArray'].value[1].value['e'].value, false) - - st.equals(locals['structArray'].value[2].value['a'].value, 'item2 a') - st.equals(locals['structArray'].value[2].value['b'].value, '200') - st.equals(locals['structArray'].value[2].value['c'].value, 'item2 c') - st.equals(locals['structArray'].value[2].value['d'].value, '-450') - st.equals(locals['structArray'].value[2].value['e'].value, true) - - st.equals(locals['arrayStruct'].value.a.value[0].value, 'string') - st.equals(locals['arrayStruct'].value.b.value[0].value, '34') - st.equals(locals['arrayStruct'].value.b.value[1].value, '-23') - st.equals(locals['arrayStruct'].value.b.value[2].value, '-3') - st.equals(locals['arrayStruct'].value.c.value, 'three') + const callTree = new InternalCallTree(debuggerEvent, traceManager, solidityProxy, codeManager, { includeLocalVariables: true }, offsetToLineColumnConverter) + callTree.event.register('callTreeBuildFailed', (error) => { + st.fail(error) + }) + callTree.event.register('callTreeReady', (scopes, scopeStarts) => { + helper.decodeLocals(st, 1622, traceManager, callTree, function (locals) { + try { + console.log('at 1622', locals) + st.equals(locals['bytesSimple'].length, '0x14') + st.equals(locals['bytesSimple'].value, '0x746573745f7375706572') + st.equals(locals['e'].value['a'].value, 'test') + st.equals(locals['e'].value['a'].length, '0x8') + st.equals(locals['e'].value['a'].raw, '0x74657374') + st.equals(locals['e'].value['b'].value, '5') + st.equals(locals['e'].value['c'].length, '0x220') + st.equals(locals['e'].value['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374') + st.equals(locals['e'].value['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test') + st.equals(locals['e'].value['d'].value, '3') + st.equals(locals['f'].length, '0x1b8') + st.equals(locals['f'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f') + st.equals(locals['f'].value, 'test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_') + st.equals(locals['e'].value['e'].value, true) + + st.equals(locals['simpleArray'].value[0].value, '45') + st.equals(locals['simpleArray'].value[1].value, '324324') + st.equals(locals['simpleArray'].value[2].value, '-333') + st.equals(locals['simpleArray'].value[3].value, '5656') + st.equals(locals['simpleArray'].value[4].value, '-1111') + + st.equals(locals['stringArray'].value[0].value, 'long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_') + st.equals(locals['stringArray'].value[1].value, 'two') + st.equals(locals['stringArray'].value[2].value, 'three') + + st.equals(locals['dynArray'].value[0].value[0].value, '3423423532') + st.equals(locals['dynArray'].value[1].value[0].value, '-342343323532') + st.equals(locals['dynArray'].value[1].value[1].value, '23432') + st.equals(locals['dynArray'].value[2].value[0].value, '-432432') + st.equals(locals['dynArray'].value[2].value[1].value, '3423423532') + st.equals(locals['dynArray'].value[2].value[2].value, '-432432') + + st.equals(locals['structArray'].value[0].value['a'].value, 'test') + st.equals(locals['structArray'].value[0].value['a'].length, '0x8') + st.equals(locals['structArray'].value[0].value['a'].raw, '0x74657374') + st.equals(locals['structArray'].value[0].value['b'].value, '5') + st.equals(locals['structArray'].value[0].value['c'].length, '0x220') + st.equals(locals['structArray'].value[0].value['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374') + st.equals(locals['structArray'].value[0].value['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test') + st.equals(locals['structArray'].value[0].value['d'].value, '3') + st.equals(locals['structArray'].value[0].value['e'].value, true) + + st.equals(locals['structArray'].value[1].value['a'].value, 'item1 a') + st.equals(locals['structArray'].value[1].value['b'].value, '20') + st.equals(locals['structArray'].value[1].value['c'].value, 'item1 c') + st.equals(locals['structArray'].value[1].value['d'].value, '-45') + st.equals(locals['structArray'].value[1].value['e'].value, false) + + st.equals(locals['structArray'].value[2].value['a'].value, 'item2 a') + st.equals(locals['structArray'].value[2].value['b'].value, '200') + st.equals(locals['structArray'].value[2].value['c'].value, 'item2 c') + st.equals(locals['structArray'].value[2].value['d'].value, '-450') + st.equals(locals['structArray'].value[2].value['e'].value, true) + + st.equals(locals['arrayStruct'].value.a.value[0].value, 'string') + st.equals(locals['arrayStruct'].value.b.value[0].value, '34') + st.equals(locals['arrayStruct'].value.b.value[1].value, '-23') + st.equals(locals['arrayStruct'].value.b.value[2].value, '-3') + st.equals(locals['arrayStruct'].value.c.value, 'three') + + st.equals(Object.keys(locals).length, 8) + } catch (e) { + st.fail(e.message) + } + }) - st.equals(Object.keys(locals).length, 8) - } catch (e) { - st.fail(e.message) - } + helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { + try { + console.log('at 7', locals) + st.equals(0, 0) + // st.equals(Object.keys(locals).length, 0) + } catch (e) { + st.fail(e.message) + } + resolve({}) + }) }) - - helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { - try { - console.log('at 7', locals) - st.equals(0, 0) - // st.equals(Object.keys(locals).length, 0) - } catch (e) { - st.fail(e.message) - } - resolve({}) + traceManager.resolveTrace(tx).then(() => { + debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) + }).catch((error) => { + st.fail(error) }) }) - traceManager.resolveTrace(tx).then(() => { - debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) - }).catch((error) => { - st.fail(error) - }) - }) + .catch(error => st.fail(error)) }) }) } diff --git a/libs/remix-debug/test/decoder/stateTests/mapping.ts b/libs/remix-debug/test/decoder/stateTests/mapping.ts index 52b457e8ce1..09056d36937 100644 --- a/libs/remix-debug/test/decoder/stateTests/mapping.ts +++ b/libs/remix-debug/test/decoder/stateTests/mapping.ts @@ -23,23 +23,22 @@ module.exports = async function testMappingStorage (st, cb) { } const compilationResults = new CompilerAbstract('json', output, sources) const web3 = await (vmCall as any).getWeb3(); - (vmCall as any).sendTx(web3, {nonce: 0, privateKey: privateKey}, null, 0, output.contracts['test.sol']['SimpleMappingState'].evm.bytecode.object, function (error, hash) { + (vmCall as any).sendTx(web3, {nonce: 0, privateKey: privateKey}, undefined, 0, output.contracts['test.sol']['SimpleMappingState'].evm.bytecode.object, function (error, hash) { if (error) { console.log(error) st.end(error) } else { - web3.eth.getTransactionReceipt(hash, (error, tx) => { - if (error) { - console.log(error) - st.end(error) - } else { + web3.eth.getTransactionReceipt(hash) + .then(tx => // const storage = await this.vm.stateManager.dumpStorage(data.to) // (vmCall as any).web3().eth.getCode(tx.contractAddress).then((code) => console.log('code:', code)) // (vmCall as any).web3().debug.traceTransaction(hash).then((code) => console.log('trace:', code)) testMapping(st, privateKey, tx.contractAddress, output, compilationResults, web3, cb) // st.end() - } - }) + ) + .catch(error => { + st.end(error) + }) } }) } @@ -50,18 +49,15 @@ function testMapping (st, privateKey, contractAddress, output, compilationResult if (error) { console.log(error) st.end(error) - } else { - web3.eth.getTransaction(hash, (error, tx) => { - if (error) { - console.log(error) - st.end(error) - } else { + } else { + web3.eth.getTransaction(hash) + .then(tx => { const traceManager = new TraceManager({ web3 }) const codeManager = new CodeManager(traceManager) codeManager.clear() console.log(compilationResults) - const solidityProxy = new SolidityProxy({ - getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), + const solidityProxy = new SolidityProxy({ + getCurrentCalledAddressAt: traceManager.getCurrentCalledAddressAt.bind(traceManager), getCode: codeManager.getCode.bind(codeManager), compilationResult: () => compilationResults }) @@ -101,8 +97,11 @@ function testMapping (st, privateKey, contractAddress, output, compilationResult }).catch((error) => { st.fail(error) }) - } - }) + }) + .catch(error => { + console.log(error) + st.end(error) + }) } }) } diff --git a/libs/remix-debug/test/vmCall.ts b/libs/remix-debug/test/vmCall.ts index 56d15729e97..b00a5069837 100644 --- a/libs/remix-debug/test/vmCall.ts +++ b/libs/remix-debug/test/vmCall.ts @@ -1,8 +1,8 @@ 'use strict' import { extendWeb3 } from '../src/init' import { Address } from '@ethereumjs/util' +import { Web3 } from 'web3'; const { Provider } = require('@remix-project/remix-simulator') -const Web3 = require('web3') async function getWeb3 () { diff --git a/libs/remix-lib/package.json b/libs/remix-lib/package.json index afec35ad63c..7e357fd5240 100644 --- a/libs/remix-lib/package.json +++ b/libs/remix-lib/package.json @@ -25,7 +25,8 @@ "from-exponential": "1.1.1", "solc": "^0.7.4", "string-similarity": "^4.0.4", - "web3": "^1.5.1" + "web3": "^4.1.1", + "web3-validator": "^2.0.0" }, "devDependencies": { "@babel/core": "^7.4.5", @@ -54,4 +55,4 @@ "typings": "src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220", "types": "./src/index.d.ts" -} \ No newline at end of file +} diff --git a/libs/remix-lib/src/execution/logsManager.ts b/libs/remix-lib/src/execution/logsManager.ts index a8ae3ec3c8e..7d9bba2c6b8 100644 --- a/libs/remix-lib/src/execution/logsManager.ts +++ b/libs/remix-lib/src/execution/logsManager.ts @@ -20,12 +20,10 @@ export class LogsManager { checkBlock (blockNumber, block, web3) { eachOf(block.transactions, (tx: any, i, next) => { const txHash = '0x' + tx.hash().toString('hex') - web3.eth.getTransactionReceipt(txHash, (_error, receipt) => { for (const log of receipt.logs) { this.oldLogs.push({ type: 'block', blockNumber, block, tx, log, txNumber: i, receipt }) const subscriptions = this.getSubscriptionsFor({ type: 'block', blockNumber, block, tx, log, receipt}) - for (const subscriptionId of subscriptions) { const result = { logIndex: '0x1', // 1 diff --git a/libs/remix-lib/src/execution/txListener.ts b/libs/remix-lib/src/execution/txListener.ts index d4251f02974..203a0b9b66c 100644 --- a/libs/remix-lib/src/execution/txListener.ts +++ b/libs/remix-lib/src/execution/txListener.ts @@ -33,7 +33,7 @@ export class TxListener { _listenOnNetwork:boolean _loopId blocks - + constructor (opt, executionContext) { this.event = new EventManager() // has a default for now for backwards compatibility @@ -63,7 +63,7 @@ export class TxListener { let returnValue let execResult if (this.executionContext.isVM()) { - execResult = await this.executionContext.web3().eth.getExecutionResultFromSimulator(txResult.transactionHash) + execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash) returnValue = toBuffer(execResult.returnValue) } else { returnValue = toBuffer(addHexPrefix(txResult.result)) @@ -94,19 +94,17 @@ export class TxListener { // in web3 mode && listen remix txs only if (!this._isListening) return // we don't listen if (this._loopId) return // we seems to already listen on a "web3" network - this.executionContext.web3().eth.getTransaction(txResult.transactionHash, async (error, tx) => { - if (error) return console.log(error) - + this.executionContext.web3().eth.getTransaction(txResult.transactionHash).then(async tx=>{ let execResult if (this.executionContext.isVM()) { - execResult = await this.executionContext.web3().eth.getExecutionResultFromSimulator(txResult.transactionHash) + execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash) } addExecutionCosts(txResult, tx, execResult) tx.envMode = this.executionContext.getProvider() tx.status = txResult.receipt.status this._resolve([tx]) - }) + }).catch(error=>console.log(error)) }) } @@ -159,7 +157,7 @@ export class TxListener { } async _startListenOnNetwork () { - let lastSeenBlock = this.executionContext.lastBlock?.number - 1 + let lastSeenBlock = this.executionContext.lastBlock?.number - BigInt(1) let processingBlock = false const processBlocks = async () => { @@ -204,7 +202,7 @@ export class TxListener { async _manageBlock (blockNumber) { try { const result = await this.executionContext.web3().eth.getBlock(blockNumber, true) - return await this._newBlock(Object.assign({ type: 'web3' }, result)) + return await this._newBlock(Object.assign({ type: 'web3' }, result)) } catch (e) {} } @@ -285,8 +283,7 @@ export class TxListener { // first check known contract, resolve against the `runtimeBytecode` if not known contract = this._resolvedContracts[tx.to] if (!contract) { - this.executionContext.web3().eth.getCode(tx.to, (error, code) => { - if (error) return cb(error) + this.executionContext.web3().eth.getCode(tx.to).then(code=>{ if (code) { const contract = this._tryResolveContract(code, contracts, false) if (contract) { @@ -296,7 +293,7 @@ export class TxListener { } } return cb() - }) + }).catch(error=>cb(error)) return } if (contract) { diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index 31364c045a7..c71f8778a09 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -72,12 +72,12 @@ export class TxRunnerVM { if (!from && useCall && Object.keys(this.vmaccounts).length) { from = Object.keys(this.vmaccounts)[0] account = this.vmaccounts[from] - } else account = this.vmaccounts[from] - + } else account = this.vmaccounts[from] + if (!account) { return callback('Invalid account selected') } - + this.getVMObject().stateManager.getAccount(Address.fromString(from)).then((res: Account) => { const EIP1559 = this.commonContext.hardfork() !== 'berlin' // berlin is the only pre eip1559 fork that we handle. let tx @@ -106,7 +106,7 @@ export class TxRunnerVM { const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] const difficulties = [69762765929000, 70762765929000, 71762765929000] const difficulty = this.commonContext.consensusType() === ConsensusType.ProofOfStake ? 0 : difficulties[this.blockNumber % difficulties.length] - + const blocknumber = this.blockNumber + 1 const block = Block.fromBlockData({ header: { diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index ab754c0feff..78e13f2e2bd 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -2,6 +2,7 @@ import { EventManager } from '../eventManager' import type { Transaction as InternalTransaction } from './txRunner' import Web3 from 'web3' +import {toBigInt} from 'web3-utils' export class TxRunnerWeb3 { event @@ -16,11 +17,13 @@ export class TxRunnerWeb3 { this._api = api } - _executeTx (tx, network, txFee, api, promptCb, callback) { + async _executeTx (tx, network, txFee, api, promptCb, callback) { if (network && network.lastBlock && network.lastBlock.baseFeePerGas) { // the sending stack (web3.js / metamask need to have the type defined) // this is to avoid the following issue: https://github.com/MetaMask/metamask-extension/issues/11824 tx.type = '0x2' + } else { + tx.type = '0x1' } if (txFee) { if (txFee.baseFeePerGas) { @@ -33,21 +36,6 @@ export class TxRunnerWeb3 { } } - 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) { let currentDateTime = new Date(); const start = currentDateTime.getTime() / 1000 const cb = (err, resp) => { @@ -72,11 +60,30 @@ export class TxRunnerWeb3 { } 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. `) + + if (api.personalMode()) { + promptCb( + async (value) => { + try { + const res = await (this.getWeb3() as any).eth.personal.sendTransaction({...tx, value}) + cb(null, res.transactionHash) + } catch (e) { + console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) + cb(null, e.receipt.transactionHash) + } + }, + () => { + return callback('Canceled by user.') + } + ) + } else { + try { + const res = await this.getWeb3().eth.sendTransaction(tx) + cb(null, res.transactionHash) + } catch (e) { + console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `) + cb(null, e.receipt.transactionHash) + } } } @@ -94,13 +101,15 @@ export class TxRunnerWeb3 { if (!from) return callback('the value of "from" is not defined. Please make sure an account is selected.') if (useCall) { tx['gas'] = gasLimit - if (this._api && this._api.isVM()) tx['timestamp'] = timestamp - return this.getWeb3().eth.call(tx, function (error, result: any) { - if (error) return callback(error) - callback(null, { + if (this._api && this._api.isVM()) { + (this.getWeb3() as any).remix.registerCallId(timestamp) + } + this.getWeb3().eth.call(tx) + .then((result: any) => callback(null, { result: result - }) - }) + })) + .catch(error => callback(error)) + return } this._api.detectNetwork((errNetWork, network) => { if (errNetWork) { @@ -113,48 +122,49 @@ export class TxRunnerWeb3 { // the sending stack (web3.js / metamask need to have the type defined) // this is to avoid the following issue: https://github.com/MetaMask/metamask-extension/issues/11824 txCopy.type = '0x2' - txCopy.maxFeePerGas = Math.ceil(network.lastBlock.baseFeePerGas + network.lastBlock.baseFeePerGas / 3) + txCopy.maxFeePerGas = Math.ceil(Number((toBigInt(network.lastBlock.baseFeePerGas) + toBigInt(network.lastBlock.baseFeePerGas) / BigInt(3)).toString())) } else { txCopy.type = '0x1' - txCopy.gasPrice = network.lastBlock.baseFeePerGas - } - } - this.getWeb3().eth.estimateGas(txCopy, (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 - callback(new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.')) + txCopy.gasPrice = undefined } - err = network.name === 'VM' ? null : err // just send the tx if "VM" - gasEstimationForceSend(err, () => { - // callback is called whenever no error - tx['gas'] = !gasEstimation ? gasLimit : gasEstimation - - if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { - return this._executeTx(tx, network, null, this._api, promptCb, callback) - } + } + this.getWeb3().eth.estimateGas(txCopy) + .then(gasEstimation => { + gasEstimationForceSend(null, () => { + // callback is called whenever no error + tx['gas'] = !gasEstimation ? gasLimit : gasEstimation - confirmCb(network, tx, tx['gas'], (txFee) => { - return this._executeTx(tx, network, txFee, this._api, promptCb, callback) - }, (error) => { - callback(error) + if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { + return this._executeTx(tx, network, null, this._api, promptCb, callback) + } + + confirmCb(network, tx, tx['gas'], (txFee) => { + return this._executeTx(tx, network, txFee, 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) + }) + .catch(err => { + 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 + callback(new Error('Gas estimation failed because of an unknown internal error. This may indicated that the transaction will fail.')) } + err = network.name === 'VM' ? null : err // just send the tx if "VM" + gasEstimationForceSend(err, () => { + tx['gas'] = gasLimit + + if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) { + return this._executeTx(tx, network, null, this._api, promptCb, callback) + } + + confirmCb(network, tx, tx['gas'], (txFee) => { + return this._executeTx(tx, network, txFee, this._api, promptCb, callback) + }, (error) => { + callback(error) + }) + }) }) - }) }) } } diff --git a/libs/remix-lib/src/execution/typeConversion.ts b/libs/remix-lib/src/execution/typeConversion.ts index 46a25bff8af..5d7bf97084f 100644 --- a/libs/remix-lib/src/execution/typeConversion.ts +++ b/libs/remix-lib/src/execution/typeConversion.ts @@ -1,11 +1,12 @@ 'use strict' import { BN } from 'bn.js' import { bufferToHex } from '@ethereumjs/util' +import { isBigInt } from 'web3-validator' export function toInt (h) { if (h.indexOf && h.indexOf('0x') === 0) { return (new BN(h.replace('0x', ''), 16)).toString(10) - } else if ((h.constructor && h.constructor.name === 'BigNumber') || BN.isBN(h)) { + } else if ((h.constructor && h.constructor.name === 'BigNumber') || BN.isBN(h) || isBigInt(h)) { return h.toString(10) } return h @@ -21,7 +22,7 @@ function convertToString (v) { ret.push(convertToString(v[k])) } return ret - } else if (BN.isBN(v) || (v.constructor && v.constructor.name === 'BigNumber')) { + } else if (BN.isBN(v) || (v.constructor && v.constructor.name === 'BigNumber') || isBigInt(v)) { return v.toString(10) } else if (v._isBuffer) { return bufferToHex(v) diff --git a/libs/remix-lib/src/init.ts b/libs/remix-lib/src/init.ts index b59d10b4a44..c3e30f269dd 100644 --- a/libs/remix-lib/src/init.ts +++ b/libs/remix-lib/src/init.ts @@ -1,54 +1,46 @@ 'use strict' -import Web3 from 'web3' +import Web3, { Web3PluginBase } from 'web3' + +export function extendWeb3 (web3) { + if(!web3.debug){ + web3.registerPlugin(new Web3DebugPlugin()) + } +} export function loadWeb3 (url = 'http://localhost:8545') { const web3 = new Web3() web3.setProvider(new Web3.providers.HttpProvider(url)) - extend(web3) + extendWeb3(web3) return web3 } -export function extendWeb3 (web3) { - extend(web3) -} +class Web3DebugPlugin extends Web3PluginBase { + public pluginNamespace = 'debug' -export function extend (web3) { - if (!web3.extend) { - return - } - // DEBUG - const methods = [] - if (!(web3.debug && web3.debug.preimage)) { - methods.push(new web3.extend.Method({ - name: 'preimage', - call: 'debug_preimage', - inputFormatter: [null], - params: 1 - })) + public preimage(key, cb) { + this.requestManager.send({ + method: 'debug_preimage', + params: [key] + }) + .then(result => cb(null, result)) + .catch(error => cb(error)) } - if (!(web3.debug && web3.debug.traceTransaction)) { - methods.push(new web3.extend.Method({ - name: 'traceTransaction', - call: 'debug_traceTransaction', - inputFormatter: [null, null], - params: 2 - })) + public traceTransaction(txHash, options, cb) { + this.requestManager.send({ + method: 'debug_traceTransaction', + params: [txHash, options] + }) + .then(result => cb(null, result)) + .catch(error => cb(error)) } - if (!(web3.debug && web3.debug.storageRangeAt)) { - methods.push(new web3.extend.Method({ - name: 'storageRangeAt', - call: 'debug_storageRangeAt', - inputFormatter: [null, null, null, null, null], - params: 5 - })) - } - if (methods.length > 0) { - web3.extend({ - property: 'debug', - methods: methods, - properties: [] + public storageRangeAt(txBlockHash, txIndex, address, start, maxSize, cb) { + this.requestManager.send({ + method: 'debug_storageRangeAt', + params: [txBlockHash, txIndex, address, start, maxSize] }) + .then(result => cb(null, result)) + .catch(error => cb(error)) } } diff --git a/libs/remix-simulator/package.json b/libs/remix-simulator/package.json index 594f82c8f24..62a74be1e09 100644 --- a/libs/remix-simulator/package.json +++ b/libs/remix-simulator/package.json @@ -36,7 +36,8 @@ "merge": "^1.2.0", "string-similarity": "^4.0.4", "time-stamp": "^2.0.0", - "web3": "^1.5.1" + "web3": "^4.1.1", + "web3-utils": "^4.0.5" }, "devDependencies": { "@babel/core": "^7.4.5", @@ -69,4 +70,4 @@ "typings": "src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220", "types": "./src/index.d.ts" -} \ No newline at end of file +} diff --git a/libs/remix-simulator/src/VmProxy.ts b/libs/remix-simulator/src/VmProxy.ts index 90d7ebfbf72..d0a5e634e24 100644 --- a/libs/remix-simulator/src/VmProxy.ts +++ b/libs/remix-simulator/src/VmProxy.ts @@ -3,10 +3,9 @@ const { toHexPaddedString, formatMemory } = util import { helpers } from '@remix-project/remix-lib' const { normalizeHexAddress } = helpers.ui import { ConsoleLogs, hash } from '@remix-project/remix-lib' -import BN from 'bn.js' -import { isBigNumber } from 'web3-utils' import { toChecksumAddress, bufferToHex, Address, toBuffer } from '@ethereumjs/util' -import utils from 'web3-utils' +import utils, {toBigInt} from 'web3-utils' +import {isBigInt} from 'web3-validator' import { ethers } from 'ethers' import { VMContext } from './vm-context' import type { StateManager } from '@ethereumjs/statemanager' @@ -47,7 +46,7 @@ export class VmProxy { stateCopy: StateManager flagDoNotRecordEVMSteps: boolean lastMemoryUpdate: Array - + constructor (vmContext: VMContext) { this.vmContext = vmContext this.stateCopy @@ -84,7 +83,7 @@ export class VmProxy { this.fromDecimal = (...args) => utils.fromDecimal.apply(this, args) this.fromWei = (...args) => utils.fromWei.apply(this, args) this.toWei = (...args) => utils.toWei.apply(this, args) - this.toBigNumber = (...args) => utils.toBN.apply(this, args) + this.toBigNumber = (...args) => toBigInt.apply(this, args) this.isAddress = (...args) => utils.isAddress.apply(this, args) this.utils = utils this.txsMapBlock = {} @@ -176,6 +175,7 @@ export class VmProxy { const topics = [] if (log[1].length > 0) { for (const k in log[1]) { + // @ts-ignore topics.push('0x' + log[1][k].toString('hex')) } } else { @@ -278,7 +278,8 @@ export class VmProxy { } let consoleArgs = iface.decodeFunctionData(functionDesc, payload) consoleArgs = consoleArgs.map((value) => { - if (isBigNumber(value)) { + // Copied from: https://github.com/web3/web3.js/blob/e68194bdc590d811d4bf66dde12f99659861a110/packages/web3-utils/src/utils.js#L48C10-L48C10 + if (value && ((value.constructor && value.constructor.name === 'BigNumber') || isBigInt(value))) { return value.toString() } return value @@ -347,7 +348,7 @@ export class VmProxy { getStorageAt (address: string, position: string, blockNumber: string, cb) { // we don't use the range params here address = toChecksumAddress(address) - + blockNumber = blockNumber === 'latest' ? this.vmContext.latestBlockNumber : blockNumber const block = this.vmContext.blocks[blockNumber] @@ -425,10 +426,10 @@ export class VmProxy { getSha3Input (stack, memory) { const memoryStart = toHexPaddedString(stack[stack.length - 1]) const memoryLength = toHexPaddedString(stack[stack.length - 2]) - const memStartDec = (new BN(memoryStart.replace('0x', ''), 16)).toString(10) + const memStartDec = toBigInt(memoryStart).toString(10) const memoryStartInt = parseInt(memStartDec) * 2 - const memLengthDec = (new BN(memoryLength.replace('0x', ''), 16).toString(10)) - const memoryLengthInt = parseInt(memLengthDec) * 2 + const memLengthDec = toBigInt(memoryLength).toString(10) + const memoryLengthInt = parseInt(memLengthDec.toString()) * 2 let i = Math.floor(memoryStartInt / 32) const maxIndex = Math.floor(memoryLengthInt / 32) + i diff --git a/libs/remix-simulator/src/methods/accounts.ts b/libs/remix-simulator/src/methods/accounts.ts index ffbfc89a3a2..00b8701da38 100644 --- a/libs/remix-simulator/src/methods/accounts.ts +++ b/libs/remix-simulator/src/methods/accounts.ts @@ -1,19 +1,17 @@ import { privateToAddress, toChecksumAddress, isValidPrivate, Address } from '@ethereumjs/util' -import BN from 'bn.js' -const Web3EthAccounts = require('web3-eth-accounts'); +import { privateKeyToAccount } from 'web3-eth-accounts' +import { toBigInt } from 'web3-utils' import * as crypto from 'crypto' export class Web3Accounts { accounts: Record accountsKeys: Record - web3Accounts: any vmContext constructor (vmContext) { this.vmContext = vmContext // TODO: make it random and/or use remix-libs - this.web3Accounts = new Web3EthAccounts() this.accounts = {} this.accountsKeys = {} } @@ -48,7 +46,7 @@ export class Web3Accounts { const stateManager = this.vmContext.vm().stateManager stateManager.getAccount(Address.fromString(addressStr)).then((account) => { - account.balance = new BN(balance.replace('0x', '') || 'f00000000000000001', 16) + account.balance = toBigInt(balance || '0xf00000000000000001') stateManager.putAccount(Address.fromString(addressStr), account).catch((error) => { reject(error) }).then(() => { @@ -85,7 +83,7 @@ export class Web3Accounts { const address = payload.params[0] this.vmContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { - cb(null, new BN(account.balance).toString(10)) + cb(null, toBigInt(account.balance).toString(10)) }).catch((error) => { cb(error) }) @@ -99,7 +97,7 @@ export class Web3Accounts { if (!privateKey) { return cb(new Error('unknown account')) } - const account = this.web3Accounts.privateKeyToAccount(privateKey as string) + const account = privateKeyToAccount(privateKey as string) const data = account.sign(message) diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index dc6d940e650..25c751ed4d5 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -1,5 +1,4 @@ -import { toHex, toDecimal } from 'web3-utils' -import BN from 'bn.js' +import { toHex, toNumber, toBigInt } from 'web3-utils' import { toChecksumAddress, Address, bigIntToHex } from '@ethereumjs/util' import { processTx } from './txProcess' import { execution } from '@remix-project/remix-lib' @@ -26,6 +25,7 @@ export class Transactions { txRunnerVMInstance txRunnerInstance TX_INDEX = '0x0' // currently there's always only 1 tx per block, so the transaction index will always be 0x0 + comingCallId constructor (vmContext) { this.vmContext = vmContext @@ -73,7 +73,8 @@ export class Transactions { eth_getTransactionByBlockNumberAndIndex: this.eth_getTransactionByBlockNumberAndIndex.bind(this), eth_getExecutionResultFromSimulator: this.eth_getExecutionResultFromSimulator.bind(this), eth_getHHLogsForTx: this.eth_getHHLogsForTx.bind(this), - eth_getHashFromTagBySimulator: this.eth_getHashFromTagBySimulator.bind(this) + eth_getHashFromTagBySimulator: this.eth_getHashFromTagBySimulator.bind(this), + eth_registerCallId: this.eth_registerCallId.bind(this) } } @@ -154,9 +155,8 @@ export class Transactions { } payload.params[0].gas = 10000000 * 10 - this.vmContext.web3().flagNextAsDoNotRecordEvmSteps() - processTx(this.txRunnerInstance, payload, true, (error, value: VMexecutionResult) => { + processTx(this.txRunnerInstance, payload, true, (error, value: VMexecutionResult) => { if (error) return cb(error) const result: RunTxResult = value.result if ((result as any).receipt?.status === '0x0' || (result as any).receipt?.status === 0) { @@ -169,12 +169,12 @@ export class Transactions { return cb(e.message) } } - let gasUsed = result.execResult.executionGasUsed + let gasUsed = Number(toNumber(result.execResult.executionGasUsed)) if (result.execResult.gasRefund) { - gasUsed += result.execResult.gasRefund + gasUsed += Number(toNumber(result.execResult.gasRefund)) } - gasUsed = gasUsed + value.tx.getBaseFee() - cb(null, Math.ceil(Number(gasUsed) + (15 * Number(gasUsed)) / 100)) + gasUsed = gasUsed + Number(toNumber(value.tx.getBaseFee())) + cb(null, Math.ceil(gasUsed + (15 * gasUsed) / 100)) }) } @@ -190,6 +190,11 @@ export class Transactions { }) } + eth_registerCallId (payload, cb) { + this.comingCallId = payload.params[0] + cb() + } + eth_call (payload, cb) { // from might be lowercased address (web3) if (payload.params && payload.params.length > 0 && payload.params[0].from) { @@ -200,12 +205,10 @@ export class Transactions { } payload.params[0].value = undefined - - const tag = payload.params[0].timestamp // e2e reference - + const tag = payload.params[0].timestamp processTx(this.txRunnerInstance, payload, true, (error, result: VMexecutionResult) => { if (!error && result) { - this.vmContext.addBlock(result.block) + this.vmContext.addBlock(result.block, null, true) const hash = '0x' + result.tx.hash().toString('hex') this.vmContext.trackTx(hash, result.block, result.tx) const returnValue = `0x${result.result.execResult.returnValue.toString('hex') || '0'}` @@ -217,9 +220,14 @@ export class Transactions { logs: result.result.execResult.logs, returnValue: returnValue } - this.vmContext.trackExecResult(hash, 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. + // either the tag is specified as a timestamp in a tx or the caller should call registerCallId before calling the call. + if (tag) this.tags[tag] = result.transactionHash + else if (this.comingCallId) { + this.tags[this.comingCallId] = result.transactionHash + this.comingCallId = null + } + this.vmContext.trackExecResult(hash, execResult) return cb(null, returnValue) } cb(error) @@ -234,7 +242,7 @@ export class Transactions { const address = payload.params[0] this.vmContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { - const nonce = new BN(account.nonce).toString(10) + const nonce = toBigInt(account.nonce).toString(10) cb(null, nonce) }).catch((error) => { cb(error) @@ -292,7 +300,7 @@ export class Transactions { const txIndex = payload.params[1] const txBlock = this.vmContext.blocks[payload.params[0]] - const txHash = '0x' + txBlock.transactions[toDecimal(txIndex)].hash().toString('hex') + const txHash = '0x' + txBlock.transactions[toNumber(txIndex) as number].hash().toString('hex') this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { if (error) { @@ -337,7 +345,7 @@ export class Transactions { const txIndex = payload.params[1] const txBlock = this.vmContext.blocks[payload.params[0]] - const txHash = '0x' + txBlock.transactions[toDecimal(txIndex)].hash().toString('hex') + const txHash = '0x' + txBlock.transactions[toNumber(txIndex) as number].hash().toString('hex') this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { if (error) { diff --git a/libs/remix-simulator/src/methods/txProcess.ts b/libs/remix-simulator/src/methods/txProcess.ts index f269ca1baf8..61a9821ab5f 100644 --- a/libs/remix-simulator/src/methods/txProcess.ts +++ b/libs/remix-simulator/src/methods/txProcess.ts @@ -35,7 +35,7 @@ function createContract (payload, from, data, value, gasLimit, txRunner, callbac } export function processTx (txRunnerInstance, payload, isCall, callback) { - let { from, to, data, value, gas } = payload.params[0] // eslint-disable-line + let { from, to, data, input, value, gas } = payload.params[0] // eslint-disable-line gas = gas || 3000000 const callbacks = { @@ -54,10 +54,10 @@ export function processTx (txRunnerInstance, payload, isCall, callback) { } if (isCall) { - runCall(payload, from, to, data, value, gas, txRunnerInstance, callbacks, callback) + runCall(payload, from, to, data||input, value, gas, txRunnerInstance, callbacks, callback) } else if (to) { - runTx(payload, from, to, data, value, gas, txRunnerInstance, callbacks, callback) + runTx(payload, from, to, data||input, value, gas, txRunnerInstance, callbacks, callback) } else { - createContract(payload, from, data, value, gas, txRunnerInstance, callbacks, callback) + createContract(payload, from, data||input, value, gas, txRunnerInstance, callbacks, callback) } } diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index 997accddf9e..2d2da213f19 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -10,6 +10,7 @@ import { methods as netMethods } from './methods/net' import { Transactions } from './methods/transactions' import { Debug } from './methods/debug' import { VMContext } from './vm-context' +import { Web3PluginBase } from 'web3' export interface JSONRPCRequestPayload { params: any[]; @@ -69,7 +70,7 @@ export class Provider { } } - sendAsync (payload: JSONRPCRequestPayload, callback: (err: Error, result?: JSONRPCResponsePayload) => void) { + _send(payload: JSONRPCRequestPayload, callback: (err: Error, result?: JSONRPCResponsePayload) => void) { // log.info('payload method is ', payload.method) // commented because, this floods the IDE console if (!this.initialized) { this.pendingRequests.push({ payload, callback }) @@ -95,8 +96,23 @@ export class Provider { callback(new Error('unknown method ' + payload.method)) } + sendAsync (payload: JSONRPCRequestPayload, callback: (err: Error, result?: JSONRPCResponsePayload) => void) { + return new Promise((resolve,reject)=>{ + const cb = (err, result) => { + if(typeof callback==='function'){ + callback(err,result) + } + if(err){ + return reject(err) + } + return resolve(result) + } + this._send(payload, cb) + }) + } + send (payload, callback) { - this.sendAsync(payload, callback || function () {}) + return this.sendAsync(payload,callback) } isConnected () { @@ -117,43 +133,39 @@ export class Provider { } export function extend (web3) { - if (!web3.extend) { - return + if(!web3.remix){ + web3.registerPlugin(new Web3TestPlugin()) } - // DEBUG - const methods = [] - if (!(web3.eth && web3.eth.getExecutionResultFromSimulator)) { - methods.push(new web3.extend.Method({ - name: 'getExecutionResultFromSimulator', - call: 'eth_getExecutionResultFromSimulator', - inputFormatter: [null], - params: 1 - })) +} + +class Web3TestPlugin extends Web3PluginBase { + public pluginNamespace = 'remix' + + public getExecutionResultFromSimulator(transactionHash) { + return this.requestManager.send({ + method: 'eth_getExecutionResultFromSimulator', + params: [transactionHash] + }) } - if (!(web3.eth && web3.eth.getHHLogsForTx)) { - methods.push(new web3.extend.Method({ - name: 'getHHLogsForTx', - call: 'eth_getHHLogsForTx', - inputFormatter: [null], - params: 1 - })) + public getHHLogsForTx(transactionHash) { + return this.requestManager.send({ + method: 'eth_getHHLogsForTx', + params: [transactionHash] + }) } - if (!(web3.eth && web3.eth.getHashFromTagBySimulator)) { - methods.push(new web3.extend.Method({ - name: 'getHashFromTagBySimulator', - call: 'eth_getHashFromTagBySimulator', - inputFormatter: [null], - params: 1 - })) + public getHashFromTagBySimulator(timestamp) { + return this.requestManager.send({ + method: 'eth_getHashFromTagBySimulator', + params: [timestamp] + }) } - if (methods.length > 0) { - web3.extend({ - property: 'eth', - methods: methods, - properties: [] + public registerCallId(id) { + return this.requestManager.send({ + method: 'eth_registerCallId', + params: [id] }) } } diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index 62122a61c91..224dbb96e5c 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -374,7 +374,7 @@ export class VMContext { return this.currentVm } - addBlock (block: Block, genesis?: boolean) { + addBlock (block: Block, genesis?: boolean, isCall?: boolean) { let blockNumber = bigIntToHex(block.header.number) if (blockNumber === '0x') { blockNumber = '0x0' @@ -384,7 +384,7 @@ export class VMContext { this.blocks[blockNumber] = block this.latestBlockNumber = blockNumber - if (!genesis) this.logsManager.checkBlock(blockNumber, block, this.web3()) + if (!isCall && !genesis) this.logsManager.checkBlock(blockNumber, block, this.web3()) } trackTx (txHash, block, tx) { diff --git a/libs/remix-simulator/test/accounts.ts b/libs/remix-simulator/test/accounts.ts index 336d438380c..cb923e209ae 100644 --- a/libs/remix-simulator/test/accounts.ts +++ b/libs/remix-simulator/test/accounts.ts @@ -1,5 +1,5 @@ /* global describe, before, it */ -import Web3 from 'web3' +import Web3, { FMT_BYTES, FMT_NUMBER } from 'web3' import { Provider } from '../src/index' const web3 = new Web3() import * as assert from 'assert' @@ -21,9 +21,9 @@ describe('Accounts', () => { describe('eth_getBalance', () => { it('should get a account balance', async () => { const accounts: string[] = await web3.eth.getAccounts() - const balance0: string = await web3.eth.getBalance(accounts[0]) - const balance1: string = await web3.eth.getBalance(accounts[1]) - const balance2: string = await web3.eth.getBalance(accounts[2]) + const balance0: string = await web3.eth.getBalance(accounts[0], undefined, { number: FMT_NUMBER.STR, bytes: FMT_BYTES.HEX }) + const balance1: string = await web3.eth.getBalance(accounts[1], undefined, { number: FMT_NUMBER.STR, bytes: FMT_BYTES.HEX }) + const balance2: string = await web3.eth.getBalance(accounts[2], undefined, { number: FMT_NUMBER.STR, bytes: FMT_BYTES.HEX }) assert.deepEqual(balance0, '100000000000000000000') assert.deepEqual(balance1, '100000000000000000000') @@ -34,9 +34,9 @@ describe('Accounts', () => { describe('eth_sign', () => { it('should sign payloads', async () => { const accounts: string[] = await web3.eth.getAccounts() - const signature: string = await web3.eth.sign('Hello world', accounts[0]) + const signature = await web3.eth.sign(web3.utils.utf8ToHex('Hello world'), accounts[0]) - assert.deepEqual(signature.length, 132) + assert.deepEqual(typeof signature === 'string' ? signature.length : signature.signature.length, 132) }) }) }) diff --git a/libs/remix-simulator/test/blocks.ts b/libs/remix-simulator/test/blocks.ts index 72b454b8dd5..08c5fe2e108 100644 --- a/libs/remix-simulator/test/blocks.ts +++ b/libs/remix-simulator/test/blocks.ts @@ -18,23 +18,22 @@ describe('blocks', () => { const block = await web3.eth.getBlock(0) const expectedBlock = { - baseFeePerGas: 1, - difficulty: 0, + baseFeePerGas: '1', + difficulty: '0', extraData: '0x0', - gasLimit: 8000000, - gasUsed: 0, + gasLimit: '8000000', + gasUsed: '0', hash: block.hash.toString(), - logsBloom: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', + logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', miner: '0x0000000000000000000000000000000000000001', - nonce: '0x0000000000000000', - number: 0, + nonce: '0', + number: '0', parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000', sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', - size: 163591, + size: '163591', stateRoot: '0x0000000000000000000000000000000000000000000000000000000000000000', timestamp: block.timestamp, totalDifficulty: '0', - transactions: [], transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', uncles: [] } @@ -94,10 +93,9 @@ describe('blocks', () => { it('should get block given its hash', async () => { const correctBlock = await web3.eth.getBlock(0) const numberTransactions = await (new Promise((resolve, reject) => { - web3['_requestManager'].send({method: 'eth_getUncleCountByBlockHash', params: [correctBlock.hash]}, (err, numberTransactions) => { - if (err) return reject(err) - resolve(numberTransactions) - }) + web3['_requestManager'].send({method: 'eth_getUncleCountByBlockHash', params: [correctBlock.hash]}) + .then(numberTransactions => resolve(numberTransactions)) + .catch(err => reject(err)) })) assert.deepEqual(numberTransactions, correctBlock.uncles.length) }) @@ -107,17 +105,16 @@ describe('blocks', () => { it('should get block given its number', async () => { const correctBlock = await web3.eth.getBlock(0) const numberTransactions = await (new Promise((resolve, reject) => { - web3['_requestManager'].send({method: 'eth_getUncleCountByBlockHash', params: [0]}, (err, numberTransactions) => { - if (err) return reject(err) - resolve(numberTransactions) - }) + web3['_requestManager'].send({method: 'eth_getUncleCountByBlockHash', params: [0]}) + .then(numberTransactions => resolve(numberTransactions)) + .catch(err => reject(err)) })) assert.deepEqual(numberTransactions, correctBlock.uncles.length) }) }) describe('eth_getStorageAt', () => { it('should get storage at position at given address', async () => { - const abi: any = [ + const abi = [ { 'constant': false, 'inputs': [ @@ -197,16 +194,16 @@ describe('blocks', () => { 'stateMutability': 'view', 'type': 'function' } - ] + ] as const const code = '0x608060405234801561001057600080fd5b506040516020806102018339810180604052602081101561003057600080fd5b810190808051906020019092919050505080600081905550506101a9806100586000396000f3fe60806040526004361061005c576000357c0100000000000000000000000000000000000000000000000000000000900480632a1afcd91461006157806360fe47b11461008c5780636d4ce63c146100c7578063ce01e1ec146100f2575b600080fd5b34801561006d57600080fd5b5061007661012d565b6040518082815260200191505060405180910390f35b34801561009857600080fd5b506100c5600480360360208110156100af57600080fd5b8101908080359060200190929190505050610133565b005b3480156100d357600080fd5b506100dc61013d565b6040518082815260200191505060405180910390f35b3480156100fe57600080fd5b5061012b6004803603602081101561011557600080fd5b8101908080359060200190929190505050610146565b005b60005481565b8060008190555050565b60008054905090565b80600081905550807f63a242a632efe33c0e210e04e4173612a17efa4f16aa4890bc7e46caece80de060405160405180910390a25056fea165627a7a7230582063160eb16dc361092a85ced1a773eed0b63738b83bea1e1c51cf066fa90e135d0029' const contract = new web3.eth.Contract(abi) const accounts = await web3.eth.getAccounts() - const contractInstance: any = await contract.deploy({ data: code, arguments: [100] }).send({ from: accounts[0], gas: 400000 }) + const contractInstance: any = await contract.deploy({ data: code, arguments: [100] }).send({ from: accounts[0], gas: '400000' }) contractInstance.currentProvider = web3.eth.currentProvider - contractInstance.givenProvider = web3.eth.currentProvider + // contractInstance.givenProvider = web3.eth.currentProvider await contractInstance.methods.set(100).send({ from: accounts[0].toLowerCase(), gas: 400000 }) let storage = await web3.eth.getStorageAt(contractInstance.options.address, 0) @@ -223,7 +220,7 @@ describe('blocks', () => { }) describe('eth_call', () => { it('should get a value', async () => { - const abi: any = [ + const abi = [ { 'constant': false, 'inputs': [ @@ -303,16 +300,15 @@ describe('blocks', () => { 'stateMutability': 'view', 'type': 'function' } - ] + ] as const const code = '0x608060405234801561001057600080fd5b506040516020806102018339810180604052602081101561003057600080fd5b810190808051906020019092919050505080600081905550506101a9806100586000396000f3fe60806040526004361061005c576000357c0100000000000000000000000000000000000000000000000000000000900480632a1afcd91461006157806360fe47b11461008c5780636d4ce63c146100c7578063ce01e1ec146100f2575b600080fd5b34801561006d57600080fd5b5061007661012d565b6040518082815260200191505060405180910390f35b34801561009857600080fd5b506100c5600480360360208110156100af57600080fd5b8101908080359060200190929190505050610133565b005b3480156100d357600080fd5b506100dc61013d565b6040518082815260200191505060405180910390f35b3480156100fe57600080fd5b5061012b6004803603602081101561011557600080fd5b8101908080359060200190929190505050610146565b005b60005481565b8060008190555050565b60008054905090565b80600081905550807f63a242a632efe33c0e210e04e4173612a17efa4f16aa4890bc7e46caece80de060405160405180910390a25056fea165627a7a7230582063160eb16dc361092a85ced1a773eed0b63738b83bea1e1c51cf066fa90e135d0029' const contract = new web3.eth.Contract(abi) const accounts = await web3.eth.getAccounts() - const contractInstance: any = await contract.deploy({ data: code, arguments: [100] }).send({ from: accounts[0], gas: 400000 }) + const contractInstance: any = await contract.deploy({ data: code, arguments: [100] }).send({ from: accounts[0], gas: '400000' }) contractInstance.currentProvider = web3.eth.currentProvider - contractInstance.givenProvider = web3.eth.currentProvider const value = await contractInstance.methods.get().call({ from: accounts[0] }) assert.deepEqual(value, 100) diff --git a/libs/remix-simulator/test/misc.ts b/libs/remix-simulator/test/misc.ts index a339910996f..785cc3dd554 100644 --- a/libs/remix-simulator/test/misc.ts +++ b/libs/remix-simulator/test/misc.ts @@ -12,26 +12,21 @@ describe('Misc', () => { }) describe('web3_clientVersion', () => { - it('should get correct remix simulator version', async (done) => { - web3['_requestManager'].send({ method: 'web3_clientVersion', params: [] }, (err, version) => { - if (err) { - throw new Error(err) - } - const remixVersion = require('../package.json').version - assert.equal(version, 'Remix Simulator/' + remixVersion) - done() - }) + it('should get correct remix simulator version', async () => { + web3['_requestManager'].send({ method: 'web3_clientVersion', params: [] }) + .then(version => { + const remixVersion = require('../package.json').version + assert.equal(version, 'Remix Simulator/' + remixVersion) + }) + .catch(err => { throw new Error(err) }) }) }) describe('eth_protocolVersion', () => { it('should get protocol version', async () => { - web3['_requestManager'].send({ method: 'eth_protocolVersion', params: [] }, (err, result) => { - if (err) { - throw new Error(err) - } - assert.equal(result, '0x3f') - }) + web3['_requestManager'].send({ method: 'eth_protocolVersion', params: [] }) + .then(result => assert.equal(result, '0x3f')) + .catch(err => { throw new Error(err) }) }) }) @@ -58,56 +53,41 @@ describe('Misc', () => { describe('web3_sha3', () => { it('should get result of a sha3', async () => { - web3['_requestManager'].send({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] }, (err, result) => { - if (err) { - throw new Error(err) - } - assert.equal(result, '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad') - }) + web3['_requestManager'].send({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] }) + .then(result => assert.equal(result, '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad')) + .catch(err => { throw new Error(err)} ) }) }) describe('eth_getCompilers', () => { it('should get list of compilers', async () => { - web3['_requestManager'].send({ method: 'eth_getCompilers', params: [] }, (err, result) => { - if (err) { - throw new Error(err) - } - assert.equal(result, 0) - }) + web3['_requestManager'].send({ method: 'eth_getCompilers', params: [] }) + .then(result => assert.equal(result, 0)) + .catch(err => { throw new Error(err) }) }) }) describe('eth_compileSolidity', () => { it('get unsupported result when requesting solidity compiler', async () => { - web3['_requestManager'].send({ method: 'eth_compileSolidity', params: [] }, (err, result) => { - if (err) { - throw new Error(err) - } - assert.equal(result, 'unsupported') - }) + web3['_requestManager'].send({ method: 'eth_compileSolidity', params: [] }) + .then(result => assert.equal(result, 'unsupported')) + .catch(err => { throw new Error(err) }) }) }) describe('eth_compileLLL', () => { it('get unsupported result when requesting LLL compiler', async () => { - web3['_requestManager'].send({ method: 'eth_compileLLL', params: [] }, (err, result) => { - if (err) { - throw new Error(err) - } - assert.equal(result, 'unsupported') - }) + web3['_requestManager'].send({ method: 'eth_compileLLL', params: [] }) + .then(result => assert.equal(result, 'unsupported')) + .catch(err => { throw new Error(err) }) }) }) describe('eth_compileSerpent', () => { it('get unsupported result when requesting serpent compiler', async () => { - web3['_requestManager'].send({ method: 'eth_compileSerpent', params: [] }, (err, result) => { - if (err) { - throw new Error(err) - } - assert.equal(result, 'unsupported') - }) + web3['_requestManager'].send({ method: 'eth_compileSerpent', params: [] }) + .then(result => assert.equal(result, 'unsupported')) + .catch(err => { throw new Error(err)} ) }) }) }) diff --git a/libs/remix-solidity/package.json b/libs/remix-solidity/package.json index 5a9ecbc0202..bc2626e33bf 100644 --- a/libs/remix-solidity/package.json +++ b/libs/remix-solidity/package.json @@ -28,7 +28,7 @@ "semver": "^6.3.0", "solc": "^0.7.4", "string-similarity": "^4.0.4", - "web3": "^1.5.1", + "web3": "^4.1.1", "webworkify-webpack": "^2.1.5" }, "devDependencies": { @@ -58,4 +58,4 @@ "homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-solidity#readme", "typings": "src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220" -} \ No newline at end of file +} diff --git a/libs/remix-tests/package.json b/libs/remix-tests/package.json index a9462d00759..a33fc54f270 100644 --- a/libs/remix-tests/package.json +++ b/libs/remix-tests/package.json @@ -62,7 +62,7 @@ "string-similarity": "^4.0.4", "time-stamp": "^2.2.0", "tslib": "^2.3.0", - "web3": "^1.5.1", + "web3": "^4.1.1", "winston": "^3.0.0" }, "devDependencies": { @@ -79,4 +79,4 @@ }, "typings": "src/index.d.ts", "gitHead": "b6db2a29c223e423c70f06b87d9b245e26f0b220" -} \ No newline at end of file +} diff --git a/libs/remix-tests/src/deployer.ts b/libs/remix-tests/src/deployer.ts index d3164eb285a..991847a0514 100644 --- a/libs/remix-tests/src/deployer.ts +++ b/libs/remix-tests/src/deployer.ts @@ -1,6 +1,6 @@ import async from 'async' import { execution } from '@remix-project/remix-lib' -import Web3 from 'web3' +import Web3, { FMT_BYTES, FMT_NUMBER } from 'web3' import { compilationInterface } from './types' /** @@ -58,7 +58,7 @@ export function deployAll (compileResult: compilationInterface, web3: Web3, test }, function deployContracts (contractsToDeploy: string[], next) { const deployRunner = (deployObject, contractObject, contractName, filename, callback) => { - deployObject.estimateGas().then((gasValue) => { + deployObject.estimateGas(undefined, { number: FMT_NUMBER.NUMBER, bytes: FMT_BYTES.HEX }).then((gasValue) => { const gasBase = Math.ceil(gasValue * 1.2) const gas = withDoubleGas ? gasBase * 2 : gasBase deployObject.send({ diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 116da1cb28e..83fc6c1dc9c 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -127,10 +127,9 @@ commander nodeUrl: options.nodeUrl || null, blockNumber: options.blockNumber || null } - const web3 = new Web3() const provider: any = new Provider(providerConfig) await provider.init() - web3.setProvider(provider) + const web3 = new Web3(provider) extend(web3) runTestFiles(path.resolve(file_path), isDirectory, web3, compilerConfig, (error, totalPassing, totalFailing) => { if (error) process.exit(1) diff --git a/libs/remix-tests/src/runTestFiles.ts b/libs/remix-tests/src/runTestFiles.ts index a811f9b441b..3ac058857b6 100644 --- a/libs/remix-tests/src/runTestFiles.ts +++ b/libs/remix-tests/src/runTestFiles.ts @@ -62,10 +62,12 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3 async.waterfall([ function getAccountList (next) { if (accounts) return next(null) - web3.eth.getAccounts((_err: Error | null | undefined, _accounts) => { - accounts = _accounts - next(null) - }) + web3.eth.getAccounts() + .then(_accounts => { + accounts = _accounts + next(null) + }) + .catch((_err: Error | null | undefined) => next(null)) }, function compile (next) { compileFileOrFiles(filepath, isDirectory, { accounts }, compilerConfig, next) @@ -82,10 +84,10 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3 // accept deployment params from UI if (err.message.includes('The contract code couldn\'t be stored, please check your gas limit')) { deployAll(compilationResult, web3, accounts, true, null, (error, contracts) => { - if (error) next([{ message: 'contract deployment failed after trying twice: ' + error.message, severity: 'error' }]) // IDE expects errors in array + if (error) next([{ message: 'contract deployment failed after trying twice: ' + error.innerError || error.message, severity: 'error' }]) // IDE expects errors in array else next(null, compilationResult, contracts) }) - } else { next([{ message: 'contract deployment failed: ' + err.message, severity: 'error' }]) } // IDE expects errors in array + } else { next([{ message: 'contract deployment failed: ' + err.innerError || err.message, severity: 'error' }]) } // IDE expects errors in array } else { next(null, compilationResult, contracts) } }) }, diff --git a/libs/remix-tests/src/runTestSources.ts b/libs/remix-tests/src/runTestSources.ts index f6cb8cbcf33..7b97b2851c9 100644 --- a/libs/remix-tests/src/runTestSources.ts +++ b/libs/remix-tests/src/runTestSources.ts @@ -64,10 +64,10 @@ export class UnitTestRunner { // accept deployment params from UI if (err.message.includes('The contract code couldn\'t be stored, please check your gas limit')) { deployAll(compilationResult, this.web3, this.testsAccounts, true, deployCb, (error, contracts) => { - if (error) next([{ message: 'contract deployment failed after trying twice: ' + error.message, severity: 'error' }]) // IDE expects errors in array + if (error) next([{ message: 'contract deployment failed after trying twice: ' + error.innerError || error.message, severity: 'error' }]) // IDE expects errors in array else next(null, compilationResult, contracts) }) - } else { next([{ message: 'contract deployment failed: ' + err.message, severity: 'error' }]) } // IDE expects errors in array + } else { next([{ message: 'contract deployment failed: ' + err.innerError || err.message, severity: 'error' }]) } // IDE expects errors in array } else { next(null, compilationResult, contracts) } }) }, diff --git a/libs/remix-tests/src/testRunner.ts b/libs/remix-tests/src/testRunner.ts index 77317860682..3f59dd1f125 100644 --- a/libs/remix-tests/src/testRunner.ts +++ b/libs/remix-tests/src/testRunner.ts @@ -214,6 +214,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com let passingNum = 0 let failureNum = 0 let timePassed = 0 + const failedTransactions = {} const isJSONInterfaceAvailable = testObject && testObject.options && testObject.options.jsonInterface if (!isJSONInterfaceAvailable) { return resultsCallback(new Error('Contract interface not available'), { passingNum, failureNum, timePassed }) } const runList: RunListInterface[] = createRunList(testObject.options.jsonInterface, fileAST, testName) @@ -249,12 +250,12 @@ export function runTest (testName: string, testObject: any, contractDetails: Com if (func.constant) { sendParams = {} const tagTimestamp = 'remix_tests_tag' + Date.now() - sendParams.timestamp = tagTimestamp + if (web3.remix && web3.remix.registerCallId) web3.remix.registerCallId(tagTimestamp) method.call(sendParams).then(async (result) => { const time = (Date.now() - startTime) / 1000.0 let tagTxHash - if (web3.eth && web3.eth.getHashFromTagBySimulator) tagTxHash = await web3.eth.getHashFromTagBySimulator(tagTimestamp) - if (web3.eth && web3.eth.getHHLogsForTx) hhLogs = await web3.eth.getHHLogsForTx(tagTxHash) + if (web3.remix && web3.remix.getHashFromTagBySimulator) tagTxHash = await web3.remix.getHashFromTagBySimulator(tagTimestamp) + if (web3.remix && web3.remix.getHHLogsForTx) hhLogs = await web3.remix.getHHLogsForTx(tagTxHash) debugTxHash = tagTxHash if (result) { const resp: TestResultInterface = { @@ -301,17 +302,17 @@ export function runTest (testName: string, testObject: any, contractDetails: Com method.send(sendParams).on('receipt', async (receipt) => { try { debugTxHash = receipt.transactionHash - if (web3.eth && web3.eth.getHHLogsForTx) hhLogs = await web3.eth.getHHLogsForTx(receipt.transactionHash) + if (web3.remix && web3.remix.getHHLogsForTx) hhLogs = await web3.remix.getHHLogsForTx(receipt.transactionHash) const time: number = (Date.now() - startTime) / 1000.0 const assertionEventHashes = assertionEvents.map(e => Web3.utils.sha3(e.name + '(' + e.params.join() + ')')) let testPassed = false - for (const i in receipt.events) { - let events = receipt.events[i] + for (const i in receipt.logs) { + let events = receipt.logs[i] if (!Array.isArray(events)) events = [events] for (const event of events) { - const eIndex = assertionEventHashes.indexOf(event.raw.topics[0]) // event name topic will always be at index 0 + const eIndex = assertionEventHashes.indexOf(event.topics[0]) // event name topic will always be at index 0 if (eIndex >= 0) { - const testEvent = web3.eth.abi.decodeParameters(assertionEvents[eIndex].params, event.raw.data) + const testEvent = web3.eth.abi.decodeParameters(assertionEvents[eIndex].params, event.data) if (!testEvent[0]) { const assertMethod = testEvent[2] if (assertMethod === 'ok') { // for 'Assert.ok' method @@ -378,9 +379,11 @@ export function runTest (testName: string, testObject: any, contractDetails: Com } }).on('error', async (err) => { const time: number = (Date.now() - startTime) / 1000.0 + if (failedTransactions[err.receipt.transactionHash]) return // we are already aware of this transaction failing. + failedTransactions[err.receipt.transactionHash] = time let errMsg = err.message let txHash - if (err.reason) errMsg = `transaction reverted with the reason: ${err.reason}` + if (err.reason) errMsg = `transaction reverted with the reason: ${err.reason}` const resp: TestResultInterface = { type: 'testFailure', value: changeCase.sentenceCase(func.name), @@ -394,7 +397,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com else if (err.message.includes('Transaction has been reverted by the EVM')) { txHash = JSON.parse(err.message.replace('Transaction has been reverted by the EVM:', '')).transactionHash } - if (web3.eth && web3.eth.getHHLogsForTx && txHash) hhLogs = await web3.eth.getHHLogsForTx(txHash) + if (web3.remix && web3.remix.getHHLogsForTx && txHash) hhLogs = await web3.remix.getHHLogsForTx(txHash) if (hhLogs && hhLogs.length) resp.hhLogs = hhLogs resp.debugTxHash = txHash testCallback(undefined, resp) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 8ac5505f10c..f9686ca073b 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -4,10 +4,10 @@ import { expect } from 'chai'; describe('testRunner: remix-tests CLI', function(){ this.timeout(120000) - // remix-tests binary, after build, is used as executable - + // 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() @@ -20,7 +20,7 @@ describe('testRunner: remix-tests CLI', function(){ execSync('yarn install', { cwd: resolve(__dirname + '/../../../dist/libs/remix-tests') }) } } - + describe('test various CLI options', function() { it('remix-tests version', () => { @@ -74,10 +74,10 @@ Commands: expect(res.stdout.toString().trim()).to.match(/Expected value should be ok to: true/) expect(res.stdout.toString().trim()).to.match(/Received: false/) expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) - + }) - + it('remix-tests running a test file with custom compiler version', () => { const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) @@ -92,13 +92,13 @@ Commands: // match fail test details expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) }) - + it('remix-tests running a test file with unavailable custom compiler version (should fail)', () => { const res = spawnSync(executablePath, ['--compiler', '1.10.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim()).to.contain('No compiler found in releases with version 1.10.4') }) - + it('remix-tests running a test file with custom EVM', () => { const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines @@ -111,7 +111,7 @@ Commands: // match fail test details expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) }) - + it('remix-tests running a test file by enabling optimization', () => { const res = spawnSync(executablePath, ['--optimize', 'true', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines @@ -124,7 +124,7 @@ Commands: // match fail test details expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) }) - + it('remix-tests running a test file by enabling optimization and setting runs', () => { const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines @@ -161,6 +161,6 @@ Commands: // match fail test details expect(res.stdout.toString().trim()).to.match(/Message: okFailTest fails/) }) - + }) -}) \ No newline at end of file +}) diff --git a/libs/remix-tests/tests/testRunner.spec.ts b/libs/remix-tests/tests/testRunner.spec.ts index cbdc1c4aa1d..fd84bca1729 100644 --- a/libs/remix-tests/tests/testRunner.spec.ts +++ b/libs/remix-tests/tests/testRunner.spec.ts @@ -53,14 +53,16 @@ async function compileAndDeploy(filename: string, callback: any) { let compilationData: any async.waterfall([ function getAccountList(next: any): void { - web3.eth.getAccounts((_err: Error | null | undefined, _accounts: string[]) => { - accounts = _accounts - web3.eth.defaultAccount = accounts[0] - next(_err) - }) + web3.eth.getAccounts() + .then(( _accounts: string[]) => { + accounts = _accounts + web3.eth.defaultAccount = accounts[0] + next(undefined) + }) + .catch((_err: Error | null | undefined) => next(_err)) }, function compile(next: any): void { - compileFileOrFiles(filename, false, { accounts }, null, next) + compileFileOrFiles(filename, false, { accounts, web3 }, null, next) }, function deployAllContracts(compilationResult: compilationInterface, asts, next: any): void { for (const filename in asts) { @@ -131,8 +133,8 @@ describe('testRunner', function () { { type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' }, { type: 'testPass', debugTxHash: '0x5b665752a4faf83229259b9b2811d3295be0af633b0051d4b90042283ef55707', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest', hhLogs: hhLogs1 }, { type: 'testFailure', debugTxHash: '0xa0a30ad042a7fc3495f72be7ba788d705888ffbbec7173f60bb27e07721510f2', value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', hhLogs: hhLogs2, assertMethod: 'ok', location: '366:36:0', expected: 'true', returned: 'false' }, - - ], ['time', 'web3']) + // + ], ['time','type','debugTxHash','location','expected','returned','errMsg','assertMethod','web3']) }) }) @@ -141,7 +143,7 @@ describe('testRunner', function () { before((done) => { compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) => { - runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -182,7 +184,7 @@ describe('testRunner', function () { before((done) => { compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) => { - runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -222,7 +224,7 @@ describe('testRunner', function () { before((done) => { compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) => { - runTest('AssertGreaterThanTest', contracts.AssertGreaterThanTest, compilationData[filename]['AssertGreaterThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('AssertGreaterThanTest', contracts.AssertGreaterThanTest, compilationData[filename]['AssertGreaterThanTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -256,7 +258,7 @@ describe('testRunner', function () { before((done) => { compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) => { - runTest('AssertLesserThanTest', contracts.AssertLesserThanTest, compilationData[filename]['AssertLesserThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('AssertLesserThanTest', contracts.AssertLesserThanTest, compilationData[filename]['AssertLesserThanTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -291,7 +293,7 @@ describe('testRunner', function () { before((done) => { compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) => { - runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -322,7 +324,7 @@ describe('testRunner', function () { before(done => { compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) { - runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -352,7 +354,7 @@ describe('testRunner', function () { before(done => { compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) { - runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -378,7 +380,7 @@ describe('testRunner', function () { before(done => { compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) { - runTest('StorageResolveTest', contracts.StorageResolveTest, compilationData[filename]['StorageResolveTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('StorageResolveTest', contracts.StorageResolveTest, compilationData[filename]['StorageResolveTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -405,7 +407,7 @@ describe('testRunner', function () { before(done => { compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) { - runTest('SafeMathTest', contracts.SafeMathTest, compilationData[filename]['SafeMathTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('SafeMathTest', contracts.SafeMathTest, compilationData[filename]['SafeMathTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -425,7 +427,7 @@ describe('testRunner', function () { before(done => { compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) { - runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -445,7 +447,7 @@ describe('testRunner', function () { before(done => { compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) { - runTest('SenderAndValueTest', contracts.SenderAndValueTest, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + runTest('SenderAndValueTest', contracts.SenderAndValueTest, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts, web3 }, testCallback, resultsCallback(done)) }) }) @@ -473,7 +475,7 @@ describe('testRunner', function () { } before(done => { compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: any, contracts: any, asts: any, accounts: string[], web3: any) { - runTest('SenderAndValueTest', undefined, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, errorCallback(done)) + runTest('SenderAndValueTest', undefined, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts, web3 }, testCallback, errorCallback(done)) }) }) @@ -486,4 +488,4 @@ describe('testRunner', function () { }) }) -}) \ No newline at end of file +}) diff --git a/libs/remix-ui/debugger-ui/src/lib/api/debugger-api.ts b/libs/remix-ui/debugger-ui/src/lib/api/debugger-api.ts index 0879471fe83..a8fed04499a 100644 --- a/libs/remix-ui/debugger-ui/src/lib/api/debugger-api.ts +++ b/libs/remix-ui/debugger-ui/src/lib/api/debugger-api.ts @@ -14,9 +14,7 @@ export const DebuggerApiMixin = (Base) => class extends Base { const self = this this.web3Provider = { sendAsync (payload, callback) { - self.call('web3Provider', 'sendAsync', payload) - .then(result => callback(null, result)) - .catch(e => callback(e)) + return self.call('web3Provider', 'sendAsync', payload) } } this._web3 = new Web3(this.web3Provider) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx index 20af7302e33..55174aee9b2 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx @@ -4,6 +4,7 @@ import {TreeView, TreeViewItem} from '@remix-ui/tree-view' // eslint-disable-lin import {DropdownPanelProps, ExtractData, ExtractFunc} from '../../types' // eslint-disable-line import {CopyToClipboard} from '@remix-ui/clipboard' // eslint-disable-line import {initialState, reducer} from '../../reducers/calldata' +import {isBigInt} from 'web3-validator' import './styles/dropdown-panel.css' export const DropdownPanel = (props: DropdownPanelProps) => { @@ -55,6 +56,7 @@ export const DropdownPanel = (props: DropdownPanelProps) => { } const formatSelfDefault = (key: string | number, data: ExtractData) => { let value + if (isBigInt(data.self)) data.self = data.self.toString() if (hexHighlight && typeof data.self === 'string') { const isHex = data.self.startsWith('0x') || hexHighlight if (isHex) { @@ -184,6 +186,10 @@ export const DropdownPanel = (props: DropdownPanelProps) => { else if (calldata && Object.keys(calldata).length === 0 && calldata.constructor === Object) isEmpty = true setState((prevState) => { + const copiableContent = JSON.stringify(calldata, (key, value) => { + if (isBigInt(value)) value = value.toString() + return value + }, '\t').replace(/0xNaN/g, '0x0') return { ...prevState, dropdownContent: { @@ -191,7 +197,7 @@ export const DropdownPanel = (props: DropdownPanelProps) => { display: 'block' }, // replace 0xNaN with 0x0 - copiableContent: JSON.stringify(calldata, null, '\t').replace(/0xNaN/g, '0x0'), + copiableContent, message: { innerText: isEmpty ? intl.formatMessage({id: 'debugger.noDataAvailable'}) : '', display: isEmpty ? 'block' : 'none' diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx index 9c017786151..a649cc73b37 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx @@ -1,7 +1,6 @@ import React from 'react' // eslint-disable-line import DropdownPanel from './dropdown-panel' // eslint-disable-line -import {BN} from 'bn.js' -import Web3 from 'web3' +import {toBigInt} from 'web3-utils' // eslint-disable-line export const GlobalVariables = ({block, receipt, tx, className}) => { // see https://docs.soliditylang.org/en/latest/units-and-global-variables.html#block-and-transaction-properties @@ -18,7 +17,7 @@ export const GlobalVariables = ({block, receipt, tx, className}) => { 'tx.origin': tx && tx.from } if (block && block.baseFeePerGas) { - globals['block.basefee'] = Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` + globals['block.basefee'] = toBigInt(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` } return ( diff --git a/libs/remix-ui/editor/src/lib/web-types.ts b/libs/remix-ui/editor/src/lib/web-types.ts index dd70a43bc0a..9d95f1440e0 100644 --- a/libs/remix-ui/editor/src/lib/web-types.ts +++ b/libs/remix-ui/editor/src/lib/web-types.ts @@ -184,40 +184,32 @@ export const loadTypes = async (monaco) => { // Web3 // @ts-ignore - const indexWeb3 = await import('raw-loader!web3/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3.default, `file:///node_modules/@types/web3/index.d.ts`) + const indexWeb3 = await import('raw-loader!web3') + monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3.default, `file:///node_modules/web3/lib/types/index.d.ts`) // @ts-ignore - const indexWeb3Bzz = await import('raw-loader!web3-bzz/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Bzz.default, `file:///node_modules/@types/web3-bzz/index.d.ts`) + const indexWeb3Core = await import('raw-loader!web3-core') + monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Core.default, `file:///node_modules/web3-core/lib/types/index.d.ts`) // @ts-ignore - const indexWeb3Core = await import('raw-loader!web3-core/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Core.default, `file:///node_modules/@types/web3-core/index.d.ts`) + const indexWeb3Eth = await import('raw-loader!web3-eth') + monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Eth.default, `file:///node_modules/web3-eth/lib/types/index.d.ts`) // @ts-ignore - const indexWeb3Eth = await import('raw-loader!web3-eth/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Eth.default, `file:///node_modules/@types/web3-eth/index.d.ts`) + const indexWeb3Personal = await import('raw-loader!web3-eth-personal') + monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Personal.default, `file:///node_modules/web3-eth-personal/lib/types/index.d.ts`) // @ts-ignore - const indexWeb3Personal = await import('raw-loader!web3-eth-personal/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Personal.default, `file:///node_modules/@types/web3-eth-personal/index.d.ts`) + const indexWeb3Contract = await import('raw-loader!web3-eth-contract') + monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Contract.default, `file:///node_modules/web3-eth-contract/lib/types/index.d.ts`) // @ts-ignore - const indexWeb3Contract = await import('raw-loader!web3-eth-contract/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Contract.default, `file:///node_modules/@types/web3-eth-contract/index.d.ts`) + const indexWeb3Net = await import('raw-loader!web3-net') + monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Net.default, `file:///node_modules/web3-net/lib/types/index.d.ts`) // @ts-ignore - const indexWeb3Net = await import('raw-loader!web3-net/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Net.default, `file:///node_modules/@types/web3-net/index.d.ts`) - - // @ts-ignore - const indexWeb3Shh = await import('raw-loader!web3-shh/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Shh.default, `file:///node_modules/@types/web3-shh/index.d.ts`) - - // @ts-ignore - const indexWeb3Util = await import('raw-loader!web3-utils/types/index.d.ts') - monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Util.default, `file:///node_modules/@types/web3-utils/index.d.ts`) + const indexWeb3Util = await import('raw-loader!web3-utils') + monaco.languages.typescript.typescriptDefaults.addExtraLib(indexWeb3Util.default, `file:///node_modules/web3-utils/lib/types/index.d.ts`) // remix const indexRemixApi = remixTypes + `\n declare global { diff --git a/libs/remix-ui/run-tab/src/lib/components/mainnet.tsx b/libs/remix-ui/run-tab/src/lib/components/mainnet.tsx index 8d7b8046f43..06fc44ebd8e 100644 --- a/libs/remix-ui/run-tab/src/lib/components/mainnet.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/mainnet.tsx @@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react' import {FormattedMessage, useIntl} from 'react-intl' import {CopyToClipboard} from '@remix-ui/clipboard' -import Web3 from 'web3' +import {fromWei, toBigInt, toWei} from 'web3-utils' import {MainnetProps} from '../types' export function MainnetPrompt(props: MainnetProps) { @@ -15,7 +15,7 @@ export function MainnetPrompt(props: MainnetProps) { if (txFeeText) setTransactionFee(txFeeText) if (gasPriceValue) onGasPriceChange(gasPriceValue) if (props.network && props.network.lastBlock && props.network.lastBlock.baseFeePerGas) { - const baseFee = Web3.utils.fromWei(Web3.utils.toBN(props.network.lastBlock.baseFeePerGas), 'Gwei') + const baseFee = fromWei(toBigInt(props.network.lastBlock.baseFeePerGas), 'Gwei') setBaseFee(baseFee) onMaxFeeChange(baseFee) @@ -27,7 +27,7 @@ export function MainnetPrompt(props: MainnetProps) { const onMaxFeeChange = (value: string) => { const maxFee = value // @ts-ignore - if (Web3.utils.toBN(props.network.lastBlock.baseFeePerGas).gt(Web3.utils.toBN(Web3.utils.toWei(maxFee, 'Gwei')))) { + if (toBN(props.network.lastBlock.baseFeePerGas).gt(toBN(toWei(maxFee, 'Gwei')))) { setTransactionFee(intl.formatMessage({id: 'udapp.transactionFeeText'})) props.updateGasPriceStatus(false) props.updateConfirmSettings(true) @@ -125,7 +125,7 @@ export function MainnetPrompt(props: MainnetProps) {
- : + : = 1.5.0 < 2" - toidentifier "1.0.0" - http-errors@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" @@ -15485,11 +15004,6 @@ http-errors@~1.6.2: setprototypeof "1.1.0" statuses ">= 1.4.0 < 2" -http-https@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz#2f908dd5f1db4068c058cd6e6d4ce392c913389b" - integrity sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs= - http-parser-js@>=0.5.1: version "0.5.3" resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.3.tgz#01d2709c79d41698bb01d4decc5e9da4e4a033d9" @@ -15576,14 +15090,6 @@ http2-wrapper@^1.0.0-beta.5.2: quick-lru "^5.1.1" resolve-alpn "^1.0.0" -http2-wrapper@^2.1.10: - version "2.1.11" - resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.1.11.tgz#d7c980c7ffb85be3859b6a96c800b2951ae257ef" - integrity sha512-aNAk5JzLturWEUiuhAN73Jcbq96R7rTitAoXV54FYMatvihnpD2+6PUgU4ce3D/m5VDbw+F5CsyKSF176ptitQ== - dependencies: - quick-lru "^5.1.1" - resolve-alpn "^1.2.0" - https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" @@ -15686,13 +15192,6 @@ identity-obj-proxy@3.0.0: dependencies: harmony-reflect "^1.4.6" -idna-uts46-hx@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz#a1dc5c4df37eee522bf66d969cc980e00e8711f9" - integrity sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA== - dependencies: - punycode "2.1.0" - ieee754@^1.1.13, ieee754@^1.1.4, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -16417,11 +15916,6 @@ is-fullwidth-code-point@^4.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88" integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== -is-function@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" - integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== - is-generator-fn@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" @@ -16551,11 +16045,6 @@ is-obj@^2.0.0: resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== -is-object@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.2.tgz#a56552e1c665c9e950b4a025461da87e72f86fcf" - integrity sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA== - is-path-inside@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" @@ -16867,7 +16356,7 @@ isomorphic-textencoder@1.0.1: dependencies: fast-text-encoding "^1.0.0" -isomorphic-ws@5.0.0: +isomorphic-ws@5.0.0, isomorphic-ws@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== @@ -16981,14 +16470,6 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -isurl@^1.0.0-alpha5: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isurl/-/isurl-1.0.0.tgz#b27f4f49f3cdaa3ea44a0a5b7f3462e6edc39d67" - integrity sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w== - dependencies: - has-to-string-tag-x "^1.2.0" - is-object "^1.0.1" - it-all@^1.0.1: version "1.0.6" resolved "https://registry.yarnpkg.com/it-all/-/it-all-1.0.6.tgz#852557355367606295c4c3b7eff0136f07749335" @@ -17520,11 +17001,6 @@ js-sha3@0.8.0, js-sha3@^0.8.0: resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== -js-sha3@^0.5.7: - version "0.5.7" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" - integrity sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -18618,11 +18094,6 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== -lowercase-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" - integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== - lru-cache@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-3.2.0.tgz#71789b3b7f5399bec8565dda38aa30d2a097efee" @@ -19486,7 +18957,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== -mime-types@^2.1.12, mime-types@^2.1.16, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34, mime-types@~2.1.7: +mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34, mime-types@~2.1.7: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -19528,13 +18999,6 @@ mimic-response@^3.1.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== -min-document@^2.19.0: - version "2.19.0" - resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" - integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU= - dependencies: - dom-walk "^0.1.0" - min-indent@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" @@ -19868,11 +19332,6 @@ mocha@^8.0.1: yargs-parser "20.2.4" yargs-unparser "2.0.0" -mock-fs@^4.1.0: - version "4.14.0" - resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.14.0.tgz#ce5124d2c601421255985e6e94da80a7357b1b18" - integrity sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw== - modify-values@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -19956,11 +19415,6 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - ms@2.1.2, ms@^2.0.0, ms@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -19992,14 +19446,6 @@ multiaddr@^8.0.0: uint8arrays "^1.1.0" varint "^5.0.0" -multibase@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" - integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - multibase@^3.0.0, multibase@^3.1.0: version "3.1.2" resolved "https://registry.yarnpkg.com/multibase/-/multibase-3.1.2.tgz#59314e1e2c35d018db38e4c20bb79026827f0f2f" @@ -20015,14 +19461,6 @@ multibase@^4.0.1: dependencies: "@multiformats/base-x" "^4.0.1" -multibase@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz#b76df6298536cc17b9f6a6db53ec88f85f8cc12b" - integrity sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw== - dependencies: - base-x "^3.0.8" - buffer "^5.5.0" - multicast-dns@^7.2.5: version "7.2.5" resolved "https://registry.yarnpkg.com/multicast-dns/-/multicast-dns-7.2.5.tgz#77eb46057f4d7adbd16d9290fa7299f6fa64cced" @@ -20031,21 +19469,6 @@ multicast-dns@^7.2.5: dns-packet "^5.2.2" thunky "^1.0.2" -multicodec@^0.5.5: - version "0.5.7" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-0.5.7.tgz#1fb3f9dd866a10a55d226e194abba2dcc1ee9ffd" - integrity sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA== - dependencies: - varint "^5.0.0" - -multicodec@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz#46ac064657c40380c28367c90304d8ed175a714f" - integrity sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg== - dependencies: - buffer "^5.6.0" - varint "^5.0.0" - multicodec@^2.0.0: version "2.1.3" resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-2.1.3.tgz#b9850635ad4e2a285a933151b55b4a2294152a5d" @@ -20067,15 +19490,6 @@ multiformats@^9.4.2: resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.4.10.tgz#d654d06b28cc066506e4e59b246d65267fb6b93b" integrity sha512-BwWGvgqB/5J/cnWaOA0sXzJ+UGl+kyFAw3Sw1L6TN4oad34C9OpW+GCpYTYPDp4pUaXDC1EjvB3yv9Iodo1EhA== -multihashes@^0.4.15, multihashes@~0.4.15: - version "0.4.21" - resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz#dc02d525579f334a7909ade8a122dabb58ccfcb5" - integrity sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw== - dependencies: - buffer "^5.5.0" - multibase "^0.7.0" - varint "^5.0.0" - multihashes@^3.0.1: version "3.1.2" resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-3.1.2.tgz#ffa5e50497aceb7911f7b4a3b6cada9b9730edfc" @@ -20155,11 +19569,6 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee" integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ== -nano-json-stream-parser@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz#0cc8f6d0e2b622b479c40d499c46d64b755c6f5f" - integrity sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18= - nanoassert@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d" @@ -20392,6 +19801,13 @@ node-fetch@3.0.0-beta.9: data-uri-to-buffer "^3.0.1" fetch-blob "^2.1.1" +node-fetch@^2.6.12: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + node-fetch@^2.6.7: version "2.6.9" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" @@ -20935,14 +20351,6 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -number-to-bn@1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" - integrity sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA= - dependencies: - bn.js "4.11.6" - strip-hex-prefix "1.0.0" - nx@15.7.1: version "15.7.1" resolved "https://registry.yarnpkg.com/nx/-/nx-15.7.1.tgz#e4d881307907f266b698ed4d61af9b998faa54eb" @@ -21088,7 +20496,7 @@ oauth-sign@~0.9.0: object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== object-copy@^0.1.0: version "0.1.0" @@ -21244,13 +20652,6 @@ obliterator@^2.0.0: resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816" integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ== -oboe@2.1.5: - version "2.1.5" - resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.5.tgz#5554284c543a2266d7a38f17e073821fbde393cd" - integrity sha1-VVQoTFQ6ImbXo48X4HOCH73jk80= - dependencies: - http-https "^1.0.0" - obuf@^1.0.0, obuf@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" @@ -21273,13 +20674,6 @@ on-finished@2.4.1: dependencies: ee-first "1.1.1" -on-finished@~2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= - dependencies: - ee-first "1.1.1" - on-headers@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" @@ -21483,11 +20877,6 @@ outpipe@^1.1.0: dependencies: shell-quote "^1.4.2" -p-cancelable@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" - integrity sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw== - p-cancelable@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc" @@ -21498,11 +20887,6 @@ p-cancelable@^2.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf" integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== -p-cancelable@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" - integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== - p-defer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" @@ -21639,13 +21023,6 @@ p-retry@^4.5.0: "@types/retry" "0.12.0" retry "^0.13.1" -p-timeout@^1.1.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386" - integrity sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y= - dependencies: - p-finally "^1.0.0" - p-timeout@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-3.2.0.tgz#c7e17abc971d2a7962ef83626b35d635acf23dfe" @@ -21799,11 +21176,6 @@ parse-glob@^3.0.4: is-extglob "^1.0.0" is-glob "^2.0.0" -parse-headers@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.4.tgz#9eaf2d02bed2d1eff494331ce3df36d7924760bf" - integrity sha512-psZ9iZoCNFLrgRjZ1d8mn0h9WRqJwFxM9q3x7iUjN/YT2OksthDJ5TiPCu2F38kS4zutqfW+YdVVkBZZx3/1aw== - parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" @@ -22820,7 +22192,7 @@ protons@^2.0.0: uint8arrays "^3.0.0" varint "^5.0.0" -proxy-addr@~2.0.5, proxy-addr@~2.0.7: +proxy-addr@~2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== @@ -22922,11 +22294,6 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= -punycode@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" - integrity sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0= - punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -22999,11 +22366,6 @@ qs@6.11.0, qs@^6.4.0, qs@^6.7.0, qs@^6.9.4: dependencies: side-channel "^1.0.4" -qs@6.7.0: - version "6.7.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" - integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== - qs@^6.10.3: version "6.11.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.1.tgz#6c29dff97f0c0060765911ba65cbc9764186109f" @@ -23031,15 +22393,6 @@ query-string@7.1.3: split-on-first "^1.0.0" strict-uri-encode "^2.0.0" -query-string@^5.0.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" - integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== - dependencies: - decode-uri-component "^0.2.0" - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - query-string@^6.13.5, query-string@^6.13.8: version "6.14.1" resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.14.1.tgz#7ac2dca46da7f309449ba0f86b1fd28255b0c86a" @@ -23131,16 +22484,6 @@ range-parser@^1.2.1, range-parser@~1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" - integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== - dependencies: - bytes "3.1.0" - http-errors "1.7.2" - iconv-lite "0.4.24" - unpipe "1.0.0" - raw-body@2.5.1, raw-body@^2.4.1: version "2.5.1" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" @@ -24068,7 +23411,7 @@ request@2, request@^2.74.0, request@~2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" -request@^2.79.0, request@^2.83.0, request@^2.88.0: +request@^2.83.0, request@^2.88.0: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -24129,7 +23472,7 @@ reset@^0.1.0: resolved "https://registry.yarnpkg.com/reset/-/reset-0.1.0.tgz#9fc7314171995ae6cb0b7e58b06ce7522af4bafb" integrity sha1-n8cxQXGZWubLC35YsGznUir0uvs= -resolve-alpn@^1.0.0, resolve-alpn@^1.2.0: +resolve-alpn@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== @@ -24616,7 +23959,7 @@ schema-utils@^4.0.0: ajv-formats "^2.1.1" ajv-keywords "^5.0.0" -scrypt-js@3.0.1, scrypt-js@^3.0.0, scrypt-js@^3.0.1: +scrypt-js@3.0.1, scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== @@ -24733,25 +24076,6 @@ semver@~7.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -send@0.17.1: - version "0.17.1" - resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" - integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== - dependencies: - debug "2.6.9" - depd "~1.1.2" - destroy "~1.0.4" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "~1.7.2" - mime "1.6.0" - ms "2.1.1" - on-finished "~2.3.0" - range-parser "~1.2.1" - statuses "~1.5.0" - send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -24807,16 +24131,6 @@ serve-index@^1.9.1: mime-types "~2.1.17" parseurl "~1.3.2" -serve-static@1.14.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" - integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.3" - send "0.17.1" - serve-static@1.15.0: version "1.15.0" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" @@ -24827,17 +24141,6 @@ serve-static@1.15.0: parseurl "~1.3.3" send "0.18.0" -servify@^0.1.12: - version "0.1.12" - resolved "https://registry.yarnpkg.com/servify/-/servify-0.1.12.tgz#142ab7bee1f1d033b66d0707086085b17c06db95" - integrity sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw== - dependencies: - body-parser "^1.16.0" - cors "^2.8.1" - express "^4.14.0" - request "^2.79.0" - xhr "^2.3.3" - set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -24877,11 +24180,6 @@ setprototypeof@1.1.0: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== -setprototypeof@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" - integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== - setprototypeof@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" @@ -25018,7 +24316,7 @@ simple-concat@^1.0.0: resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== -simple-get@^2.5.1, simple-get@^2.7.0: +simple-get@^2.5.1: version "2.8.2" resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.2.tgz#5708fb0919d440657326cd5fe7d2599d07705019" integrity sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw== @@ -25583,7 +24881,7 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@~1.5.0: +"statuses@>= 1.4.0 < 2": version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= @@ -25673,11 +24971,6 @@ streamx@^2.15.0: fast-fifo "^1.1.0" queue-tick "^1.0.1" -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= - strict-uri-encode@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" @@ -26173,23 +25466,6 @@ svgpath@^2.3.0: resolved "https://registry.yarnpkg.com/svgpath/-/svgpath-2.6.0.tgz#5b160ef3d742b7dfd2d721bf90588d3450d7a90d" integrity sha512-OIWR6bKzXvdXYyO4DK/UWa1VA1JeKq8E+0ug2DG98Y/vOmMpfZNj+TIG988HjfYSqtcy/hFOtZq/n/j5GSESNg== -swarm-js@^0.1.40: - version "0.1.40" - resolved "https://registry.yarnpkg.com/swarm-js/-/swarm-js-0.1.40.tgz#b1bc7b6dcc76061f6c772203e004c11997e06b99" - integrity sha512-yqiOCEoA4/IShXkY3WKwP5PvZhmoOOD8clsKA7EEcRILMkTEYHCQ21HDCAcVpmIxZq4LyZvWeRJ6quIyHk1caA== - dependencies: - bluebird "^3.5.0" - buffer "^5.0.5" - eth-lib "^0.1.26" - fs-extra "^4.0.2" - got "^7.1.0" - mime-types "^2.1.16" - mkdirp-promise "^5.0.1" - mock-fs "^4.1.0" - setimmediate "^1.0.5" - tar "^4.0.2" - xhr-request "^1.0.1" - syntax-error@^1.1.1: version "1.4.0" resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c" @@ -26300,7 +25576,7 @@ tar@^2.0.0, tar@~2.2.1: fstream "^1.0.12" inherits "2" -tar@^4.0.2, tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: +tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: version "4.4.19" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== @@ -26489,7 +25765,7 @@ time-stamp@^2.2.0: resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-2.2.0.tgz#917e0a66905688790ec7bbbde04046259af83f57" integrity sha512-zxke8goJQpBeEgD82CXABeMh0LSJcj7CXEd0OHOg45HgcofF7pxNwZm9+RknpxpDhwN4gFpySkApKfFYfRQnUA== -timed-out@^4.0.0, timed-out@^4.0.1: +timed-out@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" integrity sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= @@ -26612,11 +25888,6 @@ toggle-selection@^1.0.6: resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" integrity sha1-bkWxJj8gF/oKzH2J14sVuL932jI= -toidentifier@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" - integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== - toidentifier@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" @@ -26935,7 +26206,7 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-is@~1.6.17, type-is@~1.6.18: +type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== @@ -26997,7 +26268,7 @@ typed-assert@^1.0.8: resolved "https://registry.yarnpkg.com/typed-assert/-/typed-assert-1.0.9.tgz#8af9d4f93432c4970ec717e3006f33f135b06213" integrity sha512-KNNZtayBCtmnNmbo5mG47p1XsCyrx6iVqomjcZnec/1Y5GGARaxPs6r49RnSPeUP3YjNYiU9sQHAtY4BBvnZwg== -typedarray-to-buffer@3.1.5, typedarray-to-buffer@^3.1.5: +typedarray-to-buffer@3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== @@ -27078,11 +26349,6 @@ ultron@1.0.x: resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa" integrity sha512-QMpnpVtYaWEeY+MwKDN/UdKlE/LsFZXM5lO1u7GaZzNgmIbGixHEmVMIKT+vqYOALu3m5GYQy9kz4Xu4IVn7Ow== -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" - integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== - umask@^1.1.0, umask@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d" @@ -27429,16 +26695,6 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.0.0" -url-set-query@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz#016e8cfd7c20ee05cafe7795e892bd0702faa339" - integrity sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk= - -url-to-options@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" - integrity sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k= - url@^0.11.0, url@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" @@ -27498,11 +26754,6 @@ utf8-byte-length@^1.0.1: resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz#f45f150c4c66eee968186505ab93fcbb8ad6bf61" integrity sha1-9F8VDExm7uloGGUFq5P8u4rWv2E= -utf8@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" - integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== - util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -27589,11 +26840,6 @@ uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -uuid@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" - integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== - uvu@^0.5.0: version "0.5.6" resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.6.tgz#2754ca20bcb0bb59b64e9985e84d2e81058502df" @@ -27679,7 +26925,7 @@ varint@^6.0.0: vary@^1, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== verror@1.3.6: version "1.3.6" @@ -27882,234 +27128,216 @@ web-streams-polyfill@^3.1.0: resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz#a6b74026b38e4885869fb5c589e90b95ccfc7965" integrity sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA== -web3-bzz@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.8.2.tgz#67ea1c775874056250eece551ded22905ed08784" - integrity sha512-1EEnxjPnFnvNWw3XeeKuTR8PBxYd0+XWzvaLK7OJC/Go9O8llLGxrxICbKV+8cgIE0sDRBxiYx02X+6OhoAQ9w== - dependencies: - "@types/node" "^12.12.6" - got "12.1.0" - swarm-js "^0.1.40" - -web3-core-helpers@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.8.2.tgz#82066560f8085e6c7b93bcc8e88b441289ea9f9f" - integrity sha512-6B1eLlq9JFrfealZBomd1fmlq1o4A09vrCVQSa51ANoib/jllT3atZrRDr0zt1rfI7TSZTZBXdN/aTdeN99DWw== - dependencies: - web3-eth-iban "1.8.2" - web3-utils "1.8.2" - -web3-core-method@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.8.2.tgz#ba5ec68084e903f0516415010477618be017eac2" - integrity sha512-1qnr5mw5wVyULzLOrk4B+ryO3gfGjGd/fx8NR+J2xCGLf1e6OSjxT9vbfuQ3fErk/NjSTWWreieYWLMhaogcRA== - dependencies: - "@ethersproject/transactions" "^5.6.2" - web3-core-helpers "1.8.2" - web3-core-promievent "1.8.2" - web3-core-subscriptions "1.8.2" - web3-utils "1.8.2" +web3-core@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-4.3.0.tgz#96c5e8f7ec92ea573f388785548bf31c4089d508" + integrity sha512-//cy1W780nkMXd/9g2+GIa7KlHMuE+PJPhPD4NdwpUxvtQni6GkXSxtFnImZufyGVP+BpO5g7QneiSeu5ce+IQ== + dependencies: + web3-errors "^1.1.3" + web3-eth-iban "^4.0.7" + web3-providers-http "^4.1.0" + web3-providers-ws "^4.0.7" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" + optionalDependencies: + web3-providers-ipc "^4.0.7" -web3-core-promievent@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.8.2.tgz#e670d6b4453632e6ecfd9ad82da44f77ac1585c9" - integrity sha512-nvkJWDVgoOSsolJldN33tKW6bKKRJX3MCPDYMwP5SUFOA/mCzDEoI88N0JFofDTXkh1k7gOqp1pvwi9heuaxGg== +web3-errors@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/web3-errors/-/web3-errors-1.1.3.tgz#d3516c2012ba3892fe3926c3c0f671fb625514bf" + integrity sha512-3GA4leG6XsKLmFWe62mIjVgW4GhkJmvd4IaRLgnKtNnqNmx6L9YWysYwgQ09BaD/NmhKN+AtalSVRds8gU+N0w== dependencies: - eventemitter3 "4.0.4" + web3-types "^1.3.0" -web3-core-requestmanager@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.8.2.tgz#dda95e83ca4808949612a41e54ecea557f78ef26" - integrity sha512-p1d090RYs5Mu7DK1yyc3GCBVZB/03rBtFhYFoS2EruGzOWs/5Q0grgtpwS/DScdRAm8wB8mYEBhY/RKJWF6B2g== +web3-eth-abi@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-4.1.3.tgz#82ef303e02250d5193f20bb6c5cc0c72eb761ce8" + integrity sha512-iInBZFXWtmH3hC2dKZY6peO5QeprXj/SMZLDZXaiRk6ZYjKX07BpdnMAKniaguhi5OHz8HoFAqy3OGCH/k8x+g== dependencies: - util "^0.12.5" - web3-core-helpers "1.8.2" - web3-providers-http "1.8.2" - web3-providers-ipc "1.8.2" - web3-providers-ws "1.8.2" + abitype "0.7.1" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" -web3-core-subscriptions@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.8.2.tgz#0c8bd49439d83c6f0a03c70f00b24a915a70a5ed" - integrity sha512-vXQogHDmAIQcKpXvGiMddBUeP9lnKgYF64+yQJhPNE5PnWr1sAibXuIPV7mIPihpFr/n/DORRj6Wh1pUv9zaTw== +web3-eth-accounts@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-4.1.0.tgz#5b5e6c60d457e7b829ec590021fc87ada8585920" + integrity sha512-UFtAsOANsvihTQ6SSvOKguupmQkResyR9M9JNuOxYpKh7+3W+sTnbLXw2UbOSYIsKlc1mpqqW9bVr1SjqHDpUQ== dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.8.2" + "@ethereumjs/rlp" "^4.0.1" + crc-32 "^1.2.2" + ethereum-cryptography "^2.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" -web3-core@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.8.2.tgz#333e93d7872b1a36efe758ed8b89a7acbdd962c2" - integrity sha512-DJTVEAYcNqxkqruJE+Rxp3CIv0y5AZMwPHQmOkz/cz+MM75SIzMTc0AUdXzGyTS8xMF8h3YWMQGgGEy8SBf1PQ== +web3-eth-contract@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-4.1.1.tgz#60bb9df7acba158a9da692c81b5b6454c71dbc2c" + integrity sha512-jSjHB0elvq7YbrLwfBKdMkeiNVIqg/UO5EbfmGwRvalGe/I6l9kerQntZbjTMbOj/9v9eEZjO7wfPIAtg1UTLg== + dependencies: + web3-core "^4.3.0" + web3-errors "^1.1.3" + web3-eth "^4.3.0" + web3-eth-abi "^4.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" + +web3-eth-ens@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-4.0.7.tgz#afdfd51e6f16faf658e5ecc5d18b74283c2e1b1c" + integrity sha512-CXx+u66Jse/4cP6h6QazTe2+RX7VaHJjAhYA1Fpw6xVIBjCriCk0hgZRBBbolNCstmaGxWDJwqCN9EcV7o3Rvg== + dependencies: + "@adraffy/ens-normalize" "^1.8.8" + web3-core "^4.3.0" + web3-errors "^1.1.3" + web3-eth "^4.3.0" + web3-eth-contract "^4.1.1" + web3-net "^4.0.7" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" + +web3-eth-iban@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-4.0.7.tgz#ee504f845d7b6315f0be78fcf070ccd5d38e4aaf" + integrity sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ== dependencies: - "@types/bn.js" "^5.1.0" - "@types/node" "^12.12.6" - bignumber.js "^9.0.0" - web3-core-helpers "1.8.2" - web3-core-method "1.8.2" - web3-core-requestmanager "1.8.2" - web3-utils "1.8.2" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" -web3-eth-abi@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.8.2.tgz#16e1e9be40e2527404f041a4745111211488f31a" - integrity sha512-Om9g3kaRNjqiNPAgKwGT16y+ZwtBzRe4ZJFGjLiSs6v5I7TPNF+rRMWuKnR6jq0azQZDj6rblvKFMA49/k48Og== +web3-eth-personal@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-4.0.7.tgz#21de4b73479d324a5907eb5f46bd6df1d48cfb6b" + integrity sha512-UmHdy54YxgcLGISu5ZPwgtKYbY5zCeccy8oEoMnblrvAwzFZ09v/kmMKvN09hh5oytcZt+nG/s2ff+HyMUML9w== dependencies: - "@ethersproject/abi" "^5.6.3" - web3-utils "1.8.2" + web3-core "^4.3.0" + web3-eth "^4.3.0" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" -web3-eth-accounts@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.8.2.tgz#b894f5d5158fcae429da42de75d96520d0712971" - integrity sha512-c367Ij63VCz9YdyjiHHWLFtN85l6QghgwMQH2B1eM/p9Y5lTlTX7t/Eg/8+f1yoIStXbk2w/PYM2lk+IkbqdLA== - dependencies: - "@ethereumjs/common" "2.5.0" - "@ethereumjs/tx" "3.3.2" - eth-lib "0.2.8" - ethereumjs-util "^7.1.5" - scrypt-js "^3.0.1" - uuid "^9.0.0" - web3-core "1.8.2" - web3-core-helpers "1.8.2" - web3-core-method "1.8.2" - web3-utils "1.8.2" - -web3-eth-contract@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.8.2.tgz#5388b7130923d2b790c09a420391a81312a867fb" - integrity sha512-ID5A25tHTSBNwOPjiXSVzxruz006ULRIDbzWTYIFTp7NJ7vXu/kynKK2ag/ObuTqBpMbobP8nXcA9b5EDkIdQA== +web3-eth@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-4.3.0.tgz#997bddd92863a8e877c6e010b660efc12aa9bc21" + integrity sha512-7FSFc947j5rCAotQ4lhXdY3JCmDvZ75CY97UYN2bzfDUlPsVORzGFR8n2LPG1NZjxFWpSLtA4CCuqlAca/Gxsg== dependencies: - "@types/bn.js" "^5.1.0" - web3-core "1.8.2" - web3-core-helpers "1.8.2" - web3-core-method "1.8.2" - web3-core-promievent "1.8.2" - web3-core-subscriptions "1.8.2" - web3-eth-abi "1.8.2" - web3-utils "1.8.2" - -web3-eth-ens@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.8.2.tgz#0a086ad4d919102e28b9fd3036df246add9df22a" - integrity sha512-PWph7C/CnqdWuu1+SH4U4zdrK4t2HNt0I4XzPYFdv9ugE8EuojselioPQXsVGvjql+Nt3jDLvQvggPqlMbvwRw== - dependencies: - content-hash "^2.5.2" - eth-ens-namehash "2.0.8" - web3-core "1.8.2" - web3-core-helpers "1.8.2" - web3-core-promievent "1.8.2" - web3-eth-abi "1.8.2" - web3-eth-contract "1.8.2" - web3-utils "1.8.2" - -web3-eth-iban@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.8.2.tgz#5cb3022234b13986f086353b53f0379a881feeaf" - integrity sha512-h3vNblDWkWMuYx93Q27TAJz6lhzpP93EiC3+45D6xoz983p6si773vntoQ+H+5aZhwglBtoiBzdh7PSSOnP/xQ== + setimmediate "^1.0.5" + web3-core "^4.3.0" + web3-errors "^1.1.3" + web3-eth-abi "^4.1.3" + web3-eth-accounts "^4.1.0" + web3-net "^4.0.7" + web3-providers-ws "^4.0.7" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" + +web3-net@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-4.0.7.tgz#ed2c1bd700cf94be93a6dbd8bd8aa413d8681942" + integrity sha512-SzEaXFrBjY25iQGk5myaOfO9ZyfTwQEa4l4Ps4HDNVMibgZji3WPzpjq8zomVHMwi8bRp6VV7YS71eEsX7zLow== dependencies: - bn.js "^5.2.1" - web3-utils "1.8.2" + web3-core "^4.3.0" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" -web3-eth-personal@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.8.2.tgz#3526c1ebaa4e7bf3a0a8ec77e34f067cc9a750b2" - integrity sha512-Vg4HfwCr7doiUF/RC+Jz0wT4+cYaXcOWMAW2AHIjHX6Z7Xwa8nrURIeQgeEE62qcEHAzajyAdB1u6bJyTfuCXw== +web3-providers-http@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-4.1.0.tgz#8d7afda67d1d8542ca85b30f60a3d1fe1993b561" + integrity sha512-6qRUGAhJfVQM41E5t+re5IHYmb5hSaLc02BE2MaRQsz2xKA6RjmHpOA5h/+ojJxEpI9NI2CrfDKOAgtJfoUJQg== dependencies: - "@types/node" "^12.12.6" - web3-core "1.8.2" - web3-core-helpers "1.8.2" - web3-core-method "1.8.2" - web3-net "1.8.2" - web3-utils "1.8.2" + cross-fetch "^4.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" -web3-eth@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.8.2.tgz#8562287ae1803c30eb54dc7d832092e5739ce06a" - integrity sha512-JoTiWWc4F4TInpbvDUGb0WgDYJsFhuIjJlinc5ByjWD88Gvh+GKLsRjjFdbqe5YtwIGT4NymwoC5LQd1K6u/QQ== - dependencies: - web3-core "1.8.2" - web3-core-helpers "1.8.2" - web3-core-method "1.8.2" - web3-core-subscriptions "1.8.2" - web3-eth-abi "1.8.2" - web3-eth-accounts "1.8.2" - web3-eth-contract "1.8.2" - web3-eth-ens "1.8.2" - web3-eth-iban "1.8.2" - web3-eth-personal "1.8.2" - web3-net "1.8.2" - web3-utils "1.8.2" - -web3-net@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-net/-/web3-net-1.8.2.tgz#97e1e0015fabc4cda31017813e98d0b5468dd04f" - integrity sha512-1itkDMGmbgb83Dg9nporFes9/fxsU7smJ3oRXlFkg4ZHn8YJyP1MSQFPJWWwSc+GrcCFt4O5IrUTvEkHqE3xag== +web3-providers-ipc@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-4.0.7.tgz#9ec4c8565053af005a5170ba80cddeb40ff3e3d3" + integrity sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g== dependencies: - web3-core "1.8.2" - web3-core-method "1.8.2" - web3-utils "1.8.2" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" -web3-providers-http@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.8.2.tgz#fbda3a3bbc8db004af36e91bec35f80273b37885" - integrity sha512-2xY94IIEQd16+b+vIBF4IC1p7GVaz9q4EUFscvMUjtEq4ru4Atdzjs9GP+jmcoo49p70II0UV3bqQcz0TQfVyQ== +web3-providers-ws@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-4.0.7.tgz#7a78a0dcf077e0e802da524fbb37d080b356c14b" + integrity sha512-n4Dal9/rQWjS7d6LjyEPM2R458V8blRm0eLJupDEJOOIBhGYlxw5/4FthZZ/cqB7y/sLVi7K09DdYx2MeRtU5w== dependencies: - abortcontroller-polyfill "^1.7.3" - cross-fetch "^3.1.4" - es6-promise "^4.2.8" - web3-core-helpers "1.8.2" + "@types/ws" "8.5.3" + isomorphic-ws "^5.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + ws "^8.8.1" -web3-providers-ipc@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.8.2.tgz#e52a7250f40c83b99a2482ec5b4cf2728377ae5c" - integrity sha512-p6fqKVGFg+WiXGHWnB1hu43PbvPkDHTz4RgoEzbXugv5rtv5zfYLqm8Ba6lrJOS5ks9kGKR21a0y3NzE3u7V4w== +web3-rpc-methods@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/web3-rpc-methods/-/web3-rpc-methods-1.1.3.tgz#4be8a85628d8b69846e2e0afa0ed71e3f6eaf163" + integrity sha512-XB6SsCZZPdZUMPIRqDxJkZFKMu0/Y+yaExAt+Z7RqmuM7xF55fJ/Qb84LQho8zarvUoYziy4jnIfs+SXImxQUw== dependencies: - oboe "2.1.5" - web3-core-helpers "1.8.2" + web3-core "^4.3.0" + web3-types "^1.3.0" + web3-validator "^2.0.3" -web3-providers-ws@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.8.2.tgz#56a2b701387011aca9154ca4bc06ea4b5f27e4ef" - integrity sha512-3s/4K+wHgbiN+Zrp9YjMq2eqAF6QGABw7wFftPdx+m5hWImV27/MoIx57c6HffNRqZXmCHnfWWFCNHHsi7wXnA== - dependencies: - eventemitter3 "4.0.4" - web3-core-helpers "1.8.2" - websocket "^1.0.32" +web3-types@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/web3-types/-/web3-types-1.3.0.tgz#b25900c11b42459ce756f97628dbd53cb222ef75" + integrity sha512-ReRq6D0w6Mr6PkC8mtn6JwBgbVAobPFYNWFO994C7LzTNweYQegb0peri5KMpEHQm2iG2tQbiIyAAeseIohc2Q== -web3-shh@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.8.2.tgz#217a417f0d6e243dd4d441848ffc2bd164cea8a0" - integrity sha512-uZ+3MAoNcaJsXXNCDnizKJ5viBNeHOFYsCbFhV755Uu52FswzTOw6DtE7yK9nYXMtIhiSgi7nwl1RYzP8pystw== +web3-utils@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-4.0.7.tgz#7df497b7cdd06cdfe7d02036c45fecbe3382d137" + integrity sha512-sy8S6C2FIa5NNHc8DjND+Fx3S8KDAizuh5RbL1RX3h0PRbFgPfWzF5RfUns8gTt0mjJuOhs/IaDhrZfeTszG5A== dependencies: - web3-core "1.8.2" - web3-core-method "1.8.2" - web3-core-subscriptions "1.8.2" - web3-net "1.8.2" + ethereum-cryptography "^2.0.0" + web3-errors "^1.1.3" + web3-types "^1.3.0" + web3-validator "^2.0.3" -web3-utils@1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.8.2.tgz#c32dec5e9b955acbab220eefd7715bc540b75cc9" - integrity sha512-v7j6xhfLQfY7xQDrUP0BKbaNrmZ2/+egbqP9q3KYmOiPpnvAfol+32slgL0WX/5n8VPvKCK5EZ1HGrAVICSToA== +web3-validator@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/web3-validator/-/web3-validator-2.0.3.tgz#e5dcd4b4902612cff21b7f8817dd233393999d97" + integrity sha512-fJbAQh+9LSNWy+l5Ze6HABreml8fra98o5+vS073T35jUcLbRZ0IOjF/ZPJhJNbJDt+jP1vseZsc3z3uX9mxxQ== dependencies: - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereumjs-util "^7.1.0" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" + ethereum-cryptography "^2.0.0" + util "^0.12.5" + web3-errors "^1.1.3" + web3-types "^1.3.0" + zod "^3.21.4" -web3@^1.8.0: - version "1.8.2" - resolved "https://registry.yarnpkg.com/web3/-/web3-1.8.2.tgz#95a4e5398fd0f01325264bf8e5e8cdc69a7afe86" - integrity sha512-92h0GdEHW9wqDICQQKyG4foZBYi0OQkyg4CRml2F7XBl/NG+fu9o6J19kzfFXzSBoA4DnJXbyRgj/RHZv5LRiw== - dependencies: - web3-bzz "1.8.2" - web3-core "1.8.2" - web3-eth "1.8.2" - web3-eth-personal "1.8.2" - web3-net "1.8.2" - web3-shh "1.8.2" - web3-utils "1.8.2" +web3@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/web3/-/web3-4.2.0.tgz#c51cb274c97c03c47fe98557a6588ce3ffdf5cec" + integrity sha512-UKrcfVqum+ZmdW2Fu2cqoKApPYz17zEsKizK5fZaPu/VvWq2KuXoUrsEzAbXtDgpYhIuBnBnQIa3XtyrhroBLQ== + dependencies: + web3-core "^4.3.0" + web3-errors "^1.1.3" + web3-eth "^4.3.0" + web3-eth-abi "^4.1.3" + web3-eth-accounts "^4.1.0" + web3-eth-contract "^4.1.1" + web3-eth-ens "^4.0.7" + web3-eth-iban "^4.0.7" + web3-eth-personal "^4.0.7" + web3-net "^4.0.7" + web3-providers-http "^4.1.0" + web3-providers-ws "^4.0.7" + web3-rpc-methods "^1.1.3" + web3-types "^1.3.0" + web3-utils "^4.0.7" + web3-validator "^2.0.3" webidl-conversions@^3.0.0: version "3.0.1" @@ -28270,18 +27498,6 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== -websocket@^1.0.32: - version "1.0.34" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" - integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== - dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.50" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" - whatwg-encoding@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" @@ -28610,15 +27826,6 @@ ws@^1.1.1: options ">=0.0.5" ultron "1.0.x" -ws@^3.0.0: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" - integrity sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA== - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" - ws@^7.3.0, ws@^7.5.0: version "7.5.5" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" @@ -28634,7 +27841,7 @@ ws@^8.4.2: resolved "https://registry.yarnpkg.com/ws/-/ws-8.9.0.tgz#2a994bb67144be1b53fe2d23c53c028adeb7f45e" integrity sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg== -ws@^8.5.0: +ws@^8.5.0, ws@^8.8.1: version "8.13.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== @@ -28644,36 +27851,6 @@ xdg-basedir@^3.0.0: resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" integrity sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ= -xhr-request-promise@^0.1.2: - version "0.1.3" - resolved "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz#2d5f4b16d8c6c893be97f1a62b0ed4cf3ca5f96c" - integrity sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg== - dependencies: - xhr-request "^1.1.0" - -xhr-request@^1.0.1, xhr-request@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz#f4a7c1868b9f198723444d82dcae317643f2e2ed" - integrity sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA== - dependencies: - buffer-to-arraybuffer "^0.0.5" - object-assign "^4.1.1" - query-string "^5.0.1" - simple-get "^2.7.0" - timed-out "^4.0.1" - url-set-query "^1.0.0" - xhr "^2.0.4" - -xhr@^2.0.4, xhr@^2.3.3: - version "2.6.0" - resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz#b69d4395e792b4173d6b7df077f0fc5e4e2b249d" - integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== - dependencies: - global "~4.4.0" - is-function "^1.0.1" - parse-headers "^2.0.0" - xtend "^4.0.0" - xml2js@^0.4.19: version "0.4.23" resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66" @@ -28712,11 +27889,6 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" - integrity sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= - yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" @@ -28987,6 +28159,11 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== +zod@^3.21.4: + version "3.22.4" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" + integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== + zustand@^4.3.1: version "4.3.6" resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.3.6.tgz#ce7804eb75361af0461a2d0536b65461ec5de86f"