Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bridge] Frontend Development #1908

Merged
merged 137 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
bf14bbc
initialise turborepo 💥
Jennievon May 24, 2024
1825181
- rename shared components
Jennievon May 24, 2024
1684ac3
Update import paths in UI components
Jennievon May 24, 2024
7984364
Add eslint-config-custom to package.json
Jennievon May 24, 2024
7fa4a88
Update tsconfig.json and tsconfig.lint.json to
Jennievon May 27, 2024
70d18a1
fix:
Jennievon May 30, 2024
044a343
Fix import in 500.tsx and remove unused import
Jennievon May 30, 2024
7cec3aa
update wrong import path
Jennievon May 30, 2024
f4bc8a9
Fix form receiver value bug
Jennievon May 30, 2024
4c0838d
refactor: contract instance
Jennievon Jun 2, 2024
581cb74
Fix loading state and add transaction hash to
Jennievon Jun 3, 2024
45ce9d4
Add Ten Bridge deployment workflow and Dockerfile
Jennievon Jun 11, 2024
52ceab6
Update bridge example env variables
Jennievon Jun 11, 2024
2475db4
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Jun 20, 2024
7735df6
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Jun 20, 2024
5dbeb83
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Jun 26, 2024
f18157f
Fix favicon link and meta tags
Jennievon Jul 1, 2024
4d8fdd2
wip: refactor provider
Jennievon Jul 2, 2024
b46d582
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Jul 18, 2024
6db7193
wip: L2>L1 bridge withdrawal
Jennievon Jul 19, 2024
a9e5733
wip: L2>L1 bridge withdrawal
Jennievon Jul 22, 2024
f355d32
Add new contract files
Jennievon Jul 22, 2024
f824f5c
refactor: contract store
Jennievon Jul 25, 2024
32ced69
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Jul 25, 2024
46271a6
update manifest and favicon files
Jennievon Jul 31, 2024
5634bd9
add dashboard sub components
Jennievon Jul 31, 2024
2e00fd8
add nvmrc file
Jennievon Jul 31, 2024
73b208d
update env example file
Jennievon Jul 31, 2024
bdd1067
refactor config method to get contracts
Jennievon Jul 31, 2024
375c7c5
update component format
Jennievon Jul 31, 2024
eb2b9c4
Update API endpoint and switchNetwork function
Jennievon Jul 31, 2024
2b7928c
Add utility functions for wallet and event
Jennievon Jul 31, 2024
4f39d03
Refactor destination address form
Jennievon Jul 31, 2024
71d9665
wip: refactor bridge implementation
Jennievon Aug 5, 2024
60554ff
fix: token and chain select defaultValue bug
Jennievon Aug 5, 2024
c8a3132
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Aug 5, 2024
28d57ec
Delete unused contract files
Jennievon Aug 5, 2024
3257e49
rm logs
Jennievon Aug 5, 2024
2c5d2ed
update chain and token selection logic
Jennievon Aug 6, 2024
75aaf89
Update environment variables in Dockerfile and
Jennievon Aug 6, 2024
56ffa28
Add privateKey constant and display toast messages
Jennievon Aug 6, 2024
e419680
Fix wallet connection and balance validation
Jennievon Aug 6, 2024
a03bb1c
Update siteMetadata description in Ten Bridge
Jennievon Aug 6, 2024
12df673
Update environment variable and API host URLs
Jennievon Aug 7, 2024
2f1da92
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Aug 7, 2024
a369f72
feat: state mgt - add contract and wallet stores
Jennievon Aug 13, 2024
421af27
Fix import statements and add missing dependencies
Jennievon Aug 13, 2024
4cdd296
Fix switchNetwork method call
Jennievon Aug 13, 2024
bd0738f
Update API host and remove unused import
Jennievon Aug 14, 2024
8b236ae
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Aug 14, 2024
1ec1146
updat build error
Jennievon Aug 14, 2024
1fcfbdc
fix network config request
zkokelj Aug 14, 2024
97fa89a
Merge branch 'jennifer/3248-bridge-develop-bridge-frontend' of https:…
zkokelj Aug 14, 2024
86939a5
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Aug 14, 2024
720bc1a
Merge branch 'jennifer/3248-bridge-develop-bridge-frontend' of https:…
Jennievon Aug 14, 2024
483e548
Refactor API routes and service functions
Jennievon Aug 15, 2024
cc10014
refactor contract store
Jennievon Aug 15, 2024
fbb57b6
rm logs
Jennievon Aug 15, 2024
ec2de17
add a polling interval for balance
Jennievon Aug 15, 2024
abd96c2
add estimated gas fee
Jennievon Aug 15, 2024
51db0e8
Fix balance fetching bug and remove unused code
Jennievon Aug 15, 2024
1ece8e8
Refactor contract-store to use IContractState
Jennievon Aug 20, 2024
3e3cf48
refactor type names in bridge components
Jennievon Aug 20, 2024
57bedf5
refactor wallet store and provider
Jennievon Aug 20, 2024
d24c71b
- add TruncatedAddress to header
Jennievon Aug 21, 2024
670d013
- add showCopy prop to TruncatedAddress component to hide copy button
Jennievon Aug 21, 2024
92f5d1c
fix: `isL1ToL2` assignment in wallet store
Jennievon Aug 21, 2024
2105123
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Aug 21, 2024
da45a87
move bridge frontend folder to tools folder
Jennievon Aug 21, 2024
a4d5bb7
update node and react dependencies
Jennievon Aug 21, 2024
cebf589
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Aug 21, 2024
8ea863c
- handle unknown account error
Jennievon Aug 21, 2024
7cbc078
update contract hooks name
Jennievon Aug 22, 2024
b9f2ae7
Add `bridgeAddress` to contract service
Jennievon Aug 23, 2024
70f097a
feat: bridge txn logs
Jennievon Aug 25, 2024
ea2fa6d
add noPagination prop to TransactionsComponent
Jennievon Aug 25, 2024
7303f5f
fix: balance display issue-`transfer-from-section`
Jennievon Aug 26, 2024
679c533
refactor: move contract utility methods to utils file
Jennievon Aug 26, 2024
389430e
rm log statements
Jennievon Aug 26, 2024
5215482
add status to bridge txn columns
Jennievon Aug 26, 2024
6c5844e
Fix linting issues causing build error
Jennievon Aug 26, 2024
9f881b7
improve bridge txn handling and provider setup
Jennievon Aug 26, 2024
345012e
- add useQuery hook for fetching token balance
Jennievon Aug 27, 2024
5feb07a
refactor wallet initialization and provider
Jennievon Aug 27, 2024
98dd217
- add Infura key to env example
Jennievon Aug 28, 2024
f9014a3
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Sep 2, 2024
8213b4b
refactor:
Jennievon Aug 30, 2024
131486e
feat: error handling and value transfer extraction
Jennievon Sep 2, 2024
e85e8dc
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Sep 3, 2024
c996099
update setupEventListeners
Jennievon Sep 4, 2024
38f00d2
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Sep 5, 2024
e8d7d59
add gateway to test
badgersrus Sep 5, 2024
ee01c81
Merge branch 'will/tenscan-with-gateway-test' of https://github.com/t…
Jennievon Sep 5, 2024
feeff8c
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Sep 6, 2024
c781f43
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Sep 6, 2024
543be2c
- increase gas estimation timeout
Jennievon Sep 6, 2024
6b184fd
feat: Implement multi-step txn resumption w state mgt
Jennievon Sep 9, 2024
9bf2ec4
chore: rm tenscan_test local integrations/helper to enable local testing
Jennievon Sep 9, 2024
07ffad7
feat: allow user to refresh their balance manually
Jennievon Sep 10, 2024
e05fefe
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Sep 10, 2024
87056db
refactor: add retry logic to accommodate gas estimation errors and av…
Jennievon Sep 10, 2024
a022729
- rm API version from routes
Jennievon Sep 18, 2024
b473386
invalidate bridge txn queries after succesful txn
Jennievon Sep 18, 2024
2bb506f
fix: signer initialisation
Jennievon Sep 19, 2024
418bfa8
update error method to show reason
Jennievon Sep 23, 2024
938d4c1
Merge branch 'monorepo' into jennifer/3417-implement-shared-component…
Jennievon Sep 23, 2024
de1a14d
Merge branch 'jennifer/3248-bridge-develop-bridge-frontend' of https:…
Jennievon Sep 23, 2024
5b7be1a
fix dependencies and import paths for Tenscan
Jennievon Sep 24, 2024
833ddc7
add next to packages older
Jennievon Sep 26, 2024
9988409
update import paths for address and personal txns components
Jennievon Sep 27, 2024
1bada96
- create wallet store & handle wallet edge cases
Jennievon Sep 27, 2024
d436464
refactor: group shared and common components
Jennievon Sep 27, 2024
48ec744
refactor: move document component to common folder
Jennievon Sep 27, 2024
279f3fc
feat: loading state and list for details' pages
Jennievon Sep 27, 2024
65c7021
feat: move common error pages
Jennievon Sep 27, 2024
b9e5021
fix default value for showStatusText in
Jennievon Sep 27, 2024
8b0fe1e
chore: revert tenscan changes
Jennievon Sep 27, 2024
4a262c2
rm cookie files and update
Jennievon Sep 27, 2024
47b6e62
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Sep 27, 2024
3af5948
revert tenscan changes
Jennievon Sep 27, 2024
d68eeb5
chore: revert changes to tools
Jennievon Sep 27, 2024
3708766
feat: add public folder to packages
Jennievon Sep 27, 2024
f60fefb
refactor: ui components and add new utility
Jennievon Sep 28, 2024
0f79ef3
rm unused general service file
Jennievon Sep 28, 2024
1abea37
feat: add monorepo structure README
Jennievon Oct 1, 2024
3d1695b
Update file structure in packages README
Jennievon Oct 1, 2024
5cbefbe
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Oct 1, 2024
01383c9
fix meta tag
Jennievon Oct 1, 2024
00764bb
fix: submit button disabled state
Jennievon Oct 1, 2024
afe6a07
refactor: bridge txn func and add a bridge utils file
Jennievon Oct 1, 2024
5a786a5
add pnpm to Dockerfile and rm ARG for INFURA_KEY
Jennievon Oct 1, 2024
ca43dde
Merge pull request #2063 from ten-protocol/jennifer/3417-implement-sh…
Jennievon Oct 1, 2024
0c26de2
Revert "[Frontend] monorepo config"
Jennievon Oct 1, 2024
77b3f4f
Merge pull request #2073 from ten-protocol/revert-2063-jennifer/3417-…
Jennievon Oct 1, 2024
8f23b7a
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Oct 1, 2024
31498a8
fix: bridge tx validation and error
Jennievon Oct 1, 2024
7af99f6
fix: info snackbar
Jennievon Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/manual-deploy-ten-bridge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Deploys Ten Bridge on Azure for Testnet
# Builds the Ten Bridge image, pushes the image to dockerhub and starts the Ten Bridge on Azure

