ethclient: improve doc comment style

This commit is contained in:
Tinu280 2025-11-13 17:22:38 +07:00
parent 7285021460
commit 2b5a92c896

View file

@ -42,7 +42,13 @@ func Dial(rawurl string) (*Client, error) {
return DialContext(context.Background(), rawurl)
}
// DialContext connects a client to the given URL with context.
// Dial creates a new RPC client and connects to the given URL endpoint.
func Dial(rawurl string) (*Client, error) {
return DialContext(context.Background(), rawurl)
}
// DialContext creates a new RPC client using the provided context
// and connects it to the specified URL endpoint.
func DialContext(ctx context.Context, rawurl string) (*Client, error) {
c, err := rpc.DialContext(ctx, rawurl)
if err != nil {
@ -51,17 +57,17 @@ func DialContext(ctx context.Context, rawurl string) (*Client, error) {
return NewClient(c), nil
}
// NewClient creates a client that uses the given RPC client.
// NewClient creates a Client instance that wraps the provided RPC client.
func NewClient(c *rpc.Client) *Client {
return &Client{c}
}
// Close closes the underlying RPC connection.
// Close terminates the underlying RPC connection.
func (ec *Client) Close() {
ec.c.Close()
}
// Client gets the underlying RPC client.
// Client returns the underlying RPC client instance.
func (ec *Client) Client() *rpc.Client {
return ec.c
}