rpc/client: split out client packages (#4628)

* rpc/client: initial split into directories

* lite2: split out test package

* rpc/client: simplify client constructurs

* updated docs

* updated changelog
This commit is contained in:
Erik Grinaker
2020-04-02 13:25:30 +00:00
committed by GitHub
parent 6c88d2ba1f
commit fdf9c7ae64
19 changed files with 159 additions and 145 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
/*
Package client defines a provider that uses a rpcclient
Package client defines a provider that uses a rpchttp
to get information, which is used to get new headers
and validators directly from a Tendermint client.
*/
@@ -12,6 +12,7 @@ import (
"github.com/tendermint/tendermint/lite"
lerr "github.com/tendermint/tendermint/lite/errors"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/types"
)
@@ -40,7 +41,7 @@ func NewProvider(chainID string, client SignStatusClient) lite.Provider {
// NewHTTPProvider can connect to a tendermint json-rpc endpoint
// at the given url, and uses that as a read-only provider.
func NewHTTPProvider(chainID, remote string) (lite.Provider, error) {
httpClient, err := rpcclient.NewHTTP(remote, "/websocket")
httpClient, err := rpchttp.New(remote, "/websocket")
if err != nil {
return nil, err
}
+3 -2
View File
@@ -15,6 +15,7 @@ import (
certclient "github.com/tendermint/tendermint/lite/client"
nm "github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/rpc/client"
rpclocal "github.com/tendermint/tendermint/rpc/client/local"
rpctest "github.com/tendermint/tendermint/rpc/test"
"github.com/tendermint/tendermint/types"
)
@@ -47,7 +48,7 @@ func _TestAppProofs(t *testing.T) {
assert, require := assert.New(t), require.New(t)
prt := defaultProofRuntime()
cl := client.NewLocal(node)
cl := rpclocal.New(node)
client.WaitForHeight(cl, 1, nil)
// This sets up our trust on the node based on some past point.
@@ -126,7 +127,7 @@ func _TestAppProofs(t *testing.T) {
func TestTxProofs(t *testing.T) {
assert, require := assert.New(t), require.New(t)
cl := client.NewLocal(node)
cl := rpclocal.New(node)
client.WaitForHeight(cl, 1, nil)
tx := kvstoreTx([]byte("key-a"), []byte("value-a"))