diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 1cebf59ecc8..b2c46feff45 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -46,7 +46,6 @@ export class TxRunnerWeb3 { const listenOnResponse = () => { // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { - console.log('listenOnResponse') const receipt = await tryTillReceiptAvailable(resp, this.getWeb3()) tx = await tryTillTxAvailable(resp, this.getWeb3()) currentDateTime = new Date(); @@ -81,10 +80,8 @@ export class TxRunnerWeb3 { } else { try { const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true }) - console.log('res', res) cb(null, res.transactionHash) } catch (e) { - console.log(e) if (!e.message) e.message = '' if (e.error) { e.message = e.message + ' ' + e.error @@ -195,7 +192,6 @@ export class TxRunnerWeb3 { async function tryTillReceiptAvailable (txhash: string, web3: Web3) { try { const receipt = await web3.eth.getTransactionReceipt(txhash) - console.log('receipt', receipt) if (receipt) { if (!receipt.to && !receipt.contractAddress) { // this is a contract creation and the receipt doesn't contain a contract address. we have to keep polling... diff --git a/libs/remix-ui/terminal-transactions/src/components/terminal-transactions.tsx b/libs/remix-ui/terminal-transactions/src/components/terminal-transactions.tsx deleted file mode 100644 index 540b6866045..00000000000 --- a/libs/remix-ui/terminal-transactions/src/components/terminal-transactions.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { TerminalContext } from '@remix-ui/terminal' -import { Plugin } from '@remixproject/engine' -import { PluginQueueItem } from '@remixproject/plugin-utils/src/lib/tools/queue'; -import React, { useState, useEffect, useContext } from 'react' // eslint-disable-line - -export interface TerminalTransactionsProps { - plugin: Plugin -} - -const pluginsToWatch = ['injected-metamask', 'web3Provider']; - -interface queue { - pluginName: string, - queue: PluginQueueItem[] -} - -export const TerminalTransactions = (props: TerminalTransactionsProps) => { - - const { xtermState, dispatchXterm } = useContext(TerminalContext) - const [queues, setQueues] = useState([]) - - useEffect(() => { - - pluginsToWatch.forEach(pluginName => { - props.plugin.on(pluginName, 'queue', (data: any) => { - //console.log('plugin', pluginName, 'queue', data); - setQueues(queues => [...queues.filter(queue => queue.pluginName !== pluginName), { pluginName, queue: data }]); - }); - }); - return () => { - pluginsToWatch.forEach(pluginName => { - props.plugin.off(pluginName, 'queue'); - }); - }; - }, [props.plugin]); - -return (<> -
- {queues.map((queue, index) => { - return
-
{queue.queue.map((item, i) =>
{item && (item as any).args && (item as any).args[0] && (item as any).args[0].method}
)}
-
- })} -
-) - -} \ No newline at end of file diff --git a/libs/remix-ui/terminal-transactions/src/index.ts b/libs/remix-ui/terminal-transactions/src/index.ts deleted file mode 100644 index 055a9b0730e..00000000000 --- a/libs/remix-ui/terminal-transactions/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/terminal-transactions' \ No newline at end of file diff --git a/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx b/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx index 797b2fd8a86..a51bb33e613 100644 --- a/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx +++ b/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-bar.tsx @@ -1,4 +1,4 @@ -import { AppContext, appPlatformTypes, platformContext } from '@remix-ui/app' +import { appPlatformTypes, platformContext } from '@remix-ui/app' import { CustomTooltip } from '@remix-ui/helper' import React, { useState, useEffect, useRef, useContext } from 'react' // eslint-disable-line import { FormattedMessage, useIntl } from 'react-intl' @@ -9,12 +9,10 @@ import { RemixUITerminalMenu } from './remix-ui-terminal-menu' import { RemixUITerminalMenuToggle } from './remix-ui-terminal-menu-toggle' import { RemixUIXtermMenu } from '../../../../xterm/src/lib/components/remix-ui-terminal-menu-xterm' import { RemixUITerminalMenuButtons } from './remix-ui-terminal-menu-buttons' -import { desktopConnextionType } from '@remix-api' export const RemixUITerminalBar = (props: RemixUiTerminalProps) => { const { terminalState, xtermState } = useContext(TerminalContext) const platform = useContext(platformContext) - const appContext = useContext(AppContext) const intl = useIntl() const terminalMenu = useRef(null) @@ -30,17 +28,10 @@ export const RemixUITerminalBar = (props: RemixUiTerminalProps) => { data-id="terminalToggleMenu" > - {appContext.appState.connectedToDesktop !== desktopConnextionType.disabled ? -
- - -
: null - - } {platform === appPlatformTypes.desktop ?
- {xtermState.selectedTerminalTab === 'output' ? : } + {xtermState.showOutput? : }
: } diff --git a/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-menu-buttons.tsx b/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-menu-buttons.tsx index 1e0ffe06cea..826528759fe 100644 --- a/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-menu-buttons.tsx +++ b/libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-menu-buttons.tsx @@ -1,69 +1,42 @@ -import { AppContext } from '@remix-ui/app' import React, { useContext, useEffect } from 'react' // eslint-disable-line import { TerminalContext } from '../context' import { RemixUiTerminalProps, SET_OPEN } from '../types/terminalTypes' import './remix-ui-terminal-menu-buttons.css' -import { desktopConnextionType } from '@remix-api'; export const RemixUITerminalMenuButtons = (props: RemixUiTerminalProps) => { const { xtermState, dispatchXterm, terminalState, dispatch } = useContext(TerminalContext) - const appContext = useContext(AppContext) function selectOutput(event: any): void { props.plugin.call('layout', 'minimize', props.plugin.profile.name, false) - dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'output' }) + dispatchXterm({ type: 'SHOW_OUTPUT', payload: true }) dispatch({ type: SET_OPEN, payload: true }) } - const showTerminal = async (event: any): Promise => { + const showTerminal = async(event: any): Promise => { props.plugin.call('layout', 'minimize', props.plugin.profile.name, false) - if (xtermState.terminals.length === 0) { + if ( xtermState.terminals.length === 0) { const start_time = Date.now() const pid = await props.plugin.call('xterm', 'createTerminal', xtermState.workingDir, null) const end_time = Date.now() console.log(`createTerminal took ${end_time - start_time} ms`) dispatchXterm({ type: 'HIDE_ALL_TERMINALS', payload: null }) - dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'xterm' }) + dispatchXterm({ type: 'SHOW_OUTPUT', payload: false }) dispatchXterm({ type: 'ADD_TERMINAL', payload: { pid, queue: '', timeStamp: Date.now(), ref: null, hidden: false } }) } else { - dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'xterm' }) + dispatchXterm({ type: 'SHOW_OUTPUT', payload: false }) } dispatch({ type: SET_OPEN, payload: true }) } - const showTransactions = async (event: any): Promise => { - dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'transactions' }) - } - - if (appContext.appState.connectedToDesktop === desktopConnextionType.connected) { - - return null - return ( -
- - -
- ) - } - return (
- - -{/* */}
) } \ No newline at end of file diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal-wrapper.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal-wrapper.tsx index e403bd61c7b..d21123eaef2 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal-wrapper.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal-wrapper.tsx @@ -1,19 +1,16 @@ -import { AppContext, appPlatformTypes, platformContext } from '@remix-ui/app' +import { appPlatformTypes, platformContext } from '@remix-ui/app' import { RemixUiXterminals, xTerminInitialState, xtermReducer } from '@remix-ui/xterm' -import { TerminalTransactions } from 'libs/remix-ui/terminal-transactions/src' -import React, { useContext, useEffect, useReducer } from 'react' // eslint-disable-line +import React, { useContext, useReducer } from 'react' // eslint-disable-line import { RemixUITerminalBar } from './components/remix-ui-terminal-bar' import { TerminalContext } from './context' import { initialState, registerCommandReducer } from './reducers/terminalReducer' import RemixUiTerminal from './remix-ui-terminal' import { RemixUiTerminalProps } from './types/terminalTypes' -import { desktopConnextionType } from '@remix-api' export const RemixUITerminalWrapper = (props: RemixUiTerminalProps) => { const [terminalState, dispatch] = useReducer(registerCommandReducer, initialState) const [xtermState, dispatchXterm] = useReducer(xtermReducer, xTerminInitialState) const platform = useContext(platformContext) - const appContext = useContext(AppContext) const providerState = { terminalState, dispatch, @@ -21,34 +18,14 @@ export const RemixUITerminalWrapper = (props: RemixUiTerminalProps) => { dispatchXterm } - useEffect(() => { - if (appContext.appState.connectedToDesktop === desktopConnextionType.connected) { - dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'transactions' }) - } - }, [appContext.appState.connectedToDesktop]) - - if (appContext.appState.connectedToDesktop === desktopConnextionType.disconnected) { - return <> - } - - if (appContext.appState.connectedToDesktop === desktopConnextionType.connected) { - return <> - - - {platform !== appPlatformTypes.desktop && } - - - } - return (<> {platform !== appPlatformTypes.desktop && } {platform === appPlatformTypes.desktop && <> - + - {/* */} } diff --git a/libs/remix-ui/xterm/src/lib/actions/index.ts b/libs/remix-ui/xterm/src/lib/actions/index.ts index 5e81f5fc39e..5489af6206b 100644 --- a/libs/remix-ui/xterm/src/lib/actions/index.ts +++ b/libs/remix-ui/xterm/src/lib/actions/index.ts @@ -3,7 +3,7 @@ import { Plugin } from "@remixproject/engine" export const createTerminal = async (shell: string = '', plugin: Plugin, workingDir: string, dispatch: React.Dispatch) => { const pid = await plugin.call('xterm', 'createTerminal', workingDir, shell) - dispatch({ type: 'SET_TERMINAL_TAB', payload: 'xterm' }) + dispatch({ type: 'SHOW_OUTPUT', payload: false }) dispatch({ type: 'HIDE_ALL_TERMINALS', payload: null }) dispatch({ type: 'ADD_TERMINAL', payload: { pid, queue: '', timeStamp: Date.now(), ref: null, hidden: false } }) diff --git a/libs/remix-ui/xterm/src/lib/components/remix-ui-terminal-menu-xterm.tsx b/libs/remix-ui/xterm/src/lib/components/remix-ui-terminal-menu-xterm.tsx index 8eb0a022774..49a5d2e36cb 100644 --- a/libs/remix-ui/xterm/src/lib/components/remix-ui-terminal-menu-xterm.tsx +++ b/libs/remix-ui/xterm/src/lib/components/remix-ui-terminal-menu-xterm.tsx @@ -26,7 +26,7 @@ export const RemixUIXtermMenu = (props: RemixUiTerminalProps) => { } return (<> -
+
onCreateTerminal()}> }> diff --git a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx index 207238a08a3..7dbcedaaf82 100644 --- a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx +++ b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx @@ -40,7 +40,7 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => { plugin.on('xterm', 'new', async () => { const pid = await plugin.call('xterm', 'createTerminal', workingDir, null) dispatchXterm({ type: 'HIDE_ALL_TERMINALS', payload: null }) - dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'xterm' }) + dispatchXterm({ type: 'SHOW_OUTPUT', payload: false }) dispatchXterm({ type: 'ADD_TERMINAL', payload: { pid, queue: '', timeStamp: Date.now(), ref: null, hidden: false } }) }) @@ -80,7 +80,7 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => { useEffect(() => { setTerminals(xtermState.terminals) if (xtermState.terminals.length === 0) { - dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'output' }) + dispatchXterm({ type: 'SHOW_OUTPUT', payload: true }) } }, [xtermState.terminals]) @@ -139,9 +139,9 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => { } return (<> - {
+ {
<> - {
+ {
{terminals.map((xtermState) => { return (
diff --git a/libs/remix-ui/xterm/src/lib/reducer/index.ts b/libs/remix-ui/xterm/src/lib/reducer/index.ts index cf038787992..a96d2185234 100644 --- a/libs/remix-ui/xterm/src/lib/reducer/index.ts +++ b/libs/remix-ui/xterm/src/lib/reducer/index.ts @@ -5,8 +5,7 @@ export const xTerminInitialState: xTerminalUiState = { terminals: [], shells: [], showOutput: true, - workingDir: '', - selectedTerminalTab: 'output' + workingDir: '' } export const xtermReducer = (state = xTerminInitialState, action: Actions) => { @@ -60,13 +59,6 @@ export const xtermReducer = (state = xTerminInitialState, action: Actions) => { ...state, showOutput: action.payload } - - case 'SET_TERMINAL_TAB': - return { - ...state, - selectedTerminalTab: action.payload - } - case 'SET_WORKING_DIR': return { ...state, diff --git a/libs/remix-ui/xterm/src/lib/types/index.ts b/libs/remix-ui/xterm/src/lib/types/index.ts index b9fcbaed260..170441acb95 100644 --- a/libs/remix-ui/xterm/src/lib/types/index.ts +++ b/libs/remix-ui/xterm/src/lib/types/index.ts @@ -13,7 +13,6 @@ export interface xTerminalUiState { shells: string[] showOutput: boolean workingDir: string - selectedTerminalTab: 'output' | 'xterm' | 'transactions' } export interface ActionPayloadTypes { @@ -27,7 +26,6 @@ export interface ActionPayloadTypes { ADD_SHELLS: string[], SHOW_OUTPUT: boolean SET_WORKING_DIR: string - SET_TERMINAL_TAB: 'output' | 'xterm' | 'transactions' } export interface Action { diff --git a/tsconfig.paths.json b/tsconfig.paths.json index 5d5f8b219c0..7e5cec001f4 100644 --- a/tsconfig.paths.json +++ b/tsconfig.paths.json @@ -175,9 +175,6 @@ "@remix-ui/xterm": [ "libs/remix-ui/xterm/src/index.ts" ], - "@remix-ui/terminal-transactions": [ - "libs/remix-ui/erminal-transactions/src/index.ts" - ], "@remix-ui/remix-ai": [ "libs/remix-ui/remix-ai/src/index.ts" ],