diff --git a/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
index 4d4f1a4abf..c84fde7c13 100644
--- a/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
+++ b/apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
@@ -201,13 +201,13 @@ module.exports = {
.waitForElementVisible('*[data-id="testTabSolidityUnitTestsOutputheader"]', 120000)
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 60000)
.waitForElementContainsText('#solidityUnittestsOutput', 'tests/hhLogs_test.sol', 60000)
- .assert.containsText('#journal > div:nth-child(3) > span > div', 'Before all:')
- .assert.containsText('#journal > div:nth-child(3) > span > div', 'Inside beforeAll')
- .assert.containsText('#journal > div:nth-child(4) > span > div', 'Check sender:')
- .assert.containsText('#journal > div:nth-child(4) > span > div', 'msg.sender is 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4')
- .assert.containsText('#journal > div:nth-child(5) > span > div', 'Check int logs:')
- .assert.containsText('#journal > div:nth-child(5) > span > div', '10 20')
- .assert.containsText('#journal > div:nth-child(5) > span > div', 'Number is 25')
+ .assert.containsText('#journal > div:nth-child(2) > span ', 'Before all:')
+ .assert.containsText('#journal > div:nth-child(2) > span', 'Inside beforeAll')
+ .assert.containsText('#journal > div:nth-child(3) > span', 'Check sender:')
+ .assert.containsText('#journal > div:nth-child(3) > span', 'msg.sender is 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4')
+ .assert.containsText('#journal > div:nth-child(4) > span', 'Check int logs:')
+ .assert.containsText('#journal > div:nth-child(4) > span', '10 20')
+ .assert.containsText('#journal > div:nth-child(4) > span', 'Number is 25')
.openFile('tests/hhLogs_test.sol')
.removeFile('tests/hhLogs_test.sol', 'workspace_new')
},
diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js
index e732612b99..081b868e21 100644
--- a/apps/remix-ide/src/app/panels/terminal.js
+++ b/apps/remix-ide/src/app/panels/terminal.js
@@ -88,6 +88,8 @@ class Terminal extends Plugin {
this.call('menuicons', 'select', 'debugger')
this.call('debugger', 'debug', hash)
})
+ this.logHtmlResponse = []
+ this.logResponse = []
}
onActivation () {
@@ -108,6 +110,12 @@ class Terminal extends Plugin {
this.logHtmlResponse = []
}
+ log (message) {
+ this.logResponse.push(message)
+ this.renderComponent()
+ this.logResponse = []
+ }
+
render () {
return this.element
}
@@ -132,6 +140,8 @@ class Terminal extends Plugin {
registry = {this.registry}
txListener = {this.txListener}
eventsDecoder = {this.eventsDecoder}
+ logHtml = {this.logHtmlResponse}
+ logResponse = {this.logResponse}
/>,
this.element
)
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 fc8345fb3f..8cc2f731d8 100644
--- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
+++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
@@ -14,9 +14,12 @@ import './remix-ui-terminal.css'
import vm from 'vm'
import javascriptserialize from 'javascript-serialize'
import jsbeautify from 'js-beautify'
-import helper from '../../../../../apps/remix-ide/src/lib/helper'
-const remixLib = require('@remix-project/remix-lib')
-var typeConversion = remixLib.execution.typeConversion
+import renderUnKnownTransactions from './components/RenderUnknownTransactions'
+import renderCall from './components/RenderCall'
+import renderKnownTransactions from './components/RenderKnownTransactions'
+import parse from 'html-react-parser'
+import { RemixUiTerminalProps } from './types/terminalTypes'
+import { wrapScript } from './utils/wrapScript'
/* eslint-disable-next-line */
export interface RemixUiTerminalProps {
@@ -98,6 +101,14 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
messagesEndRef.current.scrollIntoView({ behavior: 'smooth' })
}
+ useEffect(() => {
+ scriptRunnerDispatch({ type: 'html', payload: { message: props.logHtml } })
+ }, [props.logHtml])
+
+ useEffect(() => {
+ scriptRunnerDispatch({ type: 'log', payload: { message: props.logResponse } })
+ }, [props.logResponse])
+
// events
useEffect(() => {
initListeningOnNetwork(props, scriptRunnerDispatch)
@@ -1105,7 +1116,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
return x.message.map((msg, i) => {
if (typeof msg === 'object') {
return (
-
{ JSON.stringify(msg) }
+ { msg.value ? parse(msg.value) : JSON.stringify(msg) }
)
} else {
return (
diff --git a/libs/remix-ui/terminal/src/lib/types/terminalTypes.ts b/libs/remix-ui/terminal/src/lib/types/terminalTypes.ts
index 5751e625be..50b74f739c 100644
--- a/libs/remix-ui/terminal/src/lib/types/terminalTypes.ts
+++ b/libs/remix-ui/terminal/src/lib/types/terminalTypes.ts
@@ -24,5 +24,6 @@ export interface RemixUiTerminalProps {
commands: any,
txListener: any,
eventsDecoder: any,
- logHtml: any
+ logHtml: any,
+ logResponse: any
}
diff --git a/package-lock.json b/package-lock.json
index 701a880b09..bd9a57b5fb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14890,6 +14890,21 @@
"webidl-conversions": "^4.0.2"
}
},
+ "domhandler": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.2.tgz",
+ "integrity": "sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w==",
+ "requires": {
+ "domelementtype": "^2.2.0"
+ },
+ "dependencies": {
+ "domelementtype": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz",
+ "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A=="
+ }
+ }
+ },
"domutils": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz",
@@ -15242,8 +15257,7 @@
"entities": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz",
- "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==",
- "dev": true
+ "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ=="
},
"env-paths": {
"version": "2.2.0",
@@ -19581,6 +19595,15 @@
"integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==",
"dev": true
},
+ "html-dom-parser": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-1.0.2.tgz",
+ "integrity": "sha512-Jq4oVkVSn+10ut3fyc2P/Fs1jqTo0l45cP6Q8d2ef/9jfkYwulO0QXmyLI0VUiZrXF4czpGgMEJRa52CQ6Fk8Q==",
+ "requires": {
+ "domhandler": "4.2.2",
+ "htmlparser2": "6.1.0"
+ }
+ },
"html-encoding-sniffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz",
@@ -19602,12 +19625,61 @@
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
+ "html-react-parser": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/html-react-parser/-/html-react-parser-1.3.0.tgz",
+ "integrity": "sha512-lhpkOFH8pwqEjlNUYCWvjT43/JVCZO9MAZuCS6afT1/VP+bZcNxNUs4AUqiMzH0QPSDHwM/GFNXZNok1KTA4BQ==",
+ "requires": {
+ "domhandler": "4.2.2",
+ "html-dom-parser": "1.0.2",
+ "react-property": "2.0.0",
+ "style-to-js": "1.1.0"
+ }
+ },
"htmlescape": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz",
"integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=",
"dev": true
},
+ "htmlparser2": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",
+ "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==",
+ "requires": {
+ "domelementtype": "^2.0.1",
+ "domhandler": "^4.0.0",
+ "domutils": "^2.5.2",
+ "entities": "^2.0.0"
+ },
+ "dependencies": {
+ "dom-serializer": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",
+ "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==",
+ "requires": {
+ "domelementtype": "^2.0.1",
+ "domhandler": "^4.2.0",
+ "entities": "^2.0.0"
+ }
+ },
+ "domelementtype": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz",
+ "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A=="
+ },
+ "domutils": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
+ "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
+ "requires": {
+ "dom-serializer": "^1.0.1",
+ "domelementtype": "^2.2.0",
+ "domhandler": "^4.2.0"
+ }
+ }
+ }
+ },
"http-cache-semantics": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
@@ -20001,6 +20073,11 @@
"source-map": "~0.5.3"
}
},
+ "inline-style-parser": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz",
+ "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q=="
+ },
"inquirer": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz",
@@ -32937,6 +33014,11 @@
"warning": "^4.0.3"
}
},
+ "react-property": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/react-property/-/react-property-2.0.0.tgz",
+ "integrity": "sha512-kzmNjIgU32mO4mmH5+iUyrqlpFQhF8K2k7eZ4fdLSOPFrD1XgEuSBv9LDEgxRXTMBqMd8ppT0x6TIzqE5pdGdw=="
+ },
"react-redux": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.2.tgz",
@@ -36397,6 +36479,22 @@
"schema-utils": "^2.0.1"
}
},
+ "style-to-js": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.0.tgz",
+ "integrity": "sha512-1OqefPDxGrlMwcbfpsTVRyzwdhr4W0uxYQzeA2F1CBc8WG04udg2+ybRnvh3XYL4TdHQrCahLtax2jc8xaE6rA==",
+ "requires": {
+ "style-to-object": "0.3.0"
+ }
+ },
+ "style-to-object": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.3.0.tgz",
+ "integrity": "sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==",
+ "requires": {
+ "inline-style-parser": "0.1.1"
+ }
+ },
"stylehacks": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz",
diff --git a/package.json b/package.json
index c8ea5d1057..d58eb3aff5 100644
--- a/package.json
+++ b/package.json
@@ -160,6 +160,7 @@
"file-saver": "^2.0.5",
"form-data": "^4.0.0",
"fs-extra": "^3.0.1",
+ "html-react-parser": "^1.3.0",
"http-server": "^0.11.1",
"intro.js": "^4.1.0",
"isbinaryfile": "^3.0.2",