diff --git a/packages/mrgn-common/src/utils/formatters.utils.ts b/packages/mrgn-common/src/utils/formatters.utils.ts index 9950d657ed..d21ef3eaf5 100644 --- a/packages/mrgn-common/src/utils/formatters.utils.ts +++ b/packages/mrgn-common/src/utils/formatters.utils.ts @@ -105,6 +105,9 @@ const clampedNumeralFormatter = (value: number) => { }; const tokenPriceFormatter = (price: number, style: "currency" | "decimal" = "currency") => { + if (price === 0) { + return 0; + } const reformatNum = Number(price.toFixed(20)); if (reformatNum < 0.00000001) { diff --git a/packages/mrgn-ui/src/components/action-box-v2/actions/lend-box/components/action-input/action-input.tsx b/packages/mrgn-ui/src/components/action-box-v2/actions/lend-box/components/action-input/action-input.tsx index 844864766a..740f0f9521 100644 --- a/packages/mrgn-ui/src/components/action-box-v2/actions/lend-box/components/action-input/action-input.tsx +++ b/packages/mrgn-ui/src/components/action-box-v2/actions/lend-box/components/action-input/action-input.tsx @@ -2,6 +2,7 @@ import React from "react"; import { ActionType, ExtendedBankInfo } from "@mrgnlabs/marginfi-v2-ui-state"; import { formatAmount } from "@mrgnlabs/mrgn-utils"; +import { usdFormatter, tokenPriceFormatter } from "@mrgnlabs/mrgn-common"; import { Input } from "~/components/ui/input"; @@ -9,6 +10,7 @@ import { LendingAction, BankSelect } from "./components"; type ActionInputProps = { amountRaw: string; + amount: number | null; nativeSolBalance: number; walletAmount: number | undefined; maxAmount: number; @@ -38,6 +40,7 @@ export const ActionInput = ({ showTokenSelection, showTokenSelectionGroups, amountRaw, + amount, selectedBank, lendMode, setAmountRaw, @@ -85,7 +88,7 @@ export const ActionInput = ({ connected={connected} /> -