Skip to content

Commit

Permalink
feat: include emissions apy in action complete dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Jan 3, 2025
1 parent fde181b commit 2f9165d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Image from "next/image";

import { IconExternalLink } from "@tabler/icons-react";
import { ActionType, ActiveBankInfo } from "@mrgnlabs/marginfi-v2-ui-state";
import { shortenAddress, dynamicNumeralFormatter } from "@mrgnlabs/mrgn-common";
import { cn, computeBankRate, LendingModes } from "@mrgnlabs/mrgn-utils";
import { shortenAddress, dynamicNumeralFormatter, percentFormatter } from "@mrgnlabs/mrgn-common";
import { cn, getRateData } from "@mrgnlabs/mrgn-utils";

interface Props {
amount: number;
Expand All @@ -30,7 +30,7 @@ export const LendingScreen = ({ amount, bank, type, txn, txnLink, collatRepay }:
}, [type]);

const rate = React.useMemo(() => {
return computeBankRate(bank, type === ActionType.Deposit ? LendingModes.LEND : LendingModes.BORROW);
return getRateData(bank, type === ActionType.Deposit || type === ActionType.Withdraw);
}, [bank, type]);

const updatedBankAmount = React.useMemo(() => {
Expand Down Expand Up @@ -137,7 +137,7 @@ export const LendingScreen = ({ amount, bank, type, txn, txnLink, collatRepay }:
</>
)}
<dt>APY</dt>
<dd className={cn("text-right", actionTextColor)}>{rate}</dd>
<dd className={cn("text-right", actionTextColor)}>{percentFormatter.format(rate.rateAPY)}</dd>
<dt>Transaction</dt>
<dd className="text-right">
<Link
Expand Down

0 comments on commit 2f9165d

Please sign in to comment.