Skip to content

Commit 8963961

Browse files
authored
Merge pull request #3 from hyperweb-io/templates
Templates
2 parents f256e13 + 15201a1 commit 8963961

File tree

11 files changed

+3656
-7223
lines changed

11 files changed

+3656
-7223
lines changed

templates/connect-chain/components/wallet/Wallet.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
Stack,
55
useColorModeValue,
66
} from "@interchain-ui/react";
7-
import { WalletStatus } from "cosmos-kit";
8-
import { useChain } from "@cosmos-kit/react";
7+
import { WalletState as WalletStatus } from "@interchain-kit/core";
8+
import { useChain } from "@interchain-kit/react";
99
import { getChainLogo } from "@/utils";
1010
import { CHAIN_NAME } from "@/config";
1111
import { User } from "./User";
@@ -37,17 +37,17 @@ export function Wallet() {
3737
[WalletStatus.Connected]: <ButtonConnected onClick={openView} />,
3838
[WalletStatus.Connecting]: <ButtonConnecting />,
3939
[WalletStatus.Disconnected]: <ButtonDisconnected onClick={connect} />,
40-
[WalletStatus.Error]: <ButtonError onClick={openView} />,
40+
// [WalletStatus.Error]: <ButtonError onClick={openView} />,
4141
[WalletStatus.Rejected]: <ButtonRejected onClick={connect} />,
42-
[WalletStatus.NotExist]: <ButtonNotExist onClick={openView} />,
42+
// [WalletStatus.NotExist]: <ButtonNotExist onClick={openView} />,
4343
}[status] || <ButtonConnect onClick={connect} />;
4444

4545
return (
4646
<Box py="$16">
4747
<Stack attributes={{ mb: "$12", justifyContent: "center" }}>
4848
<Chain
49-
name={chain.pretty_name}
50-
logo={getChainLogo(chain.chain_name)!}
49+
name={chain.prettyName!}
50+
logo={getChainLogo(chain.chainName)!}
5151
/>
5252
</Stack>
5353
<Stack
@@ -83,8 +83,11 @@ export function Wallet() {
8383
{ConnectButton}
8484
</Box>
8585

86-
{message && [WalletStatus.Error, WalletStatus.Rejected].includes(status)
87-
? <Warning text={`${wallet?.prettyName}: ${message}`} />
86+
{message && [
87+
// WalletStatus.Error,
88+
WalletStatus.Rejected
89+
].includes(status)
90+
? <Warning text={`${wallet?.info?.prettyName}: ${message}`} />
8891
: null}
8992
</Stack>
9093
</Box>

templates/connect-chain/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@
1919
},
2020
"dependencies": {
2121
"@chain-registry/types": "^0.50.18",
22-
"@cosmjs/cosmwasm-stargate": "0.31.3",
23-
"@cosmjs/stargate": "0.32.3",
24-
"@cosmos-kit/react": "2.17.0",
2522
"@emotion/react": "11.10.6",
2623
"@emotion/styled": "11.10.6",
27-
"@interchain-ui/react": "1.23.22",
24+
"@interchain-kit/core": "^0.0.1-beta.62",
25+
"@interchain-kit/keplr-extension": "^0.0.1-beta.62",
26+
"@interchain-kit/leap-extension": "^0.0.1-beta.62",
27+
"@interchain-kit/react": "^0.0.1-beta.62",
28+
"@interchain-ui/react": "1.26.1",
2829
"@interchain-ui/react-no-ssr": "^0.1.6",
29-
"chain-registry": "^1.69.32",
30-
"cosmos-kit": "2.18.0",
30+
"bech32": "^2.0.0",
3131
"framer-motion": "9.0.7",
32+
"interchain-kit": "0.0.1-beta.62",
3233
"next": "^13",
3334
"react": "18.2.0",
3435
"react-dom": "18.2.0",

templates/connect-chain/pages/_app.tsx

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,34 @@ import "../styles/globals.css";
22
import "@interchain-ui/react/styles";
33

44
import type { AppProps } from "next/app";
5-
import { SignerOptions, wallets } from "cosmos-kit";
6-
import { ChainProvider } from "@cosmos-kit/react";
7-
import { assets, chains } from "chain-registry";
5+
import { ChainProvider } from "@interchain-kit/react";
6+
import { assetLists, chains } from "@chain-registry/v2";
7+
import { keplrWallet } from "@interchain-kit/keplr-extension";
8+
import { leapWallet } from "@interchain-kit/leap-extension";
89
import {
910
Box,
1011
ThemeProvider,
1112
useColorModeValue,
1213
useTheme,
1314
} from "@interchain-ui/react";
1415

16+
const chain = chains.find((chain) => chain.chainName === 'cosmoshub')!
17+
18+
console.log('keplrWallet', keplrWallet)
19+
1520
function CreateCosmosApp({ Component, pageProps }: AppProps) {
1621
const { themeClass } = useTheme();
1722

18-
const signerOptions: SignerOptions = {
19-
// signingStargate: () => {
20-
// return getSigningCosmosClientOptions();
21-
// }
22-
};
23-
2423
return (
2524
<ThemeProvider>
2625
<ChainProvider
26+
chains={[{ ...chain }]}
27+
assetLists={assetLists}
2728
// @ts-ignore
28-
chains={chains}
29-
// @ts-ingore
30-
assetLists={assets}
31-
wallets={wallets}
32-
walletConnectOptions={{
33-
signClient: {
34-
projectId: "a8510432ebb71e6948cfd6cde54b70f7",
35-
relayUrl: "wss://relay.walletconnect.org",
36-
metadata: {
37-
name: 'Interchain Kit dApp',
38-
description: 'Interchain Kit dApp built by Create Interchain App',
39-
url: "https://docs.cosmology.zone/interchain-kit/",
40-
icons: [],
41-
},
42-
},
43-
}}
29+
wallets={[keplrWallet, leapWallet]}
4430
// @ts-ignore
45-
signerOptions={signerOptions}
31+
signerOptions={{}}
32+
endpointOptions={{ endpoints: {} }}
4633
>
4734
<Box
4835
className={themeClass}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { chains } from 'chain-registry';
2-
import { Asset, Chain } from '@chain-registry/types';
1+
import { chains } from '@chain-registry/v2';
2+
import { Asset, Chain } from '@chain-registry/v2-types';
33

44
export function getLogo(from: Asset | Chain) {
5-
return from.logo_URIs?.svg || from.logo_URIs?.png;
5+
return from.logoURIs?.svg || from.logoURIs?.png;
66
}
77

88
export function getChainLogo(name: string) {
9-
const chain = chains.find(chain => chain.chain_name === name)
9+
const chain = chains.find(chain => chain.chainName === name)
1010
return chain ? getLogo(chain) : null;
1111
}

0 commit comments

Comments
 (0)