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

fix(ui-ux): utxo-evm bug #4051

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export function ConvertConfirmationScreen({ route }: Props): JSX.Element {
fee,
}),
suffix: ` ${sourceToken.displayTextSymbol}${
convertDirection === ConvertDirection.dvmToEvm ? "" : "-EVM"
convertDirection !== ConvertDirection.evmToDvm ? "" : "-EVM"
}`,
testID: "resulting_tokens_value",
themedProps: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AddressRow } from "@screens/AppNavigator/screens/Portfolio/components/AddressRow";
import { useDomainContext } from "@contexts/DomainContext";
import { ConvertDirection } from "@screens/enum";
import {
AddressType as AddressCategory,
getAddressType as getAddressCategory,
} from "@waveshq/walletkit-core";
import { useTokenPrice } from "../hooks/TokenPrice";
import { ActiveUSDValueV2 } from "../../Loans/VaultDetail/components/ActiveUSDValueV2";
import { PortfolioParamList } from "../PortfolioNavigator";
Expand Down Expand Up @@ -139,6 +143,9 @@ export function SendScreen({ route, navigation }: Props): JSX.Element {
let infoText;
let themedProps;
let status = TransactionCardStatus.Default;
const isEvmAddress =
getAddressCategory(getValues("address"), networkName) ===
pierregee marked this conversation as resolved.
Show resolved Hide resolved
AddressCategory.ETH;

if (new BigNumber(amountToSend).isGreaterThan(token?.amount ?? 0)) {
infoText = "Insufficient balance";
Expand All @@ -147,6 +154,17 @@ export function SendScreen({ route, navigation }: Props): JSX.Element {
light: tailwind("text-red-v2"),
};
status = TransactionCardStatus.Error;
} else if (
isEvmAddress &&
(token?.isDAT === false || token?.isLPS === true)
) {
infoText =
"Transferring non-DAT tokens or LP tokens to an EVM address is not supported";
themedProps = {
dark: tailwind("text-red-v2"),
light: tailwind("text-red-v2"),
};
status = TransactionCardStatus.Error;
} else if (
token?.isLPS === true &&
new BigNumber(amountToSend).isGreaterThan(0)
Expand Down Expand Up @@ -179,7 +197,7 @@ export function SendScreen({ route, navigation }: Props): JSX.Element {
style: tailwind("text-xs mt-2 ml-5 font-normal-v2"),
},
};
}, [token, isReservedUtxoUsed, amountToSend]);
}, [token, isReservedUtxoUsed, amountToSend, address]);

useEffect(() => {
setToken(route.params.token);
Expand Down