Skip to content

Commit

Permalink
fix(wallet, ui): resolve wallet issue and fix visual bug
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenary committed Dec 4, 2024
1 parent 6523305 commit 038b09f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/components/sidebar-navigation/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ export const SmallScreenHeaderActions = styled.div<{
opacity: 1;
transition: all var(--sidebar-expand-transition-speed);
gap: ${(p) => p.$gap ?? 'unset'};
margin-right: 16px;
${(p) =>
p.$hidden
Expand Down
16 changes: 7 additions & 9 deletions src/components/wallet-utilities/SendNear.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ type FormData = {
};

function displayBalance(balance: number) {
if (balance < 1) {
const display = (balance * 100000).toFixed(5);
if (balance && parseFloat(display) === 0) return '< 0.00001';
return display;
}
return balance.toFixed(5);
if (balance && parseFloat(balance.toFixed(4)) === 0) return '< 0.0001';
return balance
}

export const SendNear = () => {
Expand All @@ -31,10 +27,12 @@ export const SendNear = () => {

const loadBalance = async () => {
try {
const balance = await wallet.getBalance(signedAccountId);
const balance = await wallet.getBalance(signedAccountId,true);
const requiredGas = 0.00005;
const availableBalance = balance - requiredGas;
setCurrentNearAmount(Math.max(availableBalance, 0));

const availableBalance = Math.max(balance - requiredGas,0);
const formattedNumber = parseFloat(availableBalance.toFixed(4));
setCurrentNearAmount(formattedNumber);
} catch (error) {
console.error(error);
}
Expand Down

0 comments on commit 038b09f

Please sign in to comment.