@ -10,6 +10,7 @@ import {
listenOnNetworkAction ,
listenOnNetworkAction ,
initListeningOnNetwork ,
initListeningOnNetwork ,
} from './actions/terminalAction'
} from './actions/terminalAction'
import { isBigInt } from 'web3-validator'
import { initialState , registerCommandReducer , addCommandHistoryReducer , registerScriptRunnerReducer } from './reducers/terminalReducer'
import { initialState , registerCommandReducer , addCommandHistoryReducer , registerScriptRunnerReducer } from './reducers/terminalReducer'
import { getKeyOf , getValueOf , Objectfilter , matched } from './utils/utils'
import { getKeyOf , getValueOf , Objectfilter , matched } from './utils/utils'
import { allCommands , allPrograms } from './commands' // eslint-disable-line
import { allCommands , allPrograms } from './commands' // eslint-disable-line
@ -583,6 +584,22 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
const classNameBlock = 'remix_ui_terminal_block px-4 py-1 text-break'
const classNameBlock = 'remix_ui_terminal_block px-4 py-1 text-break'
const replacer = ( key , value ) = > {
if ( isBigInt ( value ) ) value = value . toString ( )
if ( typeof value === 'function' ) value = value . toString ( )
return value
}
const includeSearch = ( x , searchInput ) = > {
try {
const value = JSON . stringify ( x , replacer )
return value . indexOf ( searchInput ) !== - 1 || value . indexOf ( searchInput . toLowerCase ( ) ) !== - 1
} catch ( e ) {
console . error ( e )
return true
}
}
return (
return (
( ! props . visible ? < > < / > :
( ! props . visible ? < > < / > :
< div style = { { flexGrow : 1 } } className = "remix_ui_terminal_panel" ref = { panelRef } >
< div style = { { flexGrow : 1 } } className = "remix_ui_terminal_panel" ref = { panelRef } >
@ -642,7 +659,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
className = "remix_ui_terminal_filter border form-control"
className = "remix_ui_terminal_filter border form-control"
id = "searchInput"
id = "searchInput"
placeholder = { intl . formatMessage ( { id : 'terminal.search' } ) }
placeholder = { intl . formatMessage ( { id : 'terminal.search' } ) }
data - id = "terminalInputSearch"
data - id = "terminalInputSearchTerminal "
/ >
/ >
< / div >
< / div >
< / div >
< / div >
@ -666,7 +683,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
)
)
} else if ( x . name === UNKNOWN_TRANSACTION ) {
} else if ( x . name === UNKNOWN_TRANSACTION ) {
return x . message
return x . message
. filter ( ( x ) = > x . tx . hash . includes ( searchInput ) || x . tx . from . includes ( searchInput ) || ( x . tx . to && x . tx . to . includes ( searchInput ) ) )
. filter ( ( x ) = > includeSearch ( x , searchInput ) )
. map ( ( trans ) = > {
. map ( ( trans ) = > {
return (
return (
< div className = { classNameBlock } data - id = { ` block_tx ${ trans . tx . hash } ` } key = { index } >
< div className = { classNameBlock } data - id = { ` block_tx ${ trans . tx . hash } ` } key = { index } >
@ -688,38 +705,38 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
} )
} )
} else if ( x . name === KNOWN_TRANSACTION ) {
} else if ( x . name === KNOWN_TRANSACTION ) {
return x . message
return x . message
. filter ( ( x ) = > x . tx . hash . includes ( searchInput ) || x . tx . from . includes ( searchInput ) || ( x . tx . to && x . tx . to . includes ( searchInput ) ) )
. filter ( ( x ) = > includeSearch ( x , searchInput ) )
. map ( ( trans ) = > {
. map ( ( trans ) = > {
return (
return (
< div className = { classNameBlock } data - id = { ` block_tx ${ trans . tx . hash } ` } key = { index } >
< div className = { classNameBlock } data - id = { ` block_tx ${ trans . tx . hash } ` } key = { index } >
{ trans . tx . isCall ? (
{ trans . tx . isCall ? (
< RenderCall
< RenderCall
tx = { trans . tx }
tx = { trans . tx }
resolvedData = { trans . resolvedData }
resolvedData = { trans . resolvedData }
logs = { trans . logs }
logs = { trans . logs }
index = { index }
index = { index }
plugin = { props . plugin }
plugin = { props . plugin }
showTableHash = { showTableHash }
showTableHash = { showTableHash }
txDetails = { txDetails }
txDetails = { txDetails }
modal = { modal }
modal = { modal }
/ >
/ >
) : (
) : (
< RenderKnownTransactions
< RenderKnownTransactions
tx = { trans . tx }
tx = { trans . tx }
receipt = { trans . receipt }
receipt = { trans . receipt }
resolvedData = { trans . resolvedData }
resolvedData = { trans . resolvedData }
logs = { trans . logs }
logs = { trans . logs }
index = { index }
index = { index }
plugin = { props . plugin }
plugin = { props . plugin }
showTableHash = { showTableHash }
showTableHash = { showTableHash }
txDetails = { txDetails }
txDetails = { txDetails }
modal = { modal }
modal = { modal }
provider = { x . provider }
provider = { x . provider }
/ >
/ >
) }
) }
< / div >
< / div >
)
)
} )
} )
} else if ( Array . isArray ( x . message ) ) {
} else if ( Array . isArray ( x . message ) ) {
if ( searchInput !== '' ) return [ ]
if ( searchInput !== '' ) return [ ]
return x . message . map ( ( msg , i ) = > {
return x . message . map ( ( msg , i ) = > {