Skip to content

Commit

Permalink
feat: allows for setting a custom http client when NewClientFromNode (#…
Browse files Browse the repository at this point in the history
…224)

Co-authored-by: reneecok <renee.zpro@gmail.com>
  • Loading branch information
Raina and reneecok authored Jun 25, 2023
1 parent ffdee94 commit aac488b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package client

import (
"encoding/base64"
"net/http"

rpchttp "github.com/cometbft/cometbft/rpc/client/http"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit aac488b

Please sign in to comment.