fix plugins

pull/3951/head
Oleksii Kosynskyi 1 year ago
parent 196426d790
commit 36d85d5500
No known key found for this signature in database
GPG Key ID: B4A8D3CCE22EA65E
  1. 12
      libs/remix-debug/src/init.ts
  2. 12
      libs/remix-lib/src/init.ts
  3. 4
      libs/remix-simulator/src/provider.ts

@ -1,18 +1,20 @@
'use strict' 'use strict'
import Web3, { Web3PluginBase } from 'web3' import Web3, { Web3PluginBase } from 'web3'
export function extendWeb3 (web3) {
if(!web3.debug){
web3.registerPlugin(new Web3DebugPlugin())
}
}
export function loadWeb3 (url) { export function loadWeb3 (url) {
if (!url) url = 'http://localhost:8545' if (!url) url = 'http://localhost:8545'
const web3 = new Web3() const web3 = new Web3()
web3.setProvider(new Web3.providers.HttpProvider(url)) web3.setProvider(new Web3.providers.HttpProvider(url))
web3.registerPlugin(new Web3DebugPlugin()) extendWeb3(web3)
return web3 return web3
} }
export function extendWeb3 (web3) {
web3.registerPlugin(new Web3DebugPlugin())
}
export function setProvider (web3, url) { export function setProvider (web3, url) {
web3.setProvider(new web3.providers.HttpProvider(url)) web3.setProvider(new web3.providers.HttpProvider(url))
} }

@ -1,17 +1,19 @@
'use strict' 'use strict'
import Web3, { Web3PluginBase } from 'web3' import Web3, { Web3PluginBase } from 'web3'
export function extendWeb3 (web3) {
if(!web3.debug){
web3.registerPlugin(new Web3DebugPlugin())
}
}
export function loadWeb3 (url = 'http://localhost:8545') { export function loadWeb3 (url = 'http://localhost:8545') {
const web3 = new Web3() const web3 = new Web3()
web3.setProvider(new Web3.providers.HttpProvider(url)) web3.setProvider(new Web3.providers.HttpProvider(url))
web3.registerPlugin(new Web3DebugPlugin()) extendWeb3(web3)
return web3 return web3
} }
export function extendWeb3 (web3) {
web3.registerPlugin(new Web3DebugPlugin())
}
class Web3DebugPlugin extends Web3PluginBase { class Web3DebugPlugin extends Web3PluginBase {
public pluginNamespace = 'debug' public pluginNamespace = 'debug'

@ -133,7 +133,9 @@ export class Provider {
} }
export function extend (web3) { export function extend (web3) {
web3.registerPlugin(new Web3TestPlugin()) if(!web3.testPlugin){
web3.registerPlugin(new Web3TestPlugin())
}
} }
class Web3TestPlugin extends Web3PluginBase { class Web3TestPlugin extends Web3PluginBase {

Loading…
Cancel
Save