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
c48fb569
Commit
c48fb569
authored
Aug 27, 2021
by
davidzagi93@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging winnerName from Run and Deploy to terminal
parent
c734f28a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
25 deletions
+59
-25
testFunction.ts
apps/remix-ide-e2e/src/commands/testFunction.ts
+1
-2
terminal.js
apps/remix-ide/src/app/panels/terminal.js
+4
-2
terminalAction.ts
libs/remix-ui/terminal/src/lib/actions/terminalAction.ts
+5
-14
terminalReducer.ts
libs/remix-ui/terminal/src/lib/reducers/terminalReducer.ts
+0
-1
remix-ui-terminal.tsx
libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
+49
-6
No files found.
apps/remix-ide-e2e/src/commands/testFunction.ts
View file @
c48fb569
...
@@ -25,7 +25,6 @@ class TestFunction extends EventEmitter {
...
@@ -25,7 +25,6 @@ class TestFunction extends EventEmitter {
browser
.
waitForElementVisible
(
`[data-id="block_tx
${
txHash
}
"]`
,
60000
)
browser
.
waitForElementVisible
(
`[data-id="block_tx
${
txHash
}
"]`
,
60000
)
.
click
(
`[data-id="block_tx
${
txHash
}
"]`
)
.
click
(
`[data-id="block_tx
${
txHash
}
"]`
)
.
waitForElementVisible
(
`*[data-id="txLoggerTable
${
txHash
}
"]`
,
60000
)
.
waitForElementVisible
(
`*[data-id="txLoggerTable
${
txHash
}
"]`
,
60000
)
.
pause
(
10000
)
// fetch and format transaction logs as key => pair object
// fetch and format transaction logs as key => pair object
.
elements
(
'css selector'
,
`*[data-shared="key_
${
txHash
}
"]`
,
(
res
)
=>
{
.
elements
(
'css selector'
,
`*[data-shared="key_
${
txHash
}
"]`
,
(
res
)
=>
{
Array
.
isArray
(
res
.
value
)
&&
res
.
value
.
forEach
(
function
(
jsonWebElement
)
{
Array
.
isArray
(
res
.
value
)
&&
res
.
value
.
forEach
(
function
(
jsonWebElement
)
{
...
@@ -55,10 +54,10 @@ class TestFunction extends EventEmitter {
...
@@ -55,10 +54,10 @@ class TestFunction extends EventEmitter {
})
})
}).
perform
(()
=>
done
())
}).
perform
(()
=>
done
())
})
})
.
click
(
`[data-id="block_tx
${
txHash
}
"]`
)
.
perform
(()
=>
{
.
perform
(()
=>
{
Object
.
keys
(
expectedValue
).
forEach
(
key
=>
{
Object
.
keys
(
expectedValue
).
forEach
(
key
=>
{
let
equal
=
false
let
equal
=
false
try
{
try
{
const
receivedValue
=
JSON
.
parse
(
logs
[
key
])
const
receivedValue
=
JSON
.
parse
(
logs
[
key
])
...
...
apps/remix-ide/src/app/panels/terminal.js
View file @
c48fb569
...
@@ -102,8 +102,10 @@ class Terminal extends Plugin {
...
@@ -102,8 +102,10 @@ class Terminal extends Plugin {
}
}
logHtml
(
html
)
{
logHtml
(
html
)
{
var
command
=
this
.
commands
.
html
// console.log({ html: html.innerText })
if
(
typeof
command
===
'function'
)
command
(
html
)
this
.
logHtmlResponse
.
push
(
html
.
innerText
)
this
.
renderComponent
()
this
.
logHtmlResponse
=
[]
}
}
render
()
{
render
()
{
...
...
libs/remix-ui/terminal/src/lib/actions/terminalAction.ts
View file @
c48fb569
...
@@ -54,12 +54,10 @@ export const registerCommandAction = (name, command, activate, dispatch) => {
...
@@ -54,12 +54,10 @@ export const registerCommandAction = (name, command, activate, dispatch) => {
item
.
step
=
steps
.
push
(
item
)
-
1
item
.
step
=
steps
.
push
(
item
)
-
1
item
.
args
=
params
item
.
args
=
params
// _appendItem(item)
// _appendItem(item)
console
.
log
({
item
},
'append items'
)
// self._appendItem(item)
// self._appendItem(item)
}
}
var
scopedCommands
=
_scopeCommands
(
append
)
var
scopedCommands
=
_scopeCommands
(
append
)
command
(
args
,
scopedCommands
,
el
=>
append
(
null
,
args
,
blockify
(
el
)))
command
(
args
,
scopedCommands
,
el
=>
append
(
null
,
args
,
blockify
(
el
)))
console
.
log
({
args
})
}
}
const
help
=
typeof
command
.
help
===
'string'
?
command
.
help
:
[
const
help
=
typeof
command
.
help
===
'string'
?
command
.
help
:
[
'// no help available for:'
,
`terminal.command.
${
name
}
`
'// no help available for:'
,
`terminal.command.
${
name
}
`
...
@@ -83,11 +81,9 @@ export const registerCommandAction = (name, command, activate, dispatch) => {
...
@@ -83,11 +81,9 @@ export const registerCommandAction = (name, command, activate, dispatch) => {
var
command
=
_commands
[
cmd
]
var
command
=
_commands
[
cmd
]
scopedCommands
[
cmd
]
=
function
_command
()
{
scopedCommands
[
cmd
]
=
function
_command
()
{
var
args
=
[...
arguments
]
var
args
=
[...
arguments
]
console
.
log
({
cmd
},
{
args
},
{
blockify
})
command
(
args
,
scopedCommands
,
el
=>
append
(
cmd
,
args
,
blockify
(
el
)))
command
(
args
,
scopedCommands
,
el
=>
append
(
cmd
,
args
,
blockify
(
el
)))
}
}
})
})
console
.
log
({
scopedCommands
})
return
scopedCommands
return
scopedCommands
}
}
}
}
...
@@ -142,20 +138,16 @@ export const initListeningOnNetwork = (props, dispatch) => {
...
@@ -142,20 +138,16 @@ export const initListeningOnNetwork = (props, dispatch) => {
props
.
txListener
.
event
.
register
(
'newBlock'
,
(
block
)
=>
{
props
.
txListener
.
event
.
register
(
'newBlock'
,
(
block
)
=>
{
if
(
!
block
.
transactions
||
(
block
.
transactions
&&
!
block
.
transactions
.
length
))
{
if
(
!
block
.
transactions
||
(
block
.
transactions
&&
!
block
.
transactions
.
length
))
{
dispatch
({
type
:
'emptyBlock'
,
payload
:
{
message
:
0
}
})
dispatch
({
type
:
'emptyBlock'
,
payload
:
{
message
:
0
}
})
console
.
log
({
block
},
' david'
)
// registerCommandAction('emptyBlock', (args, cmds, append) => {
// registerCommandAction('emptyBlock', (args, cmds, append) => {
// const data = args[0]
// const data = args[0]
// console.log({ data }, ' useEffect props')
// // // var el = renderEmptyBlock(this, data)
// // // var el = renderEmptyBlock(this, data)
// // // append(el)
// // // append(el)
// }, { activate: true }, dispatch)
// }, { activate: true }, dispatch)
}
else
{
}
else
{
registerCommandAction
(
'knownTransaction'
,
function
(
args
)
{
registerCommandAction
(
'knownTransaction'
,
function
(
args
)
{
var
data
=
args
[
0
]
var
data
=
args
[
0
]
console
.
log
({
data
})
// let el
// let el
// if (data.tx.isCall) {
// if (data.tx.isCall) {
// console.log({ data })
// // el = renderCall(this, data)
// // el = renderCall(this, data)
// } else {
// } else {
// // el = renderKnownTransaction(this, data, blockchain)
// // el = renderKnownTransaction(this, data, blockchain)
...
@@ -165,8 +157,11 @@ export const initListeningOnNetwork = (props, dispatch) => {
...
@@ -165,8 +157,11 @@ export const initListeningOnNetwork = (props, dispatch) => {
},
{
activate
:
true
},
dispatch
)
},
{
activate
:
true
},
dispatch
)
}
}
})
})
props
.
txListener
.
event
.
register
(
'newCall'
,
()
=>
{
props
.
txListener
.
event
.
register
(
'knownTransaction'
,
(
block
)
=>
{
console
.
log
(
'new call action'
)
console
.
log
({
block
},
' is call transaction test'
)
})
props
.
txListener
.
event
.
register
(
'newCall'
,
(
tx
,
receipt
)
=>
{
log
(
props
,
tx
,
receipt
,
dispatch
)
// log(this, tx, null)
// log(this, tx, null)
})
})
props
.
txListener
.
event
.
register
(
'newTransaction'
,
(
tx
,
receipt
)
=>
{
props
.
txListener
.
event
.
register
(
'newTransaction'
,
(
tx
,
receipt
)
=>
{
...
@@ -196,16 +191,12 @@ export const initListeningOnNetwork = (props, dispatch) => {
...
@@ -196,16 +191,12 @@ export const initListeningOnNetwork = (props, dispatch) => {
if
(
props
.
_deps
.
compilersArtefacts
.
__last
)
{
if
(
props
.
_deps
.
compilersArtefacts
.
__last
)
{
compiledContracts
=
await
props
.
_deps
.
compilersArtefacts
.
__last
.
getContracts
()
compiledContracts
=
await
props
.
_deps
.
compilersArtefacts
.
__last
.
getContracts
()
}
}
console
.
log
({
compiledContracts
})
await
props
.
eventsDecoder
.
parseLogs
(
tx
,
resolvedTransaction
.
contractName
,
compiledContracts
,
async
(
error
,
logs
)
=>
{
await
props
.
eventsDecoder
.
parseLogs
(
tx
,
resolvedTransaction
.
contractName
,
compiledContracts
,
async
(
error
,
logs
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
console
.
log
({
tx
:
tx
,
receipt
:
receipt
,
resolvedData
:
resolvedTransaction
,
logs
:
logs
})
console
.
log
(
'knownTransaction dispatch'
)
await
dispatch
({
type
:
'knownTransaction'
,
payload
:
{
message
:
[{
tx
:
tx
,
receipt
:
receipt
,
resolvedData
:
resolvedTransaction
,
logs
:
logs
}]
}
})
await
dispatch
({
type
:
'knownTransaction'
,
payload
:
{
message
:
[{
tx
:
tx
,
receipt
:
receipt
,
resolvedData
:
resolvedTransaction
,
logs
:
logs
}]
}
})
}
}
})
})
}
else
{
}
else
{
console
.
log
(
'unknownTransaction'
)
// contract unknown - just displaying raw tx.
// contract unknown - just displaying raw tx.
// logUnknownTX({ tx: tx, receipt: receipt })
// logUnknownTX({ tx: tx, receipt: receipt })
await
dispatch
({
type
:
'unknownTransaction'
,
payload
:
{
message
:
[{
tx
:
tx
,
receipt
:
receipt
}]
}
})
await
dispatch
({
type
:
'unknownTransaction'
,
payload
:
{
message
:
[{
tx
:
tx
,
receipt
:
receipt
}]
}
})
...
...
libs/remix-ui/terminal/src/lib/reducers/terminalReducer.ts
View file @
c48fb569
...
@@ -180,7 +180,6 @@ export const registerScriptRunnerReducer = (state, action) => {
...
@@ -180,7 +180,6 @@ export const registerScriptRunnerReducer = (state, action) => {
journalBlocks
:
initialState
.
journalBlocks
.
push
({
message
:
action
.
payload
.
message
,
style
:
''
,
name
:
'unknownTransaction'
})
journalBlocks
:
initialState
.
journalBlocks
.
push
({
message
:
action
.
payload
.
message
,
style
:
''
,
name
:
'unknownTransaction'
})
}
}
case
'emptyBlock'
:
case
'emptyBlock'
:
console
.
log
({
action
:
action
.
payload
.
message
},
' emptyBLock reducer'
)
return
{
return
{
...
state
,
...
state
,
journalBlocks
:
initialState
.
journalBlocks
.
push
({
message
:
action
.
payload
.
message
,
style
:
''
,
name
:
'emptyBlock'
})
journalBlocks
:
initialState
.
journalBlocks
.
push
({
message
:
action
.
payload
.
message
,
style
:
''
,
name
:
'emptyBlock'
})
...
...
libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
View file @
c48fb569
...
@@ -673,13 +673,13 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -673,13 +673,13 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
<
tr
className=
'tr'
>
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
status
</
td
>
<
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
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableStatus${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
`${opts.status} ${msg}`
}
</
td
>
</
tr
>
</
tr
>
)
<
tr
className=
'tr'
>
{
opts
.
hash
&&
(
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
transaction hash
</
td
>
<
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
}
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
.
hash
}
<
CopyToClipboard
content=
{
opts
.
hash
}
/>
<
CopyToClipboard
content=
{
opts
.
hash
}
/>
</
td
>
</
td
>
</
tr
>
</
tr
>
)
}
{
{
opts
.
contractAddress
&&
(
opts
.
contractAddress
&&
(
<
tr
className=
'tr'
>
<
tr
className=
'tr'
>
...
@@ -758,7 +758,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -758,7 +758,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
)
}
)
}
{
opts
[
'decoded input'
]
&&
(
{
opts
[
'decoded input'
]
&&
(
<
tr
className=
'tr'
>
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
decode input
</
td
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
decode
d
input
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
[
'decoded input'
].
trim
()
}
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
[
'decoded input'
].
trim
()
}
<
CopyToClipboard
content=
{
opts
[
'decoded input'
]
}
/>
<
CopyToClipboard
content=
{
opts
[
'decoded input'
]
}
/>
</
td
>
</
td
>
...
@@ -766,7 +766,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -766,7 +766,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
)
}
)
}
{
opts
[
'decoded output'
]
&&
(
{
opts
[
'decoded output'
]
&&
(
<
tr
className=
'tr'
>
<
tr
className=
'tr'
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
decode output
</
td
>
<
td
className=
'td'
data
-
shared=
{
`key_${opts.hash}`
}
>
decode
d
output
</
td
>
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
[
'decoded output'
]
}
<
td
className=
'td'
data
-
id=
{
`txLoggerTableHash${opts.hash}`
}
data
-
shared=
{
`pair_${opts.hash}`
}
>
{
opts
[
'decoded output'
]
}
<
CopyToClipboard
content=
{
opts
[
'decoded output'
]
}
/>
<
CopyToClipboard
content=
{
opts
[
'decoded output'
]
}
/>
</
td
>
</
td
>
...
@@ -877,6 +877,48 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -877,6 +877,48 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
)
)
}
}
const
renderCall
=
(
tx
,
resolvedData
,
logs
,
index
)
=>
{
const
to
=
resolvedData
.
contractName
+
'.'
+
resolvedData
.
fn
const
from
=
tx
.
from
?
tx
.
from
:
' - '
const
input
=
tx
.
input
?
helper
.
shortenHexData
(
tx
.
input
)
:
''
const
obj
=
{
from
,
to
}
const
txType
=
'call'
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
})
:
null
}
</
span
>
)
}
const
handleAutoComplete
=
()
=>
(
const
handleAutoComplete
=
()
=>
(
<
div
className=
'popup alert alert-secondary'
style=
{
{
display
:
autoCompletState
.
showSuggestions
&&
autoCompletState
.
userInput
!==
''
?
'block'
:
'none'
}
}
>
<
div
className=
'popup alert alert-secondary'
style=
{
{
display
:
autoCompletState
.
showSuggestions
&&
autoCompletState
.
userInput
!==
''
?
'block'
:
'none'
}
}
>
<
div
>
<
div
>
...
@@ -1433,7 +1475,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -1433,7 +1475,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
})
})
}
else
if
(
x
.
name
===
'knownTransaction'
)
{
}
else
if
(
x
.
name
===
'knownTransaction'
)
{
return
x
.
message
.
map
((
trans
)
=>
{
return
x
.
message
.
map
((
trans
)
=>
{
return
(<
div
className=
'px-4 block'
data
-
id=
{
`block_tx${trans.tx.hash}`
}
key=
{
index
}
>
{
renderKnownTransactions
(
trans
.
tx
,
trans
.
receipt
,
trans
.
resolvedData
,
trans
.
logs
,
index
)
}
</
div
>)
console
.
log
({
trans
},
' resolveData'
)
return
(<
div
className=
'px-4 block'
data
-
id=
{
`block_tx${trans.tx.hash}`
}
key=
{
index
}
>
{
trans
.
tx
.
isCall
?
renderCall
(
trans
.
tx
,
trans
.
resolvedData
,
trans
.
logs
,
index
)
:
renderKnownTransactions
(
trans
.
tx
,
trans
.
receipt
,
trans
.
resolvedData
,
trans
.
logs
,
index
)
}
</
div
>)
})
})
}
else
{
}
else
{
return
x
.
message
.
map
((
x
,
i
)
=>
{
return
x
.
message
.
map
((
x
,
i
)
=>
{
...
...
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