Skip to content

Commit

Permalink
Updates for gm-frontend tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikbratashchuk committed May 11, 2024
1 parent fd058bb commit c845e63
Show file tree
Hide file tree
Showing 11 changed files with 15,574 additions and 1,752 deletions.
23 changes: 2 additions & 21 deletions components/react/staking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,8 @@ const convertChainName = (chainName: string) => {
}

switch (chainName) {
case 'cosmoshub':
return 'cosmos';
case 'assetmantle':
return 'asset-mantle';
case 'cryptoorgchain':
return 'crypto-org';
case 'dig':
return 'dig-chain';
case 'gravitybridge':
return 'gravity-bridge';
case 'kichain':
return 'ki-chain';
case 'oraichain':
return 'orai-chain';
case 'terra':
return 'terra-classic';
case 'gm-rollup':
return 'gm-rollup';
default:
return chainName;
}
Expand Down Expand Up @@ -194,11 +180,6 @@ export const StakingSection = ({ chainName }: { chainName: ChainName }) => {

let rpcEndpoint = await getRpcEndpoint();

if (!rpcEndpoint) {
console.log('no rpc endpoint — using a fallback');
rpcEndpoint = `https://rpc.cosmos.directory/${chainName}`;
}

// get RPC client
const client = await cosmos.ClientFactory.createRPCQueryClient({
rpcEndpoint:
Expand Down
5 changes: 1 addition & 4 deletions components/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ import { ChainName } from '@cosmos-kit/core';

const allowedChains = [
'gmrollup',
'celestiatestnet',
'celestiatestnet2',
'celestiatestnet3',
];

export const WalletSection = ({
Expand Down Expand Up @@ -133,7 +130,7 @@ export const WalletSection = ({
);

useEffect(() => {
setChainName?.(window.localStorage.getItem('selected-chain') || 'osmosis');
setChainName?.(window.localStorage.getItem('selected-chain'));
}, [setChainName]);

const onChainChange: handleSelectChainDropdown = async (
Expand Down
15 changes: 5 additions & 10 deletions config/assetlist.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
export const assetlist = {
"$schema": "../../assetlist.schema.json",
"chain_name": "gmrollup",
"chain_name": "gm-rollup",
"chain-id": "gm",
"assets": [
{
"description": "",
"description": "The native token of the gm rollup chain.",
"denom_units": [
// is there also a ustake?
{
"denom": "ustake",
"exponent": 0
},
{
"denom": "stake",
"exponent": 6
}
],
// "base": "ustake", // is this correct instead of `stake`?
"base": "stake",
"name": "GM rollup",
"name": "gm rollup token",
"display": "stake",
"symbol": "STAKE",
"logo_URIs": {
"svg": "https://raw.githubusercontent.com/jcstein/gm-portal/b030ce3fe548d188fbacb6b932d7e51dc7afd65e/frontend/public/gm.svg"
}
}
]
}
}
53 changes: 5 additions & 48 deletions config/chain.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const chain = {
"$schema": "../../chain.schema.json",
"chain_name": "gmrollup",
"chain_name": "gm-rollup",
"chain_id": "gm",
"pretty_name": "my gm rollup",
"pretty_name": "gm-world rollup",
"status": "live",
"network_type": "testnet",
"bech32_prefix": "gm",
Expand All @@ -15,51 +15,15 @@ export const chain = {
"fees": {
"fee_tokens": [
{
"denom": "ustake", // should this be `stake`?
"denom": "stake",
"fixed_min_gas_price": 0
}
]
},
// "fees": {
// "fee_tokens": [
// {
// "denom": "utia",
// "fixed_min_gas_price": 0
// }
// ]
// },
// "codebase": {
// "git_repo": "https://github.com/celestiaorg/celestia-app",
// "recommended_version": "v0.12.0",
// "compatible_versions": [
// "v0.12.0"
// ],
// "genesis": {
// "genesis_url": "https://raw.githubusercontent.com/celestiaorg/networks/master/blockspacerace/genesis.json"
// },
// "versions": [
// {
// "name": "v0.12.0",
// "recommended_version": "v0.12.0",
// "compatible_versions": [
// "v0.12.0"
// ]
// }
// ]
// },
// "peers": {
// "seeds": [
// {
// "id": "f97a75fb69d3a5fe893dca7c8d238ccc0bd66a8f",
// "address": "celestia-blockspacerace.seed.brocha.in:30583",
// "provider": "Brochain"
// }
// ]
// },
"apis": {
"rpc": [
{
"address": "http://localhost:26657",
"address": "http://163.172.162.109:26657",
"provider": "JCS"
}
],
Expand All @@ -71,11 +35,4 @@ export const chain = {
]
},
"beta": true,
// "explorers": [
// {
// "kind": "Mintscan",
// "url": "https://testnet.mintscan.io/celestia-incentivized-testnet",
// "tx_page": "https://testnet.mintscan.io/celestia-incentivized-testnet/txs/${txHash}"
// }
// ]
}
}
13 changes: 11 additions & 2 deletions config/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
export const CHAIN_NAME = 'gm-rollup';

import { assets } from 'chain-registry';
import { AssetList, Asset } from '@chain-registry/types';

export const defaultChainName = 'gmrollup';
import { chain } from "./chain"
import { assetlist } from "./assetlist"

export const defaultChainName = 'gm-rollup';

export const getChainAssets = (chainName: string = defaultChainName) => {
return assets.find((chain) => chain.chain_name === chainName) as AssetList;
var vals = assets.find((chain) => chain.chain_name === chainName) as AssetList;
if (!vals) {
vals = assetlist;
}
return vals;
};

export const getCoin = (chainName: string = defaultChainName) => {
Expand Down
Loading

0 comments on commit c845e63

Please sign in to comment.