Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
107f556b
Commit
107f556b
authored
Sep 29, 2018
by
HackyMiner
Committed by
Felix Lange
Sep 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal/ethapi: add eth_chainId method (#17617)
This implements EIP-695.
parent
44eb6956
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
api.go
eth/api.go
+9
-0
web3ext.go
internal/web3ext/web3ext.go
+5
-0
No files found.
eth/api.go
View file @
107f556b
...
@@ -67,6 +67,15 @@ func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
...
@@ -67,6 +67,15 @@ func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
return
hexutil
.
Uint64
(
api
.
e
.
Miner
()
.
HashRate
())
return
hexutil
.
Uint64
(
api
.
e
.
Miner
()
.
HashRate
())
}
}
// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func
(
api
*
PublicEthereumAPI
)
ChainId
()
hexutil
.
Uint64
{
chainID
:=
new
(
big
.
Int
)
if
config
:=
api
.
e
.
chainConfig
;
config
.
IsEIP155
(
api
.
e
.
blockchain
.
CurrentBlock
()
.
Number
())
{
chainID
=
config
.
ChainID
}
return
(
hexutil
.
Uint64
)(
chainID
.
Uint64
())
}
// PublicMinerAPI provides an API to control the miner.
// PublicMinerAPI provides an API to control the miner.
// It offers only methods that operate on data that pose no security risk when it is publicly accessible.
// It offers only methods that operate on data that pose no security risk when it is publicly accessible.
type
PublicMinerAPI
struct
{
type
PublicMinerAPI
struct
{
...
...
internal/web3ext/web3ext.go
View file @
107f556b
...
@@ -433,6 +433,11 @@ const Eth_JS = `
...
@@ -433,6 +433,11 @@ const Eth_JS = `
web3._extend({
web3._extend({
property: 'eth',
property: 'eth',
methods: [
methods: [
new web3._extend.Method({
name: 'chainId',
call: 'eth_chainId',
params: 0
}),
new web3._extend.Method({
new web3._extend.Method({
name: 'sign',
name: 'sign',
call: 'eth_sign',
call: 'eth_sign',
...
...
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