Skip to content

Commit e5e42a0

Browse files
committed
upgraded interchain-kit
added hyperweb chain info
1 parent 63d8db3 commit e5e42a0

File tree

3 files changed

+1049
-277
lines changed

3 files changed

+1049
-277
lines changed

templates/chain-admin/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
},
2121
"dependencies": {
2222
"@chain-registry/assets": "1.70.240",
23-
"@interchain-kit/core": "^0.2.1",
24-
"@interchain-kit/keplr-extension": "^0.2.1",
25-
"@interchain-kit/leap-extension": "^0.2.1",
26-
"@interchain-kit/react": "^0.2.1",
23+
"@interchain-kit/core": "0.3.41",
24+
"@interchain-kit/keplr-extension": "0.3.41",
25+
"@interchain-kit/leap-extension": "0.3.41",
26+
"@interchain-kit/react": "0.3.41",
2727
"@interchain-ui/react": "1.23.31",
2828
"@interchain-ui/react-no-ssr": "0.1.2",
2929
"@interchainjs/cosmos": "^1.9.12",
@@ -34,7 +34,7 @@
3434
"chain-registry": "2.0.9",
3535
"dayjs": "1.11.11",
3636
"hyperwebjs": "^0.0.5",
37-
"interchain-kit": "^0.2.1",
37+
"interchain-kit": "0.3.41",
3838
"next": "^13",
3939
"node-gzip": "^1.1.2",
4040
"react": "18.2.0",

templates/chain-admin/pages/_app.tsx

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import { ChainProvider } from '@interchain-kit/react';
66
import { chains, assetLists } from 'chain-registry';
77
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
88
import { Box, Toaster, useTheme } from '@interchain-ui/react';
9+
import { useMemo } from 'react';
910
// import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
1011

1112
import { CustomThemeProvider, Layout } from '@/components';
1213
import { wallets } from '@/config';
14+
import { useStarshipChains } from '@/hooks';
1315

1416
const queryClient = new QueryClient({
1517
defaultOptions: {
@@ -21,22 +23,52 @@ const queryClient = new QueryClient({
2123
},
2224
});
2325

24-
function CreateCosmosApp({ Component, pageProps }: AppProps) {
26+
// Create a separate component for the app content
27+
function AppContent({ Component, pageProps }: AppProps) {
2528
const { themeClass } = useTheme();
29+
const { data: starshipData, isLoading } = useStarshipChains();
30+
console.log('starshipData', starshipData);
2631

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+
40+
// Merge chain-registry and starship assetLists
41+
const combinedAssetLists = useMemo(() => {
42+
if (starshipData?.v2.assets) {
43+
return [...assetLists, ...starshipData.v2.assets];
44+
}
45+
return assetLists;
46+
}, [starshipData]);
47+
48+
// Don't render ChainProvider until starship data is loaded
49+
if (isLoading) {
50+
return <div>Loading chains...</div>; // or your preferred loading component
51+
}
52+
53+
return (
54+
<ChainProvider chains={combinedChains} assetLists={combinedAssetLists} wallets={wallets}>
55+
<Box className={themeClass}>
56+
<Layout>
57+
<Component {...pageProps} />
58+
<Toaster position="top-right" closeButton={true} />
59+
</Layout>
60+
</Box>
61+
</ChainProvider>
62+
);
63+
}
64+
65+
function CreateCosmosApp(props: AppProps) {
2766
return (
2867
<CustomThemeProvider>
29-
<ChainProvider chains={chains} assetLists={assetLists} wallets={wallets}>
30-
<QueryClientProvider client={queryClient}>
31-
<Box className={themeClass}>
32-
<Layout>
33-
<Component {...pageProps} />
34-
<Toaster position="top-right" closeButton={true} />
35-
</Layout>
36-
</Box>
37-
{/* <ReactQueryDevtools /> */}
38-
</QueryClientProvider>
39-
</ChainProvider>
68+
<QueryClientProvider client={queryClient}>
69+
<AppContent {...props} />
70+
{/* <ReactQueryDevtools /> */}
71+
</QueryClientProvider>
4072
</CustomThemeProvider>
4173
);
4274
}

0 commit comments

Comments
 (0)