Skip to content

Commit

Permalink
Merge 1f70aa5 into e5b0151
Browse files Browse the repository at this point in the history
  • Loading branch information
pierregee authored Oct 11, 2023
2 parents e5b0151 + 1f70aa5 commit 46f96d8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
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) ===
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

0 comments on commit 46f96d8

Please sign in to comment.