Skip to content

Commit c845e63

Browse files
Updates for gm-frontend tutorial
1 parent fd058bb commit c845e63

File tree

11 files changed

+15574
-1752
lines changed

11 files changed

+15574
-1752
lines changed

components/react/staking.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,8 @@ const convertChainName = (chainName: string) => {
4545
}
4646

4747
switch (chainName) {
48-
case 'cosmoshub':
49-
return 'cosmos';
50-
case 'assetmantle':
51-
return 'asset-mantle';
52-
case 'cryptoorgchain':
53-
return 'crypto-org';
54-
case 'dig':
55-
return 'dig-chain';
56-
case 'gravitybridge':
57-
return 'gravity-bridge';
58-
case 'kichain':
59-
return 'ki-chain';
60-
case 'oraichain':
61-
return 'orai-chain';
62-
case 'terra':
63-
return 'terra-classic';
48+
case 'gm-rollup':
49+
return 'gm-rollup';
6450
default:
6551
return chainName;
6652
}
@@ -194,11 +180,6 @@ export const StakingSection = ({ chainName }: { chainName: ChainName }) => {
194180

195181
let rpcEndpoint = await getRpcEndpoint();
196182

197-
if (!rpcEndpoint) {
198-
console.log('no rpc endpoint — using a fallback');
199-
rpcEndpoint = `https://rpc.cosmos.directory/${chainName}`;
200-
}
201-
202183
// get RPC client
203184
const client = await cosmos.ClientFactory.createRPCQueryClient({
204185
rpcEndpoint:

components/wallet.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ import { ChainName } from '@cosmos-kit/core';
3535

3636
const allowedChains = [
3737
'gmrollup',
38-
'celestiatestnet',
39-
'celestiatestnet2',
40-
'celestiatestnet3',
4138
];
4239

4340
export const WalletSection = ({
@@ -133,7 +130,7 @@ export const WalletSection = ({
133130
);
134131

135132
useEffect(() => {
136-
setChainName?.(window.localStorage.getItem('selected-chain') || 'osmosis');
133+
setChainName?.(window.localStorage.getItem('selected-chain'));
137134
}, [setChainName]);
138135

139136
const onChainChange: handleSelectChainDropdown = async (

config/assetlist.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
export const assetlist = {
22
"$schema": "../../assetlist.schema.json",
3-
"chain_name": "gmrollup",
3+
"chain_name": "gm-rollup",
4+
"chain-id": "gm",
45
"assets": [
56
{
6-
"description": "",
7+
"description": "The native token of the gm rollup chain.",
78
"denom_units": [
8-
// is there also a ustake?
9-
{
10-
"denom": "ustake",
11-
"exponent": 0
12-
},
139
{
1410
"denom": "stake",
1511
"exponent": 6
1612
}
1713
],
18-
// "base": "ustake", // is this correct instead of `stake`?
1914
"base": "stake",
20-
"name": "GM rollup",
15+
"name": "gm rollup token",
2116
"display": "stake",
2217
"symbol": "STAKE",
2318
"logo_URIs": {
2419
"svg": "https://raw.githubusercontent.com/jcstein/gm-portal/b030ce3fe548d188fbacb6b932d7e51dc7afd65e/frontend/public/gm.svg"
2520
}
2621
}
2722
]
28-
}
23+
}

config/chain.ts

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export const chain = {
22
"$schema": "../../chain.schema.json",
3-
"chain_name": "gmrollup",
3+
"chain_name": "gm-rollup",
44
"chain_id": "gm",
5-
"pretty_name": "my gm rollup",
5+
"pretty_name": "gm-world rollup",
66
"status": "live",
77
"network_type": "testnet",
88
"bech32_prefix": "gm",
@@ -15,51 +15,15 @@ export const chain = {
1515
"fees": {
1616
"fee_tokens": [
1717
{
18-
"denom": "ustake", // should this be `stake`?
18+
"denom": "stake",
1919
"fixed_min_gas_price": 0
2020
}
2121
]
2222
},
23-
// "fees": {
24-
// "fee_tokens": [
25-
// {
26-
// "denom": "utia",
27-
// "fixed_min_gas_price": 0
28-
// }
29-
// ]
30-
// },
31-
// "codebase": {
32-
// "git_repo": "https://github.com/celestiaorg/celestia-app",
33-
// "recommended_version": "v0.12.0",
34-
// "compatible_versions": [
35-
// "v0.12.0"
36-
// ],
37-
// "genesis": {
38-
// "genesis_url": "https://raw.githubusercontent.com/celestiaorg/networks/master/blockspacerace/genesis.json"
39-
// },
40-
// "versions": [
41-
// {
42-
// "name": "v0.12.0",
43-
// "recommended_version": "v0.12.0",
44-
// "compatible_versions": [
45-
// "v0.12.0"
46-
// ]
47-
// }
48-
// ]
49-
// },
50-
// "peers": {
51-
// "seeds": [
52-
// {
53-
// "id": "f97a75fb69d3a5fe893dca7c8d238ccc0bd66a8f",
54-
// "address": "celestia-blockspacerace.seed.brocha.in:30583",
55-
// "provider": "Brochain"
56-
// }
57-
// ]
58-
// },
5923
"apis": {
6024
"rpc": [
6125
{
62-
"address": "http://localhost:26657",
26+
"address": "http://163.172.162.109:26657",
6327
"provider": "JCS"
6428
}
6529
],
@@ -71,11 +35,4 @@ export const chain = {
7135
]
7236
},
7337
"beta": true,
74-
// "explorers": [
75-
// {
76-
// "kind": "Mintscan",
77-
// "url": "https://testnet.mintscan.io/celestia-incentivized-testnet",
78-
// "tx_page": "https://testnet.mintscan.io/celestia-incentivized-testnet/txs/${txHash}"
79-
// }
80-
// ]
81-
}
38+
}

config/defaults.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
export const CHAIN_NAME = 'gm-rollup';
2+
13
import { assets } from 'chain-registry';
24
import { AssetList, Asset } from '@chain-registry/types';
35

4-
export const defaultChainName = 'gmrollup';
6+
import { chain } from "./chain"
7+
import { assetlist } from "./assetlist"
8+
9+
export const defaultChainName = 'gm-rollup';
510

611
export const getChainAssets = (chainName: string = defaultChainName) => {
7-
return assets.find((chain) => chain.chain_name === chainName) as AssetList;
12+
var vals = assets.find((chain) => chain.chain_name === chainName) as AssetList;
13+
if (!vals) {
14+
vals = assetlist;
15+
}
16+
return vals;
817
};
918

1019
export const getCoin = (chainName: string = defaultChainName) => {

0 commit comments

Comments
 (0)