Apophis provides a WebSocket API abstraction for Cosmos RPCs.
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:
TendermintQuery
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
Response
of your smart contract:
TODO: Example
Sorry for the incomplete state of this documentation. The missing parts I need to re-discover
myself. :)