From 368d58458a179d0dec9e93c612078410ca46f491 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 24 Oct 2023 21:41:47 +0200 Subject: [PATCH] rename testPlugin to remix --- apps/remix-ide/src/app/plugins/solidity-script.tsx | 2 +- apps/remix-ide/src/blockchain/blockchain.tsx | 8 ++++---- libs/remix-lib/src/execution/txListener.ts | 4 ++-- libs/remix-lib/src/execution/txRunnerWeb3.ts | 2 +- libs/remix-simulator/src/provider.ts | 4 ++-- libs/remix-tests/src/testRunner.ts | 10 +++++----- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/solidity-script.tsx b/apps/remix-ide/src/app/plugins/solidity-script.tsx index c5eeaca32f..4da5425a34 100644 --- a/apps/remix-ide/src/app/plugins/solidity-script.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-script.tsx @@ -81,7 +81,7 @@ export class SolidityScript extends Plugin { } const receiptCall = await web3.eth.sendTransaction(tx) - const hhlogs = await web3.testPlugin.getHHLogsForTx(receiptCall.transactionHash) + const hhlogs = await web3.remix.getHHLogsForTx(receiptCall.transactionHash) if (hhlogs && hhlogs.length) { const finalLogs = ( diff --git a/apps/remix-ide/src/blockchain/blockchain.tsx b/apps/remix-ide/src/blockchain/blockchain.tsx index dbb3eaa77c..3abd4ce1e2 100644 --- a/apps/remix-ide/src/blockchain/blockchain.tsx +++ b/apps/remix-ide/src/blockchain/blockchain.tsx @@ -748,7 +748,7 @@ export class Blockchain extends Plugin { if (error) return reject(error) try { if (this.executionContext.isVM()) { - const execResult = await this.web3().testPlugin.getExecutionResultFromSimulator(result.transactionHash) + const execResult = await this.web3().remix.getExecutionResultFromSimulator(result.transactionHash) resolve(resultToRemixTx(result, execResult)) } else resolve(resultToRemixTx(result)) } catch (e) { @@ -869,7 +869,7 @@ export class Blockchain extends Plugin { const isVM = this.executionContext.isVM() if (isVM && tx.useCall) { try { - result.transactionHash = await this.web3().testPlugin.getHashFromTagBySimulator(timestamp) + result.transactionHash = await this.web3().remix.getHashFromTagBySimulator(timestamp) } catch (e) { console.log('unable to retrieve back the "call" hash', e) } @@ -910,7 +910,7 @@ export class Blockchain extends Plugin { let execResult let returnValue = null if (isVM) { - const hhlogs = await this.web3().testPlugin.getHHLogsForTx(txResult.transactionHash) + const hhlogs = await this.web3().remix.getHHLogsForTx(txResult.transactionHash) if (hhlogs && hhlogs.length) { const finalLogs = ( @@ -936,7 +936,7 @@ export class Blockchain extends Plugin { _paq.push(['trackEvent', 'udapp', 'hardhat', 'console.log']) this.call('terminal', 'logHtml', finalLogs) } - execResult = await this.web3().testPlugin.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. diff --git a/libs/remix-lib/src/execution/txListener.ts b/libs/remix-lib/src/execution/txListener.ts index 27d6a40f6b..203a0b9b66 100644 --- a/libs/remix-lib/src/execution/txListener.ts +++ b/libs/remix-lib/src/execution/txListener.ts @@ -63,7 +63,7 @@ export class TxListener { let returnValue let execResult if (this.executionContext.isVM()) { - execResult = await this.executionContext.web3().testPlugin.getExecutionResultFromSimulator(txResult.transactionHash) + execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash) returnValue = toBuffer(execResult.returnValue) } else { returnValue = toBuffer(addHexPrefix(txResult.result)) @@ -97,7 +97,7 @@ export class TxListener { this.executionContext.web3().eth.getTransaction(txResult.transactionHash).then(async tx=>{ let execResult if (this.executionContext.isVM()) { - execResult = await this.executionContext.web3().testPlugin.getExecutionResultFromSimulator(txResult.transactionHash) + execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash) } addExecutionCosts(txResult, tx, execResult) diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 9a49d8b43b..a18c66b373 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -103,7 +103,7 @@ export class TxRunnerWeb3 { tx['gas'] = gasLimit if (this._api && this._api.isVM()) { tx['timestamp'] = timestamp; - (this.getWeb3() as any).testPlugin.callBySimulator(tx) + (this.getWeb3() as any).remix.callBySimulator(tx) .then((result: any) => callback(null, { result: result })) diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index 8317444203..513c123b18 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -133,13 +133,13 @@ export class Provider { } export function extend (web3) { - if(!web3.testPlugin){ + if(!web3.remix){ web3.registerPlugin(new Web3TestPlugin()) } } class Web3TestPlugin extends Web3PluginBase { - public pluginNamespace = 'testPlugin' + public pluginNamespace = 'remix' public getExecutionResultFromSimulator(transactionHash) { return this.requestManager.send({ diff --git a/libs/remix-tests/src/testRunner.ts b/libs/remix-tests/src/testRunner.ts index a382e7de53..3f59dd1f12 100644 --- a/libs/remix-tests/src/testRunner.ts +++ b/libs/remix-tests/src/testRunner.ts @@ -250,12 +250,12 @@ export function runTest (testName: string, testObject: any, contractDetails: Com if (func.constant) { sendParams = {} const tagTimestamp = 'remix_tests_tag' + Date.now() - if (web3.testPlugin && web3.testPlugin.registerCallId) web3.testPlugin.registerCallId(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.testPlugin && web3.testPlugin.getHashFromTagBySimulator) tagTxHash = await web3.testPlugin.getHashFromTagBySimulator(tagTimestamp) - if (web3.testPlugin && web3.testPlugin.getHHLogsForTx) hhLogs = await web3.testPlugin.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 = { @@ -302,7 +302,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com method.send(sendParams).on('receipt', async (receipt) => { try { debugTxHash = receipt.transactionHash - if (web3.testPlugin && web3.testPlugin.getHHLogsForTx) hhLogs = await web3.testPlugin.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 @@ -397,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.testPlugin && web3.testPlugin.getHHLogsForTx && txHash) hhLogs = await web3.testPlugin.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)