Skip to content

Commit d01d807

Browse files
committed
1 parent c67dd9f commit d01d807

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

β€Žsrc/__swaps__/screens/Swap/Swap.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { ChainId } from '@/state/backendNetworks/types';
2222
import { SwapAssetType } from '@/__swaps__/types/swap';
2323
import { parseSearchAsset } from '@/__swaps__/utils/assets';
2424
import { AbsolutePortalRoot } from '@/components/AbsolutePortal';
25-
import { useAccountSettings } from '@/hooks';
2625
import { useDelayedMount } from '@/hooks/useDelayedMount';
2726
import { userAssetsStore } from '@/state/assets/userAssets';
2827
import { swapsStore, useSwapsStore } from '@/state/swaps/swapsStore';
@@ -32,6 +31,7 @@ import { SwapProvider, useSwapContext } from './providers/swap-provider';
3231
import { NavigateToSwapSettingsTrigger } from './components/NavigateToSwapSettingsTrigger';
3332
import { useSwapsSearchStore } from './resources/search/searchV2';
3433
import { ReviewButton } from './components/ReviewButton';
34+
import { useAccountAddress } from '@/state/wallets/walletsStore';
3535

3636
/** README
3737
* This screen is largely driven by Reanimated and Gesture Handler, which
@@ -142,7 +142,7 @@ const useCleanupOnUnmount = () => {
142142
};
143143

144144
const WalletAddressObserver = () => {
145-
const { accountAddress } = useAccountSettings();
145+
const accountAddress = useAccountAddress();
146146
const { setAsset } = useSwapContext();
147147

148148
const setNewInputAsset = useCallback(() => {

β€Žsrc/components/AddFundsInterstitial.jsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { analytics } from '@/analytics';
22
import Divider from '@/components/Divider';
33
import { ButtonPressAnimation, ScaleButtonZoomableAndroid } from '@/components/animations';
44
import { Icon } from '@/components/icons';
5-
import { useAccountSettings, useDimensions } from '@/hooks';
5+
import { useDimensions } from '@/hooks';
66
import Routes from '@/navigation/routesNames';
77
import ShadowStack from '@/react-native-shadow-stack';
88
import { Network } from '@/state/backendNetworks/types';
9+
import { useAccountAddress, useWalletsStore } from '@/state/wallets/walletsStore';
910
import styled from '@/styled-thing';
1011
import { padding, position } from '@/styles';
1112
import { openInBrowser } from '@/utils/openInBrowser';
@@ -17,7 +18,6 @@ import { View } from 'react-native';
1718
import networkInfo from '../helpers/networkInfo';
1819
import showWalletErrorAlert from '../helpers/support';
1920
import { useNavigation } from '../navigation/Navigation';
20-
import { useWalletsStore } from '@/state/wallets/walletsStore';
2121
import { useTheme } from '../theme/ThemeContext';
2222
import { deviceUtils, magicMemo } from '../utils';
2323
import { Centered, Row, RowWithMargins } from './layout';
@@ -176,7 +176,7 @@ const AddFundsInterstitial = ({ network }) => {
176176
const { isSmallPhone } = useDimensions();
177177
const { navigate } = useNavigation();
178178
const isDamaged = useWalletsStore(state => state.getIsDamaged());
179-
const { accountAddress } = useAccountSettings();
179+
const accountAddress = useAccountAddress();
180180
const { colors } = useTheme();
181181
const { name: routeName } = useRoute();
182182

β€Žsrc/components/activity-list/ActivityList.tsxβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { safeAreaInsetValues } from '@/utils';
1515
import { useAccountSettings, useAccountTransactions } from '@/hooks';
1616
import { usePendingTransactionsStore } from '@/state/pendingTransactions';
1717
import { TransactionSections, TransactionItemForSectionList } from '@/helpers/buildTransactionsSectionsSelector';
18+
import { useAccountAddress } from '@/state/wallets/walletsStore';
1819

1920
const sx = StyleSheet.create({
2021
sectionHeader: {
@@ -85,7 +86,8 @@ function ListFooterComponent({ label, onPress }: { label: string; onPress: () =>
8586
}
8687

8788
const ActivityList = () => {
88-
const { accountAddress, nativeCurrency } = useAccountSettings();
89+
const accountAddress = useAccountAddress();
90+
const { nativeCurrency } = useAccountSettings();
8991

9092
const { setScrollToTopRef } = useSectionListScrollToTopContext<TransactionItemForSectionList, TransactionSections>();
9193
const { sections, nextPage, transactionsCount, remainingItemsLabel } = useAccountTransactions();

β€Žsrc/components/asset-list/RecyclerAssetList2/Claimable.tsxβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ import { ChainImage } from '@/components/coin-icon/ChainImage';
1313
import { useNativeAsset } from '@/utils/ethereumUtils';
1414
import { ChainId } from '@/state/backendNetworks/types';
1515
import { usePoints } from '@/resources/points';
16+
import { useAccountAddress } from '@/state/wallets/walletsStore';
1617

1718
const RAINBOW_ICON_URL = 'https://rainbowme-res.cloudinary.com/image/upload/v1694722625/dapps/rainbow-icon-large.png';
1819

1920
export const Claimable = React.memo(function Claimable({ uniqueId, extendedState }: { uniqueId: string; extendedState: ExtendedState }) {
20-
const { accountAddress, nativeCurrency } = useAccountSettings();
21+
const accountAddress = useAccountAddress();
22+
const { nativeCurrency } = useAccountSettings();
2123
const { navigate } = extendedState;
2224

2325
const isETHRewards = uniqueId === 'rainbow-eth-rewards';

β€Žsrc/state/wallets/walletsStore.tsβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,8 @@ export const getAccountAddress = () => useWalletsStore.getState().accountAddress
613613
export const getWallets = () => useWalletsStore.getState().wallets;
614614
export const getSelectedWallet = () => useWalletsStore.getState().selected;
615615

616+
export const useAccountAddress = () => useWalletsStore(state => state.accountAddress);
617+
616618
export const isImportedWallet = (address: string): boolean => {
617619
const wallets = getWallets();
618620
if (!wallets) {

0 commit comments

Comments
Β (0)