name: "[M] Deploy Bridge Testnet"
run-name: "[M] Deploy Bridge Testnet ( ${{ github.event.inputs.testnet_type }} )"
on:
workflow_dispatch:
inputs:
testnet_type:
description: "Testnet Type"
required: true
default: "dev-testnet"
type: choice
options:
- "dev-testnet"
- "uat-testnet"
- "sepolia-testnet"

jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.testnet_type }}
steps:
- name: "Print GitHub variables"
# This is a useful record of what the environment variables were at the time the job ran, for debugging and reference
run: |
echo "GitHub Variables = ${{ toJSON(vars) }}"

- uses: actions/checkout@v3

- name: "Set up Docker"
uses: docker/setup-buildx-action@v1

- name: "Login to Azure docker registry"
uses: azure/docker-login@v1
with:
login-server: testnetobscuronet.azurecr.io
username: testnetobscuronet
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build and Push Docker FE Image
run: |
DOCKER_BUILDKIT=1 docker build -t ${{ vars.DOCKER_BUILD_TAG_BRIDGE_FE }} -f ./contracts/src/bridge/frontend/Dockerfile .
docker push ${{ vars.DOCKER_BUILD_TAG_BRIDGE_FE }}

- name: "Deploy FE to Azure Container Instances"
uses: "azure/aci-deploy@v1"
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ github.event.inputs.testnet_type }}-ten-bridge
image: ${{ vars.DOCKER_BUILD_TAG_BRIDGE_FE }}
name: ${{ github.event.inputs.testnet_type }}-fe-ten-bridge
location: "uksouth"
restart-policy: "Never"
environment-variables: NEXT_PUBLIC_BRIDGE_API_HOST=https://${{ github.event.inputs.testnet_type }}-api.tenscan.io NEXT_PUBLIC_FE_VERSION=${{ GITHUB.RUN_NUMBER }}-${{ GITHUB.SHA }}
command-line: npm run start-prod
ports: "80"
cpu: 2
memory: 2
27 changes: 27 additions & 0 deletions contracts/src/bridge/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use an official Node.js 22 as a parent image
FROM node:22-alpine

