Skip to content

Commit

Permalink
feat: optimize NewCustomClientFromNode (#228)
Browse files Browse the repository at this point in the history
Co-authored-by: reneecok <[email protected]>
  • Loading branch information
Raina and reneecok authored Jun 25, 2023
1 parent aac488b commit 2d8301b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,15 @@ func NewClientFromNode(nodeURI string) (*rpchttp.HTTP, error) {
return rpchttp.New(nodeURI, "/websocket")
}

// NewClientFromNodeWithClient allows for setting a custom http client
// NewCustomClientFromNode 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) {
func NewCustomClientFromNode(nodeURI string, customDialer func(string) (*http.Client, error)) (*rpchttp.HTTP, error) {
client, err := customDialer(nodeURI)
if err != nil {
return nil, err
}

return rpchttp.NewWithClient(nodeURI, "/websocket", client)
}

Expand Down

0 comments on commit 2d8301b

Please sign in to comment.