BalanceRepository
@Singleton
Repository for aggregating and exposing token balances to the UI layer.
Responsibilities:
Transform UTXO manager data to TokenBalance models
Expose Flow
> for UI consumption Calculate token balances from available UTXOs
Data Flow:
Database → UtxoManager → BalanceRepository → ViewModel → UI
(UTXOs) (Sum by type) (Add metadata) (Transform) (Display)Content copied to clipboard
Example Usage:
@Inject lateinit var repository: BalanceRepository
repository.observeBalances(address)
.collect { balances ->
balances.forEach { balance ->
println("${balance.tokenType}: ${balance.balance} (${balance.utxoCount} UTXOs)")
}
}Content copied to clipboard
Functions
Link copied to clipboard
Observe available token balances for a specific address.
Link copied to clipboard
Observe pending token balances for a specific address.
Link copied to clipboard
Observe balance for a specific token type.
Link copied to clipboard
Observe total balance across all token types (available + pending).
Link copied to clipboard
Reset the WebSocket connection to the indexer.