From 8a660d28bbeebb3ea476d20469ca9f831b3910fa Mon Sep 17 00:00:00 2001 From: JunLiu93 <853480121@qq.com> Date: Mon, 10 Oct 2022 12:20:25 +0800 Subject: [PATCH 1/4] modify event handler --- examples/contracts/components/wallet.tsx | 13 ++++++++----- examples/juno/components/wallet.tsx | 17 +++++++++++------ examples/osmosis/components/wallet.tsx | 13 ++++++++----- examples/send-tokens/components/wallet.tsx | 13 ++++++++----- examples/stargaze/components/wallet.tsx | 13 ++++++++----- examples/tailwindcss/components/wallet.tsx | 13 ++++++++----- examples/telescope/components/wallet.tsx | 13 ++++++++----- templates/connect-chain/components/wallet.tsx | 13 ++++++++----- .../connect-multi-chain/components/wallet.tsx | 18 +++++++++--------- 9 files changed, 76 insertions(+), 50 deletions(-) diff --git a/examples/contracts/components/wallet.tsx b/examples/contracts/components/wallet.tsx index d12be8a6f..8df1de9e0 100644 --- a/examples/contracts/components/wallet.tsx +++ b/examples/contracts/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -73,10 +74,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +82,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/juno/components/wallet.tsx b/examples/juno/components/wallet.tsx index d12be8a6f..26b467df2 100644 --- a/examples/juno/components/wallet.tsx +++ b/examples/juno/components/wallet.tsx @@ -36,13 +36,16 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, + chains, walletStatus, username, address, message, + currentChainName: chainName, currentWalletName, - chains + currentWallet } = walletManager; const chainOptions = useMemo( @@ -73,10 +76,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +84,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/osmosis/components/wallet.tsx b/examples/osmosis/components/wallet.tsx index d12be8a6f..8df1de9e0 100644 --- a/examples/osmosis/components/wallet.tsx +++ b/examples/osmosis/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -73,10 +74,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +82,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/send-tokens/components/wallet.tsx b/examples/send-tokens/components/wallet.tsx index d12be8a6f..8df1de9e0 100644 --- a/examples/send-tokens/components/wallet.tsx +++ b/examples/send-tokens/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -73,10 +74,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +82,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/stargaze/components/wallet.tsx b/examples/stargaze/components/wallet.tsx index d12be8a6f..8df1de9e0 100644 --- a/examples/stargaze/components/wallet.tsx +++ b/examples/stargaze/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -73,10 +74,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +82,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/tailwindcss/components/wallet.tsx b/examples/tailwindcss/components/wallet.tsx index d12be8a6f..8df1de9e0 100644 --- a/examples/tailwindcss/components/wallet.tsx +++ b/examples/tailwindcss/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -73,10 +74,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +82,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/telescope/components/wallet.tsx b/examples/telescope/components/wallet.tsx index d12be8a6f..8df1de9e0 100644 --- a/examples/telescope/components/wallet.tsx +++ b/examples/telescope/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -73,10 +74,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +82,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/templates/connect-chain/components/wallet.tsx b/templates/connect-chain/components/wallet.tsx index d12be8a6f..8df1de9e0 100644 --- a/templates/connect-chain/components/wallet.tsx +++ b/templates/connect-chain/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -73,10 +74,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -84,6 +82,11 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + // Components const connectWalletButton = ( { } connecting={} connected={ - + } rejected={} error={} diff --git a/templates/connect-multi-chain/components/wallet.tsx b/templates/connect-multi-chain/components/wallet.tsx index d0a03fafd..4b2ec58fa 100644 --- a/templates/connect-multi-chain/components/wallet.tsx +++ b/templates/connect-multi-chain/components/wallet.tsx @@ -36,6 +36,7 @@ export const WalletSection = () => { const { connect, openView, + disconnect, setCurrentChain, walletStatus, username, @@ -68,10 +69,7 @@ export const WalletSection = () => { // Events const onClickConnect: MouseEventHandler = async (e) => { e.preventDefault(); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; const onClickOpenView: MouseEventHandler = (e) => { @@ -79,14 +77,16 @@ export const WalletSection = () => { openView(); }; + const onClickDisconnect: MouseEventHandler = async (e) => { + e.preventDefault(); + await disconnect(); + }; + const onChainChange: handleSelectChainDropdown = async ( selectedValue: ChainOption | null ) => { setCurrentChain(selectedValue?.chainName); - openView(); - if (currentWalletName) { - await connect(); - } + await connect(); }; // Components @@ -98,7 +98,7 @@ export const WalletSection = () => { } connecting={} connected={ - + } rejected={} error={} From 46011c0bf6f1a3f413708fa4faf260a9f7937006 Mon Sep 17 00:00:00 2001 From: JunLiu93 <853480121@qq.com> Date: Tue, 11 Oct 2022 11:31:39 +0800 Subject: [PATCH 2/4] update --- examples/contracts/components/wallet.tsx | 2 +- examples/juno/components/wallet.tsx | 2 +- examples/osmosis/components/wallet.tsx | 2 +- examples/send-tokens/components/wallet.tsx | 2 +- examples/stargaze/components/wallet.tsx | 2 +- examples/tailwindcss/components/wallet.tsx | 2 +- examples/telescope/components/wallet.tsx | 2 +- package.json | 3 ++- templates/connect-chain/components/wallet.tsx | 2 +- templates/connect-multi-chain/components/wallet.tsx | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/contracts/components/wallet.tsx b/examples/contracts/components/wallet.tsx index 8df1de9e0..efc913a8d 100644 --- a/examples/contracts/components/wallet.tsx +++ b/examples/contracts/components/wallet.tsx @@ -96,7 +96,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/juno/components/wallet.tsx b/examples/juno/components/wallet.tsx index 26b467df2..77af5d759 100644 --- a/examples/juno/components/wallet.tsx +++ b/examples/juno/components/wallet.tsx @@ -98,7 +98,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/osmosis/components/wallet.tsx b/examples/osmosis/components/wallet.tsx index 8df1de9e0..efc913a8d 100644 --- a/examples/osmosis/components/wallet.tsx +++ b/examples/osmosis/components/wallet.tsx @@ -96,7 +96,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/send-tokens/components/wallet.tsx b/examples/send-tokens/components/wallet.tsx index 8df1de9e0..efc913a8d 100644 --- a/examples/send-tokens/components/wallet.tsx +++ b/examples/send-tokens/components/wallet.tsx @@ -96,7 +96,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/stargaze/components/wallet.tsx b/examples/stargaze/components/wallet.tsx index 8df1de9e0..efc913a8d 100644 --- a/examples/stargaze/components/wallet.tsx +++ b/examples/stargaze/components/wallet.tsx @@ -96,7 +96,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/tailwindcss/components/wallet.tsx b/examples/tailwindcss/components/wallet.tsx index 8df1de9e0..efc913a8d 100644 --- a/examples/tailwindcss/components/wallet.tsx +++ b/examples/tailwindcss/components/wallet.tsx @@ -96,7 +96,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/examples/telescope/components/wallet.tsx b/examples/telescope/components/wallet.tsx index 8df1de9e0..efc913a8d 100644 --- a/examples/telescope/components/wallet.tsx +++ b/examples/telescope/components/wallet.tsx @@ -96,7 +96,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/package.json b/package.json index 2eaccb688..8119f9f0b 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", + "update": "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 8df1de9e0..efc913a8d 100644 --- a/templates/connect-chain/components/wallet.tsx +++ b/templates/connect-chain/components/wallet.tsx @@ -96,7 +96,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { } connecting={} connected={ - + } rejected={} error={} diff --git a/templates/connect-multi-chain/components/wallet.tsx b/templates/connect-multi-chain/components/wallet.tsx index 4b2ec58fa..2a98a2300 100644 --- a/templates/connect-multi-chain/components/wallet.tsx +++ b/templates/connect-multi-chain/components/wallet.tsx @@ -98,7 +98,7 @@ export const WalletSection = () => { } connecting={} connected={ - + } rejected={} error={} From dc58552f3d7d50860dcb6fe690204f008ee32616 Mon Sep 17 00:00:00 2001 From: JunLiu93 <853480121@qq.com> Date: Wed, 12 Oct 2022 19:50:00 +0800 Subject: [PATCH 3/4] update target --- examples/contracts/components/wallet.tsx | 7 ----- examples/contracts/package.json | 2 +- examples/contracts/tsconfig.json | 20 ++++++++++---- examples/juno/components/wallet.tsx | 7 ----- examples/juno/package.json | 6 ++--- examples/osmosis-cosmwasm/package.json | 6 ++--- examples/osmosis/components/wallet.tsx | 7 ----- examples/osmosis/package.json | 6 ++--- examples/send-tokens/components/wallet.tsx | 7 ----- examples/send-tokens/package.json | 6 ++--- examples/stargaze/components/wallet.tsx | 7 ----- examples/stargaze/package.json | 6 ++--- examples/tailwindcss/components/wallet.tsx | 3 +-- examples/tailwindcss/package.json | 6 ++--- examples/tailwindcss/tsconfig.json | 20 ++++++++++---- examples/telescope/components/wallet.tsx | 7 ----- examples/telescope/package.json | 2 +- examples/telescope/tsconfig.json | 20 ++++++++++---- templates/connect-chain/components/wallet.tsx | 7 ----- templates/connect-chain/package.json | 6 ++--- templates/connect-chain/tsconfig.json | 20 ++++++++++---- .../connect-multi-chain/components/wallet.tsx | 7 ----- templates/connect-multi-chain/package.json | 6 ++--- templates/connect-multi-chain/tsconfig.json | 20 ++++++++++---- yarn.lock | 26 +++++++++---------- 25 files changed, 115 insertions(+), 122 deletions(-) diff --git a/examples/contracts/components/wallet.tsx b/examples/contracts/components/wallet.tsx index efc913a8d..e035cb95b 100644 --- a/examples/contracts/components/wallet.tsx +++ b/examples/contracts/components/wallet.tsx @@ -36,7 +36,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, @@ -81,12 +80,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - // Components const connectWalletButton = ( { const { connect, openView, - disconnect, setCurrentChain, chains, walletStatus, @@ -83,12 +82,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - // Components const connectWalletButton = ( { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, @@ -81,12 +80,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - // Components const connectWalletButton = ( { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, @@ -81,12 +80,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - // Components const connectWalletButton = ( { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, @@ -81,12 +80,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - // Components const connectWalletButton = ( { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, diff --git a/examples/tailwindcss/package.json b/examples/tailwindcss/package.json index d0020bf22..56b3b34ad 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.1", + "@cosmos-kit/keplr": "0.19.1", + "@cosmos-kit/react": "0.18.2", "@emotion/react": "11.10.4", "@emotion/styled": "11.10.4", "@headlessui/react": "^1.7.2", 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 efc913a8d..e035cb95b 100644 --- a/examples/telescope/components/wallet.tsx +++ b/examples/telescope/components/wallet.tsx @@ -36,7 +36,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, @@ -81,12 +80,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - // Components const connectWalletButton = ( { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, @@ -81,12 +80,6 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - // Components const connectWalletButton = ( { const { connect, openView, - disconnect, setCurrentChain, walletStatus, username, @@ -76,12 +75,6 @@ export const WalletSection = () => { e.preventDefault(); openView(); }; - - const onClickDisconnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await disconnect(); - }; - const onChainChange: handleSelectChainDropdown = async ( selectedValue: ChainOption | null ) => { diff --git a/templates/connect-multi-chain/package.json b/templates/connect-multi-chain/package.json index fc5ade45b..8590e58b2 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.1", + "@cosmos-kit/keplr": "0.19.1", + "@cosmos-kit/react": "0.18.2", "@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..eca1817b6 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.1", "@cosmos-kit/core@^0.19.1": + version "0.19.1" + resolved "https://registry.npmjs.org/@cosmos-kit/core/-/core-0.19.1.tgz#fe9ceaed7d15dc592ef01fc9a2976629511f9f70" + integrity sha512-n7X7gxpbvYw9NFEbxf7kgL9sVlCD6z9++2IrrcieQm/DUCRNBtI6v80nekvvgWwOyOYsUtVa+q2m9gziiT/NJQ== 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.1": + version "0.19.1" + resolved "https://registry.npmjs.org/@cosmos-kit/keplr/-/keplr-0.19.1.tgz#f637979bf0c4eab584e92aa4738ea2029d5c1528" + integrity sha512-JrGs/Z6R2EsR8SzZrp2SFUmu2a4a+SZQPN+jv1sz0yIC9qD5nvP/nJX/EJ03YaXHAD1RAhfPG0Nb1PAAzM9uhA== 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.1" "@emotion/react" "^11" "@emotion/styled" "^11" "@keplr-wallet/types" "^0.11.3" @@ -2980,10 +2980,10 @@ 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/react@0.18.2", "@cosmos-kit/react@^0.18.2": + version "0.18.2" + resolved "https://registry.npmjs.org/@cosmos-kit/react/-/react-0.18.2.tgz#4ca69f9c82bb3bc135d1ede32396127f8ed2766d" + integrity sha512-zm/XqjiHgmx1wUNfxhwiMpBBqakfp7UEdA0wBPDpquGa8zXsFhMEKT/6yKeXvZrxFwd9w5hJeEbBBlcNdyPBFw== dependencies: "@babel/runtime" "^7.11.2" "@chain-registry/types" "^0.11.0" From a0ef640bb7049653850f011573b4128d090c07e6 Mon Sep 17 00:00:00 2001 From: JunLiu93 <853480121@qq.com> Date: Thu, 13 Oct 2022 22:50:46 +0800 Subject: [PATCH 4/4] update --- examples/contracts/components/wallet.tsx | 27 +- examples/contracts/config/defaults.ts | 52 ++++ examples/contracts/config/index.ts | 1 + examples/contracts/package.json | 2 +- examples/contracts/pages/_app.tsx | 6 +- examples/contracts/pages/index.tsx | 58 +--- examples/juno/components/wallet.tsx | 31 +- examples/juno/config/defaults.ts | 12 + examples/juno/config/index.ts | 1 + examples/juno/package.json | 6 +- examples/juno/pages/_app.tsx | 6 +- examples/juno/pages/index.tsx | 21 +- .../osmosis-cosmwasm/components/wallet.tsx | 31 +- examples/osmosis-cosmwasm/config/defaults.ts | 13 + examples/osmosis-cosmwasm/config/index.ts | 1 + examples/osmosis-cosmwasm/package.json | 6 +- examples/osmosis-cosmwasm/pages/_app.tsx | 11 +- examples/osmosis-cosmwasm/pages/index.tsx | 20 +- examples/osmosis/components/wallet.tsx | 27 +- examples/osmosis/config/defaults.ts | 55 ++++ examples/osmosis/config/index.ts | 1 + examples/osmosis/package.json | 6 +- examples/osmosis/pages/_app.tsx | 7 +- examples/osmosis/pages/index.tsx | 62 +--- examples/send-tokens/components/wallet.tsx | 27 +- examples/send-tokens/config/defaults.ts | 54 ++++ examples/send-tokens/config/index.ts | 1 + examples/send-tokens/package.json | 6 +- examples/send-tokens/pages/_app.tsx | 6 +- examples/send-tokens/pages/index.tsx | 61 +--- examples/stargaze/components/wallet.tsx | 27 +- examples/stargaze/config/defaults.ts | 54 ++++ examples/stargaze/config/index.ts | 1 + examples/stargaze/package.json | 6 +- examples/stargaze/pages/_app.tsx | 7 +- examples/stargaze/pages/index.tsx | 61 +--- examples/tailwindcss/components/wallet.tsx | 264 ++++++++++-------- examples/tailwindcss/config/defaults.ts | 1 + examples/tailwindcss/config/index.ts | 1 + examples/tailwindcss/package.json | 6 +- examples/tailwindcss/pages/_app.tsx | 5 +- examples/tailwindcss/pages/index.tsx | 3 +- examples/telescope/components/wallet.tsx | 27 +- examples/telescope/config/defaults.ts | 54 ++++ examples/telescope/config/index.ts | 1 + examples/telescope/package.json | 2 +- examples/telescope/pages/_app.tsx | 6 +- examples/telescope/pages/index.tsx | 57 +--- package.json | 2 +- templates/connect-chain/components/wallet.tsx | 27 +- templates/connect-chain/config/defaults.ts | 1 + templates/connect-chain/config/index.ts | 1 + templates/connect-chain/package.json | 6 +- templates/connect-chain/pages/[chainName].tsx | 104 ------- templates/connect-chain/pages/_app.tsx | 6 +- templates/connect-chain/pages/index.tsx | 3 +- .../components/react/chain-dropdown.tsx | 1 - .../connect-multi-chain/components/wallet.tsx | 1 + templates/connect-multi-chain/package.json | 6 +- yarn.lock | 46 ++- 60 files changed, 672 insertions(+), 733 deletions(-) create mode 100644 examples/contracts/config/defaults.ts create mode 100644 examples/juno/config/defaults.ts create mode 100644 examples/osmosis-cosmwasm/config/defaults.ts create mode 100644 examples/osmosis/config/defaults.ts create mode 100644 examples/send-tokens/config/defaults.ts create mode 100644 examples/stargaze/config/defaults.ts create mode 100644 examples/tailwindcss/config/defaults.ts create mode 100644 examples/telescope/config/defaults.ts create mode 100644 templates/connect-chain/config/defaults.ts delete mode 100644 templates/connect-chain/pages/[chainName].tsx diff --git a/examples/contracts/components/wallet.tsx b/examples/contracts/components/wallet.tsx index e035cb95b..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,16 +62,12 @@ 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(); @@ -80,6 +78,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; + // Components const connectWalletButton = ( 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 6d926ae01..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.2", + "@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/juno/components/wallet.tsx b/examples/juno/components/wallet.tsx index 819c51aef..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,28 +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, - chains, walletStatus, username, address, message, - currentChainName: chainName, + currentChainName, currentWalletName, - currentWallet + 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; @@ -62,16 +62,12 @@ 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(); @@ -82,6 +78,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; + // Components const connectWalletButton = ( 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 93e961391..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.1", - "@cosmos-kit/keplr": "0.19.1", - "@cosmos-kit/react": "0.18.2", + "@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 a81286cee..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.1", - "@cosmos-kit/keplr": "0.19.1", - "@cosmos-kit/react": "0.18.2", + "@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 e035cb95b..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,16 +62,12 @@ 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(); @@ -80,6 +78,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; + // Components const connectWalletButton = ( 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 df0298b18..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.1", - "@cosmos-kit/keplr": "0.19.1", - "@cosmos-kit/react": "0.18.2", + "@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 e035cb95b..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,16 +62,12 @@ 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(); @@ -80,6 +78,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; + // Components const connectWalletButton = ( 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 8b2efdab3..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.1", - "@cosmos-kit/keplr": "0.19.1", - "@cosmos-kit/react": "0.18.2", + "@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 e035cb95b..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,16 +62,12 @@ 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(); @@ -80,6 +78,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; + // Components const connectWalletButton = ( 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 e44fbe7ad..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.1", - "@cosmos-kit/keplr": "0.19.1", - "@cosmos-kit/react": "0.18.2", + "@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 77290c75a..ecb7170b5 100644 --- a/examples/tailwindcss/components/wallet.tsx +++ b/examples/tailwindcss/components/wallet.tsx @@ -1,56 +1,72 @@ -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) => { @@ -59,90 +75,102 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { }; const onClickOpenView: MouseEventHandler = (e) => { - e.preventDefault() - openView() - } - - const _renderConnectButton = useMemo(() => { - // Spinner - if (walletStatus === WalletStatus.Connecting) { - return ( - - ) - } + e.preventDefault(); + openView(); + }; - let onClick - if ( - walletStatus === WalletStatus.Disconnected || - walletStatus === WalletStatus.Rejected - ) - onClick = onClickConnect - else onClick = onClickOpenView + // Components + const connectWalletButton = ( + + } + connecting={} + connected={ + + } + rejected={} + error={} + notExist={ + + } + /> + ); - const buttonData = buttons[walletStatus] + const connectWalletWarn = ( + } + wordOfWarning={`${getWalletPrettyName( + currentWalletName + )}: ${message}`} + /> + } + error={ + } + wordOfWarning={`${getWalletPrettyName( + currentWalletName + )}: ${message}`} + /> + } + /> + ); - return ( - - ) - }, [onClickConnect, onClickOpenView, 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 56b3b34ad..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.1", - "@cosmos-kit/keplr": "0.19.1", - "@cosmos-kit/react": "0.18.2", + "@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/telescope/components/wallet.tsx b/examples/telescope/components/wallet.tsx index e035cb95b..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,16 +62,12 @@ 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(); @@ -80,6 +78,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; + // Components const connectWalletButton = ( 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 8032a2d51..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.2", + "@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/package.json b/package.json index 8119f9f0b..f4d7517b5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint": "lerna run lint", "format": "lerna run format", "test": "lerna run test --stream", - "update": "yarn upgrade-interactive --latest" + "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 e035cb95b..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,16 +62,12 @@ 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(); @@ -80,6 +78,7 @@ export const WalletSection = ({ chainName }: { chainName?: ChainName }) => { e.preventDefault(); openView(); }; + // Components const connectWalletButton = ( - - 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() { - + { e.preventDefault(); openView(); }; + const onChainChange: handleSelectChainDropdown = async ( selectedValue: ChainOption | null ) => { diff --git a/templates/connect-multi-chain/package.json b/templates/connect-multi-chain/package.json index 8590e58b2..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.1", - "@cosmos-kit/keplr": "0.19.1", - "@cosmos-kit/react": "0.18.2", + "@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/yarn.lock b/yarn.lock index eca1817b6..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.1", "@cosmos-kit/core@^0.19.1": - version "0.19.1" - resolved "https://registry.npmjs.org/@cosmos-kit/core/-/core-0.19.1.tgz#fe9ceaed7d15dc592ef01fc9a2976629511f9f70" - integrity sha512-n7X7gxpbvYw9NFEbxf7kgL9sVlCD6z9++2IrrcieQm/DUCRNBtI6v80nekvvgWwOyOYsUtVa+q2m9gziiT/NJQ== +"@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.1": - version "0.19.1" - resolved "https://registry.npmjs.org/@cosmos-kit/keplr/-/keplr-0.19.1.tgz#f637979bf0c4eab584e92aa4738ea2029d5c1528" - integrity sha512-JrGs/Z6R2EsR8SzZrp2SFUmu2a4a+SZQPN+jv1sz0yIC9qD5nvP/nJX/EJ03YaXHAD1RAhfPG0Nb1PAAzM9uhA== +"@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.1" + "@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.2", "@cosmos-kit/react@^0.18.2": - version "0.18.2" - resolved "https://registry.npmjs.org/@cosmos-kit/react/-/react-0.18.2.tgz#4ca69f9c82bb3bc135d1ede32396127f8ed2766d" - integrity sha512-zm/XqjiHgmx1wUNfxhwiMpBBqakfp7UEdA0wBPDpquGa8zXsFhMEKT/6yKeXvZrxFwd9w5hJeEbBBlcNdyPBFw== +"@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"