Add debug: NewWithCustomRPCClient
This commit is contained in:
parent
b6c09dc745
commit
85781927fb
|
@ -31,10 +31,14 @@ var ErrNotFound = errors.New("not found")
|
|||
|
||||
type Client struct {
|
||||
rpcURL string
|
||||
rpcClient jsonrpc.RPCClient
|
||||
rpcClient CallForClientInterface
|
||||
headers http.Header
|
||||
}
|
||||
|
||||
type CallForClientInterface interface {
|
||||
CallFor(out interface{}, method string, params ...interface{}) error
|
||||
}
|
||||
|
||||
func NewClient(rpcURL string) *Client {
|
||||
return NewClientWithOpts(rpcURL, nil)
|
||||
}
|
||||
|
@ -47,6 +51,12 @@ func NewClientWithOpts(rpcURL string, opts *jsonrpc.RPCClientOpts) *Client {
|
|||
}
|
||||
}
|
||||
|
||||
func NewWithCustomRPCClient(rpcClient CallForClientInterface) *Client {
|
||||
return &Client{
|
||||
rpcClient: rpcClient,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) SetHeader(k, v string) {
|
||||
if c.headers == nil {
|
||||
c.headers = http.Header{}
|
||||
|
|
Loading…
Reference in New Issue