Documentation ¶
Index ¶
- Constants
- Variables
- func MaxReconnectAttempts(max int) func(*WSClient)
- func OnReconnect(cb func()) func(*WSClient)
- func ParseTx(cdc *amino.Codec, txBytes []byte) (tx.Tx, error)
- func PingPeriod(pingPeriod time.Duration) func(*WSClient)
- func ReadWait(readWait time.Duration) func(*WSClient)
- func ValidateABCIData(data libbytes.HexBytes) error
- func ValidateABCIPath(path string) error
- func ValidateABCIQueryStr(query string) error
- func ValidateDepthLevel(level int) error
- func ValidateHash(hash []byte) error
- func ValidateHeight(height *int64) error
- func ValidateHeightRange(from int64, to int64) error
- func ValidateLimit(limit int) error
- func ValidateOffset(offset int) error
- func ValidatePair(pair string) error
- func ValidateSymbol(symbol string) error
- func ValidateTx(tx types.Tx) error
- func ValidateTxSearchQueryStr(query string) error
- func ValidateUnConfirmedTxsLimit(limit int) error
- func WriteWait(writeWait time.Duration) func(*WSClient)
- type ABCIClient
- type ABCIResponses
- type Client
- type DexClient
- type EventsClient
- type HTTP
- func (c *HTTP) ABCIInfo() (*ctypes.ResultABCIInfo, error)
- func (c *HTTP) ABCIQuery(path string, data libbytes.HexBytes) (*ctypes.ResultABCIQuery, error)
- func (c *HTTP) ABCIQueryWithOptions(path string, data libbytes.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
- func (c *HTTP) Bind(symbol string, amount int64, contractAddress msg.SmartChainAddress, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) Block(height *int64) (*ctypes.ResultBlock, error)
- func (c *HTTP) BlockResults(height *int64) (*ResultBlockResults, error)
- func (c *HTTP) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
- func (c *HTTP) Broadcast(m msg.Msg, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
- func (c *HTTP) BroadcastTxCommit(tx types.Tx) (*ResultBroadcastTxCommit, error)
- func (c *HTTP) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
- func (c *HTTP) CancelOrder(baseAssetSymbol, quoteAssetSymbol, refId string, syncType SyncType, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) Claim(chainId sdk.IbcChainID, sequence uint64, payload []byte, syncType SyncType, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) ClaimHTLT(swapID []byte, randomNumber []byte, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) Commit(height *int64) (*ctypes.ResultCommit, error)
- func (c *HTTP) ConsensusState() (*ctypes.ResultConsensusState, error)
- func (c *HTTP) CreateOrder(baseAssetSymbol, quoteAssetSymbol string, op int8, price, quantity int64, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) CreateSideChainValidator(delegation types.Coin, description msg.Description, ...) (*coretypes.ResultBroadcastTx, error)
- func (c *HTTP) Deposit(proposalID int64, amount types.Coins, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) DepositHTLT(recipient types.AccAddress, swapID []byte, amount types.Coins, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
- func (c *HTTP) EditSideChainValidator(sideChainId string, description msg.Description, commissionRate *types.Dec, ...) (*coretypes.ResultBroadcastTx, error)
- func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error)
- func (c *HTTP) GetAccount(addr types.AccAddress) (acc types.Account, err error)
- func (c *HTTP) GetBalance(addr types.AccAddress, symbol string) (*types.TokenBalance, error)
- func (c *HTTP) GetBalances(addr types.AccAddress) ([]types.TokenBalance, error)
- func (c *HTTP) GetCommitAccount(addr types.AccAddress) (acc types.Account, err error)
- func (c *HTTP) GetCurrentOracleSequence(chainId sdk.IbcChainID) (int64, error)
- func (c *HTTP) GetDelegatorUnbondingDelegations(delegatorAddr types.AccAddress) ([]types.UnbondingDelegation, error)
- func (c *HTTP) GetDepth(tradePair string, level int) (*types.OrderBook, error)
- func (c *HTTP) GetFee() ([]types.FeeParam, error)
- func (c *HTTP) GetMiniTokenInfo(symbol string) (*types.MiniToken, error)
- func (c *HTTP) GetMiniTradingPairs(offset int, limit int) ([]types.TradingPair, error)
- func (c *HTTP) GetOpenOrders(addr types.AccAddress, pair string) ([]types.OpenOrder, error)
- func (c *HTTP) GetProphecy(chainId sdk.IbcChainID, sequence int64) (*msg.Prophecy, error)
- func (c *HTTP) GetProposal(proposalId int64) (types.Proposal, error)
- func (c *HTTP) GetProposals(status types.ProposalStatus, numLatest int64) ([]types.Proposal, error)
- func (c *HTTP) GetSideChainAllValidatorsCount(sideChainId string, jailInvolved bool) (int, error)
- func (c *HTTP) GetSideChainParams(sideChainId string) ([]msg.SCParam, error)
- func (c *HTTP) GetSideChainPool(sideChainId string) (*types.Pool, error)
- func (c *HTTP) GetSideChainProposal(proposalId int64, sideChainId string) (types.Proposal, error)
- func (c *HTTP) GetSideChainProposals(status types.ProposalStatus, numLatest int64, sideChainId string) ([]types.Proposal, error)
- func (c *HTTP) GetSideChainRedelegationsByValidator(sideChainId string, valAddr types.ValAddress) ([]types.Redelegation, error)
- func (c *HTTP) GetSideChainUnBondingDelegationsByValidator(sideChainId string, valAddr types.ValAddress) ([]types.UnbondingDelegation, error)
- func (c *HTTP) GetStakeValidators() ([]types.Validator, error)
- func (c *HTTP) GetSwapByCreator(creatorAddr string, offset int64, limit int64) ([]types.SwapBytes, error)
- func (c *HTTP) GetSwapByID(swapID types.SwapBytes) (types.AtomicSwap, error)
- func (c *HTTP) GetSwapByRecipient(recipientAddr string, offset int64, limit int64) ([]types.SwapBytes, error)
- func (c *HTTP) GetTimelock(addr types.AccAddress, recordID int64) (*types.TimeLockRecord, error)
- func (c *HTTP) GetTimelocks(addr types.AccAddress) ([]types.TimeLockRecord, error)
- func (c *HTTP) GetTokenInfo(symbol string) (*types.Token, error)
- func (c *HTTP) GetTradingPairs(offset int, limit int) ([]types.TradingPair, error)
- func (c *HTTP) HTLT(recipient types.AccAddress, recipientOtherChain, senderOtherChain string, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) Health() (*ctypes.ResultHealth, error)
- func (c *HTTP) IsActive() bool
- func (c *HTTP) ListAllMiniTokens(offset int, limit int) ([]types.MiniToken, error)
- func (c *HTTP) ListAllTokens(offset int, limit int) ([]types.Token, error)
- func (c *HTTP) NetInfo() (*ctypes.ResultNetInfo, error)
- func (c *HTTP) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
- func (c *HTTP) QuerySideChainDelegation(sideChainId string, delAddr types.AccAddress, valAddr types.ValAddress) (*types.DelegationResponse, error)
- func (c *HTTP) QuerySideChainDelegations(sideChainId string, delAddr types.AccAddress) ([]types.DelegationResponse, error)
- func (c *HTTP) QuerySideChainRedelegation(sideChainId string, delAddr types.AccAddress, valSrcAddr types.ValAddress, ...) (*types.Redelegation, error)
- func (c *HTTP) QuerySideChainRedelegations(sideChainId string, delAddr types.AccAddress) ([]types.Redelegation, error)
- func (c *HTTP) QuerySideChainTopValidators(sideChainId string, top int) ([]types.Validator, error)
- func (c *HTTP) QuerySideChainUnbondingDelegation(sideChainId string, valAddr types.ValAddress, delAddr types.AccAddress) (*types.UnbondingDelegation, error)
- func (c *HTTP) QuerySideChainUnbondingDelegations(sideChainId string, delAddr types.AccAddress) ([]types.UnbondingDelegation, error)
- func (c *HTTP) QuerySideChainValidator(sideChainId string, valAddr types.ValAddress) (*types.Validator, error)
- func (c *HTTP) QueryStore(key libbytes.HexBytes, storeName string) ([]byte, error)
- func (c *HTTP) QueryStoreSubspace(key libbytes.HexBytes, storeName string) (res []abcitypes.EventAttribute, err error)
- func (c *HTTP) QueryWithData(path string, data libbytes.HexBytes) ([]byte, error)
- func (c *HTTP) RefundHTLT(swapID []byte, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) SendToken(transfers []msg.Transfer, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) SetKeyManager(k keys.KeyManager)
- func (c *HTTP) SideChainDelegate(sideChainId string, valAddr types.ValAddress, delegation types.Coin, ...) (*coretypes.ResultBroadcastTx, error)
- func (c *HTTP) SideChainDeposit(proposalID int64, amount types.Coins, sideChainId string, syncType SyncType, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) SideChainRedelegate(sideChainId string, valSrcAddr types.ValAddress, valDstAddr types.ValAddress, ...) (*coretypes.ResultBroadcastTx, error)
- func (c *HTTP) SideChainSubmitCSCParamsProposal(title string, cscParam msg.CSCParamChange, initialDeposit types.Coins, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) SideChainSubmitProposal(title string, description string, proposalType msg.ProposalKind, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) SideChainSubmitSCParamsProposal(title string, scParam msg.SCChangeParams, initialDeposit types.Coins, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) SideChainUnbond(sideChainId string, valAddr types.ValAddress, amount types.Coin, ...) (*coretypes.ResultBroadcastTx, error)
- func (c *HTTP) SideChainUnjail(sideChainId string, valAddr types.ValAddress, syncType SyncType, ...) (*coretypes.ResultBroadcastTx, error)
- func (c *HTTP) SideChainVote(proposalID int64, option msg.VoteOption, sideChainId string, syncType SyncType, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) Status() (*ctypes.ResultStatus, error)
- func (c *HTTP) SubmitListProposal(title string, param msg.ListTradingPairParams, proposalType msg.ProposalKind, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) SubmitProposal(title string, description string, proposalType msg.ProposalKind, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) TransferOut(to msg.SmartChainAddress, amount types.Coin, expireTime int64, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) TransferTokenOwnership(symbol string, newOwner types.AccAddress, syncType SyncType, ...) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) Tx(hash []byte, prove bool) (*ResultTx, error)
- func (c *HTTP) TxInfoSearch(query string, prove bool, page, perPage int) ([]Info, error)
- func (c *HTTP) TxSearch(query string, prove bool, page, perPage int) (*ResultTxSearch, error)
- func (c *HTTP) Unbind(symbol string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
- func (c *HTTP) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)
- func (c *HTTP) Validators(height *int64) (*ctypes.ResultValidators, error)
- func (c *HTTP) Vote(proposalID int64, option msg.VoteOption, syncType SyncType, ...) (*core_types.ResultBroadcastTx, error)
- type Info
- type OpsClient
- type ResponseBeginBlock
- type ResponseCheckTx
- type ResponseDeliverTx
- type ResponseEndBlock
- type ResultBlockResults
- type ResultBroadcastTxCommit
- type ResultTx
- type ResultTxSearch
- type SignClient
- type StakingClient
- type SyncType
- type WSClient
- func (c *WSClient) ABCIInfo(ctx context.Context) error
- func (c *WSClient) ABCIQueryWithOptions(ctx context.Context, path string, data libbytes.HexBytes, ...) error
- func (c *WSClient) Block(ctx context.Context, height *int64) error
- func (c *WSClient) BlockResults(ctx context.Context, height *int64) error
- func (c *WSClient) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) error
- func (c *WSClient) BroadcastTx(ctx context.Context, route string, tx types.Tx) error
- func (c *WSClient) BroadcastTxCommit(ctx context.Context, tx types.Tx) error
- func (c *WSClient) Call(ctx context.Context, method string, params map[string]interface{}) error
- func (c *WSClient) Codec() *amino.Codec
- func (c *WSClient) Commit(ctx context.Context, height *int64) error
- func (c *WSClient) ConsensusState(ctx context.Context) error
- func (c *WSClient) DumpConsensusState(ctx context.Context) error
- func (c *WSClient) GenRequestId() (rpctypes.JSONRPCStringID, error)
- func (c *WSClient) Genesis(ctx context.Context) error
- func (c *WSClient) Health(ctx context.Context) error
- func (c *WSClient) IsActive() bool
- func (c *WSClient) IsReconnecting() bool
- func (c *WSClient) NetInfo(ctx context.Context) error
- func (c *WSClient) NumUnconfirmedTxs(ctx context.Context) error
- func (c *WSClient) OnStart() error
- func (c *WSClient) Send(ctx context.Context, request rpctypes.RPCRequest) error
- func (c *WSClient) SetCodec(cdc *amino.Codec)
- func (c *WSClient) Status(ctx context.Context) error
- func (c *WSClient) Stop() error
- func (c *WSClient) String() string
- func (c *WSClient) Subscribe(ctx context.Context, query string) error
- func (c *WSClient) Tx(ctx context.Context, hash []byte, prove bool) error
- func (c *WSClient) TxSearch(ctx context.Context, query string, prove bool, page, perPage int) error
- func (c *WSClient) UnconfirmedTxs(ctx context.Context, limit int) error
- func (c *WSClient) Unsubscribe(ctx context.Context, query string) error
- func (c *WSClient) UnsubscribeAll(ctx context.Context) error
- func (c *WSClient) Validators(ctx context.Context, height *int64) error
- type WSEvents
- func (w *WSEvents) ABCIInfo() (*ctypes.ResultABCIInfo, error)
- func (w *WSEvents) ABCIQueryWithOptions(path string, data libbytes.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
- func (w *WSEvents) Block(height *int64) (*ctypes.ResultBlock, error)
- func (w *WSEvents) BlockResults(height *int64) (*ResultBlockResults, error)
- func (w *WSEvents) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
- func (w *WSEvents) BroadcastTx(route string, tx types.Tx) (*ctypes.ResultBroadcastTx, error)
- func (w *WSEvents) BroadcastTxCommit(tx types.Tx) (*ResultBroadcastTxCommit, error)
- func (w *WSEvents) Commit(height *int64) (*ctypes.ResultCommit, error)
- func (w *WSEvents) ConsensusState() (*ctypes.ResultConsensusState, error)
- func (w *WSEvents) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
- func (w *WSEvents) Genesis() (*ctypes.ResultGenesis, error)
- func (w *WSEvents) Health() (*ctypes.ResultHealth, error)
- func (c *WSEvents) IsActive() bool
- func (w *WSEvents) NetInfo() (*ctypes.ResultNetInfo, error)
- func (w *WSEvents) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
- func (w *WSEvents) OnStart() error
- func (w *WSEvents) OnStop()
- func (w *WSEvents) PendingRequest() int
- func (w *WSEvents) SetLogger(logger log.Logger)
- func (w *WSEvents) SetTimeOut(timeout time.Duration)
- func (w *WSEvents) SimpleCall(doRpc func(ctx context.Context) error, ws *WSClient, proto interface{}) error
- func (w *WSEvents) Status() (*ctypes.ResultStatus, error)
- func (w *WSEvents) Subscribe(ctx context.Context, subscriber, query string, outCapacity ...int) (out <-chan ctypes.ResultEvent, err error)
- func (w *WSEvents) Tx(hash []byte, prove bool) (*ResultTx, error)
- func (w *WSEvents) TxInfoSearch(query string, prove bool, page, perPage int) ([]Info, error)
- func (w *WSEvents) TxSearch(query string, prove bool, page, perPage int) (*ResultTxSearch, error)
- func (w *WSEvents) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)
- func (w *WSEvents) Unsubscribe(ctx context.Context, subscriber, query string) error
- func (w *WSEvents) UnsubscribeAll(ctx context.Context, subscriber string) error
- func (w *WSEvents) Validators(height *int64) (*ctypes.ResultValidators, error)
- func (w *WSEvents) WaitForResponse(ctx context.Context, outChan chan rpctypes.RPCResponse, result interface{}, ...) error
Constants ¶
const ( AccountStoreName = "acc" OracleStoreName = "oracle" SideChainStoreName = "sc" BridgeStoreName = "bridge" ParamABCIPrefix = "param" TimeLockMsgRoute = "timelock" AtomicSwapStoreName = "atomic_swap" TimeLockrcNotFoundErrorCode = 458760 )
Variables ¶
var ( StakeStoreKey = "stake" StakeScStoreKey = "sc" SideChainStorePrefixByIdKey = []byte{0x01} ValidatorsKey = []byte{0x21} DelegationKey = []byte{0x31} RedelegationKey = []byte{0x34} UnbondingDelegationKey = []byte{0x32} PoolKey = []byte{0x01} )
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("keymanager is missing, use SetKeyManager to set key") EmptyResultError = fmt.Errorf("Empty result ") )
var DefaultTimeout = 5 * time.Second
Functions ¶
func MaxReconnectAttempts ¶
MaxReconnectAttempts sets the maximum number of reconnect attempts before returning an error. It should only be used in the constructor and is not Goroutine-safe.
func OnReconnect ¶
func OnReconnect(cb func()) func(*WSClient)
OnReconnect sets the callback, which will be called every time after successful reconnect.
func PingPeriod ¶
PingPeriod sets the duration for sending websocket pings. It should only be used in the constructor - not Goroutine-safe.
func ReadWait ¶
ReadWait sets the amount of time to wait before a websocket read times out. It should only be used in the constructor and is not Goroutine-safe.
func ValidateABCIData ¶
func ValidateABCIPath ¶
func ValidateABCIQueryStr ¶
func ValidateDepthLevel ¶
func ValidateHash ¶
func ValidateHeight ¶
func ValidateHeightRange ¶
func ValidateLimit ¶
func ValidateOffset ¶
func ValidatePair ¶
func ValidateSymbol ¶
func ValidateTx ¶
Types ¶
type ABCIClient ¶
type ABCIClient interface { // Reading from abci app ABCIInfo() (*ctypes.ResultABCIInfo, error) ABCIQuery(path string, data libbytes.HexBytes) (*ctypes.ResultABCIQuery, error) ABCIQueryWithOptions(path string, data libbytes.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 Client ¶
type Client interface { libservice.Service ABCIClient SignClient client.HistoryClient client.StatusClient EventsClient DexClient OpsClient StakingClient }
type DexClient ¶
type DexClient interface { Broadcast(m msg.Msg, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) 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) GetSideChainProposals(status types.ProposalStatus, numLatest int64, sideChainId string) ([]types.Proposal, error) GetSideChainProposal(proposalId int64, sideChainId string) (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) GetSideChainParams(sideChainId string) ([]msg.SCParam, 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) TransferTokenOwnership(symbol string, newOwner types.AccAddress, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) Bind(symbol string, amount int64, contractAddress msg.SmartChainAddress, contractDecimals int8, expireTime int64, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) Unbind(symbol string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) TransferOut(to msg.SmartChainAddress, amount types.Coin, expireTime int64, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) Claim(chainId sdk.IbcChainID, sequence uint64, payload []byte, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) GetProphecy(chainId sdk.IbcChainID, sequence int64) (*msg.Prophecy, error) GetCurrentOracleSequence(chainId sdk.IbcChainID) (int64, error) SideChainVote(proposalID int64, option msg.VoteOption, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) SideChainDeposit(proposalID int64, amount types.Coins, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) SideChainSubmitSCParamsProposal(title string, scParam msg.SCChangeParams, initialDeposit types.Coins, votingPeriod time.Duration, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) SideChainSubmitCSCParamsProposal(title string, cscParam msg.CSCParamChange, initialDeposit types.Coins, votingPeriod time.Duration, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) SideChainSubmitProposal(title string, description string, proposalType msg.ProposalKind, initialDeposit types.Coins, votingPeriod time.Duration, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) SubmitListProposal(title string, param msg.ListTradingPairParams, proposalType msg.ProposalKind, initialDeposit types.Coins, votingPeriod time.Duration, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) SubmitProposal(title string, description string, proposalType msg.ProposalKind, initialDeposit types.Coins, votingPeriod time.Duration, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) Deposit(proposalID int64, amount types.Coins, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) Vote(proposalID int64, option msg.VoteOption, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error) }
type EventsClient ¶
type HTTP ¶
type HTTP struct { *WSEvents // contains filtered or unexported fields }
func NewHTTP ¶
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) ABCIQueryWithOptions ¶
func (c *HTTP) ABCIQueryWithOptions(path string, data libbytes.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)
func (*HTTP) Bind ¶
func (c *HTTP) Bind(symbol string, amount int64, contractAddress msg.SmartChainAddress, contractDecimals int8, expireTime int64, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, 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) Broadcast ¶
func (c *HTTP) Broadcast(m msg.Msg, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) BroadcastTxAsync ¶
func (*HTTP) BroadcastTxCommit ¶
func (c *HTTP) BroadcastTxCommit(tx types.Tx) (*ResultBroadcastTxCommit, error)
func (*HTTP) BroadcastTxSync ¶
func (*HTTP) CancelOrder ¶
func (c *HTTP) CancelOrder(baseAssetSymbol, quoteAssetSymbol, refId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) Claim ¶
func (c *HTTP) Claim(chainId sdk.IbcChainID, sequence uint64, payload []byte, 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) 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) CreateSideChainValidator ¶
func (*HTTP) Deposit ¶
func (c *HTTP) Deposit(proposalID int64, amount types.Coins, 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) EditSideChainValidator ¶
func (*HTTP) GetAccount ¶
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 ¶
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) GetCurrentOracleSequence ¶
func (c *HTTP) GetCurrentOracleSequence(chainId sdk.IbcChainID) (int64, error)
func (*HTTP) GetDelegatorUnbondingDelegations ¶
func (c *HTTP) GetDelegatorUnbondingDelegations(delegatorAddr types.AccAddress) ([]types.UnbondingDelegation, error)
func (*HTTP) GetMiniTokenInfo ¶
func (*HTTP) GetMiniTradingPairs ¶
func (*HTTP) GetOpenOrders ¶
func (*HTTP) GetProphecy ¶
func (*HTTP) GetProposals ¶
func (*HTTP) GetSideChainAllValidatorsCount ¶
func (*HTTP) GetSideChainParams ¶
func (*HTTP) GetSideChainPool ¶
func (*HTTP) GetSideChainProposal ¶
func (*HTTP) GetSideChainProposals ¶
func (*HTTP) GetSideChainRedelegationsByValidator ¶
func (c *HTTP) GetSideChainRedelegationsByValidator(sideChainId string, valAddr types.ValAddress) ([]types.Redelegation, error)
func (*HTTP) GetSideChainUnBondingDelegationsByValidator ¶
func (c *HTTP) GetSideChainUnBondingDelegationsByValidator(sideChainId string, valAddr types.ValAddress) ([]types.UnbondingDelegation, error)
func (*HTTP) GetSwapByCreator ¶
func (*HTTP) GetSwapByID ¶
func (*HTTP) GetSwapByRecipient ¶
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) GetTradingPairs ¶
func (*HTTP) ListAllMiniTokens ¶
func (*HTTP) ListAllTokens ¶
func (*HTTP) NumUnconfirmedTxs ¶
func (c *HTTP) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
func (*HTTP) QuerySideChainDelegation ¶
func (c *HTTP) QuerySideChainDelegation(sideChainId string, delAddr types.AccAddress, valAddr types.ValAddress) (*types.DelegationResponse, error)
Query a delegation based on address and validator address
func (*HTTP) QuerySideChainDelegations ¶
func (c *HTTP) QuerySideChainDelegations(sideChainId string, delAddr types.AccAddress) ([]types.DelegationResponse, error)
Query all delegations made from one delegator
func (*HTTP) QuerySideChainRedelegation ¶
func (c *HTTP) QuerySideChainRedelegation(sideChainId string, delAddr types.AccAddress, valSrcAddr types.ValAddress, valDstAddr types.ValAddress) (*types.Redelegation, error)
Query a redelegation record based on delegator and a source and destination validator address
func (*HTTP) QuerySideChainRedelegations ¶
func (c *HTTP) QuerySideChainRedelegations(sideChainId string, delAddr types.AccAddress) ([]types.Redelegation, error)
Query all redelegations records for one delegator
func (*HTTP) QuerySideChainTopValidators ¶
func (*HTTP) QuerySideChainUnbondingDelegation ¶
func (c *HTTP) QuerySideChainUnbondingDelegation(sideChainId string, valAddr types.ValAddress, delAddr types.AccAddress) (*types.UnbondingDelegation, error)
Query an unbonding-delegation record based on delegator and validator address
func (*HTTP) QuerySideChainUnbondingDelegations ¶
func (c *HTTP) QuerySideChainUnbondingDelegations(sideChainId string, delAddr types.AccAddress) ([]types.UnbondingDelegation, error)
Query all unbonding-delegations records for one delegator
func (*HTTP) QuerySideChainValidator ¶
func (c *HTTP) QuerySideChainValidator(sideChainId string, valAddr types.ValAddress) (*types.Validator, error)
Query a validator
func (*HTTP) QueryStore ¶
func (*HTTP) QueryStoreSubspace ¶
func (*HTTP) QueryWithData ¶
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) SideChainDelegate ¶
func (*HTTP) SideChainDeposit ¶
func (*HTTP) SideChainRedelegate ¶
func (c *HTTP) SideChainRedelegate(sideChainId string, valSrcAddr types.ValAddress, valDstAddr types.ValAddress, amount types.Coin, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error)
func (*HTTP) SideChainSubmitCSCParamsProposal ¶
func (c *HTTP) SideChainSubmitCSCParamsProposal(title string, cscParam msg.CSCParamChange, initialDeposit types.Coins, votingPeriod time.Duration, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) SideChainSubmitProposal ¶
func (*HTTP) SideChainSubmitSCParamsProposal ¶
func (c *HTTP) SideChainSubmitSCParamsProposal(title string, scParam msg.SCChangeParams, initialDeposit types.Coins, votingPeriod time.Duration, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) SideChainUnbond ¶
func (*HTTP) SideChainUnjail ¶
func (c *HTTP) SideChainUnjail(sideChainId string, valAddr types.ValAddress, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error)
func (*HTTP) SideChainVote ¶
func (c *HTTP) SideChainVote(proposalID int64, option msg.VoteOption, sideChainId string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) SubmitListProposal ¶
func (c *HTTP) SubmitListProposal(title string, param msg.ListTradingPairParams, proposalType msg.ProposalKind, initialDeposit types.Coins, votingPeriod time.Duration, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) SubmitProposal ¶
func (c *HTTP) SubmitProposal(title string, description string, proposalType msg.ProposalKind, initialDeposit types.Coins, votingPeriod time.Duration, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) TransferOut ¶
func (c *HTTP) TransferOut(to msg.SmartChainAddress, amount types.Coin, expireTime int64, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) TransferTokenOwnership ¶
func (c *HTTP) TransferTokenOwnership(symbol string, newOwner types.AccAddress, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
func (*HTTP) TxInfoSearch ¶
func (*HTTP) Unbind ¶
func (c *HTTP) Unbind(symbol string, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, 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)
func (*HTTP) Vote ¶
func (c *HTTP) Vote(proposalID int64, option msg.VoteOption, syncType SyncType, options ...tx.Option) (*core_types.ResultBroadcastTx, error)
type Info ¶
type Info struct { Hash libbytes.HexBytes `json:"hash"` Height int64 `json:"height"` Tx tx.Tx `json:"tx"` Result ResponseDeliverTx `json:"result"` }
func FormatTxResults ¶
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 []types.EventAttribute `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 []types.EventAttribute `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 []types.EventAttribute `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 []types.EventAttribute `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 libbytes.HexBytes `json:"hash"` Height int64 `json:"height"` }
type ResultTxSearch ¶
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 StakingClient ¶
type StakingClient interface { CreateSideChainValidator(delegation types.Coin, description msg.Description, commission types.CommissionMsg, sideChainId string, sideConsAddr []byte, sideFeeAddr []byte, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error) EditSideChainValidator(sideChainId string, description msg.Description, commissionRate *types.Dec, sideFeeAddr []byte, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error) SideChainDelegate(sideChainId string, valAddr types.ValAddress, delegation types.Coin, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error) SideChainRedelegate(sideChainId string, valSrcAddr types.ValAddress, valDstAddr types.ValAddress, amount types.Coin, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error) SideChainUnbond(sideChainId string, valAddr types.ValAddress, amount types.Coin, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error) SideChainUnjail(sideChainId string, valAddr types.ValAddress, syncType SyncType, options ...tx.Option) (*coretypes.ResultBroadcastTx, error) QuerySideChainValidator(sideChainId string, valAddr types.ValAddress) (*types.Validator, error) QuerySideChainTopValidators(sideChainId string, top int) ([]types.Validator, error) QuerySideChainDelegation(sideChainId string, delAddr types.AccAddress, valAddr types.ValAddress) (*types.DelegationResponse, error) QuerySideChainDelegations(sideChainId string, delAddr types.AccAddress) ([]types.DelegationResponse, error) QuerySideChainRedelegation(sideChainId string, delAddr types.AccAddress, valSrcAddr types.ValAddress, valDstAddr types.ValAddress) (*types.Redelegation, error) QuerySideChainRedelegations(sideChainId string, delAddr types.AccAddress) ([]types.Redelegation, error) QuerySideChainUnbondingDelegation(sideChainId string, valAddr types.ValAddress, delAddr types.AccAddress) (*types.UnbondingDelegation, error) QuerySideChainUnbondingDelegations(sideChainId string, delAddr types.AccAddress) ([]types.UnbondingDelegation, error) GetSideChainUnBondingDelegationsByValidator(sideChainId string, valAddr types.ValAddress) ([]types.UnbondingDelegation, error) GetSideChainRedelegationsByValidator(sideChainId string, valAddr types.ValAddress) ([]types.Redelegation, error) GetSideChainPool(sideChainId string) (*types.Pool, error) GetSideChainAllValidatorsCount(sideChainId string, jailInvolved bool) (int, error) }
type WSClient ¶
type WSClient struct { Address string // IP:PORT or /path/to/socket Endpoint string // /websocket/url/endpoint Dialer func(string, string) (net.Conn, error) // Single user facing channel to read RPCResponses from ResponsesCh chan rpctypes.RPCResponse libservice.BaseService // contains filtered or unexported fields }
WSClient is a WebSocket client. The methods of WSClient are safe for use by multiple goroutines.
func NewWSClient ¶
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) ABCIQueryWithOptions ¶
func (*WSClient) BlockResults ¶
func (*WSClient) BlockchainInfo ¶
func (*WSClient) BroadcastTx ¶
func (*WSClient) BroadcastTxCommit ¶
func (*WSClient) DumpConsensusState ¶
func (*WSClient) GenRequestId ¶
func (c *WSClient) GenRequestId() (rpctypes.JSONRPCStringID, error)
func (*WSClient) IsReconnecting ¶
IsReconnecting returns true if the client is reconnecting right now.
func (*WSClient) NumUnconfirmedTxs ¶
func (*WSClient) OnStart ¶
OnStart implements libservice.Service by dialing a server and creating read and write routines.
func (*WSClient) Send ¶
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) Stop ¶
Stop overrides service.Service#Stop. There is no other way to wait until Quit channel is closed.
func (*WSClient) Subscribe ¶
Subscribe to a query. Note the server must have a "subscribe" route defined.
func (*WSClient) UnconfirmedTxs ¶
func (*WSClient) Unsubscribe ¶
Unsubscribe from a query. Note the server must have a "unsubscribe" route defined.
func (*WSClient) UnsubscribeAll ¶
UnsubscribeAll from all. Note the server must have a "unsubscribe_all" route defined.
type WSEvents ¶
type WSEvents struct { libservice.BaseService // contains filtered or unexported fields }
WSEvents is a wrapper around WSClient, which implements EventsClient.
func (*WSEvents) ABCIQueryWithOptions ¶
func (w *WSEvents) ABCIQueryWithOptions(path string, data libbytes.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, 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 (*WSEvents) BroadcastTxCommit ¶
func (w *WSEvents) BroadcastTxCommit(tx types.Tx) (*ResultBroadcastTxCommit, error)
func (*WSEvents) ConsensusState ¶
func (w *WSEvents) ConsensusState() (*ctypes.ResultConsensusState, error)
func (*WSEvents) DumpConsensusState ¶
func (w *WSEvents) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)
func (*WSEvents) NumUnconfirmedTxs ¶
func (w *WSEvents) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
func (*WSEvents) OnStart ¶
OnStart implements libservice.Service by starting WSClient and event loop.
func (*WSEvents) OnStop ¶
func (w *WSEvents) OnStop()
OnStop implements libservice.Service by stopping WSClient.
func (*WSEvents) PendingRequest ¶
func (*WSEvents) SetTimeOut ¶
func (*WSEvents) SimpleCall ¶
func (*WSEvents) Subscribe ¶
func (w *WSEvents) Subscribe(ctx context.Context, subscriber, 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 erroneous event.
It returns an error if WSEvents is not running.
func (*WSEvents) TxInfoSearch ¶
func (*WSEvents) UnconfirmedTxs ¶
func (w *WSEvents) UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error)
func (*WSEvents) Unsubscribe ¶
Unsubscribe implements EventsClient by using WSClient to unsubscribe given subscriber from query.
It returns an error if WSEvents is not running.
func (*WSEvents) UnsubscribeAll ¶
UnsubscribeAll implements EventsClient by using WSClient to unsubscribe given subscriber from all the queries.
It returns an error if WSEvents is not running.
func (*WSEvents) Validators ¶
func (w *WSEvents) Validators(height *int64) (*ctypes.ResultValidators, error)