Skip to content

Commit

Permalink
Define behavior when self is pressed in convert or cross chain but VR…
Browse files Browse the repository at this point in the history
…SC is not added
  • Loading branch information
michaeltout committed Dec 11, 2024
1 parent 5c723b0 commit d9d25d6
Showing 1 changed file with 40 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -577,33 +577,35 @@ const ConvertOrCrossChainSendForm = ({ setLoading, setModalHeight, updateSendFor
}
}

for (const coinId in activeAccount.keys) {
if (activeAccount.keys[coinId] && (activeAccount.keys[coinId][ETH] || activeAccount.keys[coinId][ERC20])) {
const ethAddresses = activeAccount.keys[coinId][ETH] ?
activeAccount.keys[coinId][ETH].addresses : activeAccount.keys[coinId][ERC20].addresses;

if (ethAddresses && ethAddresses.length > 0) {
const addr = ethAddresses[0];
const addrTitle = addr.substring(0, 8) + '...' + addr.substring(addr.length - 8);

if (!seen.has(addr)) {
seen.add(addr);
addresses.push({
title: addrTitle,
logoid: coinsList.ETH.id,
key: addr,
description: addr,
values: {
[SEND_MODAL_TO_ADDRESS_FIELD]: addr
},
right: "",
keywords: [
addr
]
})
if (!sendModal.data[SEND_MODAL_IS_PRECONVERT]) {
for (const coinId in activeAccount.keys) {
if (activeAccount.keys[coinId] && (activeAccount.keys[coinId][ETH] || activeAccount.keys[coinId][ERC20])) {
const ethAddresses = activeAccount.keys[coinId][ETH] ?
activeAccount.keys[coinId][ETH].addresses : activeAccount.keys[coinId][ERC20].addresses;

if (ethAddresses && ethAddresses.length > 0) {
const addr = ethAddresses[0];
const addrTitle = addr.substring(0, 8) + '...' + addr.substring(addr.length - 8);

if (!seen.has(addr)) {
seen.add(addr);
addresses.push({
title: addrTitle,
logoid: coinsList.ETH.id,
key: addr,
description: addr,
values: {
[SEND_MODAL_TO_ADDRESS_FIELD]: addr
},
right: "",
keywords: [
addr
]
})
}

break;
}

break;
}
}
}
Expand Down Expand Up @@ -1039,13 +1041,17 @@ const ConvertOrCrossChainSendForm = ({ setLoading, setModalHeight, updateSendFor
fillAmount(BigNumber(spendableBalance));
};

const setAddressSelf = () => {
const addr = addresses.results[0]

updateSendFormData(
SEND_MODAL_TO_ADDRESS_FIELD,
addr
);
const handleSelfPressed = () => {
if (allSubWallets[coinsList.VRSC.id]) {
handleFieldFocus(SEND_MODAL_TO_ADDRESS_FIELD);
} else {
const addr = addresses.results[0]

updateSendFormData(
SEND_MODAL_TO_ADDRESS_FIELD,
addr
);
}
};

return localBalances == null ? (<AnimatedActivityIndicatorBox />) : (
Expand Down Expand Up @@ -1192,7 +1198,7 @@ const ConvertOrCrossChainSendForm = ({ setLoading, setModalHeight, updateSendFor
onRecipientAddressChange={text =>
updateSendFormData(SEND_MODAL_TO_ADDRESS_FIELD, text)
}
onSelfPress={() => handleFieldFocus(SEND_MODAL_TO_ADDRESS_FIELD)}
onSelfPress={() => handleSelfPressed()}
amountValue={sendModal.data[SEND_MODAL_AMOUNT_FIELD]}
onAmountChange={text =>
updateSendFormData(SEND_MODAL_AMOUNT_FIELD, text)
Expand Down

0 comments on commit d9d25d6

Please sign in to comment.