From 36d85d550059ef2e5a397e62ca6b11a01bd84a41 Mon Sep 17 00:00:00 2001 From: Oleksii Kosynskyi Date: Mon, 25 Sep 2023 20:14:07 -0400 Subject: [PATCH] fix plugins --- libs/remix-debug/src/init.ts | 12 +++++++----- libs/remix-lib/src/init.ts | 12 +++++++----- libs/remix-simulator/src/provider.ts | 4 +++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/libs/remix-debug/src/init.ts b/libs/remix-debug/src/init.ts index 686db93f92..2cd616226d 100644 --- a/libs/remix-debug/src/init.ts +++ b/libs/remix-debug/src/init.ts @@ -1,18 +1,20 @@ 'use strict' import Web3, { Web3PluginBase } from 'web3' +export function extendWeb3 (web3) { + if(!web3.debug){ + web3.registerPlugin(new Web3DebugPlugin()) + } +} + export function loadWeb3 (url) { if (!url) url = 'http://localhost:8545' const web3 = new Web3() web3.setProvider(new Web3.providers.HttpProvider(url)) - web3.registerPlugin(new Web3DebugPlugin()) + extendWeb3(web3) return web3 } -export function extendWeb3 (web3) { - web3.registerPlugin(new Web3DebugPlugin()) -} - export function setProvider (web3, url) { web3.setProvider(new web3.providers.HttpProvider(url)) } diff --git a/libs/remix-lib/src/init.ts b/libs/remix-lib/src/init.ts index 15c1f633fa..c3e30f269d 100644 --- a/libs/remix-lib/src/init.ts +++ b/libs/remix-lib/src/init.ts @@ -1,17 +1,19 @@ 'use strict' import Web3, { Web3PluginBase } from 'web3' +export function extendWeb3 (web3) { + if(!web3.debug){ + web3.registerPlugin(new Web3DebugPlugin()) + } +} + export function loadWeb3 (url = 'http://localhost:8545') { const web3 = new Web3() web3.setProvider(new Web3.providers.HttpProvider(url)) - web3.registerPlugin(new Web3DebugPlugin()) + extendWeb3(web3) return web3 } -export function extendWeb3 (web3) { - web3.registerPlugin(new Web3DebugPlugin()) -} - class Web3DebugPlugin extends Web3PluginBase { public pluginNamespace = 'debug' diff --git a/libs/remix-simulator/src/provider.ts b/libs/remix-simulator/src/provider.ts index 0cc4af0054..4178747d41 100644 --- a/libs/remix-simulator/src/provider.ts +++ b/libs/remix-simulator/src/provider.ts @@ -133,7 +133,9 @@ export class Provider { } export function extend (web3) { - web3.registerPlugin(new Web3TestPlugin()) + if(!web3.testPlugin){ + web3.registerPlugin(new Web3TestPlugin()) + } } class Web3TestPlugin extends Web3PluginBase {