Skip to content

Commit

Permalink
reset amounts when chains change
Browse files Browse the repository at this point in the history
  • Loading branch information
jonator committed Jul 3, 2024
1 parent b8ef755 commit def15c5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CoinPretty } from "@keplr-wallet/unit";
import { BridgeChain } from "@osmosis-labs/bridge";
import { isNil, noop } from "@osmosis-labs/utils";
import { observer } from "mobx-react-lite";
import { useState } from "react";
import { useEffect, useState } from "react";
import { getAddress } from "viem";

import { AmountScreen } from "~/components/bridge/immersive/amount-screen";
Expand Down Expand Up @@ -39,6 +39,12 @@ export const AmountAndReviewScreen = observer(
const [cryptoAmount, setCryptoAmount] = useState<string>("0");
const [fiatAmount, setFiatAmount] = useState<string>("0");

// if the chains change, reset the amounts
useEffect(() => {
setCryptoAmount("0");
setFiatAmount("0");
}, [fromChain, toChain]);

// Wallets
const { address: evmAddress, connector: evmConnector } =
useEvmWalletAccount();
Expand Down

0 comments on commit def15c5

Please sign in to comment.