good morning!!!!

Skip to content
Snippets Groups Projects
Commit 669c0ea0 authored by Dan Sosedoff's avatar Dan Sosedoff Committed by Igor Mandrigin
Browse files

ethclient: add BlockNumber method (#21500)

This adds a new client method BlockNumber to fetch the most recent
block number of the chain.
parent c6a6a1e6
No related branches found
No related tags found
No related merge requests found
......@@ -91,6 +91,13 @@ func (ec *Client) BlockByNumber(ctx context.Context, number *big.Int) (*types.Bl
return ec.getBlock(ctx, "eth_getBlockByNumber", toBlockNumArg(number), true)
}
// BlockNumber returns the most recent block number
func (ec *Client) BlockNumber(ctx context.Context) (uint64, error) {
var result hexutil.Uint64
err := ec.c.CallContext(ctx, &result, "eth_getBlockNumber", nil)
return uint64(result), err
}
type rpcBlock struct {
Hash common.Hash `json:"hash"`
Transactions []rpcTransaction `json:"transactions"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment