rpc

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountStoreName    = "acc"
	ParamABCIPrefix     = "param"
	TimeLockMsgRoute    = "timelock"
	AtomicSwapStoreName = "atomic_swap"

	TimeLockrcNotFoundErrorCode = 458760
)
View Source
const (
	EmptyRequest = rpctypes.JSONRPCStringID("")
)

Variables

View Source
var (
	ExceedABCIPathLengthError         = fmt.Errorf("the abci path exceed max length %d ", maxABCIPathLength)
	ExceedABCIDataLengthError         = fmt.Errorf("the abci data exceed max length %d ", maxABCIDataLength)
	ExceedTxLengthError               = fmt.Errorf("the tx data exceed max length %d ", maxTxLength)
	LimitNegativeError                = fmt.Errorf("the limit can't be negative")
	ExceedMaxUnConfirmedTxsNumError   = fmt.Errorf("the limit of unConfirmed tx exceed max limit %d ", maxUnConfirmedTxs)
	HeightNegativeError               = fmt.Errorf("the height can't be negative")
	MaxMinHeightConflictError         = fmt.Errorf("the min height can't be larger than max height")
	HashLengthError                   = fmt.Errorf("the length of hash is not 32")
	ExceedABCIQueryStrLengthError     = fmt.Errorf("the query string exceed max length %d ", maxABCIPathLength)
	ExceedTxSearchQueryStrLengthError = fmt.Errorf("the query string exceed max length %d ", maxTxSearchStrLength)
	OffsetNegativeError               = fmt.Errorf("offset can't be less than 0")
	SymbolLengthExceedRangeError      = fmt.Errorf("length of symbol should be in range [%d,%d]", tokenSymbolMinLen, tokenSymbolMaxLen)
	PairFormatError                   = fmt.Errorf("the pair should in format 'symbol1_symbol2'")
	DepthLevelExceedRangeError        = fmt.Errorf("the level is out of range [%d, %d]", 0, maxDepthLevel)
	KeyMissingError                   = fmt.Errorf("BaseAssetSymbol or QuoteAssetSymbol is missing. ")
)
View Source
var DefaultTimeout = 5 * time.Second

Functions

func ParseTx

func ParseTx(cdc *amino.Codec, txBytes []byte) (tx.Tx, error)

func ValidateABCIData

func ValidateABCIData(data common.HexBytes) error

func ValidateABCIPath

func ValidateABCIPath(path string) error

func ValidateABCIQueryStr

func ValidateABCIQueryStr(query string) error

func ValidateDepthLevel

func ValidateDepthLevel(level int) error

func ValidateHash

func ValidateHash(hash []byte) error

func ValidateHeight

func ValidateHeight(height *int64) error

func ValidateHeightRange

func ValidateHeightRange(from int64, to int64) error

func ValidateLimit

func ValidateLimit(limit int) error

func ValidateOffset

func ValidateOffset(offset int) error

func ValidatePair

func ValidatePair(pair string) error

func ValidateSymbol

func ValidateSymbol(symbol string) error

func ValidateTx

func ValidateTx(tx types.Tx) error

func ValidateTxSearchQueryStr

func ValidateTxSearchQueryStr(query string) error

func ValidateUnConfirmedTxsLimit

func ValidateUnConfirmedTxsLimit(limit int) error

Types

type ABCIClient

type ABCIClient interface {
	// Reading from abci app
	ABCIInfo() (*ctypes.ResultABCIInfo, error)
	ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)
	ABCIQueryWithOptions(path string, data cmn.HexBytes,
		opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

	// Writing to abci app
	BroadcastTxCommit(tx types.Tx) (*ResultBroadcastTxCommit, error)
	BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
	BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
}

type ABCIResponses

type ABCIResponses struct {
	DeliverTx  []*ResponseDeliverTx `json:"DeliverTx"`
	EndBlock   *ResponseEndBlock    `json:"EndBlock"`
	BeginBlock *ResponseBeginBlock  `json:"BeginBlock"`
}

type DexClient

type DexClient interface {
	TxInfoSearch(query string, prove bool, page, perPage int) ([]Info, error)
	ListAllTokens(offset int, limit int) ([]types.Token, error)
	GetTokenInfo(symbol string) (*types.Token, error)
	GetAccount(addr types.AccAddress) (acc types.Account, err error)
	GetCommitAccount(addr types.AccAddress) (acc types.Account, err error)

	GetBalances(addr types.AccAddress) ([]types.TokenBalance, error)
	GetBalance(addr types.AccAddress, symbol string) (*types.TokenBalance, error)
	GetFee() ([]types.FeeParam, error)
	GetOpenOrders(addr types.AccAddress, pair string) ([]types.OpenOrder, error)
	GetTradingPairs(offset int, limit int) ([]types.TradingPair, error)
	GetDepth(tradePair string, level int) (*types.OrderBook, error)
	GetProposals(status types.ProposalStatus, numLatest int64) ([]types.Proposal, error)
	GetProposal(proposalId int64) (types.Proposal, error)
	GetTimelocks(addr types.AccAddress) ([]types.TimeLockRecord, error)
	GetTimelock(addr types.AccAddress, recordID int64) (*types.TimeLockRecord, error)
	GetSwapByID(swapID types.SwapBytes) (types.AtomicSwap, error)
	GetSwapByCreator(creatorAddr string, offset int64, limit int64) ([]types.SwapBytes, error)
	GetSwapByRecipient(recipientAddr string, offset int64, limit int64) ([]types.SwapBytes, error)

	ListAllMiniTokens(offset int, limit int) ([]types.MiniToken, error)
	GetMiniTokenInfo(symbol string) (*types.MiniToken, error)
	GetMiniTradingPairs(offset int, limit int) ([]types.TradingPair, error)

	SetKeyManager(k keys.KeyManager)
	SendToken(transfers []msg.Transfer, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
	CreateOrder(baseAssetSymbol, quoteAssetSymbol string, op int8, price, quantity int64, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
	CancelOrder(baseAssetSymbol, quoteAssetSymbol, refId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
	HTLT(recipient types.AccAddress, recipientOtherChain, senderOtherChain string, randomNumberHash []byte, timestamp int64,
		amount types.Coins, expectedIncome string, heightSpan int64, crossChain bool, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
	DepositHTLT(recipient types.AccAddress, swapID []byte, amount types.Coins,
		syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
	ClaimHTLT(swapID []byte, randomNumber []byte, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
	RefundHTLT(swapID []byte, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
}

type EventsClient

type EventsClient interface {
	Subscribe(query string, outCapacity ...int) (out chan ctypes.ResultEvent, err error)
	Unsubscribe(query string) error
	UnsubscribeAll() error
}

type HTTP

type HTTP struct {
	*WSEvents
	// contains filtered or unexported fields
}

func NewHTTP

func NewHTTP(remote, wsEndpoint string) *HTTP

NewHTTP takes a remote endpoint in the form tcp://<host>:<port> and the websocket path (which always seems to be "/websocket")

func NewRPCClient

func NewRPCClient(nodeURI string, network ntypes.ChainNetwork) *HTTP

func (*HTTP) ABCIInfo

func (c *HTTP) ABCIInfo() (*ctypes.ResultABCIInfo, error)

func (*HTTP) ABCIQuery

func (c *HTTP) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)

func (*HTTP) ABCIQueryWithOptions

func (c *HTTP) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (*HTTP) Block

func (c *HTTP) Block(height *int64) (*ctypes.ResultBlock, error)

func (*HTTP) BlockResults

func (c *HTTP) BlockResults(height *int64) (*ResultBlockResults, error)

func (*HTTP) BlockchainInfo

func (c *HTTP) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

func (*HTTP) BroadcastTxAsync

func (c *HTTP) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*HTTP) BroadcastTxCommit

func (c *HTTP) BroadcastTxCommit(tx types.Tx) (*ResultBroadcastTxCommit, error)

func (*HTTP) BroadcastTxSync

func (c *HTTP) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*HTTP) CancelOrder

func (c *HTTP) CancelOrder(baseAssetSymbol, quoteAssetSymbol, refId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)

func (*HTTP) ClaimHTLT

func (c *HTTP) ClaimHTLT(swapID []byte, randomNumber []byte, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)

func (*HTTP) Commit

func (c *HTTP) Commit(height *int64) (*ctypes.ResultCommit, error)

func (*HTTP) ConsensusState

func (c *HTTP) ConsensusState() (*ctypes.ResultConsensusState, error)

func (*HTTP) CreateOrder

func (c *HTTP) CreateOrder(baseAssetSymbol, quoteAssetSymbol string, op int8, price, quantity int64, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)

func (*HTTP) DepositHTLT

func (c *HTTP) DepositHTLT(recipient types.AccAddress, swapID []byte, amount types.Coins,
	syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)

func (*HTTP) DumpConsensusState

func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)

func (*HTTP) Genesis

func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error)

func (*HTTP) GetAccount

func (c *HTTP) GetAccount(addr types.AccAddress) (acc types.Account, err error)

Always fetch the latest account from the cache in node even the previous transaction from this account is not included in block yet. example: 1. AccountA(Balance: 10BNB, sequence: 1), AccountB(Balance: 5BNB, sequence: 1) 2. Node receive Tx(AccountA --> AccountB 2BNB) and check have passed, but not included in block yet. 3. GetAccount will return AccountA(Balance: 8BNB, sequence: 2), AccountB(Balance: 7BNB, sequence: 1)

func (*HTTP) GetBalance

func (c *HTTP) GetBalance(addr types.AccAddress, symbol string) (*types.TokenBalance, error)

func (*HTTP) GetBalances

func (c *HTTP) GetBalances(addr types.AccAddress) ([]types.TokenBalance, error)

func (*HTTP) GetCommitAccount

func (c *HTTP) GetCommitAccount(addr types.AccAddress) (acc types.Account, err error)

Always fetch the account from the commit store at (currentHeight-1) in node. example: 1. currentCommitHeight: 1000, accountA(balance: 10BNB, sequence: 10) 2. height: 999, accountA(balance: 11BNB, sequence: 9) 3. GetCommitAccount will return accountA(balance: 11BNB, sequence: 9). If the (currentHeight-1) do not exist, will return account at currentHeight. 1. currentCommitHeight: 1000, accountA(balance: 10BNB, sequence: 10) 2. height: 999. the state do not exist 3. GetCommitAccount will return accountA(balance: 10BNB, sequence: 10).

func (*HTTP) GetDelegatorUnbondingDelegations

func (c *HTTP) GetDelegatorUnbondingDelegations(delegatorAddr types.AccAddress) ([]types.UnbondingDelegation, error)

func (*HTTP) GetDepth

func (c *HTTP) GetDepth(tradePair string, level int) (*types.OrderBook, error)

func (*HTTP) GetFee

func (c *HTTP) GetFee() ([]types.FeeParam, error)

func (*HTTP) GetMiniTokenInfo

func (c *HTTP) GetMiniTokenInfo(symbol string) (*types.MiniToken, error)

func (*HTTP) GetMiniTradingPairs

func (c *HTTP) GetMiniTradingPairs(offset int, limit int) ([]types.TradingPair, error)

func (*HTTP) GetOpenOrders

func (c *HTTP) GetOpenOrders(addr types.AccAddress, pair string) ([]types.OpenOrder, error)

func (*HTTP) GetProposal

func (c *HTTP) GetProposal(proposalId int64) (types.Proposal, error)

func (*HTTP) GetProposals

func (c *HTTP) GetProposals(status types.ProposalStatus, numLatest int64) ([]types.Proposal, error)

func (*HTTP) GetStakeValidators

func (c *HTTP) GetStakeValidators() ([]types.Validator, error)

func (*HTTP) GetSwapByCreator

func (c *HTTP) GetSwapByCreator(creatorAddr string, offset int64, limit int64) ([]types.SwapBytes, error)

func (*HTTP) GetSwapByID

func (c *HTTP) GetSwapByID(swapID types.SwapBytes) (types.AtomicSwap, error)

func (*HTTP) GetSwapByRecipient

func (c *HTTP) GetSwapByRecipient(recipientAddr string, offset int64, limit int64) ([]types.SwapBytes, error)

func (*HTTP) GetTimelock

func (c *HTTP) GetTimelock(addr types.AccAddress, recordID int64) (*types.TimeLockRecord, error)

func (*HTTP) GetTimelocks

func (c *HTTP) GetTimelocks(addr types.AccAddress) ([]types.TimeLockRecord, error)

func (*HTTP) GetTokenInfo

func (c *HTTP) GetTokenInfo(symbol string) (*types.Token, error)

func (*HTTP) GetTradingPairs

func (c *HTTP) GetTradingPairs(offset int, limit int) ([]types.TradingPair, error)

func (*HTTP) HTLT

func (c *HTTP) HTLT(recipient types.AccAddress, recipientOtherChain, senderOtherChain string, randomNumberHash []byte, timestamp int64,
	amount types.Coins, expectedIncome string, heightSpan int64, crossChain bool, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)

func (*HTTP) Health

func (c *HTTP) Health() (*ctypes.ResultHealth, error)

func (*HTTP) IsActive

func (c *HTTP) IsActive() bool

func (*HTTP) ListAllMiniTokens

func (c *HTTP) ListAllMiniTokens(offset int, limit int) ([]types.MiniToken, error)

func (*HTTP) ListAllTokens

func (c *HTTP) ListAllTokens(offset int, limit int) ([]types.Token, error)

func (*HTTP) NetInfo

func (c *HTTP) NetInfo() (*ctypes.ResultNetInfo, error)

func (*HTTP) NumUnconfirmedTxs

func (c *HTTP) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)

func (*HTTP) QueryStore

func (c *HTTP) QueryStore(key cmn.HexBytes, storeName string) ([]byte, error)

func (*HTTP) RefundHTLT

func (c *HTTP) RefundHTLT(swapID []byte, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)

func (*HTTP) SendToken

func (c *HTTP) SendToken(transfers []msg.Transfer, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)

func (*HTTP) SetKeyManager

func (c *HTTP) SetKeyManager(k keys.KeyManager)

func (*HTTP) Status

func (c *HTTP) Status() (*ctypes.ResultStatus, error)

func (*HTTP) Tx

func (c *HTTP) Tx(hash []byte, prove bool) (*ResultTx, error)

func (*HTTP) TxInfoSearch

func (c *HTTP) TxInfoSearch(query string, prove bool, page, perPage int) ([]Info, error)

func (*HTTP) TxSearch

func (c *HTTP) TxSearch(query string, prove bool, page, perPage int) (*ResultTxSearch, error)

func (*HTTP) UnconfirmedTxs

func (c *HTTP) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)

func (*HTTP) Validators

func (c *HTTP) Validators(height *int64) (*ctypes.ResultValidators, error)

type Info

type Info struct {
	Hash   cmn.HexBytes      `json:"hash"`
	Height int64             `json:"height"`
	Tx     tx.Tx             `json:"tx"`
	Result ResponseDeliverTx `json:"result"`
}

func FormatTxResults

func FormatTxResults(cdc *amino.Codec, res []*ResultTx) ([]Info, error)

parse the indexed txs into an array of Info

type OpsClient

type OpsClient interface {
	IsActive() bool
	GetStakeValidators() ([]types.Validator, error)
	GetDelegatorUnbondingDelegations(delegatorAddr types.AccAddress) ([]types.UnbondingDelegation, error)
}

type ResponseBeginBlock

type ResponseBeginBlock struct {
	Events []types.Event `json:"events,omitempty"`
	Tags   []cmn.KVPair  `json:"tags,omitempty"`
}

type ResponseCheckTx

type ResponseCheckTx struct {
	Code      uint32        `json:"code,omitempty"`
	Data      []byte        `json:"data,omitempty"`
	Log       string        `json:"log,omitempty"`
	Info      string        `json:"info,omitempty"`
	GasWanted int64         `json:"gas_wanted,omitempty"`
	GasUsed   int64         `json:"gas_used,omitempty"`
	Events    []types.Event `json:"events,omitempty"`
	Tags      []cmn.KVPair  `json:"tags,omitempty"`
	Codespace string        `json:"codespace,omitempty"`
}

func (ResponseCheckTx) IsErr

func (r ResponseCheckTx) IsErr() bool

type ResponseDeliverTx

type ResponseDeliverTx struct {
	Code      uint32        `json:"code,omitempty"`
	Data      []byte        `json:"data,omitempty"`
	Log       string        `json:"log,omitempty"`
	Info      string        `json:"info,omitempty"`
	GasWanted int64         `json:"gas_wanted,omitempty"`
	GasUsed   int64         `json:"gas_used,omitempty"`
	Events    []types.Event `json:"events,omitempty"`
	Tags      []cmn.KVPair  `json:"tags,omitempty"`
	Codespace string        `json:"codespace,omitempty"`
}

type ResponseEndBlock

type ResponseEndBlock struct {
	ValidatorUpdates      []types.ValidatorUpdate `json:"validator_updates"`
	ConsensusParamUpdates *types.ConsensusParams  `json:"consensus_param_updates,omitempty"`
	Events                []types.Event           `json:"events,omitempty"`
	Tags                  []cmn.KVPair            `json:"tags,omitempty"`
}

type ResultBlockResults

type ResultBlockResults struct {
	Height  int64          `json:"height"`
	Results *ABCIResponses `json:"results"`
}

type ResultBroadcastTxCommit

type ResultBroadcastTxCommit struct {
	CheckTx   ResponseCheckTx   `json:"check_tx"`
	DeliverTx ResponseDeliverTx `json:"deliver_tx"`
	Hash      cmn.HexBytes      `json:"hash"`
	Height    int64             `json:"height"`
}

