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
c704745c
Commit
c704745c
authored
Sep 22, 2017
by
yann300
Committed by
GitHub
Sep 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #816 from ethereum/addGasEstimation
Add gas costs
parents
63b07198
a9e69a24
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
txFormat.js
src/app/execution/txFormat.js
+1
-0
txListener.js
src/app/execution/txListener.js
+8
-1
txLogger.js
src/app/execution/txLogger.js
+23
-3
No files found.
src/app/execution/txFormat.js
View file @
c704745c
...
@@ -171,5 +171,6 @@ module.exports = {
...
@@ -171,5 +171,6 @@ module.exports = {
return
{
error
:
'Failed to decode output: '
+
e
}
return
{
error
:
'Failed to decode output: '
+
e
}
}
}
}
}
return
{}
}
}
}
}
src/app/execution/txListener.js
View file @
c704745c
...
@@ -67,7 +67,14 @@ class TxListener {
...
@@ -67,7 +67,14 @@ class TxListener {
if
(
this
.
_loopId
&&
executionContext
.
getProvider
()
!==
'vm'
)
return
// we seems to already listen on a "web3" network
if
(
this
.
_loopId
&&
executionContext
.
getProvider
()
!==
'vm'
)
return
// we seems to already listen on a "web3" network
executionContext
.
web3
().
eth
.
getTransaction
(
txResult
.
transactionHash
,
(
error
,
tx
)
=>
{
executionContext
.
web3
().
eth
.
getTransaction
(
txResult
.
transactionHash
,
(
error
,
tx
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
if
(
error
)
return
console
.
log
(
error
)
if
(
txResult
&&
txResult
.
result
&&
txResult
.
result
.
vm
)
tx
.
returnValue
=
txResult
.
result
.
vm
.
return
if
(
txResult
&&
txResult
.
result
)
{
if
(
txResult
.
result
.
vm
)
{
tx
.
returnValue
=
txResult
.
result
.
vm
.
return
if
(
txResult
.
result
.
vm
.
gasUsed
)
tx
.
executionCost
=
txResult
.
result
.
vm
.
gasUsed
.
toString
(
10
)
}
if
(
txResult
.
result
.
gasUsed
)
tx
.
transactionCost
=
txResult
.
result
.
gasUsed
.
toString
(
10
)
}
tx
.
envMode
=
executionContext
.
getProvider
()
tx
.
envMode
=
executionContext
.
getProvider
()
this
.
_resolve
([
tx
],
()
=>
{
this
.
_resolve
([
tx
],
()
=>
{
})
})
...
...
src/app/execution/txLogger.js
View file @
c704745c
...
@@ -175,7 +175,9 @@ function renderKnownTransaction (self, data) {
...
@@ -175,7 +175,9 @@ function renderKnownTransaction (self, data) {
'decoded input'
:
data
.
resolvedData
&&
data
.
resolvedData
.
params
?
JSON
.
stringify
(
typeConversion
.
stringify
(
data
.
resolvedData
.
params
),
null
,
'
\
t'
)
:
' - '
,
'decoded input'
:
data
.
resolvedData
&&
data
.
resolvedData
.
params
?
JSON
.
stringify
(
typeConversion
.
stringify
(
data
.
resolvedData
.
params
),
null
,
'
\
t'
)
:
' - '
,
'decoded output'
:
data
.
resolvedData
&&
data
.
resolvedData
.
decodedReturnValue
?
JSON
.
stringify
(
typeConversion
.
stringify
(
data
.
resolvedData
.
decodedReturnValue
),
null
,
'
\
t'
)
:
' - '
,
'decoded output'
:
data
.
resolvedData
&&
data
.
resolvedData
.
decodedReturnValue
?
JSON
.
stringify
(
typeConversion
.
stringify
(
data
.
resolvedData
.
decodedReturnValue
),
null
,
'
\
t'
)
:
' - '
,
logs
:
data
.
logs
,
logs
:
data
.
logs
,
val
:
data
.
tx
.
value
val
:
data
.
tx
.
value
,
transactionCost
:
data
.
tx
.
transactionCost
,
executionCost
:
data
.
tx
.
executionCost
})
})
tx
.
appendChild
(
table
)
tx
.
appendChild
(
table
)
}
}
...
@@ -239,7 +241,9 @@ function renderUnknownTransaction (self, data) {
...
@@ -239,7 +241,9 @@ function renderUnknownTransaction (self, data) {
input
:
data
.
tx
.
input
,
input
:
data
.
tx
.
input
,
hash
:
data
.
tx
.
hash
,
hash
:
data
.
tx
.
hash
,
gas
:
data
.
tx
.
gas
,
gas
:
data
.
tx
.
gas
,
logs
:
data
.
logs
logs
:
data
.
logs
,
transactionCost
:
data
.
tx
.
transactionCost
,
executionCost
:
data
.
tx
.
executionCost
})
})
tx
.
appendChild
(
table
)
tx
.
appendChild
(
table
)
}
}
...
@@ -314,11 +318,27 @@ function createTable (opts) {
...
@@ -314,11 +318,27 @@ function createTable (opts) {
var
gas
=
yo
`
var
gas
=
yo
`
<tr class="
${
css
.
tr
}
">
<tr class="
${
css
.
tr
}
">
<td class="
${
css
.
td
}
"> gas </td>
<td class="
${
css
.
td
}
"> gas </td>
<td class="
${
css
.
td
}
"><i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
opts
.
gas
)
}
} title='Copy to clipboard'></i>
${
opts
.
gas
}
</td>
<td class="
${
css
.
td
}
"><i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
opts
.
gas
)
}
} title='Copy to clipboard'></i>
${
opts
.
gas
}
gas
</td>
</tr class="
${
css
.
tr
}
">
</tr class="
${
css
.
tr
}
">
`
`
if
(
opts
.
gas
)
table
.
appendChild
(
gas
)
if
(
opts
.
gas
)
table
.
appendChild
(
gas
)
if
(
opts
.
transactionCost
)
{
table
.
appendChild
(
yo
`
<tr class="
${
css
.
tr
}
">
<td class="
${
css
.
td
}
"> transaction cost </td>
<td class="
${
css
.
td
}
"><i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
opts
.
transactionCost
)
}
} title='Copy to clipboard'></i>
${
opts
.
transactionCost
}
gas</td>
</tr class="
${
css
.
tr
}
">`
)
}
if
(
opts
.
executionCost
)
{
table
.
appendChild
(
yo
`
<tr class="
${
css
.
tr
}
">
<td class="
${
css
.
td
}
"> execution cost </td>
<td class="
${
css
.
td
}
"><i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
opts
.
executionCost
)
}
} title='Copy to clipboard'></i>
${
opts
.
executionCost
}
gas</td>
</tr class="
${
css
.
tr
}
">`
)
}
var
hash
=
yo
`
var
hash
=
yo
`
<tr class="
${
css
.
tr
}
">
<tr class="
${
css
.
tr
}
">
<td class="
${
css
.
td
}
"> hash </td>
<td class="
${
css
.
td
}
"> hash </td>
...
...
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