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
2d4c5401
Commit
2d4c5401
authored
Apr 02, 2019
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add eth_blockNumber
parent
e136ed30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
README.md
remix-simulator/README.md
+1
-1
blocks.js
remix-simulator/src/methods/blocks.js
+14
-2
No files found.
remix-simulator/README.md
View file @
2d4c5401
...
...
@@ -14,7 +14,7 @@ Implemented:
*
[
X
]
eth_hashrate
*
[
~
]
eth_gasPrice
*
[
~
]
eth_accounts
*
[
_
]
eth_blockNumber
*
[
X
]
eth_blockNumber
*
[
_
]
eth_getBalance
*
[
_
]
eth_getStorageAt
*
[
_
]
eth_getTransactionCount
...
...
remix-simulator/src/methods/blocks.js
View file @
2d4c5401
var
Web3
=
require
(
"web3"
)
var
Blocks
=
function
(
options
)
{
this
.
coinbase
=
options
.
coinbase
||
"0x0000000000000000000000000000000000000000"
this
.
blockNumber
=
0
}
Blocks
.
prototype
.
methods
=
function
()
{
return
{
eth_getBlockByNumber
:
this
.
eth_getBlockByNumber
.
bind
(
this
),
eth_gasPrice
:
this
.
eth_gasPrice
.
bind
(
this
)
eth_gasPrice
:
this
.
eth_gasPrice
.
bind
(
this
),
eth_coinbase
:
this
.
coinbase
.
bind
(
this
),
eth_blockNumber
:
this
.
blockNumber
.
bind
(
this
)
}
}
...
...
@@ -21,7 +25,7 @@ Blocks.prototype.eth_getBlockByNumber = function (payload, cb) {
'miner'
:
this
.
coinbase
,
'mixHash'
:
'0x0000000000000000000000000000000000000000000000000000000000000000'
,
'nonce'
:
'0x0000000000000042'
,
'number'
:
'0x0'
,
'number'
:
Web3
.
utils
.
tohex
(
this
.
blockNumber
)
,
'parentHash'
:
'0x0000000000000000000000000000000000000000000000000000000000000000'
,
'receiptsRoot'
:
'0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
,
'sha3Uncles'
:
'0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
,
...
...
@@ -40,4 +44,12 @@ Blocks.prototype.eth_gasPrice = function (payload, cb) {
cb
(
null
,
1
)
}
Blocks
.
prototype
.
eth_coinbase
=
function
(
payload
,
cb
)
{
cb
(
null
,
this
.
coinbase
)
}
Blocks
.
prototype
.
eth_blockNumber
=
function
(
payload
,
cb
)
{
cb
(
null
,
this
.
blockNumber
)
}
module
.
exports
=
Blocks
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