type ResultTx

type ResultTx struct {
	Hash     cmn.HexBytes      `json:"hash"`
	Height   int64             `json:"height"`
	Index    uint32            `json:"index"`
	TxResult ResponseDeliverTx `json:"tx_result"`
	Tx       abci.Tx           `json:"tx"`
	Proof    abci.TxProof      `json:"proof,omitempty"`
}

type ResultTxSearch

type ResultTxSearch struct {
	Txs        []*ResultTx `json:"txs"`
	TotalCount int         `json:"total_count"`
}

Result of searching for txs

type SignClient

type SignClient interface {
	Block(height *int64) (*ctypes.ResultBlock, error)
	BlockResults(height *int64) (*ResultBlockResults, error)
	Commit(height *int64) (*ctypes.ResultCommit, error)
	Validators(height *int64) (*ctypes.ResultValidators, error)
	Tx(hash []byte, prove bool) (*ResultTx, error)
	TxSearch(query string, prove bool, page, perPage int) (*ResultTxSearch, error)
}

type SyncType

type SyncType int
const (
	Async SyncType = iota
	Sync
	Commit
)

type WSClient

type WSClient struct {
	cmn.BaseService

	Address  string // IP:PORT or /path/to/socket
	Endpoint string // /websocket/url/endpoint
	Dialer   func(string, string) (net.Conn, error)
	// contains filtered or unexported fields
}

WSClient is a WebSocket client. The methods of WSClient are safe for use by multiple goroutines.

func NewWSClient

func NewWSClient(remoteAddr, endpoint string, responsesCh chan<- rpctypes.RPCResponse, options ...func(*WSClient)) *WSClient

NewWSClient returns a new client. See the commentary on the func(*WSClient) functions for a detailed description of how to configure ping period and pong wait time. The endpoint argument must begin with a `/`.

func (*WSClient) ABCIInfo

func (c *WSClient) ABCIInfo(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) ABCIQueryWithOptions

func (c *WSClient) ABCIQueryWithOptions(ctx context.Context, id rpctypes.JSONRPCStringID, path string, data cmn.HexBytes, opts client.ABCIQueryOptions) error

func (*WSClient) Block

func (c *WSClient) Block(ctx context.Context, id rpctypes.JSONRPCStringID, height *int64) error

func (*WSClient) BlockResults

func (c *WSClient) BlockResults(ctx context.Context, id rpctypes.JSONRPCStringID, height *int64) error

func (*WSClient) BlockchainInfo

func (c *WSClient) BlockchainInfo(ctx context.Context, id rpctypes.JSONRPCStringID, minHeight, maxHeight int64) error

func (*WSClient) BroadcastTx

