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

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

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

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

Loading…
Cancel
Save