diff --git a/app/(private)/burn/page.tsx b/app/(private)/burn/page.tsx index 650cfe9..e49d861 100644 --- a/app/(private)/burn/page.tsx +++ b/app/(private)/burn/page.tsx @@ -5,7 +5,7 @@ import GemWithFrame from '@/components/gem/gemWithFrame' import { initList } from '@/constants' import { Bangkok, Context } from '@/provider' import { burn } from '@/services' -import { useChain } from '@cosmos-kit/react' +import { useChain, useWallet } from '@cosmos-kit/react' import { Dropdown, DropdownItem, DropdownMenu, DropdownTrigger, useDisclosure } from '@nextui-org/react' import BigNumber from 'bignumber.js' import Immutable, { Map } from 'immutable' @@ -21,7 +21,8 @@ import ResultModal from './components/prizeModal' export default function Home() { const config = getConfig() const { assets, lastAssetsUpdate, fetchAssets, setBlackListId } = useContext(Context) - const { address, chain, getSigningCosmWasmClient } = useChain(config.COSMOSKIT_CHAINKEY) + const { address, chain, getSigningCosmWasmClient, chainWallet } = useChain(config.COSMOSKIT_CHAINKEY) + const { wallet } = useWallet() const { isOpen, onOpen, onOpenChange, onClose } = useDisclosure() const [loading, setLoading] = useState(false) const [selectedColorKey, setSelectedColorKey] = useState(new Set(['all_colors'])) diff --git a/app/(public)/connect/page.tsx b/app/(public)/connect/page.tsx index ec68177..56cdc36 100644 --- a/app/(public)/connect/page.tsx +++ b/app/(public)/connect/page.tsx @@ -24,11 +24,6 @@ export default function Connect() { const { connect, address, chain, closeView, wallet, disconnect } = useChain(config.COSMOSKIT_CHAINKEY) const { status: globalStatus, mainWallet } = useWallet() const { refetch } = useQuery(GET_USER_DATA) - useEffect(() => { - if (account?.wallet_address && address == account.wallet_address) { - redirect('/') - } - }, [account?.wallet_address, address]) const connectXHandler = () => { window.location.href = `${config.REST_API_ENDPOINT}/auth/twitter` } diff --git a/provider/index.tsx b/provider/index.tsx index 365e31c..3fafe87 100644 --- a/provider/index.tsx +++ b/provider/index.tsx @@ -7,6 +7,8 @@ import { Token } from '@/model/token' import { GET_ASSETS, GET_BALANCE, GET_USER_DATA, applyCode } from '@/services' import { wallets as c98Mobile } from '@/services/c98MobileWallet' import { getGasPriceByChain } from '@/utils' +import { Euphoria } from '@/utils/cosmos-kit/chains' +import { EuphoriaAsset } from '@/utils/cosmos-kit/assets' import { getItem, removeItem, setItem } from '@/utils/localStorage' import { ApolloClient, ApolloProvider, HttpLink, InMemoryCache, NormalizedCacheObject, split } from '@apollo/client' import { setContext } from '@apollo/client/link/context' @@ -84,42 +86,8 @@ export const Mori = localFont({ }, ], }) -const testnetChains: Chain[] = [ - { - bech32_prefix: 'aura', - chain_id: 'aura_6321-3', - chain_name: 'auratestnet', - network_type: 'testnet', - pretty_name: 'Aura Euphoria Network', - slip44: 118, - status: 'live', - explorers: [ - { - url: 'https://rpc.euphoria.aura.network', - }, - { - url: 'https://lcd.euphoria.aura.network', - }, - ], - }, -] -const testnetAssets: AssetList[] = [ - { - assets: [ - { - base: 'ueaura', - denom_units: [ - { denom: 'ueaura', exponent: 0 }, - { denom: 'eaura', exponent: 6 }, - ], - display: 'eaura', - name: 'Aura', - symbol: 'EAURA', - }, - ], - chain_name: 'auratestnet', - }, -] +const testnetChains: Chain[] = [Euphoria] +const testnetAssets: AssetList[] = [EuphoriaAsset] const signerOptions = { preferredSignType: (chain: Chain) => { diff --git a/utils/cosmos-kit/assets.tsx b/utils/cosmos-kit/assets.tsx new file mode 100644 index 0000000..dbe9eec --- /dev/null +++ b/utils/cosmos-kit/assets.tsx @@ -0,0 +1,34 @@ +import { AssetList } from '@chain-registry/types' +export const EuphoriaAsset: AssetList = { + $schema: '../assetlist.schema.json', + chain_name: 'auratestnet', + assets: [ + { + description: 'The native token of Aura Test Network', + denom_units: [ + { + denom: 'ueaura', + exponent: 0, + }, + { + denom: 'eaura', + exponent: 6, + }, + ], + base: 'ueaura', + name: 'EAura', + display: 'eaura', + symbol: 'EAURA', + logo_URIs: { + png: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.png', + svg: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.svg', + }, + images: [ + { + png: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.png', + svg: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.svg', + }, + ], + }, + ], +} diff --git a/utils/cosmos-kit/chains.tsx b/utils/cosmos-kit/chains.tsx new file mode 100644 index 0000000..6db93f8 --- /dev/null +++ b/utils/cosmos-kit/chains.tsx @@ -0,0 +1,115 @@ +import { Chain } from '@chain-registry/types' +export const Euphoria: Chain = { + $schema: '../chain.schema.json', + chain_name: 'auratestnet', + status: 'live', + network_type: 'testnet', + website: 'https://aura.network/', + pretty_name: 'Aura Euphoria Network', + chain_id: 'aura_6321-3', + bech32_prefix: 'aura', + daemon_name: 'aurad', + node_home: '$HOME/.aura', + key_algos: ['secp256k1'], + slip44: 118, + fees: { + fee_tokens: [ + { + denom: 'ueaura', + fixed_min_gas_price: 0.001, + low_gas_price: 0.001, + average_gas_price: 0.002, + high_gas_price: 0.0025, + }, + ], + }, + staking: { + staking_tokens: [ + { + denom: 'ueaura', + }, + ], + lock_duration: { + time: '172800s', + }, + }, + codebase: { + git_repo: 'https://github.com/aura-nw/aura', + recommended_version: 'v0.8.0-euphoria', + compatible_versions: ['v0.8.0-euphoria'], + cosmos_sdk_version: 'v0.47.8', + ibc_go_version: 'v7.3.1', + consensus: { + type: 'cometbft', + version: '0.37.4', + }, + cosmwasm_version: '0.42.0', + cosmwasm_enabled: true, + genesis: { + genesis_url: 'https://images.aura.network/aura_6321-3-genesis.tar.gz', + }, + versions: [ + { + name: 'v0.8.0-euphoria', + recommended_version: 'v0.8.0-euphoria', + compatible_versions: ['v0.8.0-euphoria'], + cosmos_sdk_version: 'v0.47.8', + ibc_go_version: 'v7.3.1', + consensus: { + type: 'cometbft', + version: '0.37.4', + }, + cosmwasm_version: '0.42.0', + cosmwasm_enabled: true, + next_version_name: '', + }, + ], + }, + logo_URIs: { + png: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.png', + svg: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.svg', + }, + peers: { + seeds: [ + { + id: '705e3c2b2b554586976ed88bb27f68e4c4176a33', + address: '52.76.203.126:26656', + }, + ], + persistent_peers: [], + }, + apis: { + rpc: [ + { + address: 'https://rpc.euphoria.aura.network/', + provider: 'Aura Network Foundation', + }, + ], + rest: [ + { + address: 'https://lcd.euphoria.aura.network/', + provider: 'Aura Network Foundation', + }, + ], + grpc: [ + { + address: 'http://grpc.euphoria.aura.network:9090', + provider: 'Aura Network Foundation', + }, + ], + }, + explorers: [ + { + kind: 'aurascan', + url: 'https://euphoria.aurascan.io', + tx_page: 'https://euphoria.aurascan.io/tx/${txHash}', + account_page: 'https://euphoria.aurascan.io/address/${accountAddress}', + }, + ], + images: [ + { + png: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.png', + svg: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/aura/images/Aura-logo-2.2.svg', + }, + ], +}