func (c Client) SendRequest(ctx context.Context, url string, request jsonrpc.Request, options *RetryOptions) (jsonrpc.Response, error) {
	body, err := json.Marshal(request)
	if err != nil {
		return jsonrpc.Response{}, fmt.Errorf("[client] could not marshal request: %v", err)
	}
	r, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(body))
	if err != nil {
		return jsonrpc.Response{}, fmt.Errorf("[client] could not create http request: %v", err)
	}
	r = r.WithContext(ctx)
	r.Header.Set("Content-Type", "application/json")
	if options == nil {
		return c.send(r)
	}
	return c.retry(ctx, r, options)
}
SendRequest sends the `jsonrpc.Request` to the given URL. It only retries
sending the request if the retry options are non-nil. Otherwise it returns
the response and error immediately.
package http
import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"time"
	"github.com/renproject/darknode/jsonrpc"
)
type RetryOptions struct {
	Base   time.Duration  
	Max    time.Duration  
	Factor float64        
}
var DefaultRetryOptions = RetryOptions{
	Base:   time.Second,
	Max:    5 * time.Second,
	Factor: 0.2,
}
var DefaultClientTimeout = 5 * time.Second
type Client struct {
	*http.Client
}
func NewClient(timeout time.Duration) Client {
	return Client{
		Client: &http.Client{
			Timeout: timeout,
		},
	}
}