ethclient, internal/ethapi: add support for EIP-695 (eth_chainId) (#19694)
EIP-695 was written in 2017. Parity and Infura have support for this method and we should, too.
This commit is contained in:
		
				
					committed by
					
						 Péter Szilágyi
						Péter Szilágyi
					
				
			
			
				
	
			
			
			
						parent
						
							c420dcb39c
						
					
				
				
					commit
					2b54666018
				
			| @@ -529,6 +529,11 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI { | ||||
| 	return &PublicBlockChainAPI{b} | ||||
| } | ||||
|  | ||||
| // ChainId returns the chainID value for transaction replay protection. | ||||
| func (s *PublicBlockChainAPI) ChainId() *hexutil.Big { | ||||
| 	return (*hexutil.Big)(s.b.ChainConfig().ChainID) | ||||
| } | ||||
|  | ||||
| // BlockNumber returns the block number of the chain head. | ||||
| func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64 { | ||||
| 	header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) // latest header should always be available | ||||
|   | ||||
		Reference in New Issue
	
	Block a user