Skip to content

Commit

Permalink
feat: expose block number (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
piavgh committed Dec 19, 2023
1 parent 151c4f5 commit a3e55e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (c *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64,
return c.ethClient.EstimateGas(ctx, msg)
}

func (c *Client) GetBlockNumber(ctx context.Context) (uint64, error) {
return c.ethClient.BlockNumber(ctx)
}

func (c *Client) R() *Request {
r := &Request{
client: c,
Expand Down
8 changes: 8 additions & 0 deletions ethrpc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ethrpc

import (
"context"
"fmt"
"math/big"
"testing"
Expand All @@ -23,6 +24,13 @@ func (ts *RPCTestSuite) SetupTest() {
ts.client = rpcClient
}

func (ts *RPCTestSuite) TestGetBlockNumber() {
blockNumber, err := ts.client.GetBlockNumber(context.Background())

ts.Require().NoError(err)
ts.Require().NotEqual(0, blockNumber)
}

func (ts *RPCTestSuite) TestTryAggregate() {
type TradeInfo struct {
Reserve0 *big.Int
Expand Down

0 comments on commit a3e55e3

Please sign in to comment.