diff --git a/eth/api.go b/eth/api.go index c0dff79341..852499cec6 100644 --- a/eth/api.go +++ b/eth/api.go @@ -64,6 +64,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 { diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 596e2eba9c..732584aa7a 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -37,6 +37,11 @@ const Chequebook_JS = ` web3._extend({ property: 'chequebook', methods: [ + new web3._extend.Method({ + name: 'chainId', + call: 'eth_chainId', + params: 0 + }), new web3._extend.Method({ name: 'deposit', call: 'chequebook_deposit',