diff --git a/apps/remix-ide/src/app/tabs/network-module.js b/apps/remix-ide/src/app/tabs/network-module.js index 10520e679d..b59a075b79 100644 --- a/apps/remix-ide/src/app/tabs/network-module.js +++ b/apps/remix-ide/src/app/tabs/network-module.js @@ -19,12 +19,18 @@ export class NetworkModule extends Plugin { constructor (blockchain) { super(profile) this.blockchain = blockchain + // TODO: See with remix-lib to make sementic coherent this.blockchain.event.register('contextChanged', (provider) => { this.emit('providerChanged', provider) }) } + onActivation () { + // emit the initial provider type + this.emit('providerChanged', this.blockchain.getProvider) + } + /** Return the current network provider (web3, vm, injected) */ getNetworkProvider () { return this.blockchain.getProvider() diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index 88c55a465e..2f5caaf9ac 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -59,6 +59,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { }) const [clearConsole, setClearConsole] = useState(false) + const [isVM, setIsVM] = useState(false) const [paste, setPaste] = useState(false) const [storage, setStorage] = useState(null) const [autoCompletState, setAutoCompleteState] = useState({ @@ -98,6 +99,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { } useEffect(() => { + props.plugin.on('network', 'providerChanged', (provider) => { + setIsVM(provider.startsWith('vm-')) + }) + props.onReady({ logHtml: (html) => { scriptRunnerDispatch({ @@ -603,11 +608,22 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { }>
0
-
- - - - + +
+ + + - -
+
+