WORKDIR /usr/src/app

# ARG for build-time variable
ARG API_HOST
ARG L1_BRIDGE
ARG L2_BRIDGE
ARG MESSAGE_BUS
ARG GOOGLE_ANALYTICS_ID

# ENV for URL to be used in the app
ENV NEXT_PUBLIC_BRIDGE_API_HOST=${API_HOST}
ENV NEXT_PUBLIC_BRIDGE_L1=${L1_BRIDGE}
ENV NEXT_PUBLIC_BRIDGE_L2=${L2_BRIDGE}
ENV NEXT_PUBLIC_BRIDGE_MESSAGE_BUS=${MESSAGE_BUS}
ENV NEXT_PUBLIC_BRIDGE_GOOGLE_ANALYTICS_ID=${GOOGLE_ANALYTICS_ID}

# Copy package.json and package-lock.json (or yarn.lock) into the container
COPY package*.json ./

RUN npm install
COPY . .
RUN npm run build
EXPOSE 80
CMD ["npm", "start"]
3 changes: 1 addition & 2 deletions contracts/src/bridge/frontend/api/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export const fetchTestnetStatus = async (): Promise<
ResponseDataInterface<boolean>
> => {
return await httpRequest<ResponseDataInterface<boolean>>({
method: "post",
method: "get",
url: pathToUrl(apiRoutes.getHealthStatus),
data: { jsonrpc: "2.0", method: "obscuro_health", params: [], id: 1 },
});
};
8 changes: 6 additions & 2 deletions contracts/src/bridge/frontend/env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
NEXT_PUBLIC_L1_BRIDGE=
NEXT_PUBLIC_L2_BRIDGE=
NEXT_PUBLIC_BRIDGE_API_HOST=

