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
842cc983
Commit
842cc983
authored
Aug 02, 2017
by
yann300
Committed by
GitHub
Aug 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #534 from ethereum/updateIndex
Make some remix modules public && add getTransactionReceipt to vmprovider
parents
557121cb
2643c0d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
index.js
src/index.js
+7
-1
web3VmProvider.js
src/web3Provider/web3VmProvider.js
+32
-1
No files found.
src/index.js
View file @
842cc983
...
...
@@ -13,6 +13,8 @@ var decodeInfo = require('./solidity/decodeInfo')
var
stateDecoder
=
require
(
'./solidity/stateDecoder'
)
var
astHelper
=
require
(
'./solidity/astHelper'
)
var
EventManager
=
require
(
'./lib/eventManager'
)
var
codeUtil
=
require
(
'./helpers/util'
)
var
web3VMProvider
=
require
(
'./web3Provider/web3VmProvider'
)
if
(
typeof
(
module
)
!==
'undefined'
&&
typeof
(
module
.
exports
)
!==
'undefined'
)
{
module
.
exports
=
modules
()
...
...
@@ -40,7 +42,8 @@ function modules () {
},
util
:
{
SourceMappingDecoder
:
SourceMappingDecoder
,
AstWalker
:
AstWalker
AstWalker
:
AstWalker
,
code
:
codeUtil
},
solidity
:
{
decodeInfo
:
decodeInfo
,
...
...
@@ -49,6 +52,9 @@ function modules () {
},
lib
:
{
EventManager
:
EventManager
},
web3
:
{
web3VMProvider
:
web3VMProvider
}
}
}
...
...
src/web3Provider/web3VmProvider.js
View file @
842cc983
...
...
@@ -10,6 +10,7 @@ function web3VmProvider () {
this
.
vm
this
.
vmTraces
=
{}
this
.
txs
=
{}
this
.
txsReceipt
=
{}
this
.
processingHash
this
.
processingAddress
this
.
processingIndex
...
...
@@ -19,6 +20,7 @@ function web3VmProvider () {
this
.
debug
=
{}
this
.
eth
.
getCode
=
function
(
address
,
cb
)
{
return
self
.
getCode
(
address
,
cb
)
}
this
.
eth
.
getTransaction
=
function
(
hash
,
cb
)
{
return
self
.
getTransaction
(
hash
,
cb
)
}
this
.
eth
.
getTransactionReceipt
=
function
(
hash
,
cb
)
{
return
self
.
getTransactionReceipt
(
hash
,
cb
)
}
this
.
eth
.
getTransactionFromBlock
=
function
(
blockNumber
,
txIndex
,
cb
)
{
return
self
.
getTransactionFromBlock
(
blockNumber
,
txIndex
,
cb
)
}
this
.
eth
.
getBlockNumber
=
function
(
cb
)
{
return
self
.
getBlockNumber
(
cb
)
}
this
.
debug
.
traceTransaction
=
function
(
hash
,
options
,
cb
)
{
return
self
.
traceTransaction
(
hash
,
options
,
cb
)
}
...
...
@@ -72,6 +74,7 @@ web3VmProvider.prototype.txWillProcess = function (self, data) {
tx
.
value
=
util
.
hexConvert
(
data
.
value
)
}
self
.
txs
[
self
.
processingHash
]
=
tx
self
.
txsReceipt
[
self
.
processingHash
]
=
tx
self
.
storageCache
[
self
.
processingHash
]
=
{}
if
(
tx
.
to
)
{
self
.
vm
.
stateManager
.
dumpStorage
(
tx
.
to
,
function
(
storage
)
{
...
...
@@ -85,8 +88,22 @@ web3VmProvider.prototype.txProcessed = function (self, data) {
var
lastOp
=
self
.
vmTraces
[
self
.
processingHash
].
structLogs
[
self
.
processingIndex
-
1
]
lastOp
.
error
=
lastOp
.
op
!==
'RETURN'
&&
lastOp
.
op
!==
'STOP'
self
.
vmTraces
[
self
.
processingHash
].
gas
=
'0x'
+
data
.
gasUsed
.
toString
(
16
)
var
logs
=
[]
for
(
var
l
in
data
.
vm
.
logs
)
{
var
log
=
data
.
vm
.
logs
[
l
]
logs
.
push
({
data
:
log
[
2
].
toString
(
'hex'
),
topics
:
[
log
[
1
][
0
].
toString
(
'hex'
)],
rawVMResponse
:
log
})
}
self
.
txsReceipt
[
self
.
processingHash
].
logs
=
logs
if
(
data
.
createdAddress
)
{
self
.
vmTraces
[
self
.
processingHash
].
return
=
util
.
hexConvert
(
data
.
createdAddress
)
var
address
=
util
.
hexConvert
(
data
.
createdAddress
)
self
.
vmTraces
[
self
.
processingHash
].
return
=
address
self
.
txsReceipt
[
self
.
processingHash
].
contractAddress
=
address
}
else
{
self
.
vmTraces
[
self
.
processingHash
].
return
=
util
.
hexConvert
(
data
.
vm
.
return
)
}
...
...
@@ -192,6 +209,20 @@ web3VmProvider.prototype.getTransaction = function (txHash, cb) {
}
}
web3VmProvider
.
prototype
.
getTransactionReceipt
=
function
(
txHash
,
cb
)
{
// same as getTransaction but return the created address also
if
(
this
.
txsReceipt
[
txHash
])
{
if
(
cb
)
{
cb
(
null
,
this
.
txsReceipt
[
txHash
])
}
return
this
.
txsReceipt
[
txHash
]
}
else
{
if
(
cb
)
{
cb
(
'unable to retrieve txReceipt '
+
txHash
,
null
)
}
}
}
web3VmProvider
.
prototype
.
getTransactionFromBlock
=
function
(
blockNumber
,
txIndex
,
cb
)
{
var
mes
=
'not supposed to be needed by remix in vmmode'
console
.
log
(
mes
)
...
...
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