Cosmos
object also exposes a ws(network)
method that allows you to interact with the
WebSocket API of a full node. Some WebSocket endpoints have overlap with the REST API, but others
are unique to the WebSocket API. Most importantly, it abstracts block and transaction subscriptions
through the .onBlock
and .onTx
methods.
Beware that most public nodes enforce a strict rate limit of 5 subscriptions per client. If you
require more, you will need to run your own isolated full node. However, typically, 5 subscriptions
is enough for most Dapps.
expectTx
method which you can use to await the confirmation of a transaction:
Tendermint Queries
Tendermint is underlying the Cosmos SDK and provides a way for full nodes to index and query transactions based on events and their attributes emitted by the Cosmos SDK modules and smart contracts. TheTendermintQuery
class is a builder for Tendermint queries. It provides a fluent interface for
building queries and is a first-class citizen in Apophis’ WebSocket API.
block.height
message.sender
- TODO: List built-in query keys
Response
of your smart contract:
TODO: Example
Sorry for the incomplete state of this documentation. The missing parts I need to re-discover
myself. :)