mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-15 17:30:44 +00:00
parent
71608abda8
commit
df837a0c8b
1 changed files with 11 additions and 1 deletions
|
|
@ -39,7 +39,12 @@ type Client struct {
|
||||||
|
|
||||||
// Dial connects a client to the given URL.
|
// Dial connects a client to the given URL.
|
||||||
func Dial(rawurl string) (*Client, error) {
|
func Dial(rawurl string) (*Client, error) {
|
||||||
c, err := rpc.Dial(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) {
|
||||||
|
c, err := rpc.DialContext(ctx, rawurl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -51,6 +56,11 @@ func NewClient(c *rpc.Client) *Client {
|
||||||
return &Client{c}
|
return &Client{c}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close closes the underlying RPC connection.
|
||||||
|
func (ec *Client) Close() {
|
||||||
|
ec.c.Close()
|
||||||
|
}
|
||||||
|
|
||||||
// Blockchain Access
|
// Blockchain Access
|
||||||
|
|
||||||
// BlockByHash returns the given full block.
|
// BlockByHash returns the given full block.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue