hmy_blockNumber (#910)

pull/911/head
Richard Liu 6 years ago committed by GitHub
parent 9d734c0013
commit ac089bf557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      internal/hmyapi/README.md
  2. 6
      internal/hmyapi/blockchain.go

@ -14,7 +14,7 @@
### BlockChain info related
* [ ] hmy_gasPrice - return min-gas-price
* [ ] hmy_estimateGas - calculating estimate gas using signed bytes
* [ ] hmy_blockNumber - get latest block number
* [x] hmy_blockNumber - get latest block number
* [x] hmy_getBlockByHash - get block by block hash
* [x] hmy_getBlockByNumber
* [ ] hmy_getUncleByBlockHashAndIndex - get uncle by block hash and index number

@ -78,3 +78,9 @@ func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Add
}
return (*hexutil.Big)(state.GetBalance(address)), state.Error()
}
// 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
return hexutil.Uint64(header.Number.Uint64())
}

Loading…
Cancel
Save