provider updated to support web3 httpProvider typedef

pull/5370/head
aniket-engg 4 years ago committed by Aniket
parent ac0434cce6
commit 32f12d2160
  1. 16
      libs/remix-simulator/src/provider.ts
  2. 2
      libs/remix-simulator/test/accounts.ts
  3. 2
      libs/remix-simulator/test/blocks.ts
  4. 2
      libs/remix-simulator/test/misc.ts

@ -14,14 +14,18 @@ import { Debug } from './methods/debug'
import { generateBlock } from './genesis'
export class Provider {
options
options: Record<string, unknown>
executionContext
Accounts
Transactions
methods
host: string
connected: boolean;
constructor (options = {}) {
constructor (host: string = 'vm', options: Record<string, unknown> = {}) {
this.options = options
this.host = host
this.connected = true
// TODO: init executionContext here
this.executionContext = executionContext
this.Accounts = new Accounts(this.executionContext)
@ -75,6 +79,14 @@ export class Provider {
isConnected () {
return true
}
disconnect () {
return false
};
supportsSubscriptions () {
return true;
};
on (type, cb) {
this.executionContext.logsManager.addListener(type, cb)

@ -6,7 +6,7 @@ import * as assert from 'assert'
describe('Accounts', () => {
before(function () {
const provider: any = new Provider()
const provider = new Provider()
web3.setProvider(provider)
})

@ -6,7 +6,7 @@ import * as assert from 'assert'
describe('blocks', () => {
before(() => {
const provider: any = new Provider({
const provider = new Provider('vm', {
coinbase: '0x0000000000000000000000000000000000000001'
})
web3.setProvider(provider)

@ -6,7 +6,7 @@ import * as assert from 'assert'
describe('Misc', () => {
before(() => {
const provider: any = new Provider()
const provider = new Provider()
web3.setProvider(provider)
})

Loading…
Cancel
Save