@@ -6,12 +6,10 @@ import { ChainProvider, InterchainWalletModal } from '@interchain-kit/react';
66import { chains , assetLists } from 'chain-registry' ;
77import { QueryClientProvider , QueryClient } from '@tanstack/react-query' ;
88import { Box , Toaster , useTheme } from '@interchain-ui/react' ;
9- import { useMemo } from 'react' ;
109// import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
1110
1211import { CustomThemeProvider , Layout } from '@/components' ;
1312import { wallets } from '@/config' ;
14- import { useStarshipChains } from '@/hooks' ;
1513
1614const queryClient = new QueryClient ( {
1715 defaultOptions : {
@@ -23,55 +21,24 @@ const queryClient = new QueryClient({
2321 } ,
2422} ) ;
2523
26- // Create a separate component for the app content
27- function AppContent ( { Component, pageProps } : AppProps ) {
24+ function CreateCosmosApp ( { Component, pageProps } : AppProps ) {
2825 const { themeClass } = useTheme ( ) ;
29- const { data : starshipData , isLoading } = useStarshipChains ( ) ;
30- console . log ( 'starshipData' , starshipData ) ;
3126
32- // Merge chain-registry and starship chains
33- const combinedChains = useMemo ( ( ) => {
34- if ( starshipData ?. v2 . chains ) {
35- return [ ...chains , ...starshipData . v2 . chains ] ;
36- }
37- return chains ;
38- } , [ starshipData ] ) ;
39- console . log ( 'combinedChains' , combinedChains ) ;
40-
41- // Merge chain-registry and starship assetLists
42- const combinedAssetLists = useMemo ( ( ) => {
43- if ( starshipData ?. v2 . assets ) {
44- return [ ...assetLists , ...starshipData . v2 . assets ] ;
45- }
46- return assetLists ;
47- } , [ starshipData ] ) ;
48-
49- // Don't render ChainProvider until starship data is loaded
50- if ( isLoading ) {
51- return < div > Loading chains...</ div > ; // or your preferred loading component
52- }
53-
54- return (
55- < ChainProvider chains = { combinedChains } assetLists = { combinedAssetLists } wallets = { wallets }
56- walletModal = { ( ) => < InterchainWalletModal /> }
57- >
58- < Box className = { themeClass } >
59- < Layout >
60- < Component { ...pageProps } />
61- < Toaster position = "top-right" closeButton = { true } />
62- </ Layout >
63- </ Box >
64- </ ChainProvider >
65- ) ;
66- }
67-
68- function CreateCosmosApp ( props : AppProps ) {
6927 return (
7028 < CustomThemeProvider >
71- < QueryClientProvider client = { queryClient } >
72- < AppContent { ...props } />
73- { /* <ReactQueryDevtools /> */ }
74- </ QueryClientProvider >
29+ < ChainProvider chains = { chains } assetLists = { assetLists } wallets = { wallets }
30+ walletModal = { ( ) => < InterchainWalletModal /> }
31+ >
32+ < QueryClientProvider client = { queryClient } >
33+ < Box className = { themeClass } >
34+ < Layout >
35+ < Component { ...pageProps } />
36+ < Toaster position = "top-right" closeButton = { true } />
37+ </ Layout >
38+ </ Box >
39+ { /* <ReactQueryDevtools /> */ }
40+ </ QueryClientProvider >
41+ </ ChainProvider >
7542 </ CustomThemeProvider >
7643 ) ;
7744}
0 commit comments