@@ -12,7 +12,6 @@ import { Miner } from './methods/miner'
12
12
import { Debug } from './methods/debug'
13
13
import { EVM } from './methods/evm'
14
14
import { VMContext } from './vm-context'
15
- import { Web3PluginBase } from 'web3'
16
15
17
16
export interface JSONRPCRequestPayload {
18
17
params : any [ ] ;
@@ -158,54 +157,29 @@ export class Provider {
158
157
}
159
158
}
160
159
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
169
161
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 ] )
175
164
}
176
165
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 ] )
182
168
}
183
169
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 ] )
189
172
}
190
173
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 ] )
196
176
}
197
177
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' , [ ] )
203
180
}
204
181
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' , [ ] )
210
184
}
211
185
}
0 commit comments