|
@@ -529,6 +529,11 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI {
|
|
|
return &PublicBlockChainAPI{b}
|
|
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.
|
|
// BlockNumber returns the block number of the chain head.
|
|
|
func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64 {
|
|
func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64 {
|
|
|
header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) // latest header should always be available
|
|
header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) // latest header should always be available
|