Skip to content

Commit 102ce46

Browse files
committed
web3 removed from remix-simulator
1 parent 018d8ac commit 102ce46

File tree

2 files changed

+14
-41
lines changed

2 files changed

+14
-41
lines changed

libs/remix-simulator/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
"rlp": "^3.0.0",
4040
"string-similarity": "^4.0.4",
4141
"time-stamp": "^2.0.0",
42-
"tslib": "^2.3.0",
43-
"web3": "^4.1.1"
42+
"tslib": "^2.3.0"
4443
},
4544
"devDependencies": {
4645
"@babel/core": "^7.4.5",

libs/remix-simulator/src/provider.ts

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { Miner } from './methods/miner'
1212
import { Debug } from './methods/debug'
1313
import { EVM } from './methods/evm'
1414
import { VMContext } from './vm-context'
15-
import { Web3PluginBase } from 'web3'
1615

1716
export interface JSONRPCRequestPayload {
1817
params: any[];
@@ -158,54 +157,29 @@ export class Provider {
158157
}
159158
}
160159

161-
export function extend (web3) {
162-
if (!web3.remix){
163-
web3.registerPlugin(new Web3TestPlugin())
164-
}
165-
}
166-
167-
class Web3TestPlugin extends Web3PluginBase {
168-
public pluginNamespace = 'remix'
160+
export function extend (provider) { // Provider should be ethers.js provider
169161

170-
public getExecutionResultFromSimulator(transactionHash) {
171-
return this.requestManager.send({
172-
method: 'eth_getExecutionResultFromSimulator',
173-
params: [transactionHash]
174-
})
162+
provider.remix.getExecutionResultFromSimulator = async (transactionHash) => {
163+
return await this.send('eth_getExecutionResultFromSimulator', [transactionHash])
175164
}
176165

177-
public getHHLogsForTx(transactionHash) {
178-
return this.requestManager.send({
179-
method: 'eth_getHHLogsForTx',
180-
params: [transactionHash]
181-
})
166+
provider.remix.getHHLogsForTx = async (transactionHash) => {
167+
return await this.send('eth_getHHLogsForTx',[transactionHash])
182168
}
183169

184-
public getHashFromTagBySimulator(timestamp) {
185-
return this.requestManager.send({
186-
method: 'eth_getHashFromTagBySimulator',
187-
params: [timestamp]
188-
})
170+
provider.remix.getHashFromTagBySimulator = async (timestamp) => {
171+
return await this.send('eth_getHashFromTagBySimulator', [timestamp])
189172
}
190173

191-
public registerCallId(id) {
192-
return this.requestManager.send({
193-
method: 'eth_registerCallId',
194-
params: [id]
195-
})
174+
provider.remix.registerCallId = async (id) => {
175+
return await this.send('eth_registerCallId',[id])
196176
}
197177

198-
public getStateDb() {
199-
return this.requestManager.send({
200-
method: 'eth_getStateDb',
201-
params: []
202-
})
178+
provider.remix.getStateDb = async () => {
179+
return await this.send('eth_getStateDb', [])
203180
}
204181

205-
public getBlocksData() {
206-
return this.requestManager.send({
207-
method: 'eth_getBlocksData',
208-
params: []
209-
})
182+
provider.remix.getBlocksData = async () => {
183+
return await this.send('eth_getBlocksData',[])
210184
}
211185
}

0 commit comments

Comments
 (0)