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
dfd8a435
Commit
dfd8a435
authored
Oct 05, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add exe && tx cost for call
parent
97b61add
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
txListener.js
src/app/execution/txListener.js
+14
-8
No files found.
src/app/execution/txListener.js
View file @
dfd8a435
...
...
@@ -44,12 +44,14 @@ class TxListener {
from
:
from
,
to
:
to
,
input
:
data
,
hash
:
txResult
.
transactionHash
?
txResult
.
transactionHash
:
'call'
+
from
+
to
+
data
,
hash
:
txResult
.
transactionHash
?
txResult
.
transactionHash
:
'call'
+
(
from
||
''
)
+
to
+
data
,
isCall
:
true
,
output
:
txResult
.
result
,
returnValue
:
executionContext
.
isVM
()
?
txResult
.
result
.
vm
.
return
:
ethJSUtil
.
toBuffer
(
txResult
.
result
),
envMode
:
executionContext
.
getProvider
()
}
addExecutionCosts
(
txResult
,
call
)
this
.
_resolveTx
(
call
,
(
error
,
resolvedData
)
=>
{
if
(
!
error
)
{
this
.
event
.
trigger
(
'newCall'
,
[
call
])
...
...
@@ -67,20 +69,24 @@ class TxListener {
if
(
this
.
_loopId
&&
executionContext
.
getProvider
()
!==
'vm'
)
return
// we seems to already listen on a "web3" network
executionContext
.
web3
().
eth
.
getTransaction
(
txResult
.
transactionHash
,
(
error
,
tx
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
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
)
}
addExecutionCosts
(
txResult
,
tx
)
tx
.
envMode
=
executionContext
.
getProvider
()
tx
.
status
=
txResult
.
result
.
status
// 0x0 or 0x1
this
.
_resolve
([
tx
],
()
=>
{
})
})
})
function
addExecutionCosts
(
txResult
,
tx
)
{
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
)
}
}
}
/**
...
...
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