update go-rpc

rpc clients were renamed
This commit is contained in:
Anton Kaliaev 2017-03-16 12:01:29 +04:00 committed by Ethan Buchman
parent 4fff8821a3
commit 924d11397e
3 changed files with 10 additions and 10 deletions

View File

@ -12,7 +12,7 @@ import (
cmn "github.com/tendermint/go-common"
client "github.com/tendermint/go-rpc/client"
"github.com/tendermint/go-wire"
wire "github.com/tendermint/go-wire"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
@ -189,14 +189,14 @@ func AppTx(c *cli.Context, name string, data []byte) error {
func broadcastTx(c *cli.Context, tx types.Tx) ([]byte, string, error) {
tmResult := new(ctypes.TMResult)
tmAddr := c.String("node")
clientURI := client.NewURIClient(tmAddr)
uriClient := client.NewURIClient(tmAddr)
// Don't you hate having to do this?
// How many times have I lost an hour over this trick?!
txBytes := []byte(wire.BinaryBytes(struct {
types.Tx `json:"unwrap"`
}{tx}))
_, err := clientURI.Call("broadcast_tx_commit", map[string]interface{}{"tx": txBytes}, tmResult)
_, err := uriClient.Call("broadcast_tx_commit", map[string]interface{}{"tx": txBytes}, tmResult)
if err != nil {
return nil, "", errors.New(cmn.Fmt("Error on broadcast tx: %v", err))
}

View File

@ -16,7 +16,7 @@ import (
abci "github.com/tendermint/abci/types"
cmn "github.com/tendermint/go-common"
client "github.com/tendermint/go-rpc/client"
"github.com/tendermint/go-wire"
wire "github.com/tendermint/go-wire"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
tmtypes "github.com/tendermint/tendermint/types"
)
@ -89,7 +89,7 @@ func ParseCoins(str string) (types.Coins, error) {
}
func Query(tmAddr string, key []byte) (*abci.ResponseQuery, error) {
clientURI := client.NewURIClient(tmAddr)
uriClient := client.NewURIClient(tmAddr)
tmResult := new(ctypes.TMResult)
params := map[string]interface{}{
@ -97,7 +97,7 @@ func Query(tmAddr string, key []byte) (*abci.ResponseQuery, error) {
"data": key,
"prove": true,
}
_, err := clientURI.Call("abci_query", params, tmResult)
_, err := uriClient.Call("abci_query", params, tmResult)
if err != nil {
return nil, errors.New(cmn.Fmt("Error calling /abci_query: %v", err))
}
@ -136,10 +136,10 @@ func getAcc(tmAddr string, address []byte) (*types.Account, error) {
func getHeaderAndCommit(c *cli.Context, height int) (*tmtypes.Header, *tmtypes.Commit, error) {
tmResult := new(ctypes.TMResult)
tmAddr := c.String("node")
clientURI := client.NewURIClient(tmAddr)
uriClient := client.NewURIClient(tmAddr)
method := "commit"
_, err := clientURI.Call(method, map[string]interface{}{"height": height}, tmResult)
_, err := uriClient.Call(method, map[string]interface{}{"height": height}, tmResult)
if err != nil {
return nil, nil, errors.New(cmn.Fmt("Error on %s: %v", method, err))
}

View File

@ -8,9 +8,9 @@ import (
"github.com/tendermint/basecoin/types"
cmn "github.com/tendermint/go-common"
crypto "github.com/tendermint/go-crypto"
"github.com/tendermint/go-rpc/client"
rpcclient "github.com/tendermint/go-rpc/client"
"github.com/tendermint/go-rpc/types"
"github.com/tendermint/go-wire"
wire "github.com/tendermint/go-wire"
_ "github.com/tendermint/tendermint/rpc/core/types" // Register RPCResponse > Result types
)