Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allows for setting a custom http client when NewClientFromNode #224

Merged
merged 1 commit into from
Jun 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading