Skip to content

Commit

Permalink
fix fetchBalance
Browse files Browse the repository at this point in the history
  • Loading branch information
abstract829 committed Jun 12, 2024
1 parent 71f574e commit 8623195
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/hooks/useGetNativeTokenBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ const fetchBalance = async ({ sorobanContext, address }: FetchBalanceProps) => {
return { data: 0, validAccount: false };
}

try {
const balance = await tokenBalance(networkNativeToken.address, address, sorobanContext);
return { data: balance, validAccount: true };
} catch (error) {
return { data: 0, validAccount: true };
const balance = await tokenBalance(networkNativeToken.address, address, sorobanContext);

if (balance === null) {
throw new Error('Failed to fetch balance');
}

return { data: balance, validAccount: true };
};

const useGetNativeTokenBalance = () => {
Expand Down

0 comments on commit 8623195

Please sign in to comment.