-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New tabs for Longs, Shorts, LP (#207)
- Loading branch information
1 parent
22c83c2
commit b7ca514
Showing
9 changed files
with
90 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...perdrive-trading/src/ui/hyperdrive/lp/AddLiquidityModalButton/AddLiquidityModalButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ChevronRightIcon, CircleStackIcon } from "@heroicons/react/24/outline"; | ||
import { ReactElement } from "react"; | ||
import { Well } from "src/ui/base/components/Well/Well"; | ||
|
||
export function AddLiquidityModalButton(): ReactElement { | ||
return ( | ||
<Well interactive variant="primary"> | ||
<div className="flex w-52 flex-col gap-2 py-4 text-center"> | ||
<CircleStackIcon className="mb-2 h-16 text-primary" /> | ||
<p className="font-lato text-h5 font-light text-primary"> | ||
Add liquidity | ||
</p> | ||
<p className="font-light"> | ||
Earn trading fees when users open longs or shorts | ||
</p> | ||
<div className="daisy-btn-primary daisy-btn-sm daisy-btn mt-2 justify-between gap-0 normal-case"> | ||
<span className="ml-4 flex-1 text-center">Add LP</span> | ||
<ChevronRightIcon className="h-3 text-right" /> | ||
</div> | ||
</div> | ||
</Well> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
apps/hyperdrive-trading/src/ui/portfolio/YourBalanceWell/YourBalanceWell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ReactElement } from "react"; | ||
import { Token } from "src/appconfig/types"; | ||
import { Stat } from "src/ui/base/components/Stat"; | ||
import { Well } from "src/ui/base/components/Well/Well"; | ||
import { formatBalance } from "src/ui/base/formatting/formatBalance"; | ||
import { useMintBaseToken } from "src/ui/token/hooks/useMintBaseToken"; | ||
import { parseUnits } from "viem"; | ||
import { useAccount, useBalance, useChainId } from "wagmi"; | ||
|
||
export function YourBalanceWell({ token }: { token: Token }): ReactElement { | ||
const { address: account } = useAccount(); | ||
const { data: balance } = useBalance({ | ||
address: account, | ||
token: token.address, | ||
}); | ||
const chainId = useChainId(); | ||
const { mint } = useMintBaseToken({ | ||
amount: parseUnits("100", token.decimals), | ||
baseToken: token.address, | ||
destination: account, | ||
}); | ||
|
||
return ( | ||
<Well> | ||
<div className="flex items-center gap-4"> | ||
<Stat | ||
label="Your available balance" | ||
value={ | ||
<div className="-mt-1 flex items-center gap-1 text-h5"> | ||
<img className="h-4" src={token.iconUrl} /> | ||
{formatBalance(balance?.formatted || 0, 4)} {token.symbol} | ||
{chainId === 31337 ? ( | ||
<button | ||
disabled={!mint} | ||
className="daisy-btn-xs daisy-btn ml-1" | ||
onClick={() => mint?.()} | ||
> | ||
Mint Tokens | ||
</button> | ||
) : undefined} | ||
</div> | ||
} | ||
/> | ||
</div> | ||
</Well> | ||
); | ||
} |
71 changes: 7 additions & 64 deletions
71
apps/hyperdrive-trading/src/ui/trade/TradeBody/TradeBody.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b7ca514
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
hyperdrive-monorepo-hyperdrive-trading – ./apps/hyperdrive-trading
hyperdrive-monorepo-hyperdrive-trading-git-main-delvtech.vercel.app
hyperdrive-monorepo-hyperdrive-trading.vercel.app
hyperdrive-monorepo-hyperdrive-trading-delvtech.vercel.app
b7ca514
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
hyperdrive-fixed-borrow – ./apps/fixed-borrow
hyperdrive-fixed-borrow-git-main-delvtech.vercel.app
hyperdrive-fixed-borrow-delvtech.vercel.app
hyperdrive-fixed-borrow.vercel.app