Client Package
Overview
The client package exposes go APIs to facilitate interactions with the Pocket network. It includes lower-level interfaces for working with transactions and subscribing to events generally, as well as higher-level interfaces for tracking blocks and broadcasting protocol-specific transactions.
Features
SupplierClient
A high-level client for use by the "supplier" actor.
TxClient
A high-level client used to build, sign, and broadcast transaction from cosmos-sdk messages.
TxContext
Abstracts and encapsulates the transaction building, signing, encoding, and broadcasting concerns.
BlockClient
Exposes methods for receiving notifications about newly committed blocks.
DelegationClient
Exposes methods for receiving notifications about new delegation changes from application.
EventsQueryClient
Encapsulates blockchain event subscriptions.
Connection
A transport agnostic communication channel for sending and receiving messages.
Dialer
Abstracts the establishment of connections.
Architecture Overview
This package includes multiple clients and subcomponents which interact with the network via connections and dialers. The components include:
DelegationClient
BlockClient
SupplierClient
TxClient
TxContext
EventsQueryClient
EventsReplayClient
Connection
Dialer
High-level interactions documented in the original material:
direct usage via dependency injection (#DependencyMethod)
usage via network I/O (RPC subscribe, tx broadcast, tx query)
clients depend on Dialer and Connection for network interaction
TxClient and TxContext are central for transaction building, signing, and broadcasting
BlockClient and EventsQueryClient handle subscribed events and committed block sequences
(For detailed visual diagrams and legends, refer to the original source.)
Installation
go get github.com/pokt-network/poktroll/pkg/clientUsage
Basic Example
// TODO_DOCUMENT: Code example showcasing the use of TxClient or any other primary interface.Advanced Usage
// TODO_DOCUMENT: Example illustrating advanced features or edge cases of the package.Configuration
TxClientOption: Function type that modifies the
TxClientallowing for flexible and optional configurations.EventsQueryClientOption: Modifies the
EventsQueryClientto apply custom behaviors or configurations.
API Reference
For the complete API details, see the godoc: https://pkg.go.dev/github.com/pokt-network/poktroll/pkg/client
Best Practices
Use Abstractions: Instead of directly communicating with blockchain platforms, leverage the provided interfaces for consistent and error-free interactions.
Stay Updated: With evolving blockchain technologies, ensure to keep the package updated for any new features or security patches.
FAQ
Was this helpful?
