Skip to content

Commit

Permalink
Show sunrise stake extractable yield
Browse files Browse the repository at this point in the history
  • Loading branch information
s6thgehr committed Oct 19, 2023
1 parent 53e9020 commit df2f5d9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/app/src/yield/AccountBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const AccountBalance: FC<AccountBalanceProps> = ({ title, balance }) => {
return (
<div className="flex gap-2 my-8 justify-center">
<div className="text-2xl font-bold w-40">{title}</div>
<div className="flex flex-col">
<div className="flex flex-col items-center">
<WaterBowl />
<div className="text-lg">{balance} Sol</div>
</div>
Expand Down
21 changes: 20 additions & 1 deletion packages/app/src/yield/YieldApp.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
import { forwardRef, type ForwardRefRenderFunction } from "react";
import AccountBalance from "./AccountBalance";
import { useSunriseStake } from "../common/context/sunriseStakeContext";
import { type Details } from "@sunrisestake/client";
import BN from "bn.js";
import { lamportsToDisplay } from "../common/utils";

const _YieldApp: ForwardRefRenderFunction<
HTMLDivElement,
{ className?: string; active?: boolean } & React.HTMLAttributes<HTMLElement>
> = ({ className, active = false, ...rest }, ref) => {
const {
details,
}: {
details: Details | undefined;
} = useSunriseStake();

if (details == null) return <>Loading...</>;

const extractableYield = new BN(
Math.max(details.extractableYield.toNumber(), 0)
);

return (
<div className="flex flex-col justify-start w-full mt-16">
<AccountBalance title="Sunrise Stake" balance="45" />
<AccountBalance
title="Sunrise Stake"
balance={lamportsToDisplay(extractableYield)}
/>
<AccountBalance title="Yield Router" balance="5" />
<div className="flex justify-center gap-16">
<div className="flex flex-col">
Expand Down

0 comments on commit df2f5d9

Please sign in to comment.