Skip to content

Commit

Permalink
perf: add DialOptions function for Dial
Browse files Browse the repository at this point in the history
  • Loading branch information
constwz committed Aug 15, 2024
1 parent 16cc59f commit 7f99420
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ethclient/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ func DialContext(ctx context.Context, rawurl string) (*Client, error) {
return NewClient(c), nil
}

// DialOptions creates a new RPC client for the given URL. You can supply any of the
// pre-defined client options to configure the underlying transport.
func DialOptions(ctx context.Context, rawurl string, opts ...rpc.ClientOption) (*Client, error) {
c, err := rpc.DialOptions(ctx, rawurl, opts...)
if err != nil {
return nil, err
}
return NewClient(c), nil
}

// NewClient creates a client that uses the given RPC client.
func NewClient(c *rpc.Client) *Client {
return &Client{c}
Expand Down

0 comments on commit 7f99420

Please sign in to comment.