Updated on 2026-08-14
This commit is contained in:
parent
b2be9ebab0
commit
340bc656c7
24 changed files with 63 additions and 87 deletions
|
|
@ -115,7 +115,7 @@ internal class DefaultWalletAccountsFetcher @Inject constructor(
|
|||
|
||||
saveETag(userWalletId, apiResponse)
|
||||
|
||||
apiResponse.bind()
|
||||
apiResponse.bind().enrichByAccountId()
|
||||
},
|
||||
onError = { error ->
|
||||
if (error.isNetworkError(code = Code.PRECONDITION_FAILED)) {
|
||||
|
|
@ -142,10 +142,11 @@ internal class DefaultWalletAccountsFetcher @Inject constructor(
|
|||
|
||||
saveETag(userWalletId, apiResponse)
|
||||
|
||||
val responseBody = apiResponse.bind()
|
||||
store(userWalletId = userWalletId, response = responseBody)
|
||||
val response = apiResponse.bind().enrichByAccountId()
|
||||
|
||||
FetchResult(responseBody)
|
||||
store(userWalletId = userWalletId, response = response)
|
||||
|
||||
FetchResult(response)
|
||||
},
|
||||
onError = { throwable ->
|
||||
// pushWalletAccounts and storeWalletAccounts help to avoid cyclic dependency
|
||||
|
|
@ -215,6 +216,18 @@ internal class DefaultWalletAccountsFetcher @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun GetWalletAccountsResponse.enrichByAccountId(): GetWalletAccountsResponse {
|
||||
return copy(
|
||||
accounts = accounts.map { accountDTO ->
|
||||
accountDTO.copy(
|
||||
tokens = accountDTO.tokens?.map { token ->
|
||||
token.copy(accountId = accountDTO.id)
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun getAccountsResponseStore(userWalletId: UserWalletId): AccountsResponseStore {
|
||||
return accountsResponseStoreFactory.create(userWalletId = userWalletId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ internal class DefaultMainAccountTokensMigration(
|
|||
|
||||
val unassignedTokens = mainAccount.findUnassignedTokens(derivationIndex)
|
||||
|
||||
if (unassignedTokens == null) {
|
||||
if (unassignedTokens.isNullOrEmpty()) {
|
||||
Timber.i("No unassigned tokens found for migration")
|
||||
return@either
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue