Unverified Commit c8b0afb2 authored by Delweng's avatar Delweng Committed by GitHub

ethclient: acquire the rpc.Client (#27246)

Signed-off-by: 's avatarjsvisa <delweng@gmail.com>
parent 2169fa34
...@@ -41,6 +41,7 @@ func Dial(rawurl string) (*Client, error) { ...@@ -41,6 +41,7 @@ func Dial(rawurl string) (*Client, error) {
return DialContext(context.Background(), rawurl) return DialContext(context.Background(), rawurl)
} }
// DialContext connects a client to the given URL with context.
func DialContext(ctx context.Context, rawurl string) (*Client, error) { func DialContext(ctx context.Context, rawurl string) (*Client, error) {
c, err := rpc.DialContext(ctx, rawurl) c, err := rpc.DialContext(ctx, rawurl)
if err != nil { if err != nil {
...@@ -54,10 +55,16 @@ func NewClient(c *rpc.Client) *Client { ...@@ -54,10 +55,16 @@ func NewClient(c *rpc.Client) *Client {
return &Client{c} return &Client{c}
} }
// Close closes the underlying RPC connection.
func (ec *Client) Close() { func (ec *Client) Close() {
ec.c.Close() ec.c.Close()
} }
// Client gets the underlying RPC client.
func (ec *Client) Client() *rpc.Client {
return ec.c
}
// Blockchain Access // Blockchain Access
// ChainID retrieves the current chain ID for transaction replay protection. // ChainID retrieves the current chain ID for transaction replay protection.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment