Skip to content

Commit

Permalink
chore: fix zero eth check (#5361)
Browse files Browse the repository at this point in the history
* chore: fix zero eth check

* cleaner

* lint
  • Loading branch information
skylarbarrera authored Jan 29, 2024
1 parent 7014863 commit 510c45f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useOnAvatarPress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default ({ screenType = 'transaction' }: UseOnAvatarPressProps = {}) => {
const isReadOnly = isReadOnlyWallet && !enableActionsOnReadOnlyWallet;

const isENSProfile = profilesEnabled && profileEnabled && isOwner;
const isZeroETH = isZero(accountAsset.balance.amount);
const isZeroETH = isZero(accountAsset?.balance?.amount);

const callback = useCallback(
async (buttonIndex: number) => {
Expand Down
10 changes: 6 additions & 4 deletions src/hooks/usePriceImpactDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export default function usePriceImpactDetails(

const inputNativeAmount = useMemo(() => {
if (isWrapOrUnwrap) {
if (!tradeDetails?.sellAmount || !inputCurrency?.price?.value)
return null;
if (!tradeDetails?.sellAmount || !inputCurrency?.price?.value) {
return '';
}

return convertRawAmountToNativeDisplay(
tradeDetails?.sellAmount?.toString(),
Expand Down Expand Up @@ -95,7 +96,9 @@ export default function usePriceImpactDetails(

const outputNativeAmount = useMemo(() => {
if (isWrapOrUnwrap) {
if (!tradeDetails?.buyAmount || !inputCurrency?.price?.value) return null;
if (!tradeDetails?.buyAmount || !inputCurrency?.price?.value) {
return '';
}
return convertRawAmountToNativeDisplay(
tradeDetails?.buyAmount?.toString(),
inputCurrency?.decimals || 18,
Expand Down Expand Up @@ -146,7 +149,6 @@ export default function usePriceImpactDetails(
outputNativeAmount,
};
} else if (greaterThanOrEqualTo(priceImpact, PriceImpactWarningThreshold)) {
console.log({ inputNativeAmount, outputNativeAmount });
return {
priceImpact: {
type: SwapPriceImpactType.high,
Expand Down

0 comments on commit 510c45f

Please sign in to comment.