Skip to content

Commit

Permalink
fix chain data
Browse files Browse the repository at this point in the history
  • Loading branch information
imhson committed May 9, 2024
1 parent 2f3f420 commit 0f30426
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 43 deletions.
5 changes: 3 additions & 2 deletions app/(private)/burn/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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']))
Expand Down
5 changes: 0 additions & 5 deletions app/(public)/connect/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
Expand Down
40 changes: 4 additions & 36 deletions provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) => {
Expand Down
34 changes: 34 additions & 0 deletions utils/cosmos-kit/assets.tsx
Original file line number Diff line number Diff line change
@@ -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',
},
],
},
],
}
115 changes: 115 additions & 0 deletions utils/cosmos-kit/chains.tsx
Original file line number Diff line number Diff line change
@@ -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',
},
],
}

0 comments on commit 0f30426

Please sign in to comment.