func (c *WSClient) BroadcastTx(ctx context.Context, id rpctypes.JSONRPCStringID, route string, tx types.Tx) error

func (*WSClient) BroadcastTxCommit

func (c *WSClient) BroadcastTxCommit(ctx context.Context, id rpctypes.JSONRPCStringID, tx types.Tx) error

func (*WSClient) Call

func (c *WSClient) Call(ctx context.Context, method string, id rpctypes.JSONRPCStringID, params map[string]interface{}) error

Call the given method. See Send description.

func (*WSClient) Codec

func (c *WSClient) Codec() *amino.Codec

func (*WSClient) Commit

func (c *WSClient) Commit(ctx context.Context, id rpctypes.JSONRPCStringID, height *int64) error

func (*WSClient) ConsensusState

func (c *WSClient) ConsensusState(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) DumpConsensusState

func (c *WSClient) DumpConsensusState(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) GenRequestId

func (c *WSClient) GenRequestId() (rpctypes.JSONRPCStringID, error)

func (*WSClient) Genesis

func (c *WSClient) Genesis(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) Health

func (c *WSClient) Health(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) IsActive

func (c *WSClient) IsActive() bool

IsActive returns true if the client is running and not dialing.

func (*WSClient) IsDialing

func (c *WSClient) IsDialing() bool

IsDialing returns true if the client is dialing right now.

func (*WSClient) NetInfo

func (c *WSClient) NetInfo(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) NumUnconfirmedTxs

func (c *WSClient) NumUnconfirmedTxs(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) OnStart

func (c *WSClient) OnStart() error

OnStart implements cmn.Service by dialing a server and creating read and write routines.

func (*WSClient) OnStop

func (c *WSClient) OnStop()

func (*WSClient) Send

func (c *WSClient) Send(ctx context.Context, request rpctypes.RPCRequest) error

Send the given RPC request to the server. Results will be available on responsesCh, errors, if any, on ErrorsCh. Will block until send succeeds or ctx.Done is closed.

func (*WSClient) SetCodec

func (c *WSClient) SetCodec(cdc *amino.Codec)

func (*WSClient) Status

func (c *WSClient) Status(ctx context.Context, id rpctypes.JSONRPCStringID) error

func (*WSClient) String

func (c *WSClient) String() string

String returns WS client full address.

func (*WSClient) Subscribe

func (c *WSClient) Subscribe(ctx context.Context, id rpctypes.JSONRPCStringID, query string) error

Subscribe to a query. Note the server must have a "subscribe" route defined.

func (*WSClient) Tx

func (c *WSClient) Tx(ctx context.Context, id rpctypes.JSONRPCStringID, hash []byte, prove bool) error

func (*WSClient) TxSearch

func (c *WSClient) TxSearch(ctx context.Context, id rpctypes.JSONRPCStringID, query string, prove bool, page, perPage int) error

func (*WSClient) UnconfirmedTxs

func (c *WSClient) UnconfirmedTxs(ctx context.Context, id rpctypes.JSONRPCStringID, limit int) error

func (*WSClient) Unsubscribe

func (c *WSClient) Unsubscribe(ctx context.Context, id rpctypes.JSONRPCStringID, query string) error

Unsubscribe from a query. Note the server must have a "unsubscribe" route defined.

func (*WSClient) UnsubscribeAll

func (c *WSClient) UnsubscribeAll(ctx context.Context, id rpctypes.JSONRPCStringID) error

UnsubscribeAll from all. Note the server must have a "unsubscribe_all" route defined.

func (*WSClient) Validators

func (c *WSClient) Validators(ctx context.Context, id rpctypes.JSONRPCStringID, height *int64) error

type WSEvents

type WSEvents struct {
	cmn.BaseService
	// contains filtered or unexported fields
}

* websocket event stuff here... *

func (*WSEvents) ABCIInfo

func (w *WSEvents) ABCIInfo() (*ctypes.ResultABCIInfo, error)

func (*WSEvents) ABCIQueryWithOptions

func (w *WSEvents) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (*WSEvents) Block

func (w *WSEvents) Block(height *int64) (*ctypes.ResultBlock, error)

func (*WSEvents) BlockResults

