Skip to content

Commit

Permalink
fix(balances): Fixing walletHasBalance (#4807)
Browse files Browse the repository at this point in the history
### Description

`fetchTokenBalancesForAddress` can return tokens with zero balance (in
the ethereum flow for example), so `walletHasBalance` returns `true`
where it should return `false`.

Co-authored-by: Tom McGuire <[email protected]>
  • Loading branch information
dievazqu and MuckT authored Jan 26, 2024
1 parent 6020867 commit b3e4c42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/import/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function* attemptBackupPhraseCorrection(mnemonic: string) {
function* walletHasBalance(address: string) {
Logger.debug(TAG + '@walletHasBalance', 'Checking account balance')
const tokenBalances: FetchedTokenBalance[] = yield* call(fetchTokenBalancesForAddress, address)
return tokenBalances.length > 0
return tokenBalances.filter((token) => token.balance !== '0').length > 0
}

export function* watchImportBackupPhrase() {
Expand Down

0 comments on commit b3e4c42

Please sign in to comment.