From f384fd0f2e61a6a9ac5f7e20b6bdf8c72ccb2b64 Mon Sep 17 00:00:00 2001 From: Willem Olding Date: Thu, 16 May 2024 14:32:27 +1000 Subject: [PATCH] get correct dApp address --- bridge-frontend/src/App.tsx | 10 +++++++++- bridge-frontend/src/Transfers.tsx | 27 +-------------------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/bridge-frontend/src/App.tsx b/bridge-frontend/src/App.tsx index 40bc085..5d65cf2 100644 --- a/bridge-frontend/src/App.tsx +++ b/bridge-frontend/src/App.tsx @@ -54,9 +54,17 @@ init({ const App: FC = () => { const [{ connectedChain }] = useSetChain(); - const [dappAddress, setDappAddress] = useState(config["0x7a69"].DAppAddress); const [{ wallet, connecting }, connect] = useConnectWallet(); + const [dappAddress, setDappAddress] = useState(""); + + useEffect(() => { + if (connectedChain) { + setDappAddress(config[connectedChain.id].DAppAddress); + } + }, [connectedChain]); + + useEffect(() => { if (connectedChain) { diff --git a/bridge-frontend/src/Transfers.tsx b/bridge-frontend/src/Transfers.tsx index 871dd9b..f4055e0 100644 --- a/bridge-frontend/src/Transfers.tsx +++ b/bridge-frontend/src/Transfers.tsx @@ -24,7 +24,7 @@ import { useColorMode, } from "@chakra-ui/react"; import { Button, Box } from "@chakra-ui/react"; -import { Input, Stack } from "@chakra-ui/react"; +import { Stack } from "@chakra-ui/react"; import { Accordion } from "@chakra-ui/react"; import { Text } from "@chakra-ui/react"; import { Vouchers } from "./Vouchers"; @@ -42,17 +42,6 @@ export const Transfers: React.FC = (propos) => { const provider = new ethers.providers.Web3Provider(connectedWallet.provider); const { colorMode } = useColorMode(); - const sendAddress = async () => { - if (rollups) { - try { - await rollups.relayContract.relayDAppAddress(propos.dappAddress); - // setDappRelayedAddress(true); - } catch (e) { - console.log(`${e}`); - } - } - }; - const depositEtherToPortal = async (amount: string, destAddress: string) => { try { if (rollups && provider) { @@ -76,23 +65,9 @@ export const Transfers: React.FC = (propos) => { } }; - const sendTransaction = async (transactionHex: string) => { - try { - if (rollups && provider) { - const input = ethers.utils.arrayify(transactionHex); - - rollups.inputContract.addInput(propos.dappAddress, input); - } - } catch (e) { - console.log(`${e}`); - } - }; - const [etherAmount, setEtherAmount] = useState(""); const [destAddress, setDestAddress] = useState("t1"); - const [transactionHex, setTransactionHex] = useState(""); - return (