Extension APIs
TronProvider contains the core wallet surface. Protocol-specific operations are
grouped into extension traits so applications only import the domains they use:
use tronz::providers::ext::{
ExchangeApi as _, GovernanceApi as _, MarketApi as _, Trc10Api as _, WitnessApi as _,
};Every TronProvider implements these traits. Importing a trait only makes its
methods available; it does not wrap or replace the provider.
| Trait | Read methods | Transaction builders |
|---|---|---|
Trc10Api | Asset metadata, lists, balances | Issue, participate, transfer, update |
WitnessApi | Witnesses, brokerage, rewards | Register/update witness, update brokerage |
GovernanceApi | Proposals and proposal lists | Submit, approve, cancel |
ExchangeApi | Exchange lists and lookup | Create, inject, withdraw, trade |
MarketApi | Orders, pairs and prices | Sell, cancel |
Governance
Read proposals without a signer, or submit changes from an eligible witness account:
use tronz::providers::ext::GovernanceApi as _;
let proposals = provider.list_proposals().await?;
let pending = provider
.submit_proposal()
.parameter(0, 21_600_000)
.send()
.await?;The runnable governance lifecycle example shows submit, approve, and cancel operations.
Witness operations
Witness registration uses become_witness; existing candidates use
update_witness and update_brokerage:
use tronz::providers::ext::WitnessApi as _;
provider
.update_witness()
.url("https://sr.example")
.send()
.await?;
provider
.update_brokerage()
.brokerage(20)
.send()
.await?;TRC10 assets
Trc10Api covers metadata queries, balances, issuance, participation,
transfers, unfreezing, and metadata updates:
use tronz::providers::ext::Trc10Api as _;
provider
.update_trc10()
.description("updated metadata")
.url("https://token.example")
.new_limit(1_000)
.new_public_limit(10_000)
.send()
.await?;See the runnable TRC10 update example.
Exchange and Market
ExchangeApi manages legacy liquidity pools. MarketApi manages the native
order-book DEX. See Exchange and Market for
their different data models and transaction builders.
Read methods do not need a signer. Builders follow the normal
transaction lifecycle and require a provider with a
signer before .send().
See Reading chain state for the broader core read API.
