diff --git a/examples/contracts/components/wallet.tsx b/examples/contracts/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/examples/contracts/components/wallet.tsx +++ b/examples/contracts/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/examples/contracts/config/defaults.ts b/examples/contracts/config/defaults.ts new file mode 100644 index 000000000..3baf1fb5d --- /dev/null +++ b/examples/contracts/config/defaults.ts @@ -0,0 +1,52 @@ +import { StdFee } from '@cosmjs/amino'; +import { assets } from 'chain-registry'; +import { AssetList, Asset } from '@chain-registry/types'; + +export const chainName = 'osmosis'; + +export const chainassets: AssetList = assets.find( + (chain) => chain.chain_name === chainName +) as AssetList; + +export const baseAsset: Asset = chainassets.assets.find( + (asset) => asset.base === 'uosmo' +) as Asset; + +export const sendTokens = ( + getStargateClient: () => Promise, + setResp: () => any, + address: string +) => { + return async () => { + const stargateClient = await getStargateClient(); + if (!stargateClient || !address) { + console.error('stargateClient undefined or address undefined.'); + return; + } + + const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; + + const msg = send({ + amount: [ + { + denom: baseAsset.base, + amount: '1000' + } + ], + toAddress: address, + fromAddress: address + }); + + const fee: StdFee = { + amount: [ + { + denom: baseAsset.base, + amount: '0' + } + ], + gas: '86364' + }; + const response = await stargateClient.signAndBroadcast(address, [msg], fee); + setResp(JSON.stringify(response, null, 2)); + }; +}; \ No newline at end of file diff --git a/examples/contracts/config/index.ts b/examples/contracts/config/index.ts index e249d6303..2c416ce6f 100644 --- a/examples/contracts/config/index.ts +++ b/examples/contracts/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; diff --git a/examples/contracts/package.json b/examples/contracts/package.json index 4a3c000cc..e6a5024dc 100644 --- a/examples/contracts/package.json +++ b/examples/contracts/package.json @@ -16,7 +16,7 @@ "@chakra-ui/react": "^2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/react": "^0.18.1", + "@cosmos-kit/react": "0.18.4", "@cosmos-kit/types": "^0.11.0", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", diff --git a/examples/contracts/pages/_app.tsx b/examples/contracts/pages/_app.tsx index 322dff943..daa2735e0 100644 --- a/examples/contracts/pages/_app.tsx +++ b/examples/contracts/pages/_app.tsx @@ -2,7 +2,7 @@ import '../styles/globals.css'; import type { AppProps } from 'next/app'; import { WalletProvider } from '@cosmos-kit/react'; import { ChakraProvider } from '@chakra-ui/react'; -import { defaultTheme } from '../config'; +import { chainName, defaultTheme } from '../config'; import { wallets } from '@cosmos-kit/keplr'; import { chains, assets } from 'chain-registry'; import { getSigningCosmosClientOptions } from '../codegen'; @@ -38,8 +38,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} > diff --git a/examples/contracts/pages/index.tsx b/examples/contracts/pages/index.tsx index 31821d89b..360403530 100644 --- a/examples/contracts/pages/index.tsx +++ b/examples/contracts/pages/index.tsx @@ -1,76 +1,22 @@ import { Container, Button } from '@chakra-ui/react'; import { useWallet } from '@cosmos-kit/react'; -import { useEffect, useState } from 'react'; -import { StdFee } from '@cosmjs/amino'; -import { assets } from 'chain-registry'; -import { AssetList, Asset } from '@chain-registry/types'; +import { useState } from 'react'; import { SigningStargateClient } from '@cosmjs/stargate'; import { WalletStatus } from '@cosmos-kit/core'; import BigNumber from 'bignumber.js'; import { WalletSection } from '../components'; import { cosmos } from '../codegen'; - -const chainName = 'osmosis'; -const chainassets: AssetList = assets.find( - (chain) => chain.chain_name === chainName -) as AssetList; -const baseAsset: Asset = chainassets.assets.find( - (asset) => asset.base === 'uosmo' -) as Asset; - -const sendTokens = ( - getStargateClient: () => Promise, - setResp: () => any, - address: string -) => { - return async () => { - const stargateClient = await getStargateClient(); - if (!stargateClient || !address) { - console.error('stargateClient undefined or address undefined.'); - return; - } - - const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; - - const msg = send({ - amount: [ - { - denom: baseAsset.base, - amount: '1000' - } - ], - toAddress: address, - fromAddress: address - }); - - const fee: StdFee = { - amount: [ - { - denom: baseAsset.base, - amount: '0' - } - ], - gas: '86364' - }; - const response = await stargateClient.signAndBroadcast(address, [msg], fee); - setResp(JSON.stringify(response, null, 2)); - }; -}; +import { baseAsset, chainassets, chainName, sendTokens } from '../config'; export default function Home() { const { getStargateClient, address, - setCurrentChain, currentWallet, walletStatus } = useWallet(); - useEffect(() => { - setCurrentChain(chainName); - }, [chainName]); - const [balance, setBalance] = useState(new BigNumber(0)); const [resp, setResp] = useState(''); const getBalance = async () => { diff --git a/examples/contracts/tsconfig.json b/examples/contracts/tsconfig.json index 99710e857..e68bd5ae6 100644 --- a/examples/contracts/tsconfig.json +++ b/examples/contracts/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "target": "ES2020", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -15,6 +19,12 @@ "jsx": "preserve", "incremental": true }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/examples/juno/components/wallet.tsx b/examples/juno/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/examples/juno/components/wallet.tsx +++ b/examples/juno/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/examples/juno/config/defaults.ts b/examples/juno/config/defaults.ts new file mode 100644 index 000000000..50f20e528 --- /dev/null +++ b/examples/juno/config/defaults.ts @@ -0,0 +1,12 @@ +import { assets } from 'chain-registry'; +import { AssetList, Asset } from '@chain-registry/types'; + +export const chainName = 'juno'; + +export const chainassets: AssetList = assets.find( + (chain) => chain.chain_name === chainName +) as AssetList; + +export const coin: Asset = chainassets.assets.find( + (asset) => asset.base === 'ujuno' +) as Asset; \ No newline at end of file diff --git a/examples/juno/config/index.ts b/examples/juno/config/index.ts index e249d6303..2c416ce6f 100644 --- a/examples/juno/config/index.ts +++ b/examples/juno/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; diff --git a/examples/juno/package.json b/examples/juno/package.json index 1e6440569..c6150ae25 100644 --- a/examples/juno/package.json +++ b/examples/juno/package.json @@ -14,9 +14,9 @@ "@chakra-ui/react": "2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "@juno-network/assets": "0.11.1", diff --git a/examples/juno/pages/_app.tsx b/examples/juno/pages/_app.tsx index 43cd175a7..4834a5a24 100644 --- a/examples/juno/pages/_app.tsx +++ b/examples/juno/pages/_app.tsx @@ -2,7 +2,7 @@ import '../styles/globals.css'; import type { AppProps } from 'next/app'; import { WalletProvider } from '@cosmos-kit/react'; import { ChakraProvider } from '@chakra-ui/react'; -import { defaultTheme } from '../config'; +import { chainName, defaultTheme } from '../config'; import { wallets } from '@cosmos-kit/keplr'; import { assets, chains } from 'chain-registry'; import { getSigningCosmosClientOptions } from 'juno-network'; @@ -29,8 +29,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} > diff --git a/examples/juno/pages/index.tsx b/examples/juno/pages/index.tsx index 1f52f2b35..0755c8470 100644 --- a/examples/juno/pages/index.tsx +++ b/examples/juno/pages/index.tsx @@ -1,8 +1,6 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { useWallet } from '@cosmos-kit/react'; import { StdFee } from '@cosmjs/amino'; -import { assets } from 'chain-registry'; -import { AssetList, Asset } from '@chain-registry/types'; import { SigningStargateClient } from '@cosmjs/stargate'; import BigNumber from 'bignumber.js'; @@ -22,7 +20,7 @@ import { useColorModeValue } from '@chakra-ui/react'; import { BsFillMoonStarsFill, BsFillSunFill } from 'react-icons/bs'; -import { dependencies, products } from '../config'; +import { chainassets, chainName, coin, dependencies, products } from '../config'; import { WalletStatus } from '@cosmos-kit/core'; import { Product, Dependency, WalletSection } from '../components'; @@ -35,14 +33,6 @@ const library = { href: 'https://github.com/CosmosContracts/typescript' }; -const chainName = 'juno'; -const chainassets: AssetList = assets.find( - (chain) => chain.chain_name === chainName -) as AssetList; -const coin: Asset = chainassets.assets.find( - (asset) => asset.base === 'ujuno' -) as Asset; - const sendTokens = ( getStargateClient: () => Promise, setResp: () => any, @@ -88,15 +78,10 @@ export default function Home() { const { getStargateClient, address, - setCurrentChain, currentWallet, walletStatus } = useWallet(); - useEffect(() => { - setCurrentChain(chainName); - }, [chainName]); - const [balance, setBalance] = useState(new BigNumber(0)); const [resp, setResp] = useState(''); const getBalance = async () => { @@ -172,7 +157,7 @@ export default function Home() { - + {walletStatus === WalletStatus.Disconnected && ( diff --git a/examples/osmosis-cosmwasm/components/wallet.tsx b/examples/osmosis-cosmwasm/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/examples/osmosis-cosmwasm/components/wallet.tsx +++ b/examples/osmosis-cosmwasm/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/examples/osmosis-cosmwasm/config/defaults.ts b/examples/osmosis-cosmwasm/config/defaults.ts new file mode 100644 index 000000000..43f24d9af --- /dev/null +++ b/examples/osmosis-cosmwasm/config/defaults.ts @@ -0,0 +1,13 @@ +import { assets } from 'chain-registry'; +import { AssetList, Asset } from '@chain-registry/types'; + +// export const chainName = 'osmosis'; +export const chainName = 'osmosistestnet'; + +export const chainassets: AssetList = assets.find( + (chain) => chain.chain_name === chainName +) as AssetList; + +export const coin: Asset = chainassets.assets.find( + (asset) => asset.base === 'uosmo' +) as Asset; \ No newline at end of file diff --git a/examples/osmosis-cosmwasm/config/index.ts b/examples/osmosis-cosmwasm/config/index.ts index e249d6303..2c416ce6f 100644 --- a/examples/osmosis-cosmwasm/config/index.ts +++ b/examples/osmosis-cosmwasm/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; diff --git a/examples/osmosis-cosmwasm/package.json b/examples/osmosis-cosmwasm/package.json index c439f76ca..8b8082091 100644 --- a/examples/osmosis-cosmwasm/package.json +++ b/examples/osmosis-cosmwasm/package.json @@ -16,9 +16,9 @@ "@chakra-ui/react": "2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "bignumber.js": "9.1.0", diff --git a/examples/osmosis-cosmwasm/pages/_app.tsx b/examples/osmosis-cosmwasm/pages/_app.tsx index c54d93cd4..86c4cd59e 100644 --- a/examples/osmosis-cosmwasm/pages/_app.tsx +++ b/examples/osmosis-cosmwasm/pages/_app.tsx @@ -2,7 +2,7 @@ import '../styles/globals.css'; import type { AppProps } from 'next/app'; import { WalletProvider } from '@cosmos-kit/react'; import { ChakraProvider } from '@chakra-ui/react'; -import { defaultTheme } from '../config'; +import { chainName, defaultTheme } from '../config'; import { wallets } from '@cosmos-kit/keplr'; import { assets, chains } from 'chain-registry'; import { getSigningCosmosClientOptions } from 'osmojs'; @@ -30,10 +30,15 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} + endpointOptions={{ + osmosistestnet: { + rpc: ['https://testnet-rpc.osmosis.zone/'] + } + }} > diff --git a/examples/osmosis-cosmwasm/pages/index.tsx b/examples/osmosis-cosmwasm/pages/index.tsx index b5ae32b02..ef481b8ae 100644 --- a/examples/osmosis-cosmwasm/pages/index.tsx +++ b/examples/osmosis-cosmwasm/pages/index.tsx @@ -1,7 +1,4 @@ -import { useEffect } from 'react'; import { useWallet } from '@cosmos-kit/react'; -import { assets } from 'chain-registry'; -import { AssetList, Asset } from '@chain-registry/types'; import { Box, @@ -33,23 +30,10 @@ const library = { href: 'https://github.com/osmosis-labs/osmojs', }; -// const chainName = 'osmosis'; -const chainName = 'osmosistestnet'; -const chainassets: AssetList = assets.find( - (chain) => chain.chain_name === chainName -) as AssetList; -const coin: Asset = chainassets.assets.find( - (asset) => asset.base === 'uosmo' -) as Asset; - export default function Home() { const { colorMode, toggleColorMode } = useColorMode(); - const { walletStatus, setCurrentChain } = useWallet(); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName]); + const { walletStatus } = useWallet(); const color = useColorModeValue('primary.500', 'primary.200'); @@ -90,7 +74,7 @@ export default function Home() { - + diff --git a/examples/osmosis/components/wallet.tsx b/examples/osmosis/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/examples/osmosis/components/wallet.tsx +++ b/examples/osmosis/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/examples/osmosis/config/defaults.ts b/examples/osmosis/config/defaults.ts new file mode 100644 index 000000000..664c35337 --- /dev/null +++ b/examples/osmosis/config/defaults.ts @@ -0,0 +1,55 @@ +import { StdFee } from '@cosmjs/amino'; +import { assets } from 'chain-registry'; +import { AssetList, Asset } from '@chain-registry/types'; +import { SigningStargateClient } from '@cosmjs/stargate'; +import { cosmos } from 'osmojs'; + +// export const chainName = 'osmosis'; +export const chainName = 'osmosistestnet'; + +export const chainassets: AssetList = assets.find( + (chain) => chain.chain_name === chainName +) as AssetList; + +export const coin: Asset = chainassets.assets.find( + (asset) => asset.base === 'uosmo' +) as Asset; + +export const sendTokens = ( + getStargateClient: () => Promise, + setResp: () => any, + address: string +) => { + return async () => { + const stargateClient = await getStargateClient(); + if (!stargateClient || !address) { + console.error('stargateClient undefined or address undefined.'); + return; + } + + const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; + + const msg = send({ + amount: [ + { + denom: coin.base, + amount: '1000' + } + ], + toAddress: address, + fromAddress: address + }); + + const fee: StdFee = { + amount: [ + { + denom: coin.base, + amount: '864' + } + ], + gas: '86364' + }; + const response = await stargateClient.signAndBroadcast(address, [msg], fee); + setResp(JSON.stringify(response, null, 2)); + }; +}; \ No newline at end of file diff --git a/examples/osmosis/config/index.ts b/examples/osmosis/config/index.ts index e249d6303..2c416ce6f 100644 --- a/examples/osmosis/config/index.ts +++ b/examples/osmosis/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; diff --git a/examples/osmosis/package.json b/examples/osmosis/package.json index 4c6395692..04ff6d9ea 100644 --- a/examples/osmosis/package.json +++ b/examples/osmosis/package.json @@ -15,9 +15,9 @@ "@chakra-ui/react": "2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "bignumber.js": "9.1.0", diff --git a/examples/osmosis/pages/_app.tsx b/examples/osmosis/pages/_app.tsx index c54d93cd4..c3556e79e 100644 --- a/examples/osmosis/pages/_app.tsx +++ b/examples/osmosis/pages/_app.tsx @@ -11,6 +11,9 @@ import { GasPrice } from '@cosmjs/stargate'; import { SignerOptions } from '@cosmos-kit/core'; import { Chain } from '@chain-registry/types'; +// const chainName = 'osmosis'; +const chainName = 'osmosistestnet'; + function CreateCosmosApp({ Component, pageProps }: AppProps) { const signerOptions: SignerOptions = { stargate: (_chain: Chain) => { @@ -30,8 +33,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} > diff --git a/examples/osmosis/pages/index.tsx b/examples/osmosis/pages/index.tsx index cb12c04a8..217733020 100644 --- a/examples/osmosis/pages/index.tsx +++ b/examples/osmosis/pages/index.tsx @@ -1,8 +1,5 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { useWallet } from '@cosmos-kit/react'; -import { StdFee } from '@cosmjs/amino'; -import { assets } from 'chain-registry'; -import { AssetList, Asset } from '@chain-registry/types'; import { SigningStargateClient } from '@cosmjs/stargate'; import BigNumber from 'bignumber.js'; @@ -22,7 +19,7 @@ import { useColorModeValue } from '@chakra-ui/react'; import { BsFillMoonStarsFill, BsFillSunFill } from 'react-icons/bs'; -import { dependencies, products } from '../config'; +import { chainassets, chainName, coin, dependencies, products, sendTokens } from '../config'; import { WalletStatus } from '@cosmos-kit/core'; import { Product, Dependency, WalletSection } from '../components'; @@ -35,69 +32,16 @@ const library = { href: 'https://github.com/osmosis-labs/osmojs' }; -// const chainName = 'osmosis'; -const chainName = 'osmosistestnet'; -const chainassets: AssetList = assets.find( - (chain) => chain.chain_name === chainName -) as AssetList; -const coin: Asset = chainassets.assets.find( - (asset) => asset.base === 'uosmo' -) as Asset; - -const sendTokens = ( - getStargateClient: () => Promise, - setResp: () => any, - address: string -) => { - return async () => { - const stargateClient = await getStargateClient(); - if (!stargateClient || !address) { - console.error('stargateClient undefined or address undefined.'); - return; - } - - const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; - - const msg = send({ - amount: [ - { - denom: coin.base, - amount: '1000' - } - ], - toAddress: address, - fromAddress: address - }); - - const fee: StdFee = { - amount: [ - { - denom: coin.base, - amount: '864' - } - ], - gas: '86364' - }; - const response = await stargateClient.signAndBroadcast(address, [msg], fee); - setResp(JSON.stringify(response, null, 2)); - }; -}; - export default function Home() { const { colorMode, toggleColorMode } = useColorMode(); const { getStargateClient, address, - setCurrentChain, currentWallet, walletStatus } = useWallet(); - useEffect(() => { - setCurrentChain(chainName); - }, [chainName]); - const [balance, setBalance] = useState(new BigNumber(0)); const [resp, setResp] = useState(''); const getBalance = async () => { @@ -173,7 +117,7 @@ export default function Home() { - + {walletStatus === WalletStatus.Disconnected && ( diff --git a/examples/send-tokens/components/wallet.tsx b/examples/send-tokens/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/examples/send-tokens/components/wallet.tsx +++ b/examples/send-tokens/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/examples/send-tokens/config/defaults.ts b/examples/send-tokens/config/defaults.ts new file mode 100644 index 000000000..001545415 --- /dev/null +++ b/examples/send-tokens/config/defaults.ts @@ -0,0 +1,54 @@ +import { StdFee } from '@cosmjs/amino'; +import { assets } from 'chain-registry'; +import { AssetList, Asset } from '@chain-registry/types'; +import { SigningStargateClient } from '@cosmjs/stargate'; +import { cosmos } from 'interchain'; + +export const chainName = 'cosmoshub'; + +export const chainassets: AssetList = assets.find( + (chain) => chain.chain_name === chainName +) as AssetList; + +export const coin: Asset = chainassets.assets.find( + (asset) => asset.base === 'uatom' +) as Asset; + +export const sendTokens = ( + getStargateClient: () => Promise, + setResp: () => any, + address: string +) => { + return async () => { + const stargateClient = await getStargateClient(); + if (!stargateClient || !address) { + console.error('stargateClient undefined or address undefined.'); + return; + } + + const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; + + const msg = send({ + amount: [ + { + denom: coin.base, + amount: '1000' + } + ], + toAddress: address, + fromAddress: address + }); + + const fee: StdFee = { + amount: [ + { + denom: coin.base, + amount: '864' + } + ], + gas: '86364' + }; + const response = await stargateClient.signAndBroadcast(address, [msg], fee); + setResp(JSON.stringify(response, null, 2)); + }; +}; \ No newline at end of file diff --git a/examples/send-tokens/config/index.ts b/examples/send-tokens/config/index.ts index e249d6303..2c416ce6f 100644 --- a/examples/send-tokens/config/index.ts +++ b/examples/send-tokens/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; diff --git a/examples/send-tokens/package.json b/examples/send-tokens/package.json index 7ac313499..0d218117b 100644 --- a/examples/send-tokens/package.json +++ b/examples/send-tokens/package.json @@ -14,9 +14,9 @@ "@chakra-ui/react": "2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "bignumber.js": "9.1.0", diff --git a/examples/send-tokens/pages/_app.tsx b/examples/send-tokens/pages/_app.tsx index 4fa34a364..6b8ff203e 100644 --- a/examples/send-tokens/pages/_app.tsx +++ b/examples/send-tokens/pages/_app.tsx @@ -2,7 +2,7 @@ import '../styles/globals.css'; import type { AppProps } from 'next/app'; import { WalletProvider } from '@cosmos-kit/react'; import { ChakraProvider } from '@chakra-ui/react'; -import { defaultTheme } from '../config'; +import { chainName, defaultTheme } from '../config'; import { wallets } from '@cosmos-kit/keplr'; import { assets, chains } from 'chain-registry'; import { getSigningCosmosClientOptions } from 'interchain'; @@ -20,8 +20,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} > diff --git a/examples/send-tokens/pages/index.tsx b/examples/send-tokens/pages/index.tsx index 545c5ad55..3ab362dc4 100644 --- a/examples/send-tokens/pages/index.tsx +++ b/examples/send-tokens/pages/index.tsx @@ -1,8 +1,5 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { useWallet } from '@cosmos-kit/react'; -import { StdFee } from '@cosmjs/amino'; -import { assets } from 'chain-registry'; -import { AssetList, Asset } from '@chain-registry/types'; import { SigningStargateClient } from '@cosmjs/stargate'; import BigNumber from 'bignumber.js'; @@ -22,75 +19,23 @@ import { useColorModeValue } from '@chakra-ui/react'; import { BsFillMoonStarsFill, BsFillSunFill } from 'react-icons/bs'; -import { dependencies, products } from '../config'; +import { chainassets, chainName, coin, dependencies, products, sendTokens } from '../config'; import { WalletStatus } from '@cosmos-kit/core'; import { Product, Dependency, WalletSection } from '../components'; import { cosmos } from 'interchain'; import Head from 'next/head'; -const chainName = 'cosmoshub'; -const chainassets: AssetList = assets.find( - (chain) => chain.chain_name === chainName -) as AssetList; -const coin: Asset = chainassets.assets.find( - (asset) => asset.base === 'uatom' -) as Asset; - -const sendTokens = ( - getStargateClient: () => Promise, - setResp: () => any, - address: string -) => { - return async () => { - const stargateClient = await getStargateClient(); - if (!stargateClient || !address) { - console.error('stargateClient undefined or address undefined.'); - return; - } - - const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; - - const msg = send({ - amount: [ - { - denom: coin.base, - amount: '1000' - } - ], - toAddress: address, - fromAddress: address - }); - - const fee: StdFee = { - amount: [ - { - denom: coin.base, - amount: '864' - } - ], - gas: '86364' - }; - const response = await stargateClient.signAndBroadcast(address, [msg], fee); - setResp(JSON.stringify(response, null, 2)); - }; -}; - export default function Home() { const { colorMode, toggleColorMode } = useColorMode(); const { getStargateClient, address, - setCurrentChain, currentWallet, walletStatus } = useWallet(); - useEffect(() => { - setCurrentChain(chainName); - }, [chainName]); - const [balance, setBalance] = useState(new BigNumber(0)); const [resp, setResp] = useState(''); const getBalance = async () => { @@ -163,7 +108,7 @@ export default function Home() { - + {walletStatus === WalletStatus.Disconnected && ( diff --git a/examples/stargaze/components/wallet.tsx b/examples/stargaze/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/examples/stargaze/components/wallet.tsx +++ b/examples/stargaze/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/examples/stargaze/config/defaults.ts b/examples/stargaze/config/defaults.ts new file mode 100644 index 000000000..623eea36a --- /dev/null +++ b/examples/stargaze/config/defaults.ts @@ -0,0 +1,54 @@ +import { StdFee } from '@cosmjs/amino'; +import { assets } from 'chain-registry'; +import { AssetList, Asset } from '@chain-registry/types'; +import { SigningStargateClient } from '@cosmjs/stargate'; +import { cosmos } from 'stargaze-zone'; + +export const chainName = 'stargaze'; + +export const chainassets: AssetList = assets.find( + (chain) => chain.chain_name === chainName +) as AssetList; + +export const coin: Asset = chainassets.assets.find( + (asset) => asset.base === 'ustars' +) as Asset; + +export const sendTokens = ( + getStargateClient: () => Promise, + setResp: () => any, + address: string +) => { + return async () => { + const stargateClient = await getStargateClient(); + if (!stargateClient || !address) { + console.error('stargateClient undefined or address undefined.'); + return; + } + + const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; + + const msg = send({ + amount: [ + { + denom: coin.base, + amount: '1000' + } + ], + toAddress: address, + fromAddress: address + }); + + const fee: StdFee = { + amount: [ + { + denom: coin.base, + amount: '864' + } + ], + gas: '86364' + }; + const response = await stargateClient.signAndBroadcast(address, [msg], fee); + setResp(JSON.stringify(response, null, 2)); + }; +}; \ No newline at end of file diff --git a/examples/stargaze/config/index.ts b/examples/stargaze/config/index.ts index e249d6303..2c416ce6f 100644 --- a/examples/stargaze/config/index.ts +++ b/examples/stargaze/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; diff --git a/examples/stargaze/package.json b/examples/stargaze/package.json index 19e478222..f179ef32d 100644 --- a/examples/stargaze/package.json +++ b/examples/stargaze/package.json @@ -14,9 +14,9 @@ "@chakra-ui/react": "2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "bignumber.js": "9.1.0", diff --git a/examples/stargaze/pages/_app.tsx b/examples/stargaze/pages/_app.tsx index 3bc6928f7..5af61d592 100644 --- a/examples/stargaze/pages/_app.tsx +++ b/examples/stargaze/pages/_app.tsx @@ -2,7 +2,7 @@ import '../styles/globals.css'; import type { AppProps } from 'next/app'; import { WalletProvider } from '@cosmos-kit/react'; import { ChakraProvider } from '@chakra-ui/react'; -import { defaultTheme } from '../config'; +import { chainName, defaultTheme } from '../config'; import { wallets } from '@cosmos-kit/keplr'; import { chains, assets } from 'chain-registry'; import { getSigningCosmosClientOptions } from 'stargaze-zone'; @@ -11,6 +11,7 @@ import { GasPrice } from '@cosmjs/stargate'; import { SignerOptions } from '@cosmos-kit/core'; import { Chain } from '@chain-registry/types'; + function CreateCosmosApp({ Component, pageProps }: AppProps) { const signerOptions: SignerOptions = { stargate: (_chain: Chain) => { @@ -29,8 +30,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} > diff --git a/examples/stargaze/pages/index.tsx b/examples/stargaze/pages/index.tsx index 66d8adeeb..508b23c1b 100644 --- a/examples/stargaze/pages/index.tsx +++ b/examples/stargaze/pages/index.tsx @@ -1,8 +1,5 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { useWallet } from '@cosmos-kit/react'; -import { StdFee } from '@cosmjs/amino'; -import { assets } from 'chain-registry'; -import { AssetList, Asset } from '@chain-registry/types'; import { SigningStargateClient } from '@cosmjs/stargate'; import BigNumber from 'bignumber.js'; import { @@ -21,7 +18,7 @@ import { useColorModeValue } from '@chakra-ui/react'; import { BsFillMoonStarsFill, BsFillSunFill } from 'react-icons/bs'; -import { dependencies, products } from '../config'; +import { dependencies, products, chainName, chainassets, sendTokens, coin } from '../config'; import { WalletStatus } from '@cosmos-kit/core'; import { Product, Dependency, WalletSection } from '../components'; @@ -35,68 +32,16 @@ const library = { href: 'https://github.com/cosmology-tech/stargaze-zone' }; -const chainName = 'stargaze'; -const chainassets: AssetList = assets.find( - (chain) => chain.chain_name === chainName -) as AssetList; -const coin: Asset = chainassets.assets.find( - (asset) => asset.base === 'ustars' -) as Asset; - -const sendTokens = ( - getStargateClient: () => Promise, - setResp: () => any, - address: string -) => { - return async () => { - const stargateClient = await getStargateClient(); - if (!stargateClient || !address) { - console.error('stargateClient undefined or address undefined.'); - return; - } - - const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; - - const msg = send({ - amount: [ - { - denom: coin.base, - amount: '1000' - } - ], - toAddress: address, - fromAddress: address - }); - - const fee: StdFee = { - amount: [ - { - denom: coin.base, - amount: '864' - } - ], - gas: '86364' - }; - const response = await stargateClient.signAndBroadcast(address, [msg], fee); - setResp(JSON.stringify(response, null, 2)); - }; -}; - export default function Home() { const { colorMode, toggleColorMode } = useColorMode(); const { getStargateClient, address, - setCurrentChain, currentWallet, walletStatus } = useWallet(); - useEffect(() => { - setCurrentChain(chainName); - }, [chainName]); - const [balance, setBalance] = useState(new BigNumber(0)); const [resp, setResp] = useState(''); const getBalance = async () => { @@ -172,7 +117,7 @@ export default function Home() { - + {walletStatus === WalletStatus.Disconnected && ( diff --git a/examples/tailwindcss/components/wallet.tsx b/examples/tailwindcss/components/wallet.tsx index ea5c09128..ecb7170b5 100644 --- a/examples/tailwindcss/components/wallet.tsx +++ b/examples/tailwindcss/components/wallet.tsx @@ -1,151 +1,176 @@ -import { MouseEventHandler, useEffect, useMemo } from 'react' -import { ChainCard } from '../components' -import { Address, truncate } from './react/views' +import { useWallet } from '@cosmos-kit/react'; import { - ArrowPathIcon, - ArrowDownTrayIcon, - WalletIcon, -} from '@heroicons/react/24/outline' -import { useWallet } from '@cosmos-kit/react' -import { ChainName, WalletStatus } from '@cosmos-kit/core' -import { chainInfos } from '../config/chain-infos' - -const buttons = { - Disconnected: { - icon: WalletIcon, - title: 'Connect Wallet', - }, - Connected: { - icon: WalletIcon, - title: 'My Wallet', - }, - Rejected: { - icon: ArrowPathIcon, - title: 'Reconnect', - }, - Error: { - icon: ArrowPathIcon, - title: 'Change Wallet', - }, - NotExist: { - icon: ArrowDownTrayIcon, - title: 'Install Wallet', - }, -} + Box, + Center, + Grid, + GridItem, + Icon, + Stack, + useColorModeValue, + Text +} from '@chakra-ui/react'; +import { MouseEventHandler, useMemo } from 'react'; +import { FiAlertTriangle } from 'react-icons/fi'; +import { + Astronaut, + Error, + Connected, + ConnectedShowAddress, + ConnectedUserInfo, + Connecting, + ConnectStatusWarn, + CopyAddressBtn, + Disconnected, + NotExist, + Rejected, + RejectedWarn, + WalletConnectComponent, + ChainCard +} from '../components'; +import { getWalletPrettyName } from '@cosmos-kit/config'; +import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { - const walletManager = useWallet() +export const WalletSection = () => { + const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, + message, + currentChainName, currentWalletName, - chains, - } = walletManager + chains + } = walletManager; - const chain = chainInfos.find((c) => c.chainName === chainName) + const chainName = currentChainName; - useEffect(() => { - setCurrentChain(chainName) - }, [chainName, setCurrentChain]) + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { + const assets = chainAssets.find( + (_chain) => _chain.chain_name === chainRecord.name + )?.assets; + return { + chainName: chainRecord.name, + label: chainRecord.chain.pretty_name, + value: chainRecord.name, + icon: assets + ? assets[0]?.logo_URIs?.svg || assets[0]?.logo_URIs?.png + : undefined, + disabled: false + }; + } + return getChain(chains[0]); + }, + [chains] + ); // Events const onClickConnect: MouseEventHandler = async (e) => { - e.preventDefault() - openView() - if (currentWalletName) { - await connect() - } - } + e.preventDefault(); + await connect(); + }; const onClickOpenView: MouseEventHandler = (e) => { - e.preventDefault() - openView() - } + e.preventDefault(); + openView(); + }; - const _renderConnectButton = useMemo(() => { - // Spinner - if (walletStatus === WalletStatus.Connecting) { - return ( - - ) - } + // Components + const connectWalletButton = ( + + } + connecting={} + connected={ + + } + rejected={} + error={} + notExist={ + + } + /> + ); - let onClick - if ( - walletStatus === WalletStatus.Disconnected || - walletStatus === WalletStatus.Rejected - ) - onClick = onClickConnect - else onClick = onClickOpenView + const connectWalletWarn = ( + } + wordOfWarning={`${getWalletPrettyName( + currentWalletName + )}: ${message}`} + /> + } + error={ + } + wordOfWarning={`${getWalletPrettyName( + currentWalletName + )}: ${message}`} + /> + } + /> + ); - const buttonData = buttons[walletStatus] - - return ( - - ) - }, [walletStatus]) + const userInfo = ( + } /> + ); + const addressBtn = chainName && ( + } + /> + ); return ( -
-
+
+ {chainName && ( -
+ -
+ )} -
-
-
- {username && ( -
-
-

- {username} -

-
- )} -
- {address ?
{truncate(address)}
: <>} -
- {_renderConnectButton} -
-
-
-
-
- ) -} + + + {userInfo} + {addressBtn} + + {connectWalletButton} + + {connectWalletWarn} + + + + + ); +}; diff --git a/examples/tailwindcss/config/defaults.ts b/examples/tailwindcss/config/defaults.ts new file mode 100644 index 000000000..5c3dba51b --- /dev/null +++ b/examples/tailwindcss/config/defaults.ts @@ -0,0 +1 @@ +export const chainName = process.env.NEXT_PUBLIC_CHAIN ?? 'stargaze';; \ No newline at end of file diff --git a/examples/tailwindcss/config/index.ts b/examples/tailwindcss/config/index.ts index b8795830d..2e1983362 100644 --- a/examples/tailwindcss/config/index.ts +++ b/examples/tailwindcss/config/index.ts @@ -1 +1,2 @@ export * from './features'; +export * from './defaults'; diff --git a/examples/tailwindcss/package.json b/examples/tailwindcss/package.json index d0020bf22..295cda310 100644 --- a/examples/tailwindcss/package.json +++ b/examples/tailwindcss/package.json @@ -11,9 +11,9 @@ "dependencies": { "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "@headlessui/react": "^1.7.2", diff --git a/examples/tailwindcss/pages/_app.tsx b/examples/tailwindcss/pages/_app.tsx index 1c1b5980e..ccd2955bd 100644 --- a/examples/tailwindcss/pages/_app.tsx +++ b/examples/tailwindcss/pages/_app.tsx @@ -7,6 +7,7 @@ import { ThemeProvider } from '../contexts/theme'; import { SignerOptions } from '@cosmos-kit/core'; import { chains, assets } from 'chain-registry'; +import { chainName } from '../config'; function CreateCosmosApp({ Component, pageProps }: AppProps) { const signerOptions: SignerOptions = { @@ -17,8 +18,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} walletModal={TailwindModal} diff --git a/examples/tailwindcss/pages/index.tsx b/examples/tailwindcss/pages/index.tsx index b8874835f..0e31b30fc 100644 --- a/examples/tailwindcss/pages/index.tsx +++ b/examples/tailwindcss/pages/index.tsx @@ -5,7 +5,6 @@ import { useTheme } from '../contexts/theme'; import { MoonIcon, SunIcon } from '@heroicons/react/24/outline'; export default function Home() { - const chainName = process.env.NEXT_PUBLIC_CHAIN ?? 'stargaze'; const { theme, toggleTheme } = useTheme(); return ( @@ -38,7 +37,7 @@ export default function Home() { - +
{products.map((product) => ( diff --git a/examples/tailwindcss/tsconfig.json b/examples/tailwindcss/tsconfig.json index 99710e857..e68bd5ae6 100644 --- a/examples/tailwindcss/tsconfig.json +++ b/examples/tailwindcss/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "target": "ES2020", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -15,6 +19,12 @@ "jsx": "preserve", "incremental": true }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/examples/telescope/components/wallet.tsx b/examples/telescope/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/examples/telescope/components/wallet.tsx +++ b/examples/telescope/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/examples/telescope/config/defaults.ts b/examples/telescope/config/defaults.ts new file mode 100644 index 000000000..77bed9576 --- /dev/null +++ b/examples/telescope/config/defaults.ts @@ -0,0 +1,54 @@ +import { Asset, AssetList } from "@chain-registry/types"; +import { SigningStargateClient } from "@cosmjs/stargate"; +import { cosmos } from "../codegen"; +import { StdFee } from '@cosmjs/amino'; +import { assets } from 'chain-registry'; + +export const chainName = 'osmosis'; + +export const chainassets: AssetList = assets.find( + (chain) => chain.chain_name === chainName +) as AssetList; + +export const baseAsset: Asset = chainassets.assets.find( + (asset) => asset.base === 'uosmo' +) as Asset; + +export const sendTokens = ( + getStargateClient: () => Promise, + setResp: () => any, + address: string +) => { + return async () => { + const stargateClient = await getStargateClient(); + if (!stargateClient || !address) { + console.error('stargateClient undefined or address undefined.'); + return; + } + + const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; + + const msg = send({ + amount: [ + { + denom: baseAsset.base, + amount: '1000' + } + ], + toAddress: address, + fromAddress: address + }); + + const fee: StdFee = { + amount: [ + { + denom: baseAsset.base, + amount: '0' + } + ], + gas: '86364' + }; + const response = await stargateClient.signAndBroadcast(address, [msg], fee); + setResp(JSON.stringify(response, null, 2)); + }; +}; \ No newline at end of file diff --git a/examples/telescope/config/index.ts b/examples/telescope/config/index.ts index e249d6303..2c416ce6f 100644 --- a/examples/telescope/config/index.ts +++ b/examples/telescope/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; diff --git a/examples/telescope/package.json b/examples/telescope/package.json index 0392d4593..ca99b4031 100644 --- a/examples/telescope/package.json +++ b/examples/telescope/package.json @@ -15,7 +15,7 @@ "@chakra-ui/react": "^2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/react": "^0.18.1", + "@cosmos-kit/react": "0.18.4", "@cosmos-kit/types": "^0.11.0", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", diff --git a/examples/telescope/pages/_app.tsx b/examples/telescope/pages/_app.tsx index cda639c11..83f24dc78 100644 --- a/examples/telescope/pages/_app.tsx +++ b/examples/telescope/pages/_app.tsx @@ -2,7 +2,7 @@ import '../styles/globals.css'; import type { AppProps } from 'next/app'; import { WalletProvider } from '@cosmos-kit/react'; import { ChakraProvider } from '@chakra-ui/react'; -import { defaultTheme } from '../config'; +import { defaultTheme, chainName } from '../config'; import { wallets } from '@cosmos-kit/keplr'; import { chains, assets } from 'chain-registry'; import { getSigningCosmosClientOptions } from '../codegen'; @@ -37,8 +37,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} > diff --git a/examples/telescope/pages/index.tsx b/examples/telescope/pages/index.tsx index 31821d89b..5cc3158c6 100644 --- a/examples/telescope/pages/index.tsx +++ b/examples/telescope/pages/index.tsx @@ -1,9 +1,6 @@ import { Container, Button } from '@chakra-ui/react'; import { useWallet } from '@cosmos-kit/react'; -import { useEffect, useState } from 'react'; -import { StdFee } from '@cosmjs/amino'; -import { assets } from 'chain-registry'; -import { AssetList, Asset } from '@chain-registry/types'; +import { useState } from 'react'; import { SigningStargateClient } from '@cosmjs/stargate'; import { WalletStatus } from '@cosmos-kit/core'; import BigNumber from 'bignumber.js'; @@ -11,66 +8,16 @@ import BigNumber from 'bignumber.js'; import { WalletSection } from '../components'; import { cosmos } from '../codegen'; -const chainName = 'osmosis'; -const chainassets: AssetList = assets.find( - (chain) => chain.chain_name === chainName -) as AssetList; -const baseAsset: Asset = chainassets.assets.find( - (asset) => asset.base === 'uosmo' -) as Asset; - -const sendTokens = ( - getStargateClient: () => Promise, - setResp: () => any, - address: string -) => { - return async () => { - const stargateClient = await getStargateClient(); - if (!stargateClient || !address) { - console.error('stargateClient undefined or address undefined.'); - return; - } - - const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; - - const msg = send({ - amount: [ - { - denom: baseAsset.base, - amount: '1000' - } - ], - toAddress: address, - fromAddress: address - }); - - const fee: StdFee = { - amount: [ - { - denom: baseAsset.base, - amount: '0' - } - ], - gas: '86364' - }; - const response = await stargateClient.signAndBroadcast(address, [msg], fee); - setResp(JSON.stringify(response, null, 2)); - }; -}; +import { chainName, chainassets, baseAsset, sendTokens } from '../config'; export default function Home() { const { getStargateClient, address, - setCurrentChain, currentWallet, walletStatus } = useWallet(); - useEffect(() => { - setCurrentChain(chainName); - }, [chainName]); - const [balance, setBalance] = useState(new BigNumber(0)); const [resp, setResp] = useState(''); const getBalance = async () => { diff --git a/examples/telescope/tsconfig.json b/examples/telescope/tsconfig.json index 99710e857..e68bd5ae6 100644 --- a/examples/telescope/tsconfig.json +++ b/examples/telescope/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "target": "ES2020", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -15,6 +19,12 @@ "jsx": "preserve", "incremental": true }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index 2eaccb688..f4d7517b5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "bootstrap": "lerna bootstrap --use-workspaces", "lint": "lerna run lint", "format": "lerna run format", - "test": "lerna run test --stream" + "test": "lerna run test --stream", + "upgrade": "yarn upgrade-interactive --latest" }, "devDependencies": { "@babel/cli": "7.18.10", diff --git a/templates/connect-chain/components/wallet.tsx b/templates/connect-chain/components/wallet.tsx index d12be8a6f..ecb7170b5 100644 --- a/templates/connect-chain/components/wallet.tsx +++ b/templates/connect-chain/components/wallet.tsx @@ -9,7 +9,7 @@ import { useColorModeValue, Text } from '@chakra-ui/react'; -import { MouseEventHandler, useEffect, useMemo } from 'react'; +import { MouseEventHandler, useMemo } from 'react'; import { FiAlertTriangle } from 'react-icons/fi'; import { Astronaut, @@ -28,26 +28,28 @@ import { ChainCard } from '../components'; import { getWalletPrettyName } from '@cosmos-kit/config'; -import { ChainName } from '@cosmos-kit/core'; import { assets as chainAssets } from 'chain-registry'; +import { ChainRecord } from '@cosmos-kit/core'; -export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { +export const WalletSection = () => { const walletManager = useWallet(); const { connect, openView, - setCurrentChain, walletStatus, username, address, message, + currentChainName, currentWalletName, chains } = walletManager; - const chainOptions = useMemo( - () => - chains.map((chainRecord) => { + const chainName = currentChainName; + + const chain = useMemo( + () => { + const getChain = (chainRecord: ChainRecord) => { const assets = chainAssets.find( (_chain) => _chain.chain_name === chainRecord.name )?.assets; @@ -60,23 +62,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { : undefined, disabled: false }; - }), + } + return getChain(chains[0]); + }, [chains] ); - const chain = chainOptions.find((c) => c.chainName === chainName); - - useEffect(() => { - setCurrentChain(chainName); - }, [chainName, setCurrentChain]); - // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { diff --git a/templates/connect-chain/config/defaults.ts b/templates/connect-chain/config/defaults.ts new file mode 100644 index 000000000..fdcdba738 --- /dev/null +++ b/templates/connect-chain/config/defaults.ts @@ -0,0 +1 @@ +export const chainName = 'cosmoshub'; \ No newline at end of file diff --git a/templates/connect-chain/config/index.ts b/templates/connect-chain/config/index.ts index e249d6303..6e9a0e820 100644 --- a/templates/connect-chain/config/index.ts +++ b/templates/connect-chain/config/index.ts @@ -1,2 +1,3 @@ export * from './theme'; export * from './features'; +export * from './defaults'; \ No newline at end of file diff --git a/templates/connect-chain/package.json b/templates/connect-chain/package.json index 013af78dd..59ba13184 100644 --- a/templates/connect-chain/package.json +++ b/templates/connect-chain/package.json @@ -13,9 +13,9 @@ "@chakra-ui/react": "2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "chain-registry": "1.0.0", diff --git a/templates/connect-chain/pages/[chainName].tsx b/templates/connect-chain/pages/[chainName].tsx deleted file mode 100644 index 3b99eccd9..000000000 --- a/templates/connect-chain/pages/[chainName].tsx +++ /dev/null @@ -1,104 +0,0 @@ -import Head from 'next/head'; -import { - Box, - Divider, - Grid, - Heading, - Text, - Stack, - Container, - Link, - Button, - Flex, - Icon, - useColorMode, - useColorModeValue -} from '@chakra-ui/react'; -import { BsFillMoonStarsFill, BsFillSunFill } from 'react-icons/bs'; -import { Product, Dependency, WalletSection } from '../components'; -import { dependencies, products } from '../config'; -import { useRouter } from 'next/router'; - -export default function Home() { - const { colorMode, toggleColorMode } = useColorMode(); - const router = useRouter(); - let { chainName } = router.query; - chainName = chainName ? (chainName as string) : undefined; - - return ( - - - Create Cosmos App - - - - - - - - - Create Cosmos App - - - Welcome to  - - CosmosKit + Next.js - - - - - - {products.map((product) => ( - - ))} - - - {dependencies.map((dependency) => ( - - ))} - - - - - - Built with - - Cosmology - - - - ); -} diff --git a/templates/connect-chain/pages/_app.tsx b/templates/connect-chain/pages/_app.tsx index f7ee2a0e5..ad6ace545 100644 --- a/templates/connect-chain/pages/_app.tsx +++ b/templates/connect-chain/pages/_app.tsx @@ -2,7 +2,7 @@ import '../styles/globals.css'; import type { AppProps } from 'next/app'; import { WalletProvider } from '@cosmos-kit/react'; import { ChakraProvider } from '@chakra-ui/react'; -import { defaultTheme } from '../config'; +import { defaultTheme, chainName } from '../config'; import { wallets } from '@cosmos-kit/keplr'; import { SignerOptions } from '@cosmos-kit/core'; @@ -18,8 +18,8 @@ function CreateCosmosApp({ Component, pageProps }: AppProps) { return ( chain.chain_name === chainName)} + assetLists={assets.filter(asset => asset.chain_name === chainName)} wallets={wallets} signerOptions={signerOptions} > diff --git a/templates/connect-chain/pages/index.tsx b/templates/connect-chain/pages/index.tsx index 809379b04..2c8e394ae 100644 --- a/templates/connect-chain/pages/index.tsx +++ b/templates/connect-chain/pages/index.tsx @@ -20,7 +20,6 @@ import { dependencies, products } from '../config'; export default function Home() { const { colorMode, toggleColorMode } = useColorMode(); - const chainName = 'cosmoshub'; return ( @@ -59,7 +58,7 @@ export default function Home() { - + { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -83,10 +80,7 @@ export const WalletSection = () => { selectedValue: ChainOption | null ) => { setCurrentChain(selectedValue?.chainName); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; // Components diff --git a/templates/connect-multi-chain/package.json b/templates/connect-multi-chain/package.json index fc5ade45b..b3718bddf 100644 --- a/templates/connect-multi-chain/package.json +++ b/templates/connect-multi-chain/package.json @@ -14,9 +14,9 @@ "@chakra-ui/react": "2.3.4", "@cosmjs/cosmwasm-stargate": "0.29.0", "@cosmjs/stargate": "0.29.0", - "@cosmos-kit/core": "0.19.0", - "@cosmos-kit/keplr": "0.19.0", - "@cosmos-kit/react": "0.18.1", + "@cosmos-kit/core": "0.19.3", + "@cosmos-kit/keplr": "0.19.3", + "@cosmos-kit/react": "0.18.4", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "chain-registry": "1.0.0", diff --git a/templates/connect-multi-chain/tsconfig.json b/templates/connect-multi-chain/tsconfig.json index 99710e857..e68bd5ae6 100644 --- a/templates/connect-multi-chain/tsconfig.json +++ b/templates/connect-multi-chain/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "target": "ES2020", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -15,6 +19,12 @@ "jsx": "preserve", "incremental": true }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], - "exclude": ["node_modules"] -} + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index e3b02ea4b..b8adf5520 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2922,10 +2922,10 @@ "@cosmos-kit/core" "^0.16.2" "@cosmos-kit/keplr" "^0.16.2" -"@cosmos-kit/core@0.19.0", "@cosmos-kit/core@^0.19.0": - version "0.19.0" - resolved "https://registry.npmjs.org/@cosmos-kit/core/-/core-0.19.0.tgz#df053f173aa6c3ca8419e61e1b7b0f67f6243a33" - integrity sha512-FNBgrIik20aWUbfL5P+A3hgR+alvKUjEU88OCrGX90jgSlJHCYrp50CYR0qSuRK/nq4QwP45Oo/8yTcnaMMrnA== +"@cosmos-kit/core@0.19.3", "@cosmos-kit/core@^0.19.3": + version "0.19.3" + resolved "https://registry.npmjs.org/@cosmos-kit/core/-/core-0.19.3.tgz#1c065956e4c84c3a912ad1fce98028de01d4494a" + integrity sha512-0YqThC5hoLIFKmQdJn7BEI/og+4YlSxr/Rytmt29dICr8FXLIfdfjMHb/W+MqBUo7y0lLAal1l6RIcFbq2qKCg== dependencies: "@babel/runtime" "^7.11.2" "@chain-registry/types" "^0.11.0" @@ -2940,16 +2940,16 @@ "@chain-registry/types" "^0.11.0" chain-registry "^0.14.0" -"@cosmos-kit/keplr@0.19.0": - version "0.19.0" - resolved "https://registry.npmjs.org/@cosmos-kit/keplr/-/keplr-0.19.0.tgz#d50f2d109f0015b787a569b3aaf38427c253669c" - integrity sha512-eUNDaUGwfrR5fp4xAFTfxWO7aREVyEv2G+R+0tFnvZOddZbMBs9EpiPLgUzDq3BNuKrVQE7GybeKs7zkRPO0Ag== +"@cosmos-kit/keplr@0.19.3": + version "0.19.3" + resolved "https://registry.npmjs.org/@cosmos-kit/keplr/-/keplr-0.19.3.tgz#fbbaad6dc5139883a89ac1f75aeb9b845727fad9" + integrity sha512-lm5jKrAVL8sWFCwo5jfqN4QrTwCYNgLoTdnQPi7+IqgsX8FAZke7qSkfSHyd32ST55RWnfgz5jAgLlWzIzlz4Q== dependencies: "@babel/runtime" "^7.11.2" "@chain-registry/keplr" "1.0.0" "@chain-registry/types" "^0.11.0" "@chakra-ui/react" "^2.2.9" - "@cosmos-kit/core" "^0.19.0" + "@cosmos-kit/core" "^0.19.3" "@emotion/react" "^11" "@emotion/styled" "^11" "@keplr-wallet/types" "^0.11.3" @@ -2980,10 +2980,30 @@ react-dom "18.2.0" react-icons "^4.4.0" -"@cosmos-kit/react@0.18.1", "@cosmos-kit/react@^0.18.1": - version "0.18.1" - resolved "https://registry.npmjs.org/@cosmos-kit/react/-/react-0.18.1.tgz#8aa52ad1501063d3a9407968d73807244838f1b8" - integrity sha512-CoiD7l5R7AUutW00OPlFTWi0NGlKoJfX9YPZZ+Cpn4M47mjmw6MTDoqtSEZa44zb36r+JYp6QUbckMPg4mTVDw== +"@cosmos-kit/leap@0.1.2": + version "0.1.2" + resolved "https://registry.npmjs.org/@cosmos-kit/leap/-/leap-0.1.2.tgz#7ddb6f809f64cc043f0f44265bff5c39c22f2a61" + integrity sha512-mh0BHlgmDoNoJf8i5Jp6q8GTMGCHSky4gnyulG9vCza/CXyvbjc9mFnQjLT0dKs8sJ7NGFtx1L42Hwzgr4mPng== + dependencies: + "@babel/runtime" "^7.11.2" + "@chain-registry/keplr" "1.0.0" + "@chain-registry/types" "^0.11.0" + "@chakra-ui/react" "^2.2.9" + "@cosmos-kit/core" "^0.19.3" + "@emotion/react" "^11" + "@emotion/styled" "^11" + "@keplr-wallet/types" "^0.11.3" + "@keplr-wallet/wc-client" "^0.11.3" + "@walletconnect/client" "1.8.0" + events "3.3.0" + react "18.2.0" + react-dom "18.2.0" + react-icons "^4.4.0" + +"@cosmos-kit/react@0.18.4": + version "0.18.4" + resolved "https://registry.npmjs.org/@cosmos-kit/react/-/react-0.18.4.tgz#f02cf5939a08595b8b7db82c388d3ccfb36be956" + integrity sha512-gRAPFE7Ln4CMiyKq3YxW5hqUbLvyqFAT1CUlvBFtb+wdrM3g+7JhdNLKZLV7I68gWYW3rO4ORC6jZxsgqmmsNg== dependencies: "@babel/runtime" "^7.11.2" "@chain-registry/types" "^0.11.0"