Skip to content

Commit

Permalink
Merge branch 'feature/evm' into pierregee/test-e2e-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
lykalabrada authored Oct 20, 2023
2 parents 8107f6c + 2422423 commit 6a52521
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,27 @@ export function SendScreen({ route, navigation }: Props): JSX.Element {
});
const { address } = watch();
const amountToSend = getValues("amount");
const isEvmAddress =
getAddressCategory(getValues("address"), networkName) ===
AddressCategory.ETH;

const [addressType, setAddressType] = useState<AddressType>();

const getInputTokenType = () => {
if (token?.id === "0_unified") {
if (isEvmAddress) {
return "token";
}
return "utxo";
}
return "others";
};
const { isConversionRequired, conversionAmount } = useConversion({
inputToken: {
type: token?.id === "0_unified" ? "utxo" : "others",
type: getInputTokenType(),
amount: new BigNumber(amountToSend),
},
deps: [amountToSend, JSON.stringify(token)],
deps: [amountToSend, JSON.stringify(token), isEvmAddress],
});

const reservedDFI = 0.1;
Expand All @@ -144,9 +157,6 @@ 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 Down Expand Up @@ -299,7 +309,9 @@ export function SendScreen({ route, navigation }: Props): JSX.Element {
if (isConversionRequired) {
queueConvertTransaction(
{
mode: ConvertDirection.accountToUtxos,
mode: isEvmAddress
? ConvertDirection.utxosToAccount
: ConvertDirection.accountToUtxos,
amount: conversionAmount,
},
dispatch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function CustomUrlInput({
testID="endpoint_url_title"
text={translate("screens/ServiceProviderScreen", label)}
/>
<View style={tailwind("flex flex-row items-baseline w-full")}>
<View style={tailwind("flex flex-row items-start w-full")}>
<WalletTextInputV2
valid={errMsg === undefined}
editable={isUnlocked}
Expand All @@ -88,7 +88,7 @@ export function CustomUrlInput({
onClearButtonPress={() => handleUrlInputChange(type, "")}
placeholder={translate("screens/ServiceProviderScreen", defaultUrl)}
style={tailwind("font-normal-v2 flex-1 py-2.5")}
containerStyle="flex-1"
containerStyle="flex-1 pr-3"
testID={`${type}_endpoint_url_input`}
inlineText={{
type: errMsg !== undefined ? "error" : "helper",
Expand Down Expand Up @@ -122,7 +122,7 @@ export function CustomUrlInput({
"bg-opacity-30":
(!isUnlocked && activeInput !== undefined) || isDisabled,
})}
style={tailwind("ml-3 h-10 w-10 p-2.5 text-center rounded-full")}
style={tailwind("mt-2 h-10 w-10 p-2.5 text-center rounded-full")}
disabled={isUnlocked || isDisabled}
testID={`${type}_edit_service_provider`}
>
Expand Down

0 comments on commit 6a52521

Please sign in to comment.