From 137d8968141bd42b1c947e7fb65b8893b6f39575 Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Thu, 25 Jul 2024 12:28:48 +0300 Subject: [PATCH] Readme (#6) --- package.json | 3 +- src/app/page.tsx | 40 +----- src/components/Balances/index.tsx | 44 +++---- src/components/StakingRewards/index.tsx | 4 +- src/components/Swap/Layout.tsx | 20 +-- src/components/ui/select.tsx | 160 ++++++++++++++++++++++++ src/index.ts | 1 + tailwind.config.js | 56 +++++++++ yarn.lock | 44 +++++++ 9 files changed, 303 insertions(+), 69 deletions(-) create mode 100644 src/components/ui/select.tsx diff --git a/package.json b/package.json index 3ce5e04..1730606 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "@radix-ui/react-dropdown-menu": "^2.1.1", "@radix-ui/react-label": "^2.1.0", "@radix-ui/react-popover": "^1.1.1", + "@radix-ui/react-select": "^2.1.1", "@radix-ui/react-slot": "^1.1.0", "@rainbow-me/rainbowkit": "^2.1.3", "@tanstack/react-query": "^5.28.4", @@ -68,4 +69,4 @@ "node": ">=18.0.0" }, "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72" -} \ No newline at end of file +} diff --git a/src/app/page.tsx b/src/app/page.tsx index 1cd93c2..0471d61 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,46 +1,14 @@ "use client"; -import { useState } from "react"; import { ConnectButton } from "@rainbow-me/rainbowkit"; -import { - ConnectBitcoin, - useZetaChainClient, - useEthersSigner, - Swap, -} from "@/index"; +import { ConnectBitcoin } from "@/index"; import { useAccount, useChainId, useWalletClient } from "wagmi"; -import { ThemeToggle } from "@/components/ThemeToggle"; -import { useBitcoinWallet } from "@/providers/BitcoinWalletProvider"; - -const contract = "0xb459F14260D1dc6484CE56EB0826be317171e91F"; const Page = () => { - const account = useAccount(); - const chainId = useChainId(); - const { data: walletClient } = useWalletClient({ chainId }); - const signer = useEthersSigner({ walletClient }); - const client = useZetaChainClient({ network: "testnet", signer }); - const { sendTransaction, address: bitcoinAddress } = useBitcoinWallet(); - return ( -
-
- - - -
-
-
- {client && ( - - )} -
-
+
+ +
); }; diff --git a/src/components/Balances/index.tsx b/src/components/Balances/index.tsx index 547a08a..6e37b91 100644 --- a/src/components/Balances/index.tsx +++ b/src/components/Balances/index.tsx @@ -78,24 +78,26 @@ export const Balances = ({ ); const SearchInput = ( -
- setSearch(e.target.value)} - className="pl-9" - /> - - + + +
); @@ -107,7 +109,7 @@ export const Balances = ({ variant="outline" size="sm" key={chain} - className={`mr-2 ${ + className={`mr-2 dark:font-light ${ selectedChain === chain ? "bg-zinc-100 dark:bg-zinc-800" : "" }`} onClick={() => @@ -130,7 +132,7 @@ export const Balances = ({ onClick={() => onBalanceClick(token)} >
- {token.symbol} + {token.symbol} {token.chain_name}
{roundNumber(parseFloat(token.balance))} @@ -140,7 +142,7 @@ export const Balances = ({ ); const LoadingSkeleton = ( -
+
{Array(5) .fill(null) .map((_, index) => ( @@ -157,7 +159,7 @@ export const Balances = ({ return (
- + {SearchInput} {error ? ( ErrorMessage diff --git a/src/components/StakingRewards/index.tsx b/src/components/StakingRewards/index.tsx index 57dd578..a858225 100644 --- a/src/components/StakingRewards/index.tsx +++ b/src/components/StakingRewards/index.tsx @@ -131,7 +131,7 @@ export const StakingRewards = ({ client, account }: any) => { return (
- +
Staked
{isConnected ? ( @@ -153,7 +153,7 @@ export const StakingRewards = ({ client, account }: any) => { )}
- +
Rewards
{isConnected ? ( diff --git a/src/components/Swap/Layout.tsx b/src/components/Swap/Layout.tsx index ffb59a1..9f2eb9a 100644 --- a/src/components/Swap/Layout.tsx +++ b/src/components/Swap/Layout.tsx @@ -105,7 +105,7 @@ const SwapLayout: React.FC = ({ }; return ( - +

{sendTypeDetails[sendType as any]?.title || "Swap"}

@@ -154,16 +154,16 @@ const SwapLayout: React.FC = ({ - + - + No available tokens found. {sourceBalances.map((balances: any) => ( { setSourceToken(c === sourceTokenSelected ? null : c); @@ -238,16 +238,16 @@ const SwapLayout: React.FC = ({ - + - + No available tokens found. {destinationBalances?.map((balances: any) => ( = ({
{formatAddress(addressSelected)}
- + = ({ - +
Cross-Chain Fee
{crossChainFee?.amount}
@@ -352,6 +353,7 @@ const SwapLayout: React.FC = ({