Skip to content

Commit

Permalink
update go-rpc
Browse files Browse the repository at this point in the history
rpc clients were renamed
  • Loading branch information
melekes authored and ebuchman committed Apr 14, 2017
1 parent 4fff882 commit 924d113
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cmd/commands/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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))
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/commands/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -89,15 +89,15 @@ 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{}{
"path": "/key",
"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))
}
Expand Down Expand Up @@ -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))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/tendermint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down

0 comments on commit 924d113

Please sign in to comment.