Skip to content

Commit

Permalink
ethclient: acquire the rpc.Client (ethereum#27246)
Browse files Browse the repository at this point in the history
Signed-off-by: jsvisa <delweng@gmail.com>
  • Loading branch information
jsvisa authored May 11, 2023
1 parent 2169fa3 commit c8b0afb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func Dial(rawurl string) (*Client, error) {
return DialContext(context.Background(), rawurl)
}

// DialContext connects a client to the given URL with context.
func DialContext(ctx context.Context, rawurl string) (*Client, error) {
c, err := rpc.DialContext(ctx, rawurl)
if err != nil {
Expand All @@ -54,10 +55,16 @@ func NewClient(c *rpc.Client) *Client {
return &Client{c}
}

// Close closes the underlying RPC connection.
func (ec *Client) Close() {
ec.c.Close()
}

// Client gets the underlying RPC client.
func (ec *Client) Client() *rpc.Client {
return ec.c
}

// Blockchain Access

// ChainID retrieves the current chain ID for transaction replay protection.
Expand Down

0 comments on commit c8b0afb

Please sign in to comment.