From 52496e1c52c357f16ff3d255d42a722e925578d2 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 24 Nov 2020 14:44:07 +0530 Subject: [PATCH] provider updated to support web3 httpProvider typedef --- libs/remix-simulator/src/provider.ts | 16 ++++++++++++++-- libs/remix-simulator/test/accounts.ts | 2 +- libs/remix-simulator/test/blocks.ts | 2 +- libs/remix-simulator/test/misc.ts | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index dd69f9f551..4c8eed8ee1 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -14,14 +14,18 @@ import { Debug } from './methods/debug' import { generateBlock } from './genesis' export class Provider { - options + options: Record executionContext Accounts Transactions methods + host: string + connected: boolean; - constructor (options = {}) { + constructor (host: string = 'vm', options: Record = {}) { 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) diff --git a/libs/remix-simulator/test/accounts.ts b/libs/remix-simulator/test/accounts.ts index 3bf4d00599..471cacfd72 100644 --- a/libs/remix-simulator/test/accounts.ts +++ b/libs/remix-simulator/test/accounts.ts @@ -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) }) diff --git a/libs/remix-simulator/test/blocks.ts b/libs/remix-simulator/test/blocks.ts index de81cddc9c..5a404ee722 100644 --- a/libs/remix-simulator/test/blocks.ts +++ b/libs/remix-simulator/test/blocks.ts @@ -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) diff --git a/libs/remix-simulator/test/misc.ts b/libs/remix-simulator/test/misc.ts index 4b8075cca4..6d8f57ef49 100644 --- a/libs/remix-simulator/test/misc.ts +++ b/libs/remix-simulator/test/misc.ts @@ -6,7 +6,7 @@ import * as assert from 'assert' describe('Misc', () => { before(() => { - const provider: any = new Provider() + const provider = new Provider() web3.setProvider(provider) })