Documentation
¶
Index ¶
- Variables
- func CheckResponse(r *http.Response) error
- func NewOption(fs ...SetOption) (*option, error)
- func NewTestTmServer() *testTmServer
- type AbciQueryOption
- type BlockOption
- type BlockResultsOption
- type BlockchainOption
- type BroadcastTxAsyncOption
- type BroadcastTxCommitOption
- type BroadcastTxSyncOption
- type Client
- type SetOption
- type SubscribeOption
- type TxOption
- type TxSearchOption
- type UnconfirmedTxsOption
- type UnsubscribeOption
- type ValidatorsOption
Constants ¶
This section is empty.
Variables ¶
var TmDefaultServer = "http://127.0.0.1:26657"
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range or equal to 202 Accepted. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
The error type will be *RateLimitError for rate limit exceeded errors, *AcceptedError for 202 Accepted status codes, and *TwoFactorAuthError for two-factor authentication errors.
func NewTestTmServer ¶
func NewTestTmServer() *testTmServer
Types ¶
type AbciQueryOption ¶
type BlockOption ¶
type BlockOption struct {
Height int `url:"height,omitempty"`
}
type BlockResultsOption ¶
type BlockResultsOption struct {
Height int `url:"height,omitempty"`
}
type BlockchainOption ¶
type BroadcastTxAsyncOption ¶
type BroadcastTxAsyncOption struct {
Tx string `url:"tx,omitempty"`
}
type BroadcastTxCommitOption ¶
type BroadcastTxCommitOption struct {
Tx string `url:"tx,omitempty"`
}
type BroadcastTxSyncOption ¶
type BroadcastTxSyncOption struct {
Tx string `url:"tx,omitempty"`
}
type Client ¶
type Client struct {
Test int
Status *statusService
AbciInfo *abciInfoService
ConsensusState *consensusStateService
DumpConsensusState *dumpConsensusStateService
Genesis *genesisService
Health *healthService
NetInfo *netInfoService
NumUnconfirmedTxs *numUnconfirmedTxsService
AbciQuery *abciQueryService
Block *blockService
BlockResults *blockResultsService
Blockchain *blockchainService
BroadcastTxAsync *broadcastTxAsyncService
BroadcastTxCommit *broadcastTxCommitService
BroadcastTxSync *broadcastTxSyncService
Subscribe *subscribeService
Tx *txService
TxSearch *txSearchService
UnconfirmedTxs *unconfirmedTxsService
Unsubscribe *unsubscribeService
Validators *validatorsService
// contains filtered or unexported fields
}
Client 客户端结构
func (*Client) Do ¶
do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If rate limit is exceeded and reset time is in the future, do returns *RateLimitError immediately without making a network API call.
The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.
func (*Client) NewRequest ¶
newRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type SubscribeOption ¶
type SubscribeOption struct {
Query string `url:"query,omitempty"`
}
type TxSearchOption ¶
type UnconfirmedTxsOption ¶
type UnconfirmedTxsOption struct {
Limit int `url:"limit,omitempty"`
}
type UnsubscribeOption ¶
type UnsubscribeOption struct {
Query string `url:"query,omitempty"`
}
type ValidatorsOption ¶
type ValidatorsOption struct {
Height int `url:"height,omitempty"`
}
Source Files
¶
- abci_info.go
- abci_query.go
- block.go
- block_results.go
- blockchain.go
- broadcast_tx_async.go
- broadcast_tx_commit.go
- broadcast_tx_sync.go
- client.go
- consensus_state.go
- dump_consensus_state.go
- genesis.go
- health.go
- net_info.go
- num_unconfirmed_txs.go
- status.go
- subscribe.go
- tx.go
- tx_search.go
- unconfirmed_txs.go
- unsubscribe.go
- validators.go