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
baec74b8
Commit
baec74b8
authored
May 30, 2019
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add/fix eth_getTransactionByBlockHashAndIndex and eth_getTransactionByBlockNumberAndIndex
parent
0ebd7aa2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
8 deletions
+103
-8
README.md
remix-simulator/README.md
+6
-6
transactions.js
remix-simulator/src/methods/transactions.js
+97
-2
No files found.
remix-simulator/README.md
View file @
baec74b8
...
@@ -28,12 +28,12 @@ Implemented:
...
@@ -28,12 +28,12 @@ Implemented:
*
[
_
]
eth_sendRawTransaction
*
[
_
]
eth_sendRawTransaction
*
[
X
]
eth_call
*
[
X
]
eth_call
*
[
~
]
eth_estimateGas
*
[
~
]
eth_estimateGas
*
[
~
]
eth_getBlockByHash
*
[
V
]
eth_getBlockByHash
*
[
~
]
eth_getBlockByNumber
*
[
V
]
eth_getBlockByNumber
*
[
~
]
eth_getTransactionByHash
*
[
V
]
eth_getTransactionByHash
*
[
_
]
eth_getTransactionByBlockHashAndIndex
*
[
V
]
eth_getTransactionByBlockHashAndIndex
*
[
_
]
eth_getTransactionByBlockNumberAndIndex
*
[
V
]
eth_getTransactionByBlockNumberAndIndex
*
[
~
]
eth_getTransactionReceipt
*
[
V
]
eth_getTransactionReceipt
*
[
_
]
eth_getUncleByBlockHashAndIndex
*
[
_
]
eth_getUncleByBlockHashAndIndex
*
[
_
]
eth_getUncleByBlockNumberAndIndex
*
[
_
]
eth_getUncleByBlockNumberAndIndex
*
[
X
]
eth_getCompilers (DEPRECATED)
*
[
X
]
eth_getCompilers (DEPRECATED)
...
...
remix-simulator/src/methods/transactions.js
View file @
baec74b8
...
@@ -29,7 +29,9 @@ Transactions.prototype.methods = function () {
...
@@ -29,7 +29,9 @@ Transactions.prototype.methods = function () {
eth_call
:
this
.
eth_call
.
bind
(
this
),
eth_call
:
this
.
eth_call
.
bind
(
this
),
eth_estimateGas
:
this
.
eth_estimateGas
.
bind
(
this
),
eth_estimateGas
:
this
.
eth_estimateGas
.
bind
(
this
),
eth_getTransactionCount
:
this
.
eth_getTransactionCount
.
bind
(
this
),
eth_getTransactionCount
:
this
.
eth_getTransactionCount
.
bind
(
this
),
eth_getTransactionByHash
:
this
.
eth_getTransactionByHash
.
bind
(
this
)
eth_getTransactionByHash
:
this
.
eth_getTransactionByHash
.
bind
(
this
),
eth_getTransactionByBlockHashAndIndex
:
this
.
eth_getTransactionByBlockHashAndIndex
.
bind
(
this
),
eth_getTransactionByBlockNumberAndIndex
:
this
.
eth_getTransactionByBlockNumberAndIndex
.
bind
(
this
)
}
}
}
}
...
@@ -153,4 +155,96 @@ Transactions.prototype.eth_getTransactionByHash = function (payload, cb) {
...
@@ -153,4 +155,96 @@ Transactions.prototype.eth_getTransactionByHash = function (payload, cb) {
})
})
}
}
module
.
exports
=
Transactions
Transactions
.
prototype
.
eth_getTransactionByBlockHashAndIndex
=
function
(
payload
,
cb
)
{
console
.
dir
(
"== eth_getTransactionByHash"
)
console
.
dir
(
payload
.
params
)
// const address = payload.params[0]
const
txIndex
=
payload
.
params
[
1
]
var
txBlock
=
executionContext
.
blocks
[
payload
.
params
[
0
]]
const
txHash
=
"0x"
+
txBlock
.
transactions
[
web3
.
utils
.
toDecimal
(
txIndex
)].
hash
().
toString
(
'hex'
)
executionContext
.
web3
().
eth
.
getTransactionReceipt
(
txHash
,
(
error
,
receipt
)
=>
{
if
(
error
)
{
return
cb
(
error
)
}
// executionContext.web3().eth.getBlock(receipt.hash).then((block) => {
let
r
=
{
'blockHash'
:
"0x"
+
txBlock
.
hash
().
toString
(
'hex'
),
'blockNumber'
:
"0x"
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
'from'
:
receipt
.
from
,
'gas'
:
web3
.
utils
.
toHex
(
receipt
.
gas
),
// 'gasPrice': '2000000000000', // 0x123
"gasPrice"
:
"0x4a817c800"
,
// 20000000000
'hash'
:
receipt
.
transactionHash
,
'input'
:
receipt
.
input
,
// "nonce": 2, // 0x15
// "transactionIndex": 0,
"value"
:
receipt
.
value
// "value":"0xf3dbb76162000" // 4290000000000000
// "v": "0x25", // 37
// "r": "0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
// "s": "0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c"
}
if
(
receipt
.
to
)
{
r
.
to
=
receipt
.
to
}
if
(
r
.
value
===
"0x"
)
{
r
.
value
=
"0x0"
}
cb
(
null
,
r
)
// })
})
}
Transactions
.
prototype
.
eth_getTransactionByBlockNumberAndIndex
=
function
(
payload
,
cb
)
{
console
.
dir
(
"== eth_getTransactionByHash"
)
console
.
dir
(
payload
.
params
)
// const address = payload.params[0]
const
txIndex
=
payload
.
params
[
1
]
var
txBlock
=
executionContext
.
blocks
[
payload
.
params
[
0
]]
const
txHash
=
"0x"
+
txBlock
.
transactions
[
web3
.
utils
.
toDecimal
(
txIndex
)].
hash
().
toString
(
'hex'
)
executionContext
.
web3
().
eth
.
getTransactionReceipt
(
txHash
,
(
error
,
receipt
)
=>
{
if
(
error
)
{
return
cb
(
error
)
}
// executionContext.web3().eth.getBlock(receipt.hash).then((block) => {
let
r
=
{
'blockHash'
:
"0x"
+
txBlock
.
hash
().
toString
(
'hex'
),
'blockNumber'
:
"0x"
+
txBlock
.
header
.
number
.
toString
(
'hex'
),
'from'
:
receipt
.
from
,
'gas'
:
web3
.
utils
.
toHex
(
receipt
.
gas
),
// 'gasPrice': '2000000000000', // 0x123
"gasPrice"
:
"0x4a817c800"
,
// 20000000000
'hash'
:
receipt
.
transactionHash
,
'input'
:
receipt
.
input
,
// "nonce": 2, // 0x15
// "transactionIndex": 0,
"value"
:
receipt
.
value
// "value":"0xf3dbb76162000" // 4290000000000000
// "v": "0x25", // 37
// "r": "0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
// "s": "0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c"
}
if
(
receipt
.
to
)
{
r
.
to
=
receipt
.
to
}
if
(
r
.
value
===
"0x"
)
{
r
.
value
=
"0x0"
}
cb
(
null
,
r
)
// })
})
}
module
.
exports
=
Transactions
\ No newline at end of file
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