mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
eth,internal: add eth_chainId method to PublicEthereumApi JSONRPC
This commit is contained in:
parent
ae992a5d73
commit
51dd117a34
2 changed files with 10 additions and 0 deletions
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Reference in a new issue