fix display json rpc error

pull/5370/head
yann300 2 years ago
parent 8f1f9576b3
commit 1914d38dda
  1. 4
      apps/remix-ide/src/app/panels/terminal.js
  2. 5
      apps/remix-ide/src/app/tabs/web3-provider.js
  3. 4
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -100,8 +100,8 @@ class Terminal extends Plugin {
this.terminalApi.logHtml(html) this.terminalApi.logHtml(html)
} }
log (message) { log (message, type) {
this.terminalApi.log(message) this.terminalApi.log(message, type)
} }
setDispatch(dispatch) { setDispatch(dispatch) {

@ -29,7 +29,10 @@ export class Web3ProviderModule extends Plugin {
const provider = this.blockchain.web3().currentProvider const provider = this.blockchain.web3().currentProvider
// see https://github.com/ethereum/web3.js/pull/1018/files#diff-d25786686c1053b786cc2626dc6e048675050593c0ebaafbf0814e1996f22022R129 // see https://github.com/ethereum/web3.js/pull/1018/files#diff-d25786686c1053b786cc2626dc6e048675050593c0ebaafbf0814e1996f22022R129
provider[provider.sendAsync ? 'sendAsync' : 'send'](payload, async (error, message) => { provider[provider.sendAsync ? 'sendAsync' : 'send'](payload, async (error, message) => {
if (error) return reject(error) if (error) {
this.call('terminal', 'log', error.data ? error.data : error, 'error')
return reject(error.data ? error.data : error)
}
if (payload.method === 'eth_sendTransaction') { if (payload.method === 'eth_sendTransaction') {
if (payload.params.length && !payload.params[0].to && message.result) { if (payload.params.length && !payload.params[0].to && message.result) {
setTimeout(async () => { setTimeout(async () => {

@ -86,8 +86,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
scriptRunnerDispatch({ type: 'html', payload: { message: [html ? html.innerText ? html.innerText : html : null] } }) scriptRunnerDispatch({ type: 'html', payload: { message: [html ? html.innerText ? html.innerText : html : null] } })
}, },
log: (message) => { log: (message, type) => {
scriptRunnerDispatch({ type: 'log', payload: { message: [message] } }) scriptRunnerDispatch({ type: type ? type : 'log', payload: { message: [message] } })
} }
}) })
}, []) }, [])

Loading…
Cancel
Save