Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add eth_chainId method #17617

Merged
merged 3 commits into from Sep 29, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

eth,internal: add eth_chainId method to PublicEthereumApi JSONRPC

  • Loading branch information...
whilei authored and hackmod committed Aug 18, 2017
commit 51dd117a3423504c12c16e23834d97a45f1b5359
@@ -67,6 +67,11 @@ func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
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() *big.Int {
return api.e.chainConfig.ChainId
}

// 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.
type PublicMinerAPI struct {
@@ -433,6 +433,11 @@ const Eth_JS = `
web3._extend({
property: 'eth',
methods: [
new web3._extend.Method({
name: 'chainId',
call: 'eth_chainId',
params: 0
}),
new web3._extend.Method({
name: 'sign',
call: 'eth_sign',
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.