Updated on 2026-08-14
This commit is contained in:
parent
d9f3a8e456
commit
943baed9b8
3 changed files with 35 additions and 24 deletions
|
|
@ -34,7 +34,8 @@ internal class DefaultDynamicAddressesRepository(
|
|||
val token = response.findToken(network)
|
||||
when {
|
||||
token?.dynamicAddressesEnabled != true -> DynamicAddressesStatus.DISABLED
|
||||
!isXpubAvailable(userWalletId, network) -> DynamicAddressesStatus.ENABLED_REQUIRES_SETUP
|
||||
!walletManagersFacade.isDynamicAddressesEnabled(userWalletId, network) ->
|
||||
DynamicAddressesStatus.ENABLED_REQUIRES_SETUP
|
||||
else -> DynamicAddressesStatus.ENABLED
|
||||
}
|
||||
}
|
||||
|
|
@ -145,11 +146,6 @@ internal class DefaultDynamicAddressesRepository(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun isXpubAvailable(userWalletId: UserWalletId, network: Network): Boolean {
|
||||
// Check if WalletManager is already in XPUB mode (dynamic addresses were previously enabled on this device)
|
||||
return walletManagersFacade.getDynamicAddressesReceiveAddress(userWalletId, network) != null
|
||||
}
|
||||
|
||||
private fun GetWalletAccountsResponse.findToken(network: Network): UserTokensResponse.Token? {
|
||||
return accounts
|
||||
.flatMap { it.tokens.orEmpty() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue