Skip to content

Commit

Permalink
fix: attempt at fixing swap prev network balance
Browse files Browse the repository at this point in the history
  • Loading branch information
infiniteflower committed Jan 30, 2025
1 parent 40f74e0 commit 33e1bc5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/components/UI/Swaps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import {
selectCurrentCurrency,
} from '../../../selectors/currencyRateController';
import { selectContractExchangeRates } from '../../../selectors/tokenRatesController';
import { selectAccounts } from '../../../selectors/accountTrackerController';
import { selectAccountsByChainId } from '../../../selectors/accountTrackerController';
import { selectContractBalances } from '../../../selectors/tokenBalancesController';
import { selectSelectedInternalAccountFormattedAddress } from '../../../selectors/accountsController';
import AccountSelector from '../Ramp/components/AccountSelector';
Expand Down Expand Up @@ -182,7 +182,7 @@ const MAX_TOP_ASSETS = 20;
function SwapsAmountView({
swapsTokens,
swapsControllerTokens,
accounts,
accountsByChainId,
selectedAddress,
chainId,
selectedNetworkClientId,
Expand All @@ -196,6 +196,7 @@ function SwapsAmountView({
currentCurrency,
setLiveness,
}) {
const accounts = accountsByChainId[chainId];
const navigation = useNavigation();
const route = useRoute();
const { colors } = useTheme();
Expand Down Expand Up @@ -963,9 +964,9 @@ SwapsAmountView.propTypes = {
tokensWithBalance: PropTypes.arrayOf(PropTypes.object),
tokensTopAssets: PropTypes.arrayOf(PropTypes.object),
/**
* Map of accounts to information objects including balances
* Map of chainId to accounts to information objects including balances
*/
accounts: PropTypes.object,
accountsByChainId: PropTypes.object,
/**
* A string that represents the selected address
*/
Expand Down Expand Up @@ -1011,7 +1012,7 @@ SwapsAmountView.propTypes = {
const mapStateToProps = (state) => ({
swapsTokens: swapsTokensSelector(state),
swapsControllerTokens: swapsControllerTokens(state),
accounts: selectAccounts(state),
accountsByChainId: selectAccountsByChainId(state),
balances: selectContractBalances(state),
selectedAddress: selectSelectedInternalAccountFormattedAddress(state),
conversionRate: selectConversionRate(state),
Expand Down

0 comments on commit 33e1bc5

Please sign in to comment.