Skip to content

Commit

Permalink
Merge pull request #174 from Gamboster/fix/walletSelection
Browse files Browse the repository at this point in the history
Fix: wallet selection condition
  • Loading branch information
JohnathanWhite authored Jul 1, 2022
2 parents cc49b96 + 2fbbbb9 commit 8907a87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ const BuyCryptoRoot: React.FC<
modalTitle={'Select Destination'}
onDismiss={(newWallet?: Wallet) => {
hideModal('walletSelector');
if (newWallet) {
if (newWallet?.currencyAbbreviation) {
setWallet(newWallet);
}
}}
Expand Down
11 changes: 6 additions & 5 deletions src/navigation/services/swap-crypto/screens/SwapCryptoRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const SwapCryptoRoot: React.FC = () => {
setRateData(undefined);

const coinsTo = cloneDeep(swapCryptoSupportedCoinsFrom).filter(
coin => coin !== fromWallet.currencyAbbreviation.toLowerCase(),
coin => coin !== fromWallet.currencyAbbreviation?.toLowerCase(),
);

setSwapCryptoSupportedCoinsTo(coinsTo);
Expand All @@ -201,14 +201,15 @@ const SwapCryptoRoot: React.FC = () => {
if (fromWalletSelected) {
setFromWalletData(
SupportedCurrencyOptions.find(
({id}) => id === fromWalletSelected?.credentials.coin,
({id}) =>
id === fromWalletSelected.currencyAbbreviation.toLowerCase(),
),
);
}
if (toWalletSelected) {
setToWalletData(
SupportedCurrencyOptions.find(
({id}) => id === toWalletSelected?.credentials.coin,
({id}) => id === toWalletSelected.currencyAbbreviation.toLowerCase(),
),
);
}
Expand Down Expand Up @@ -894,7 +895,7 @@ const SwapCryptoRoot: React.FC = () => {
modalTitle={'Select Source Wallet'}
onDismiss={(fromWallet: Wallet) => {
hideModal('fromWalletSelector');
if (fromWallet) {
if (fromWallet?.currencyAbbreviation) {
setFromWallet(fromWallet);
}
}}
Expand All @@ -907,7 +908,7 @@ const SwapCryptoRoot: React.FC = () => {
modalTitle={'Select Destination'}
onDismiss={(toWallet?: Wallet) => {
hideModal('walletSelector');
if (toWallet) {
if (toWallet?.currencyAbbreviation) {
setToWallet(toWallet);
}
}}
Expand Down

0 comments on commit 8907a87

Please sign in to comment.