How it works
The Wallet
class (can be created via create_wallet
function) each minute
updates its full state via GQL API:
- Configuration settings
- User's UTXO's of Cweb
- List of user's held custom tokens and their balances
User's UTXO's of Cweb, list of user's held custom tokens and their balances are
retrieved as claims via single fetchClaims
GQL query by specifying combined
ClaimFilter
s (this is important for performance).
The Wallet
class gets real-time updates on user's UTXO's of Cweb, list of
user's held custom tokens and their balances via subscription (incremental
updates to state).
Current balance of some token (including Cweb) can be retrieved via
get_token_balance
function. A token (including Cweb) can be sent via
compose_send
function. Both functions accept token_ref
as parameter, it is
null
for Cweb. Both functions use cached data and do not make any additional
calls to backend.
ClaimFilter
s for retrieving list of user's held custom tokens and their
balances are get from Tokenization Computation Block
. Given resulting claims
Tokenization Computation Block
returns list of user's held custom tokens and
their balances.