mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
ethclient: improve doc comment style
This commit is contained in:
parent
2b5a92c896
commit
0ff4d9f456
1 changed files with 5 additions and 14 deletions
|
|
@ -37,39 +37,30 @@ type Client struct {
|
||||||
c *rpc.Client
|
c *rpc.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dial connects a client to the given URL.
|
|
||||||
func Dial(rawurl string) (*Client, error) {
|
|
||||||
return DialContext(context.Background(), rawurl)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dial creates a new RPC client and connects to the given URL endpoint.
|
// Dial creates a new RPC client and connects to the given URL endpoint.
|
||||||
func Dial(rawurl string) (*Client, error) {
|
func Dial(rawurl string) (*Client, error) {
|
||||||
return DialContext(context.Background(), rawurl)
|
return DialContext(context.Background(), rawurl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DialContext creates a new RPC client using the provided context
|
// DialContext creates a new RPC client using the provided context
|
||||||
// and connects it to the specified URL endpoint.
|
// and connects it to the specified URL endpoint.
|
||||||
func DialContext(ctx context.Context, rawurl string) (*Client, error) {
|
func DialContext(ctx context.Context, rawurl string) (*Client, error) {
|
||||||
c, err := rpc.DialContext(ctx, rawurl)
|
...
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return NewClient(c), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient creates a Client instance that wraps the provided RPC client.
|
// NewClient creates a Client instance that wraps the provided RPC client.
|
||||||
func NewClient(c *rpc.Client) *Client {
|
func NewClient(c *rpc.Client) *Client {
|
||||||
return &Client{c}
|
return &Client{c}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close terminates the underlying RPC connection.
|
// Close terminates the underlying RPC connection.
|
||||||
func (ec *Client) Close() {
|
func (ec *Client) Close() {
|
||||||
ec.c.Close()
|
ec.c.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client returns the underlying RPC client instance.
|
// Client returns the underlying RPC client instance.
|
||||||
func (ec *Client) Client() *rpc.Client {
|
func (ec *Client) Client() *rpc.Client {
|
||||||
return ec.c
|
return ec.c
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blockchain Access
|
// Blockchain Access
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue