Skip to content

Commit 9ee16bb

Browse files
author
Kirill Ageychenko
committed
feat: fetch NFT collections from explorer
1 parent 543f114 commit 9ee16bb

27 files changed

+525
-218
lines changed

.last-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7a575d8f15d4803176c8918bf00f6c8437612388
1+
543f114e0977965de7f507b1dc6977bd3a07b8fd

src/components/home-feed.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const HomeFeed = observer(() => {
4444
}
4545
setLastUpdate(Date.now());
4646
await Promise.allSettled([
47-
Currencies.fetchCurrencies(),
47+
!AppStore.isRpcOnly && Currencies.fetchCurrencies(),
4848
Wallet.fetchBalances(),
4949
Token.fetchTokens(),
5050
Nft.fetchNft(),
@@ -100,10 +100,12 @@ export const HomeFeed = observer(() => {
100100
<BannersWrapper />
101101
<Spacer height={12} />
102102
<LayoutWidget
103+
key={'export-layout'}
103104
direction="vertical"
104105
deep={true}
105106
children={[
106107
<HomeBanner
108+
key={'export-banner'}
107109
onPress={exportWallet}
108110
banner={{
109111
id: 'export_wallet',

src/components/image-wrapper.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import BlastedImage, {BlastedImageProps} from 'react-native-blasted-image';
1414
import WebView from 'react-native-webview';
1515

16+
import {useThemeSelector} from '@app/hooks';
1617
import {isValidUrl} from '@app/utils';
1718

1819
import {First} from './ui';
@@ -26,7 +27,10 @@ const SVG_MIME_TYPE = 'data:image/svg+xml;base64,';
2627

2728
export function ImageWrapper({source, style, ...props}: ImageWrapperProps) {
2829
const [isError, setError] = useState(false);
29-
30+
const placeholder = useThemeSelector({
31+
light: require('@assets/images/nft_placeholder_light.png'),
32+
dark: require('@assets/images/nft_placeholder_dark.png'),
33+
});
3034
const fixedSource = useMemo(() => {
3135
if (!source) {
3236
return undefined;
@@ -120,7 +124,7 @@ export function ImageWrapper({source, style, ...props}: ImageWrapperProps) {
120124
<Image
121125
{...(props as ImageProps)}
122126
style={StyleSheet.flatten(style)}
123-
source={fixedSource!}
127+
source={placeholder!}
124128
/>
125129
)}
126130
<BlastedImage

src/components/nft-viewer/nft-viewer-item-preview-large.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const NftViewerItemPreviewLarge = ({
1616
item,
1717
onPress,
1818
}: NftViewerItemPreviewExtendedProps) => {
19-
const imageUri = useNftImage(item.cached_url);
19+
const imageUri = useNftImage(item.metadata?.image || item?.cached_url);
2020
const handlePress = useCallback(() => onPress?.(item), [onPress, item]);
2121
const [layout, onLayout] = useLayout();
2222
const itemTextStyle = useMemo(

src/components/nft-viewer/nft-viewer-item-preview-medium.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const NftViewerItemPreviewMedium = ({
1717
onPress,
1818
}: NftViewerItemPreviewExtendedProps) => {
1919
const handlePress = useCallback(() => onPress?.(item), [onPress, item]);
20-
const imageUri = useNftImage(item.cached_url);
20+
const imageUri = useNftImage(item.metadata?.image || item?.cached_url);
2121
const [layout, onLayout] = useLayout();
2222

2323
const containerStyle: ViewStyle = useMemo(

src/components/nft-viewer/nft-viewer-item-preview-small.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const NftViewerItemPreviewSmall = ({
1616
onPress,
1717
}: NftViewerItemPreviewExtendedProps) => {
1818
const handlePress = useCallback(() => onPress?.(item), [onPress, item]);
19-
const imageUri = useNftImage(item.cached_url);
19+
const imageUri = useNftImage(item.metadata?.image || item?.cached_url);
2020
const [layout, onLayout] = useLayout();
2121

2222
const containerStyle: ViewStyle = useMemo(

src/components/total-value-info/total-value-info.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ export const TotalValueInfo = observer(
8282
[activeTab],
8383
);
8484

85-
const onTabChange = useCallback((tabName: TotalValueTabNames) => {
86-
setActiveTab(tabName);
87-
}, []);
85+
const onTabChange = useCallback(
86+
(tabName: TotalValueTabNames) => {
87+
setActiveTab(tabName);
88+
},
89+
[addressList],
90+
);
8891

8992
const renderListHeader = () => (
9093
<>
@@ -120,9 +123,9 @@ export const TotalValueInfo = observer(
120123
</>
121124
);
122125

123-
const renderListEmptyComponent = useCallback(
124-
() => (
125-
<First>
126+
const renderListEmptyComponent = useCallback(() => {
127+
return (
128+
<First key={`total-value-info-tab-content-${activeTab}`}>
126129
{activeTab === TotalValueTabNames.transactions && (
127130
<TransactionEmpty />
128131
)}
@@ -147,9 +150,8 @@ export const TotalValueInfo = observer(
147150
</>
148151
)}
149152
</First>
150-
),
151-
[activeTab, tokens],
152-
);
153+
);
154+
}, [activeTab, tokens]);
153155

154156
return (
155157
<TransactionList

src/components/transaction-list/transaction-list.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ export const TransactionList = observer(
8888
onTransactionPress,
8989
...sectionListProps
9090
}: TransactionListProps) => {
91-
Logger.log('TransactionList', 'render', {addresses});
92-
9391
/* HOOKS */
9492
const {transactions, isTransactionsLoading} = useTransactionList(addresses);
9593
const txTimestampHeadersEnabled = useRemoteConfigVar(
@@ -181,7 +179,12 @@ export const TransactionList = observer(
181179
return sectionListProps.ListEmptyComponent;
182180
}
183181
return renderListEmptyComponentDefault;
184-
}, [hideContent, renderListEmptyComponentDefault, isTransactionsLoading]);
182+
}, [
183+
hideContent,
184+
renderListEmptyComponentDefault,
185+
isTransactionsLoading,
186+
sectionListProps.ListEmptyComponent,
187+
]);
185188

186189
const renderListFooterComponent = useCallback(
187190
() => (

src/components/transaction-nft-confirmation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const TransactionNftConfirmation = observer(
5151
fee,
5252
}: TransactionConfirmationProps) => {
5353
const splittedTo = useMemo(() => splitAddress(to), [to]);
54-
const imageUri = useNftImage(item.metadata?.image || item.cached_url);
54+
const imageUri = useNftImage(item.metadata?.image || item?.cached_url);
5555

5656
return (
5757
<PopupContainer style={styles.container}>

src/contexts/app.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import Keychain, {
1111
getGenericPassword,
1212
setGenericPassword,
1313
} from 'react-native-keychain';
14-
import SplashScreen from 'react-native-splash-screen';
1514
import TouchID from 'react-native-touch-id';
1615

1716
import {DEBUG_VARS} from '@app/debug-vars';
@@ -38,7 +37,6 @@ import {Cosmos} from '@app/services/cosmos';
3837
import {EventTracker} from '@app/services/event-tracker';
3938
import {HapticEffects, vibrate} from '@app/services/haptic';
4039
import {RemoteConfig} from '@app/services/remote-config';
41-
import {sleep} from '@app/utils';
4240

4341
import {showModal} from '../helpers';
4442
import {User} from '../models/user';
@@ -132,22 +130,7 @@ class App extends AsyncEventEmitter {
132130

133131
Logger.log('isBackendAvailable', isBackendAvailable);
134132
if (!isBackendAvailable) {
135-
SplashScreen.hide();
136-
await sleep(1000);
137-
return new Promise(() => {
138-
Alert.alert(
139-
'Haqq Wallet Backend Shutdown',
140-
'The backend service for Haqq Wallet is no longer maintained. Please switch to RPC mode.',
141-
[
142-
{
143-
text: 'Switch to RPC',
144-
onPress: () => {
145-
AppStore.dataFetchMode = DataFetchSource.Rpc;
146-
},
147-
},
148-
],
149-
);
150-
});
133+
AppStore.dataFetchMode = DataFetchSource.Rpc;
151134
}
152135
}
153136
});

0 commit comments

Comments
 (0)