Skip to content

Commit

Permalink
fix: undefined balance & other props when user has no balance.
Browse files Browse the repository at this point in the history
  • Loading branch information
micwallace committed Nov 1, 2023
1 parent 387b415 commit fc72622
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,18 @@ export class DiscoveryAdapter implements ITokenDiscoveryAdapter {
token.symbol = collectionData?.symbol;
token.decimals = 0;

// TODO: Rework this. I dunno how it got this bad but I think I was working around some inconsistencies in the discovery API
// Rework so collection data API isn't required for erc20
} else if (tokenData.length > 0) {
token.name = tokenData[0].title;
token.balance = tokenData[0].data?.balance ?? 0;
token.symbol = tokenData[0].symbol;
token.decimals = tokenData[0].data?.decimals;
} else {
token.name = collectionData.title;
token.balance = 0;
token.symbol = collectionData.symbol;
token.decimals = collectionData.decimals;
return token;
}

Expand Down

0 comments on commit fc72622

Please sign in to comment.