diff --git a/examples/injective/.babelrc b/examples/injective/.babelrc deleted file mode 100644 index 1ff94f7ed..000000000 --- a/examples/injective/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["next/babel"] -} diff --git a/examples/injective/.eslintrc.json b/examples/injective/.eslintrc.json deleted file mode 100644 index bffb357a7..000000000 --- a/examples/injective/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "next/core-web-vitals" -} diff --git a/examples/injective/.gitignore b/examples/injective/.gitignore index c87c9b392..ae45b5ee5 100644 --- a/examples/injective/.gitignore +++ b/examples/injective/.gitignore @@ -34,3 +34,6 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +*.next/* +*.yarn/* \ No newline at end of file diff --git a/examples/injective/.yarnrc.yml b/examples/injective/.yarnrc.yml deleted file mode 100644 index 3186f3f07..000000000 --- a/examples/injective/.yarnrc.yml +++ /dev/null @@ -1 +0,0 @@ -nodeLinker: node-modules diff --git a/examples/injective/CHANGELOG.md b/examples/injective/CHANGELOG.md index aa20dde41..e69de29bb 100644 --- a/examples/injective/CHANGELOG.md +++ b/examples/injective/CHANGELOG.md @@ -1,356 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# 2.1.0 (2024-10-08) - -**Note:** Version bump only for package @cosmology/injective - - - - - -## [2.0.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@2.0.0...@cosmology/connect-chain-with-telescope@2.0.1) (2024-04-06) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [2.0.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.8.3...@cosmology/connect-chain-with-telescope@2.0.0) (2024-04-06) - - -### Bug Fixes - -* custom filtering stake-tokens ([9cc3d24](https://github.com/cosmology-tech/create-cosmos-app/commit/9cc3d24055cc54358af9dc7d8a56856bd2ef0787)) -* use new combobox in asset-list ([68449d3](https://github.com/cosmology-tech/create-cosmos-app/commit/68449d39411c259f85eec07b7ae42f1a712c21a9)) - - - - - -## [1.8.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.8.2...@cosmology/connect-chain-with-telescope@1.8.3) (2024-01-20) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.8.2](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.8.1...@cosmology/connect-chain-with-telescope@1.8.2) (2024-01-20) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.8.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.8.0...@cosmology/connect-chain-with-telescope@1.8.1) (2024-01-19) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.8.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.8...@cosmology/connect-chain-with-telescope@1.8.0) (2024-01-19) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.8](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.7...@cosmology/connect-chain-with-telescope@1.7.8) (2024-01-19) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.7](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.6...@cosmology/connect-chain-with-telescope@1.7.7) (2024-01-19) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.6](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.5...@cosmology/connect-chain-with-telescope@1.7.6) (2023-09-27) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.5](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.4...@cosmology/connect-chain-with-telescope@1.7.5) (2023-09-27) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.4](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.3...@cosmology/connect-chain-with-telescope@1.7.4) (2023-07-30) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.2...@cosmology/connect-chain-with-telescope@1.7.3) (2023-07-14) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.2](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.1...@cosmology/connect-chain-with-telescope@1.7.2) (2023-07-14) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.7.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.7.0...@cosmology/connect-chain-with-telescope@1.7.1) (2023-06-28) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.7.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.6.3...@cosmology/connect-chain-with-telescope@1.7.0) (2023-04-12) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.6.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.6.2...@cosmology/connect-chain-with-telescope@1.6.3) (2023-03-28) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.6.2](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.6.1...@cosmology/connect-chain-with-telescope@1.6.2) (2023-02-15) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.6.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.6.0...@cosmology/connect-chain-with-telescope@1.6.1) (2023-01-11) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.6.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.5.4...@cosmology/connect-chain-with-telescope@1.6.0) (2022-12-17) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.5.4](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.5.3...@cosmology/connect-chain-with-telescope@1.5.4) (2022-11-25) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.5.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.5.2...@cosmology/connect-chain-with-telescope@1.5.3) (2022-11-21) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.5.2](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.5.1...@cosmology/connect-chain-with-telescope@1.5.2) (2022-11-17) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.5.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.5.0...@cosmology/connect-chain-with-telescope@1.5.1) (2022-11-17) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.5.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.4.0...@cosmology/connect-chain-with-telescope@1.5.0) (2022-11-15) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.4.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.3.0...@cosmology/connect-chain-with-telescope@1.4.0) (2022-11-14) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.3.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.2.0...@cosmology/connect-chain-with-telescope@1.3.0) (2022-11-10) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.2.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.1.0...@cosmology/connect-chain-with-telescope@1.2.0) (2022-11-09) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -# [1.1.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.0.7...@cosmology/connect-chain-with-telescope@1.1.0) (2022-11-08) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.0.7](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.0.6...@cosmology/connect-chain-with-telescope@1.0.7) (2022-11-05) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.0.6](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.0.5...@cosmology/connect-chain-with-telescope@1.0.6) (2022-11-05) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.0.5](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope@1.0.4...@cosmology/connect-chain-with-telescope@1.0.5) (2022-11-05) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## 1.0.4 (2022-11-01) - -**Note:** Version bump only for package @cosmology/connect-chain-with-telescope - - - - - -## [1.0.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@1.0.2...@cosmonauts/connect-chain-with-telescope@1.0.3) (2022-10-24) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -## [1.0.2](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@1.0.1...@cosmonauts/connect-chain-with-telescope@1.0.2) (2022-10-15) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -## [1.0.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@1.0.0...@cosmonauts/connect-chain-with-telescope@1.0.1) (2022-10-03) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -# [1.0.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@0.6.0...@cosmonauts/connect-chain-with-telescope@1.0.0) (2022-10-01) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -# [0.6.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@0.5.1...@cosmonauts/connect-chain-with-telescope@0.6.0) (2022-09-30) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -## [0.5.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@0.5.0...@cosmonauts/connect-chain-with-telescope@0.5.1) (2022-09-25) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -# [0.5.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@0.4.0...@cosmonauts/connect-chain-with-telescope@0.5.0) (2022-09-25) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -# [0.4.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@0.3.0...@cosmonauts/connect-chain-with-telescope@0.4.0) (2022-09-23) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -# [0.3.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@0.2.0...@cosmonauts/connect-chain-with-telescope@0.3.0) (2022-09-22) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -# [0.2.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope@0.1.9...@cosmonauts/connect-chain-with-telescope@0.2.0) (2022-09-22) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope - - - - - -## 0.1.9 (2022-09-11) - -**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope diff --git a/examples/injective/README.md b/examples/injective/README.md index 8c1363707..c8b801a98 100644 --- a/examples/injective/README.md +++ b/examples/injective/README.md @@ -1,5 +1,3 @@ -This is a Cosmos App project bootstrapped with [`create-cosmos-app`](https://github.com/cosmology-tech/create-cosmos-app). - ## Getting Started First, install the packages and run the development server: @@ -26,11 +24,11 @@ Checkout more videos for how to use various frontend tooling in the Cosmos! * https://cosmology.zone/learn -### Cosmos Kit +### Interchain Kit A wallet connector for the Cosmos ⚛️ -* https://github.com/cosmology-tech/cosmos-kit +* https://github.com/cosmology-tech/interchain-kit ### Telescope @@ -71,7 +69,7 @@ Checkout these related projects: * [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. * [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. * [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. -* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. +* [interchain-kit](https://github.com/cosmology-tech/interchain-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. * [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command. * [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. * [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain. diff --git a/examples/injective/api/apr.ts b/examples/injective/api/apr.ts deleted file mode 100644 index 467d538fd..000000000 --- a/examples/injective/api/apr.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { handleError } from './tokens'; - -export const getSuperfluidApr = async (): Promise => { - const url = 'https://api-osmosis.imperator.co/apr/v2/all'; - return fetch(url) - .then(handleError) - .then((res) => res.json()) - .then((res) => { - const superfluidApr = res - .find((apr: { apr_list: any[] }) => - apr.apr_list.find((a) => a.symbol === 'ECH') - ) - .apr_list.find( - (a: { symbol: string }) => a.symbol === 'ECH' - ).apr_superfluid; - - return superfluidApr; - }); -}; diff --git a/examples/injective/api/fees.ts b/examples/injective/api/fees.ts deleted file mode 100644 index d3755a738..000000000 --- a/examples/injective/api/fees.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { handleError } from './tokens'; - -export type Fee = { - pool_id: string; - volume_24h: number; - volume_7d: number; - fees_spent_24h: number; - fees_spent_7d: number; - fees_percentage: string; -}; - -export const getFees = async (): Promise => { - const url = 'https://api-osmosis.imperator.co/fees/v1/pools'; - return fetch(url) - .then(handleError) - .then((res) => res.json()) - .then((res) => res.data); -}; diff --git a/examples/injective/api/index.ts b/examples/injective/api/index.ts deleted file mode 100644 index 521e52804..000000000 --- a/examples/injective/api/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './apr'; -export * from './fees'; -export * from './tokens'; -export * from './prices'; -export * from './rewards'; diff --git a/examples/injective/api/prices.ts b/examples/injective/api/prices.ts deleted file mode 100644 index 3a1828332..000000000 --- a/examples/injective/api/prices.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { handleError } from './tokens'; - -type CoinGeckoId = string; -type CoinGeckoUSD = { usd: number }; -type CoinGeckoUSDResponse = Record; - -export const getPrices = async ( - geckoIds: string[] -): Promise => { - const url = `https://api.coingecko.com/api/v3/simple/price?ids=${geckoIds.join()}&vs_currencies=usd`; - - return fetch(url) - .then(handleError) - .then((res) => res.json()); -}; diff --git a/examples/injective/api/rewards.ts b/examples/injective/api/rewards.ts deleted file mode 100644 index 444c1744d..000000000 --- a/examples/injective/api/rewards.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { handleError } from './tokens'; - -type PoolReward = { - day_usd: number; - month_usd: number; - year_usd: number; -}; - -type Rewards = { - pools: { - [key: number]: PoolReward; - }; - total_day_usd: number; - total_month_usd: number; - total_year_usd: number; -}; - -export const getRewards = async (address: string): Promise => { - const url = `https://api-osmosis-chain.imperator.co/lp/v1/rewards/estimation/${address}`; - return fetch(url) - .then(handleError) - .then((res) => res.json()); -}; diff --git a/examples/injective/api/tokens.ts b/examples/injective/api/tokens.ts deleted file mode 100644 index de31cb9b9..000000000 --- a/examples/injective/api/tokens.ts +++ /dev/null @@ -1,25 +0,0 @@ -export type Token = { - price: number; - denom: string; - symbol: string; - liquidity: number; - volume_24h: number; - volume_24h_change: number; - name: string; - price_24h_change: number; - price_7d_change: number; - exponent: number; - display: string; -}; - -export const handleError = (resp: Response) => { - if (!resp.ok) throw Error(resp.statusText); - return resp; -}; - -export const getTokens = async (): Promise => { - const url = 'https://api-osmosis.imperator.co/tokens/v2/all'; - return fetch(url) - .then(handleError) - .then((res) => res.json()); -}; diff --git a/examples/injective/components/Main.tsx b/examples/injective/components/Main.tsx new file mode 100644 index 000000000..56803830a --- /dev/null +++ b/examples/injective/components/Main.tsx @@ -0,0 +1,23 @@ +import { Box, Text } from '@interchain-ui/react'; +import { useChain } from "@interchain-kit/react"; +import { defaultChainName } from "@/config"; +import { WalletState } from '@interchain-kit/core' +import dynamic from 'next/dynamic'; + +const SendMsg = dynamic(() => import('./SendMsg'), { + ssr: false, +}); + +export function Main() { + const { status } = useChain(defaultChainName); + + return ( + status === WalletState.Connected ? + : + + + Please connect to your wallet. + + + ); +} \ No newline at end of file diff --git a/examples/injective/components/SendMsg.tsx b/examples/injective/components/SendMsg.tsx new file mode 100644 index 000000000..d2ebbc890 --- /dev/null +++ b/examples/injective/components/SendMsg.tsx @@ -0,0 +1,105 @@ +import { Box, Text, Button, Link } from "@interchain-ui/react"; +import { useState } from "react"; +import { useChain } from "@interchain-kit/react"; +import { defaultAssetList, defaultChain, defaultChainName } from "@/config"; +import useBalance from "@/hooks/useBalance"; +import { toEncoders, toConverters } from '@interchainjs/cosmos/utils'; +import { MsgSend } from '@interchainjs/cosmos-types/cosmos/bank/v1beta1/tx'; +import { cosmos } from '../src/codegen'; + +export default function SendMsg() { + const coin = defaultAssetList?.assets[0]; + + const denom = coin!.base! + + const COIN_DISPLAY_EXPONENT = coin!.denomUnits.find( + (unit) => unit.denom === coin!.display + )?.exponent as number; + + const chain = defaultChain + const txPage = chain?.explorers?.[0].txPage + + const { address, signingClient, isLoading } = useChain(defaultChainName); + signingClient?.addEncoders(toEncoders(MsgSend)); + signingClient?.addConverters(toConverters(MsgSend)); + + const [sending, setSending] = useState(false); + const [txHash, setTxHash] = useState(null); + const [error, setError] = useState(null); + + const { + balance, + isBalanceLoaded, + isFetchingBalance, + refetchBalance, + } = useBalance({ + address, + }) + + const handleSend = async () => { + if (sending || isLoading) return; + + setError(null); + setTxHash(null); + setSending(true); + + const fee = { + amount: [{ + denom, + amount: '2500', + }], + gas: "1000000", + }; + const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl + const msgs = [send({ + fromAddress: address, + toAddress: address, + amount: [{ denom, amount: '1' }] + })] + try { + const data = await signingClient.signAndBroadcast( + address, msgs, fee, 'using interchainjs' + ) as any + console.log('onSuccess', data) + if (data.code===0) { + setTimeout(() => { + refetchBalance() + setTxHash(data.hash); + setSending(false); + }, 4000) + } else { + setError(data.rawLog||JSON.stringify(data||{})); + setSending(false); + } + } catch (error:any) { + console.log('onError', error) + setError(error?.message || 'Unknown error'); + setSending(false); + } + } + + return ( + + + Balance: {isFetchingBalance?'--':(balance?.toFixed(COIN_DISPLAY_EXPONENT))} {coin?.symbol} + + + + + {txHash && + Details: + + {txPage?.replace('${txHash}', txHash)!} + + } + {error && + Error: + {error} + } + + ); +} \ No newline at end of file diff --git a/examples/injective/components/card.tsx b/examples/injective/components/card.tsx deleted file mode 100644 index 4d3716147..000000000 --- a/examples/injective/components/card.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { useChain } from "@cosmos-kit/react"; -import { - Box, - GridItem, - Icon, - Stack, - useColorModeValue, -} from "@chakra-ui/react"; -import { MouseEventHandler, useEffect } from "react"; -import { FiAlertTriangle } from "react-icons/fi"; -import { - Astronaut, - Error, - Connected, - ConnectedShowAddress, - ConnectedUserInfo, - Connecting, - ConnectStatusWarn, - CopyAddressBtn, - Disconnected, - NotExist, - Rejected, - RejectedWarn, - WalletConnectComponent, -} from "."; - -export const WalletCardSection = ({ chainName }: { chainName: string }) => { - const { connect, openView, status, username, address, message, wallet } = - useChain(chainName); - - // Events - const onClickConnect: MouseEventHandler = async (e) => { - e.preventDefault(); - await connect(); - }; - - const onClickOpenView: MouseEventHandler = (e) => { - e.preventDefault(); - openView(); - }; - - // Components - const connectWalletButton = ( - - } - connecting={} - connected={ - - } - rejected={} - error={} - notExist={ - - } - /> - ); - - const connectWalletWarn = ( - } - wordOfWarning={`${wallet?.prettyName}: ${message}`} - /> - } - error={ - } - wordOfWarning={`${wallet?.prettyName}: ${message}`} - /> - } - /> - ); - - const userInfo = username && ( - } /> - ); - const addressBtn = ( - } - /> - ); - - return ( - <> - {connectWalletWarn && {connectWalletWarn}} - - - {userInfo} - {addressBtn} - - {connectWalletButton} - - - - - ); -}; diff --git a/examples/injective/components/common/Footer.tsx b/examples/injective/components/common/Footer.tsx new file mode 100644 index 000000000..abdb60da5 --- /dev/null +++ b/examples/injective/components/common/Footer.tsx @@ -0,0 +1,141 @@ +import { Box, Link, Text, Icon, Stack, Divider, useColorModeValue } from '@interchain-ui/react'; +import { dependencies, products, Project } from '@/config'; + +function Product({ name, desc, link }: Project) { + return ( + + + + {name} → + + + {desc} + + + + ); +} + +function Dependency({ name, desc, link }: Project) { + return ( + + + + + + + + + {name} + + + {desc} + + + + + ); +} + +export function Footer() { + return ( + <> + + {products.map((product) => ( + + ))} + + + {dependencies.map((dependency) => ( + + ))} + + + + + + Built with + + Cosmology + + + + ); +} \ No newline at end of file diff --git a/examples/injective/components/common/Header.tsx b/examples/injective/components/common/Header.tsx new file mode 100644 index 000000000..b036a25e1 --- /dev/null +++ b/examples/injective/components/common/Header.tsx @@ -0,0 +1,72 @@ +import { Link, Box, Button, Icon, Text, useTheme, useColorModeValue } from '@interchain-ui/react'; +import { dependencies } from '@/config'; + +const stacks = ['Interchain Kit', 'Next.js']; + +const dependency = dependencies[0]; + +export function Header() { + const { theme, setTheme } = useTheme(); + + const toggleColorMode = () => { + setTheme(theme === 'light' ? 'dark' : 'light'); + }; + + return ( + <> + + + + + + + Interchain + + + + Welcome to  + + + {stacks.join(' + ')} + {' + '} + + + {dependency.name} + + + + + + ); +} \ No newline at end of file diff --git a/examples/injective/components/common/Layout.tsx b/examples/injective/components/common/Layout.tsx new file mode 100644 index 000000000..af6777c01 --- /dev/null +++ b/examples/injective/components/common/Layout.tsx @@ -0,0 +1,20 @@ +import Head from 'next/head'; +import { Toaster, Container } from '@interchain-ui/react'; +import { Header } from './Header'; +import { Footer } from './Footer'; + +export function Layout({ children }: { children: React.ReactNode }) { + return ( + + + Interchain-Kit Demo + + + +
+ {children} + +