NEXT_PUBLIC_BRIDGE_L1=
NEXT_PUBLIC_BRIDGE_L2=
NEXT_PUBLIC_BRIDGE_MESSAGE_BUS=
NEXT_PUBLIC_BRIDGE_GOOGLE_ANALYTICS_ID=
2 changes: 1 addition & 1 deletion contracts/src/bridge/frontend/pages/500.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorType } from "@/src/types/interfaces";
import { ErrorType } from "@/src/types";
import Error from "./_error";

function Custom500Error({
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/bridge/frontend/pages/docs/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useRouter } from "next/router";
import React from "react";
import Custom404Error from "../404";
import { showToast } from "@/src/components/ui/use-toast";
import { ToastType } from "@/src/types/interfaces";
import { ToastType } from "@/src/types";

type Document = {
title: string;
Expand Down
12 changes: 5 additions & 7 deletions contracts/src/bridge/frontend/pages/transactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ import {
TabsList,
TabsTrigger,
} from "@/src/components/ui/tabs";
import Web3Service from "@/src/services/web3service";
import { useWalletStore } from "@/src/components/providers/wallet-provider";
import { useContract } from "@/src/hooks/useContract";

export const metadata: Metadata = {
title: "Transactions",
description: "A table of transactions.",
};

export default function Transactions() {
const { signer, provider, address } = useWalletStore();
const { provider, address } = useWalletStore();
const { getBridgeTransactions } = useContract();
const { transactions, refetchTransactions } = {
transactions: {
result: {
Expand All @@ -34,16 +35,13 @@ export default function Transactions() {
};

const getTransactions = async () => {
const web3Service = new Web3Service(signer);
const transactions = await web3Service.getBridgeTransactions(
provider,
address
);
const transactions = await getBridgeTransactions(provider, address);
console.log(transactions);
};

React.useEffect(() => {
getTransactions();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@/src/components/ui/card";
import { Button } from "@/src/components/ui/button";
import { Skeleton } from "@/src/components/ui/skeleton";
import { ArrowDownUpIcon, Terminal } from "lucide-react";
import { ArrowDownUpIcon, Loader, PlusIcon, Terminal } from "lucide-react";
import {
Select,
SelectContent,
Expand All @@ -33,53 +33,49 @@ import { DrawerDialog } from "../common/drawer-dialog";
import { L1TOKENS, L2TOKENS, PERCENTAGES } from "@/src/lib/constants";
import { z } from "zod";
import { useFormHook } from "@/src/hooks/useForm";
import Web3Service from "@/src/services/web3service";
import { useWalletStore } from "../../providers/wallet-provider";
import { ToastType, Token } from "@/src/types";
import { Alert, AlertDescription } from "../../ui/alert";
import ConnectWalletButton from "../common/connect-wallet";
import Copy from "../common/copy";
import TruncatedAddress from "../common/truncated-address";
import { useContract } from "@/src/hooks/useContract";

export default function Dashboard() {
const {
signer,
provider,
address,
walletConnected,
switchNetwork,
isL1ToL2,
fromChains,
toChains,
connectWallet,
} = useWalletStore();
const web3Service = new Web3Service(signer);
const { getNativeBalance, getTokenBalance, sendERC20, sendNative } =
useContract();

const { form, FormSchema } = useFormHook();
const [loading, setLoading] = React.useState(false);
const [fromTokenBalance, setFromTokenBalance] = React.useState<any>(0);

const tokens = isL1ToL2 ? L1TOKENS : L2TOKENS;
const receiver = React.useMemo(() => form.watch("receiver"), [form.watch]);
const receiver = form.watch("receiver");

const swapTokens = () => {
switchNetwork(isL1ToL2 ? "L2" : "L1");
};

const [open, setOpen] = React.useState(false);
const watchTokenChange = form.watch("token");
React.useEffect(() => {
const getTokenBalance = async (value: string, token: Token) => {
const tokenBalance = async (value: string, token: Token) => {
setLoading(true);
try {
tokens.find((t) => t.value === value);
let balance;
if (token.isNative) {
balance = await web3Service.getNativeBalance(provider, address);
balance = await getNativeBalance(provider, address);
} else {
balance = await web3Service.getTokenBalance(
token.address,
address,
provider
);
balance = await getTokenBalance(token.address, address, provider);
}
setFromTokenBalance(balance);
} catch (error) {
Expand All @@ -92,39 +88,44 @@ export default function Dashboard() {
if (watchTokenChange) {
const token = tokens.find((t) => t.value === watchTokenChange);
if (token) {
getTokenBalance(watchTokenChange, token);
tokenBalance(watchTokenChange, token);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [watchTokenChange, address, provider]);

async function onSubmit(data: z.infer<typeof FormSchema>) {
if (!walletConnected) {
return connectWallet();
}
try {
console.log(data);
setLoading(true);
const d = {
...data,
receiver: receiver ? receiver : address,
};
toast({
title: "Bridge Transaction",
description: "Bridge transaction initiated",
variant: ToastType.INFO,
});
const token = data.token;
const token = d.token;
const t = tokens.find((t) => t.value === token);
if (!t) {
throw new Error("Invalid token");
}

const sendTransaction = t.isNative
? web3Service.sendNative
: web3Service.sendERC20;
await sendTransaction(data.receiver ?? address, data.amount, t.address);
const sendTransaction = t.isNative ? sendNative : sendERC20;
const res = await sendTransaction(
d.receiver ? d.receiver : address,
d.amount,
t.address
);
toast({
title: "Bridge Transaction",
description: "Bridge transaction completed",
description: `Bridge transaction completed: ${res.transactionHash}`,
variant: ToastType.SUCCESS,
});
form.reset();
} catch (error) {
setLoading(false);
console.error(error);
toast({
title: "Bridge Transaction",
Expand All @@ -135,6 +136,8 @@ export default function Dashboard() {
}`,
variant: ToastType.DESTRUCTIVE,
});
} finally {
setLoading(false);
}
}

Expand Down Expand Up @@ -247,6 +250,7 @@ export default function Dashboard() {
)}
/>

{/* Balance */}
<div className="pl-2">
<p className="text-sm text-muted-foreground">
Balance:
Expand Down Expand Up @@ -354,7 +358,14 @@ export default function Dashboard() {

<div className="flex items-center justify-end">
{/* Destination Address Input */}
<DrawerDialog />
<Button
variant="ghost"
className="text-sm font-bold leading-none"
onClick={() => setOpen(true)}
>
<PlusIcon className="h-3 w-3 mr-1" />
<small>Edit destination address</small>
</Button>
</div>
<div className="bg-muted dark:bg-[#15171D]">
<div className="flex items-center justify-between p-2">
Expand All @@ -377,7 +388,7 @@ export default function Dashboard() {
<strong className="text-lg">Receiver Address</strong>
<div className="flex items-center">
{receiver || address ? (
<Copy value={receiver ?? address} />
<TruncatedAddress address={receiver || address} />
) : null}
</div>
</div>
Expand All @@ -388,9 +399,9 @@ export default function Dashboard() {
type="submit"
className="text-sm font-bold leading-none w-full"
size={"lg"}
disabled={!isL1ToL2}
disabled={!isL1ToL2 || loading || fromTokenBalance <= 0}
>
Initiate Bridge Transaction
{loading ? <Loader /> : "Initiate Bridge Transaction"}
</Button>
) : (
<ConnectWalletButton
Expand All @@ -401,6 +412,7 @@ export default function Dashboard() {
</div>
</form>
</Form>
<DrawerDialog open={open} setOpen={setOpen} />
</CardContent>
</Card>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CopyIcon, CheckIcon } from "@radix-ui/react-icons";

const Copy = ({ value }: { value: string | number | undefined }) => {
const { copyToClipboard, copied } = useCopy();
if (!value) return null;
return (
<Button
type="button"
Expand Down
Loading
Loading