Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
ae1700ed
Commit
ae1700ed
authored
Sep 08, 2021
by
davidzagi93@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup
parent
868bcc5b
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
472 additions
and
40 deletions
+472
-40
solidityUnittests.spec.ts
apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
+15
-15
workspace.test.ts
apps/remix-ide-e2e/src/tests/workspace.test.ts
+1
-1
terminal.js
apps/remix-ide/src/app/panels/terminal.js
+0
-24
ChechTxStatus.tsx
libs/remix-ui/terminal/src/lib/components/ChechTxStatus.tsx
+16
-0
Context.tsx
libs/remix-ui/terminal/src/lib/components/Context.tsx
+62
-0
RenderCall.tsx
libs/remix-ui/terminal/src/lib/components/RenderCall.tsx
+65
-0
RenderKnownTransactions.tsx
...i/terminal/src/lib/components/RenderKnownTransactions.tsx
+61
-0
RenderUnknownTransactions.tsx
...terminal/src/lib/components/RenderUnknownTransactions.tsx
+54
-0
Table.tsx
libs/remix-ui/terminal/src/lib/components/Table.tsx
+165
-0
remix-ui-terminal.tsx
libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
+0
-0
terminalTypes.ts
libs/remix-ui/terminal/src/lib/types/terminalTypes.ts
+17
-0
wrapScript.ts
libs/remix-ui/terminal/src/lib/utils/wrapScript.ts
+16
-0
No files found.
apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
View file @
ae1700ed
...
...
@@ -166,22 +166,24 @@ module.exports = {
.
verify
.
attributeEquals
(
'*[data-id="uiPathInput"]'
,
'value'
,
'tests'
)
},
'Solidity Unit tests Basic'
:
function
(
browser
:
NightwatchBrowser
)
{
'Solidity Unit tests Basic
Basic with local compiler
'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfilePanel"]'
)
.
clickLaunchIcon
(
'filePanel'
)
.
click
(
'*[data-id="treeViewLitreeViewItemcontracts"]'
)
.
clickLaunchIcon
(
'solidity'
)
.
setSolidityCompilerVersion
(
'builtin'
)
.
openFile
(
'contracts/3_Ballot.sol'
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
pause
(
2000
)
.
verify
.
attributeEquals
(
'*[data-id="uiPathInput"]'
,
'value'
,
'tests'
)
.
clickLaunchIcon
(
'pluginManager'
)
.
scrollAndClick
(
'[data-id="pluginManagerComponentDeactivateButtonsolidityUnitTesting"]'
)
.
pause
(
2000
)
.
scrollAndClick
(
'[data-id="pluginManagerComponentActivateButtonsolidityUnitTesting"]'
)
.
pause
(
5000
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
scrollAndClick
(
'#runTestsTabRunAction'
)
.
waitForElementVisible
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
120000
)
.
waitForElementPresent
(
'#solidityUnittestsOutput div[class^="testPass"]'
,
60000
)
.
waitForElementContainsText
(
'#solidityUnittestsOutput'
,
'tests/4_Ballot_test.sol'
,
60000
)
.
waitForElementContainsText
(
'#solidityUnittestsOutput'
,
'✓ Check winning proposal'
,
60000
)
.
waitForElementContainsText
(
'#solidityUnittestsOutput'
,
'✓ Check winnin proposal with return value'
,
60000
)
.
end
()
},
'Debug failed test using debugger'
:
function
(
browser
:
NightwatchBrowser
)
{
...
...
@@ -216,22 +218,20 @@ module.exports = {
'Basic Solidity Unit tests with local compiler'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
clickLaunchIcon
(
'solidity'
)
.
setSolidityCompilerVersion
(
'builtin'
)
.
waitForElementPresent
(
'*[data-id="verticalIconsKindfilePanel"]'
)
.
clickLaunchIcon
(
'filePanel'
)
.
click
(
'*[data-id="treeViewLitreeViewItemcontracts"]'
)
.
openFile
(
'contracts/3_Ballot.sol'
)
.
clickLaunchIcon
(
'pluginManager'
)
.
scrollAndClick
(
'[data-id="pluginManagerComponentDeactivateButtonsolidityUnitTesting"]'
)
.
pause
(
2000
)
.
scrollAndClick
(
'[data-id="pluginManagerComponentActivateButtonsolidityUnitTesting"]'
)
.
pause
(
5000
)
.
clickLaunchIcon
(
'solidityUnitTesting'
)
.
pause
(
2000
)
.
verify
.
attributeEquals
(
'*[data-id="uiPathInput"]'
,
'value'
,
'tests'
)
.
pause
(
2000
)
.
scrollAndClick
(
'#runTestsTabRunAction'
)
.
waitForElementVisible
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
120000
)
.
waitForElementPresent
(
'#solidityUnittestsOutput div[class^="testPass"]'
,
60000
)
.
waitForElementContainsText
(
'#solidityUnittestsOutput'
,
'tests/4_Ballot_test.sol'
,
60000
)
.
waitForElementContainsText
(
'#solidityUnittestsOutput'
,
'✓ Check winning proposal'
,
60000
)
.
waitForElementContainsText
(
'#solidityUnittestsOutput'
,
'✓ Check winnin proposal with return value'
,
60000
)
.
end
()
}
}
...
...
apps/remix-ide-e2e/src/tests/workspace.test.ts
View file @
ae1700ed
...
...
@@ -37,8 +37,8 @@ module.exports = {
.
waitForElementVisible
(
'*[data-id="modalDialogCustomPromptTextCreate"]'
)
// eslint-disable-next-line dot-notation
.
execute
(
function
()
{
document
.
querySelector
(
'*[data-id="modalDialogCustomPromptTextCreate"]'
)[
'value'
]
=
'workspace_name'
})
.
pause
(
5000
)
.
waitForElementVisible
(
'*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok'
)
.
pause
(
1000
)
.
click
(
'*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok'
)
.
waitForElementVisible
(
'*[data-id="treeViewLitreeViewItemtests"]'
)
.
addFile
(
'test.sol'
,
{
content
:
'test'
})
...
...
apps/remix-ide/src/app/panels/terminal.js
View file @
ae1700ed
...
...
@@ -4,7 +4,6 @@ import ReactDOM from 'react-dom'
import
{
RemixUiTerminal
}
from
'@remix-ui/terminal'
// eslint-disable-line
import
{
Plugin
}
from
'@remixproject/engine'
import
*
as
packageJson
from
'../../../../../package.json'
var
vm
=
require
(
'vm'
)
var
EventManager
=
require
(
'../../lib/events'
)
var
CommandInterpreterAPI
=
require
(
'../../lib/cmdInterpreterAPI'
)
...
...
@@ -48,18 +47,7 @@ class Terminal extends Plugin {
compilersArtefacts
:
this
.
registry
.
get
(
'compilersartefacts'
).
api
,
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
}
this
.
commandHelp
=
{
'remix.loadgist(id)'
:
'Load a gist in the file explorer.'
,
'remix.loadurl(url)'
:
'Load the given url in the file explorer. The url can be of type github, swarm, ipfs or raw http'
,
'remix.execute(filepath)'
:
'Run the script specified by file path. If filepath is empty, script currently displayed in the editor is executed.'
,
'remix.exeCurrent()'
:
'Run the script currently displayed in the editor'
,
'remix.help()'
:
'Display this help message'
}
this
.
blockchain
=
opts
.
blockchain
this
.
vm
=
vm
this
.
_api
=
api
this
.
_opts
=
opts
this
.
config
=
config
this
.
version
=
packageJson
.
version
this
.
data
=
{
lineLength
:
opts
.
lineLength
||
80
,
// ????
...
...
@@ -115,29 +103,17 @@ class Terminal extends Plugin {
renderComponent
()
{
ReactDOM
.
render
(
<
RemixUiTerminal
event
=
{
this
.
event
}
autoCompletePopupEvent
=
{
this
.
_components
.
autoCompletePopup
.
event
}
blockchain
=
{
this
.
blockchain
}
api
=
{
this
.
_api
}
options
=
{
this
.
_opts
}
data
=
{
this
.
data
}
cmdInterpreter
=
{
this
.
_components
.
cmdInterpreter
}
autoCompletePopup
=
{
this
.
_components
.
autoCompletePopup
}
registerCommand
=
{
this
.
registerCommand
}
command
=
{
this
.
commands
}
version
=
{
this
.
version
}
config
=
{
this
.
config
}
thisState
=
{
this
}
vm
=
{
this
.
vm
}
blockchain
=
{
this
.
blockchain
}
commandHelp
=
{
this
.
commandHelp
}
event
=
{
this
.
event
}
_deps
=
{
this
.
_deps
}
fileImport
=
{
this
.
fileImport
}
sourceHighlighter
=
{
this
.
sourceHighlighter
}
gistHandler
=
{
this
.
gistHandler
}
registry
=
{
this
.
registry
}
commands
=
{
this
.
commands
}
txListener
=
{
this
.
txListener
}
eventsDecoder
=
{
this
.
eventsDecoder
}
/>
,
...
...
libs/remix-ui/terminal/src/lib/components/ChechTxStatus.tsx
0 → 100644
View file @
ae1700ed
import
React
from
'react'
// eslint-disable-line
const
checkTxStatus
=
(
tx
,
type
)
=>
{
if
(
tx
.
status
===
'0x1'
||
tx
.
status
===
true
)
{
return
(<
i
className=
'txStatus succeeded fas fa-check-circle'
></
i
>)
}
if
(
type
===
'call'
||
type
===
'unknownCall'
||
type
===
'unknown'
)
{
return
(<
i
className=
'txStatus call'
>
call
</
i
>)
}
else
if
(
tx
.
status
===
'0x0'
||
tx
.
status
===
false
)
{
return
(<
i
className=
'txStatus failed fas fa-times-circle'
></
i
>)
}
else
{
return
(<
i
className=
'txStatus notavailable fas fa-circle-thin'
title=
'Status not available'
></
i
>)
}
}
export
default
checkTxStatus
libs/remix-ui/terminal/src/lib/components/Context.tsx
0 → 100644
View file @
ae1700ed
import
React
from
'react'
// eslint-disable-line
import
helper
from
'apps/remix-ide/src/lib/helper'
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
var
typeConversion
=
remixLib
.
execution
.
typeConversion
const
context
=
(
opts
,
blockchain
)
=>
{
const
data
=
opts
.
tx
||
''
const
from
=
opts
.
from
?
helper
.
shortenHexData
(
opts
.
from
)
:
''
let
to
=
opts
.
to
if
(
data
.
to
)
to
=
to
+
' '
+
helper
.
shortenHexData
(
data
.
to
)
const
val
=
data
.
value
let
hash
=
data
.
hash
?
helper
.
shortenHexData
(
data
.
hash
)
:
''
const
input
=
data
.
input
?
helper
.
shortenHexData
(
data
.
input
)
:
''
const
logs
=
data
.
logs
&&
data
.
logs
.
decoded
&&
data
.
logs
.
decoded
.
length
?
data
.
logs
.
decoded
.
length
:
0
const
block
=
data
.
receipt
?
data
.
receipt
.
blockNumber
:
data
.
blockNumber
||
''
const
i
=
data
.
receipt
?
data
.
transactionIndex
:
data
.
transactionIndex
const
value
=
val
?
typeConversion
.
toInt
(
val
)
:
0
if
(
blockchain
.
getProvider
()
===
'vm'
)
{
return
(
<
div
>
<
span
className=
'txLog_7Xiho'
>
<
span
className=
'tx'
>
[vm]
</
span
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
from:
</
span
>
{
from
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
to:
</
span
>
{
to
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
value:
</
span
>
{
value
}
wei
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
data:
</
span
>
{
input
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
logs:
</
span
>
{
logs
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
hash:
</
span
>
{
hash
}
</
div
>
</
span
>
</
div
>)
}
else
if
(
blockchain
.
getProvider
()
!==
'vm'
&&
data
.
resolvedData
)
{
return
(
<
div
>
<
span
className=
'txLog_7Xiho'
>
<
span
className=
'tx'
>
[block:
{
block
}
txIndex:
{
i
}
]
</
span
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
from:
</
span
>
{
from
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
to:
</
span
>
{
to
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
value:
</
span
>
{
value
}
wei
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
data:
</
span
>
{
input
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
logs:
</
span
>
{
logs
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
hash:
</
span
>
{
hash
}
</
div
>
</
span
>
</
div
>)
}
else
{
hash
=
helper
.
shortenHexData
(
data
.
blockHash
)
return
(
<
div
>
<
span
className=
'txLog'
>
<
span
className=
'tx'
>
[block:
{
block
}
txIndex:
{
i
}
]
</
span
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
from:
</
span
>
{
from
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
to:
</
span
>
{
to
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
value:
</
span
>
{
value
}
wei
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
data:
</
span
>
{
input
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
logs:
</
span
>
{
logs
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
hash:
</
span
>
{
hash
}
</
div
>
</
span
>
</
div
>)
}
}
export
default
context
libs/remix-ui/terminal/src/lib/components/RenderCall.tsx
0 → 100644
View file @
ae1700ed
import
React
,
{
useState
}
from
'react'
// eslint-disable-line
import
helper
from
'apps/remix-ide/src/lib/helper'
import
checkTxStatus
from
'./ChechTxStatus'
import
showTable
from
'./Table'
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
// eslint-disable-line
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
var
typeConversion
=
remixLib
.
execution
.
typeConversion
const
renderCall
=
(
tx
,
resolvedData
,
logs
,
index
,
props
,
showTableHash
,
txDetails
)
=>
{
const
to
=
resolvedData
.
contractName
+
'.'
+
resolvedData
.
fn
const
from
=
tx
.
from
?
tx
.
from
:
' - '
const
input
=
tx
.
input
?
helper
.
shortenHexData
(
tx
.
input
)
:
''
const
txType
=
'call'
const
debug
=
(
event
,
tx
)
=>
{
event
.
stopPropagation
()
if
(
tx
.
isCall
&&
tx
.
envMode
!==
'vm'
)
{
return
(<
ModalDialog
hide=
{
false
}
handleHide=
{
()
=>
{}
}
message=
"Cannot debug this call. Debugging calls is only possible in JavaScript VM mode."
/>)
}
else
{
props
.
event
.
trigger
(
'debuggingRequested'
,
[
tx
.
hash
])
}
}
return
(
<
span
id=
{
`tx${tx.hash}`
}
key=
{
index
}
>
<
div
className=
"log"
onClick=
{
(
event
)
=>
txDetails
(
event
,
tx
)
}
>
{
checkTxStatus
(
tx
,
txType
)
}
<
span
className=
"txLog"
>
<
span
className=
"tx"
>
[call]
</
span
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
from:
</
span
>
{
from
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
to:
</
span
>
{
to
}
</
div
>
<
div
className=
'txItem'
><
span
className=
'txItemTitle'
>
data:
</
span
>
{
input
}
</
div
>
</
span
>
<
div
className=
'buttons'
>
<
div
className=
"debug btn btn-primary btn-sm"
onClick=
{
(
event
)
=>
debug
(
event
,
tx
)
}
>
Debug
</
div
>
</
div
>
<
i
className=
"arrow fas fa-angle-down"
></
i
>
</
div
>
{
showTableHash
.
includes
(
tx
.
hash
)
?
showTable
({
hash
:
tx
.
hash
,
isCall
:
tx
.
isCall
,
contractAddress
:
tx
.
contractAddress
,
data
:
tx
,
from
,
to
,
gas
:
tx
.
gas
,
input
:
tx
.
input
,
'decoded input'
:
resolvedData
&&
resolvedData
.
params
?
JSON
.
stringify
(
typeConversion
.
stringify
(
resolvedData
.
params
),
null
,
'
\
t'
)
:
' - '
,
'decoded output'
:
resolvedData
&&
resolvedData
.
decodedReturnValue
?
JSON
.
stringify
(
typeConversion
.
stringify
(
resolvedData
.
decodedReturnValue
),
null
,
'
\
t'
)
:
' - '
,
val
:
tx
.
value
,
logs
:
logs
,
transactionCost
:
tx
.
transactionCost
,
executionCost
:
tx
.
executionCost
},
showTableHash
)
:
null
}
</
span
>
)
}
export
default
renderCall
libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx
0 → 100644
View file @
ae1700ed
import
React
,
{
useState
}
from
'react'
// eslint-disable-line
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
// eslint-disable-line
import
checkTxStatus
from
'./ChechTxStatus'
import
context
from
'./Context'
import
showTable
from
'./Table'
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
typeConversion
=
remixLib
.
execution
.
typeConversion
const
renderKnownTransactions
=
(
tx
,
receipt
,
resolvedData
,
logs
,
index
,
props
,
showTableHash
,
txDetails
)
=>
{
const
debug
=
(
event
,
tx
)
=>
{
event
.
stopPropagation
()
if
(
tx
.
isCall
&&
tx
.
envMode
!==
'vm'
)
{
return
(<
ModalDialog
hide=
{
false
}
handleHide=
{
()
=>
{}
}
message=
"Cannot debug this call. Debugging calls is only possible in JavaScript VM mode."
/>)
}
else
{
props
.
event
.
trigger
(
'debuggingRequested'
,
[
tx
.
hash
])
}
}
const
from
=
tx
.
from
const
to
=
resolvedData
.
contractName
+
'.'
+
resolvedData
.
fn
// const obj = { from, to }
const
txType
=
'knownTx'
return
(
<
span
id=
{
`tx${tx.hash}`
}
key=
{
index
}
>
<
div
className=
"log"
onClick=
{
(
event
)
=>
txDetails
(
event
,
tx
)
}
>
{
checkTxStatus
(
receipt
,
txType
)
}
{
context
({
from
,
to
,
tx
},
props
.
blockchain
)
}
<
div
className=
'buttons'
>
<
div
className=
'debug btn btn-primary btn-sm'
data
-
shared=
'txLoggerDebugButton'
data
-
id=
{
`txLoggerDebugButton${tx.hash}`
}
onClick=
{
(
event
)
=>
debug
(
event
,
tx
)
}
>
Debug
</
div
>
</
div
>
<
i
className
=
{`
arrow
fas
$
{(
showTableHash
.
includes
(
tx
.
hash
))
?
'
fa
-
angle
-
up
'
:
'
fa
-
angle
-
down
'}`}
></
i
>
</
div
>
{
console
.
log
({
showTableHash
:
showTableHash
.
includes
(
tx
.
hash
)
})
}
{
showTableHash
.
includes
(
tx
.
hash
)
?
showTable
({
hash
:
tx
.
hash
,
status
:
receipt
!==
null
?
receipt
.
status
:
null
,
isCall
:
tx
.
isCall
,
contractAddress
:
tx
.
contractAddress
,
data
:
tx
,
from
,
to
,
gas
:
tx
.
gas
,
input
:
tx
.
input
,
'decoded input'
:
resolvedData
&&
resolvedData
.
params
?
JSON
.
stringify
(
typeConversion
.
stringify
(
resolvedData
.
params
),
null
,
'
\
t'
)
:
' - '
,
'decoded output'
:
resolvedData
&&
resolvedData
.
decodedReturnValue
?
JSON
.
stringify
(
typeConversion
.
stringify
(
resolvedData
.
decodedReturnValue
),
null
,
'
\
t'
)
:
' - '
,
logs
:
logs
,
val
:
tx
.
value
,
transactionCost
:
tx
.
transactionCost
,
executionCost
:
tx
.
executionCost
},
showTableHash
)
:
null
}
</
span
>
)
}
export
default
renderKnownTransactions
libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx
0 → 100644
View file @
ae1700ed
import
React
,
{
useState
}
from
'react'
// eslint-disable-line
import
{
ModalDialog
}
from
'@remix-ui/modal-dialog'
// eslint-disable-line
import
checkTxStatus
from
'./ChechTxStatus'
import
context
from
'./Context'
import
showTable
from
'./Table'
const
renderUnKnownTransactions
=
(
tx
,
receipt
,
index
,
props
,
showTableHash
,
txDetails
)
=>
{
const
debug
=
(
event
,
tx
)
=>
{
event
.
stopPropagation
()
if
(
tx
.
isCall
&&
tx
.
envMode
!==
'vm'
)
{
return
(<
ModalDialog
hide=
{
false
}
handleHide=
{
()
=>
{}
}
message=
"Cannot debug this call. Debugging calls is only possible in JavaScript VM mode."
/>)
}
else
{
props
.
event
.
trigger
(
'debuggingRequested'
,
[
tx
.
hash
])
}
}
const
from
=
tx
.
from
const
to
=
tx
.
to
// const obj = { from, to }
const
txType
=
'unknown'
+
(
tx
.
isCall
?
'Call'
:
'Tx'
)
return
(
<
span
id=
{
`tx${tx.hash}`
}
key=
{
index
}
>
<
div
className=
"log"
onClick=
{
(
event
)
=>
txDetails
(
event
,
tx
)
}
>
{
checkTxStatus
(
receipt
||
tx
,
txType
)
}
{
context
({
from
,
to
,
tx
},
props
.
blockchain
)
}
<
div
className=
'buttons'
>
<
div
className=
'debug btn btn-primary btn-sm'
data
-
shared=
'txLoggerDebugButton'
data
-
id=
{
`txLoggerDebugButton${tx.hash}`
}
onClick=
{
(
event
)
=>
debug
(
event
,
tx
)
}
>
Debug
</
div
>
</
div
>
<
i
className
=
{`
arrow
fas
$
{(
showTableHash
.
includes
(
tx
.
hash
))
?
'
fa
-
angle
-
up
'
:
'
fa
-
angle
-
down
'}`}
></
i
>
</
div
>
{
showTableHash
.
includes
(
tx
.
hash
)
?
showTable
({
hash
:
tx
.
hash
,
status
:
receipt
!==
null
?
receipt
.
status
:
null
,
isCall
:
tx
.
isCall
,
contractAddress
:
tx
.
contractAddress
,
data
:
tx
,
from
,
to
,
gas
:
tx
.
gas
,
input
:
tx
.
input
,
'decoded output'
:
' - '
,
val
:
tx
.
value
,
transactionCost
:
tx
.
transactionCost
,
executionCost
:
tx
.
executionCost
},
showTableHash
)
:
null
}
</
span
>
)
}
export
default
renderUnKnownTransactions
libs/remix-ui/terminal/src/lib/components/Table.tsx
0 → 100644
View file @
ae1700ed
import
React
,
{
useState
}
from
'react'
// eslint-disable-line
import
{
CopyToClipboard
}
from
'@remix-ui/clipboard'
// eslint-disable-line
import
helper
from
'apps/remix-ide/src/lib/helper'
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
var
typeConversion
=
remixLib
.
execution
.
typeConversion
const
showTable
=
(
opts
,
showTableHash
)
=>
{
let
msg
=
''
let
toHash
const
data
=
opts
.
data
// opts.data = data.tx
if
(
data
.
to
)
{
toHash
=
opts
.
to
+
' '
+
data
.
to
}
else
{
toHash
=
opts
.
to
}
let
callWarning
=
''
if
(
opts
.
isCall
)
{
callWarning
=
'(Cost only applies when called by a contract)'
}
if
(
!
opts
.
isCall
)
{
if
(
opts
.
status
!==
undefined
&&
opts
.
status
!==
null
)
{
if
(
opts
.
status
===
'0x0'
||
opts
.
status
===
false
)
{
msg
=
'Transaction mined but execution failed'
}
else
if
(
opts
.
status
===
'0x1'
||
opts
.
status
===
true
)
{
msg
=
'Transaction mined and execution succeed'
}
}
else
{
msg
=
'Status not available at the moment'
}
}
let
stringified
=
' - '
if
(
opts
.
logs
&&
opts
.
logs
.
decoded
)
{
stringified
=
typeConversion
.
stringify
(
opts
.
logs
.
decoded
)
}
const
val
=
opts
.
val
!=
null
?
typeConversion
.
toInt
(
opts
.
val
)
:
0
return
(
<
table
className=
{
`txTable ${showTableHash.includes(opts.hash) ? 'active' : ''}`
}
id=
'txTable'
data
-
id=
{
`txLoggerTable${opts.hash}`
}
>
<
tbody
>
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
status
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableStatus${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
`${opts.status} ${msg}`
}
</
td
>
</
tr
>
)
{
opts
.
hash
?
(<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
transaction hash
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
hash
}
<
CopyToClipboard
content=
{
opts
.
hash
}
/>
</
td
>
</
tr
>)
:
null
}
{
opts
.
contractAddress
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
contract address
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableContractAddress${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
contractAddress
}
<
CopyToClipboard
content=
{
opts
.
contractAddress
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
from
?
(
<
tr
className=
'tr'
>
<
td
className=
'td tableTitle'
data
-
shared=
{
`key_${opts.hash}`
}
>
from
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableFrom${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
from
}
<
CopyToClipboard
content=
{
opts
.
from
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
to
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
to
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableTo${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
toHash
}
<
CopyToClipboard
content=
{
data
.
to
?
data
.
to
:
toHash
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
gas
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
gas
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableGas${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
gas
}
gas
<
CopyToClipboard
content=
{
opts
.
gas
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
transactionCost
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
transaction cost
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableTransactionCost${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
transactionCost
}
gas
{
callWarning
}
<
CopyToClipboard
content=
{
opts
.
transactionCost
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
executionCost
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
execution cost
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableExecutionHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
executionCost
}
gas
{
callWarning
}
<
CopyToClipboard
content=
{
opts
.
executionCost
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
hash
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
hash
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
hash
}
<
CopyToClipboard
content=
{
opts
.
hash
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
input
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
input
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
helper
.
shortenHexData
(
opts
.
input
)
}
<
CopyToClipboard
content=
{
opts
.
input
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
[
'decoded input'
]
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
decoded input
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
[
'decoded input'
].
trim
()
}
<
CopyToClipboard
content=
{
opts
[
'decoded input'
]
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
[
'decoded output'
]
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
decoded output
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
[
'decoded output'
]
}
<
CopyToClipboard
content=
{
opts
[
'decoded output'
]
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
logs
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
logs
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
JSON
.
stringify
(
stringified
,
null
,
'
\
t'
)
}
<
CopyToClipboard
content=
{
JSON
.
stringify
(
stringified
,
null
,
'
\
t'
)
}
/>
<
CopyToClipboard
content=
{
JSON
.
stringify
(
opts
.
logs
.
raw
||
'0'
)
}
/>
</
td
>
</
tr
>
)
:
null
}
{
opts
.
val
?
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
val
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
val
}
wei
<
CopyToClipboard
content=
{
`${val} wei`
}
/>
</
td
>
</
tr
>
)
:
null
}
</
tbody
>
</
table
>
)
}
export
default
showTable
libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
View file @
ae1700ed
This diff is collapsed.
Click to expand it.
libs/remix-ui/terminal/src/lib/types/terminalTypes.ts
View file @
ae1700ed
...
...
@@ -5,3 +5,20 @@ export interface ROOTS {
gidx
:
number
,
idx
:
number
}
export
interface
RemixUiTerminalProps
{
event
:
any
blockchain
:
any
version
:
any
config
:
any
thisState
:
any
vm
:
any
_deps
:
any
,
fileImport
:
any
,
gistHandler
:
any
,
sourceHighlighter
:
any
,
registry
:
any
,
txListener
:
any
,
eventsDecoder
:
any
,
logHtml
:
any
}
libs/remix-ui/terminal/src/lib/utils/wrapScript.ts
0 → 100644
View file @
ae1700ed
export
const
wrapScript
=
(
script
)
=>
{
const
isKnownScript
=
[
'remix.'
,
'git'
].
some
(
prefix
=>
script
.
trim
().
startsWith
(
prefix
))
if
(
isKnownScript
)
return
script
return
`
try {
const ret =
${
script
}
;
if (ret instanceof Promise) {
ret.then((result) => { console.log(result) }).catch((error) => { console.log(error) })
} else {
console.log(ret)
}
} catch (e) {
console.log(e.message)
}
`
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment