ShieldedRepository

@Singleton
class ShieldedRepository @Inject constructor(dataStore: DataStore<Preferences>, indexerClient: IndexerClient, networkConfig: NetworkConfig)

Repository for shielded (zswap) wallet operations.

Uses its OWN WebSocket client, independent from the shared IndexerClient. This prevents the unshielded SubscriptionManager from killing the shielded subscription when it resets the shared WebSocket connection.

Constructors

Link copied to clipboard
@Inject
constructor(dataStore: DataStore<Preferences>, indexerClient: IndexerClient, networkConfig: NetworkConfig)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun deleteState(address: String)
Link copied to clipboard
suspend fun getBalances(address: String): Map<String, BigInteger>

Get current shielded balances.

Link copied to clipboard
suspend fun getCoinCount(address: String): Int

Get number of shielded coins.

Link copied to clipboard
suspend fun hasCachedState(address: String): Boolean

Check if cached shielded state exists.

Link copied to clipboard
suspend fun loadState(address: String): ZswapLocalState?
Link copied to clipboard
suspend fun saveState(address: String, state: ZswapLocalState)
Link copied to clipboard
fun subscribeToZswapEvents(fromId: Long? = null): Flow<RawLedgerEvent>

Subscribe to zswap events using dedicated WebSocket (not shared with unshielded).

Link copied to clipboard
suspend fun syncFromBlockchain(address: String, zswapSeed: ByteArray): Boolean

Sync shielded state from blockchain.