func (w *WSEvents) BlockResults(height *int64) (*ResultBlockResults, error)

func (*WSEvents) BlockchainInfo

func (w *WSEvents) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

func (*WSEvents) BroadcastTx

func (w *WSEvents) BroadcastTx(route string, tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*WSEvents) BroadcastTxCommit

func (w *WSEvents) BroadcastTxCommit(tx types.Tx) (*ResultBroadcastTxCommit, error)

func (*WSEvents) Commit

func (w *WSEvents) Commit(height *int64) (*ctypes.ResultCommit, error)

func (*WSEvents) ConsensusState

func (w *WSEvents) ConsensusState() (*ctypes.ResultConsensusState, error)

func (*WSEvents) DumpConsensusState

func (w *WSEvents) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)

func (*WSEvents) Genesis

func (w *WSEvents) Genesis() (*ctypes.ResultGenesis, error)

func (*WSEvents) Health

func (w *WSEvents) Health() (*ctypes.ResultHealth, error)

func (*WSEvents) IsActive

func (c *WSEvents) IsActive() bool

func (*WSEvents) NetInfo

func (w *WSEvents) NetInfo() (*ctypes.ResultNetInfo, error)

func (*WSEvents) NewContext

func (w *WSEvents) NewContext() (context.Context, context.CancelFunc)

func (*WSEvents) NumUnconfirmedTxs

func (w *WSEvents) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)

func (*WSEvents) OnStart

func (w *WSEvents) OnStart() error

OnStart implements cmn.Service by starting WSClient and event loop.

func (*WSEvents) OnStop

func (w *WSEvents) OnStop()

OnStop implements cmn.Service by stopping WSClient.

func (*WSEvents) PendingRequest

func (w *WSEvents) PendingRequest() int

OnStop implements cmn.Service by stopping WSClient.

func (*WSEvents) SetLogger

func (w *WSEvents) SetLogger(logger log.Logger)

func (*WSEvents) SetTimeOut

func (w *WSEvents) SetTimeOut(timeout time.Duration)

func (*WSEvents) SimpleCall

func (w *WSEvents) SimpleCall(doRpc func(ctx context.Context, id rpctypes.JSONRPCStringID) error, ws *WSClient, proto interface{}) error

func (*WSEvents) Status

func (w *WSEvents) Status() (*ctypes.ResultStatus, error)

func (*WSEvents) Subscribe

func (w *WSEvents) Subscribe(query string,
	outCapacity ...int) (out chan ctypes.ResultEvent, err error)

Subscribe implements EventsClient by using WSClient to subscribe given subscriber to query. By default, returns a channel with cap=1. Error is returned if it fails to subscribe. Channel is never closed to prevent clients from seeing an erroneus event.

func (*WSEvents) Tx

func (w *WSEvents) Tx(hash []byte, prove bool) (*ResultTx, error)

func (*WSEvents) TxInfoSearch

func (w *WSEvents) TxInfoSearch(query string, prove bool, page, perPage int) ([]Info, error)

func (*WSEvents) TxSearch

func (w *WSEvents) TxSearch(query string, prove bool, page, perPage int) (*ResultTxSearch, error)

func (*WSEvents) UnconfirmedTxs

func (w *WSEvents) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)

func (*WSEvents) Unsubscribe

func (w *WSEvents) Unsubscribe(query string) error

Unsubscribe implements EventsClient by using WSClient to unsubscribe given subscriber from query.

func (*WSEvents) UnsubscribeAll

func (w *WSEvents) UnsubscribeAll() error

UnsubscribeAll implements EventsClient by using WSClient to unsubscribe given subscriber from all the queries.

func (*WSEvents) Validators

func (w *WSEvents) Validators(height *int64) (*ctypes.ResultValidators, error)

func (*WSEvents) WaitForEventResponse

func (w *WSEvents) WaitForEventResponse(requestId interface{}, in chan rpctypes.RPCResponse, eventOut chan ctypes.ResultEvent, quit chan struct{})

func (*WSEvents) WaitForResponse

func (w *WSEvents) WaitForResponse(ctx context.Context, outChan chan rpctypes.RPCResponse, result interface{}, ws *WSClient) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL