@ -16,7 +16,7 @@ import (
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/libs/service"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpcclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpcclientlib "github.com/tendermint/tendermint/rpc/lib /client"
json rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc /client"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tendermint/types"
)
)
@ -61,7 +61,7 @@ Example:
* /
* /
type HTTP struct {
type HTTP struct {
remote string
remote string
rpc * rpcclientlib . JSONRPC Client
rpc * json rpcclient. Client
* baseRPCClient
* baseRPCClient
* WSEvents
* WSEvents
@ -78,7 +78,7 @@ type HTTP struct {
// batch, but ordering of transactions in the batch cannot be guaranteed in such
// batch, but ordering of transactions in the batch cannot be guaranteed in such
// an example.
// an example.
type BatchHTTP struct {
type BatchHTTP struct {
rpcBatch * rpcclientlib . JSONRPC RequestBatch
rpcBatch * json rpcclient. RequestBatch
* baseRPCClient
* baseRPCClient
}
}
@ -96,7 +96,7 @@ type rpcClient interface {
// baseRPCClient implements the basic RPC method logic without the actual
// baseRPCClient implements the basic RPC method logic without the actual
// underlying RPC call functionality, which is provided by `caller`.
// underlying RPC call functionality, which is provided by `caller`.
type baseRPCClient struct {
type baseRPCClient struct {
caller rpcclientlib . JSONRPC Caller
caller json rpcclient. Caller
}
}
var _ rpcClient = ( * HTTP ) ( nil )
var _ rpcClient = ( * HTTP ) ( nil )
@ -110,7 +110,7 @@ var _ rpcClient = (*baseRPCClient)(nil)
// the websocket path (which always seems to be "/websocket")
// the websocket path (which always seems to be "/websocket")
// An error is returned on invalid remote. The function panics when remote is nil.
// An error is returned on invalid remote. The function panics when remote is nil.
func New ( remote , wsEndpoint string ) ( * HTTP , error ) {
func New ( remote , wsEndpoint string ) ( * HTTP , error ) {
httpClient , err := rpcclientlib . DefaultHTTPClient ( remote )
httpClient , err := json rpcclient. DefaultHTTPClient ( remote )
if err != nil {
if err != nil {
return nil , err
return nil , err
}
}
@ -119,7 +119,7 @@ func New(remote, wsEndpoint string) (*HTTP, error) {
// Create timeout enabled http client
// Create timeout enabled http client
func NewWithTimeout ( remote , wsEndpoint string , timeout uint ) ( * HTTP , error ) {
func NewWithTimeout ( remote , wsEndpoint string , timeout uint ) ( * HTTP , error ) {
httpClient , err := rpcclientlib . DefaultHTTPClient ( remote )
httpClient , err := json rpcclient. DefaultHTTPClient ( remote )
if err != nil {
if err != nil {
return nil , err
return nil , err
}
}
@ -134,7 +134,7 @@ func NewWithClient(remote, wsEndpoint string, client *http.Client) (*HTTP, error
panic ( "nil http.Client provided" )
panic ( "nil http.Client provided" )
}
}
rc , err := rpcclientlib . NewJSONRPCClient WithHTTPClient ( remote , client )
rc , err := json rpcclient. NewWithHTTPClient ( remote , client )
if err != nil {
if err != nil {
return nil , err
return nil , err
}
}
@ -459,7 +459,7 @@ type WSEvents struct {
cdc * amino . Codec
cdc * amino . Codec
remote string
remote string
endpoint string
endpoint string
ws * rpcclientlib . WSClient
ws * json rpcclient. WSClient
mtx sync . RWMutex
mtx sync . RWMutex
subscriptions map [ string ] chan ctypes . ResultEvent // query -> chan
subscriptions map [ string ] chan ctypes . ResultEvent // query -> chan
@ -475,7 +475,7 @@ func newWSEvents(cdc *amino.Codec, remote, endpoint string) (*WSEvents, error) {
w . BaseService = * service . NewBaseService ( nil , "WSEvents" , w )
w . BaseService = * service . NewBaseService ( nil , "WSEvents" , w )
var err error
var err error
w . ws , err = rpcclientlib . NewWSClient ( w . remote , w . endpoint , rpcclientlib . OnReconnect ( func ( ) {
w . ws , err = json rpcclient. NewWS ( w . remote , w . endpoint , json rpcclient. OnReconnect ( func ( ) {
// resubscribe immediately
// resubscribe immediately
w . redoSubscriptionsAfter ( 0 * time . Second )
w . redoSubscriptionsAfter ( 0 * time . Second )
} ) )
} ) )