diff --git a/client/utils.go b/client/utils.go index affd0211cb..f89f22a29e 100644 --- a/client/utils.go +++ b/client/utils.go @@ -2,6 +2,7 @@ package client import ( "encoding/base64" + "net/http" rpchttp "github.com/cometbft/cometbft/rpc/client/http" "github.com/spf13/pflag" @@ -84,6 +85,13 @@ func NewClientFromNode(nodeURI string) (*rpchttp.HTTP, error) { return rpchttp.New(nodeURI, "/websocket") } +// NewClientFromNodeWithClient allows for setting a custom http client +// sets up Client implementation that communicates with a Tendermint node over +// JSON RPC and WebSockets +func NewClientFromNodeWithClient(nodeURI string, client *http.Client) (*rpchttp.HTTP, error) { + return rpchttp.NewWithClient(nodeURI, "/websocket", client) +} + // FlagSetWithPageKeyDecoded returns the provided flagSet with the page-key value base64 decoded (if it exists). // This is for when the page-key is provided as a base64 string (e.g. from the CLI). // ReadPageRequest expects it to be the raw bytes.