Skip to content

Commit

Permalink
Merge pull request #140 from constwz/perf-httpclient
Browse files Browse the repository at this point in the history
perf: add DialOptions function for Dial
  • Loading branch information
andyzhang2023 authored Aug 15, 2024
2 parents 16cc59f + 7f99420 commit 75729e0
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 75729e0

Please sign in to comment.