Skip to content

Commit

Permalink
get correct dApp address
Browse files Browse the repository at this point in the history
  • Loading branch information
willemolding committed May 16, 2024
1 parent e2320d6 commit f384fd0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
10 changes: 9 additions & 1 deletion bridge-frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,17 @@ init({

const App: FC = () => {
const [{ connectedChain }] = useSetChain();
const [dappAddress, setDappAddress] = useState<string>(config["0x7a69"].DAppAddress);

const [{ wallet, connecting }, connect] = useConnectWallet();
const [dappAddress, setDappAddress] = useState<string>("");

useEffect(() => {
if (connectedChain) {
setDappAddress(config[connectedChain.id].DAppAddress);
}
}, [connectedChain]);



useEffect(() => {
if (connectedChain) {
Expand Down
27 changes: 1 addition & 26 deletions bridge-frontend/src/Transfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -42,17 +42,6 @@ export const Transfers: React.FC<IInputPropos> = (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) {
Expand All @@ -76,23 +65,9 @@ export const Transfers: React.FC<IInputPropos> = (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<string>("");
const [destAddress, setDestAddress] = useState<string>("t1");

const [transactionHex, setTransactionHex] = useState<string>("");

return (
<Card
colorScheme="blackAlpha"
Expand Down

0 comments on commit f384fd0

Please sign in to comment.