Skip to content

Commit

Permalink
fix: as comments
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpeach committed Jan 23, 2023
1 parent 64db50c commit 8b2cae9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- [#116](https://github.com/alleslabs/celatone-frontend/pull/116) Supported Terra2.0 mainnet and testnet
- [#116](https://github.com/alleslabs/celatone-frontend/pull/116) Support Terra2.0 mainnet and testnet
- [#94](https://github.com/alleslabs/celatone-frontend/pull/94) Add unsupported assets in contract details page
- [#72](https://github.com/alleslabs/celatone-frontend/pull/72) Fix general wording and grammar
- [#110](https://github.com/alleslabs/celatone-frontend/pull/110) Fix proposal detail rendering
Expand Down
2 changes: 1 addition & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const CELATONE_CONSTANTS: CelatoneConstants = {

export const DUMMY_MNEMONIC = process.env.NEXT_PUBLIC_DUMMY_MNEMONIC;

export const SUPPORTED_CHAIN = process.env.NEXT_PUBLIC_SUPPORTED_CHAIN;
export const SELECTED_CHAIN = process.env.NEXT_PUBLIC_SELECTED_CHAIN;

export const CELATONE_API_ENDPOINT = "https://celatone-api.alleslabs.dev";

Expand Down
18 changes: 9 additions & 9 deletions src/lib/data/chain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SUPPORTED_CHAIN } from "env";
import { SELECTED_CHAIN } from "env";
import type { Option } from "lib/types";

interface Chain {
Expand All @@ -18,13 +18,13 @@ export const OSMOSIS_CHAINS: Chain = {
};

export const getSupportedChainNames = (): string[] => {
switch (SUPPORTED_CHAIN) {
switch (SELECTED_CHAIN) {
case "terra":
return Object.values(TERRA_CHAINS);
case "osmosis":
return Object.values(OSMOSIS_CHAINS);
default:
throw new Error(`Unsupported chain: ${SUPPORTED_CHAIN}`);
throw new Error(`Unsupported chain: ${SELECTED_CHAIN}`);
}
};

Expand All @@ -42,20 +42,20 @@ export const getChainNameByNetwork = (network: string): string => {

let chainName: Option<string>;

switch (SUPPORTED_CHAIN) {
switch (SELECTED_CHAIN) {
case "terra":
chainName = TERRA_CHAINS[network];
break;
case "osmosis":
chainName = OSMOSIS_CHAINS[network];
break;
default:
throw new Error(`Unsupported chain: ${SUPPORTED_CHAIN}`);
throw new Error(`Unsupported chain: ${SELECTED_CHAIN}`);
}

if (!chainName)
throw new Error(
`Can't find chain name for network: ${network} and chain: ${SUPPORTED_CHAIN}`
`Can't find chain name for network: ${network} and chain: ${SELECTED_CHAIN}`
);

return chainName;
Expand All @@ -64,7 +64,7 @@ export const getChainNameByNetwork = (network: string): string => {
export const getNetworkByChainName = (chainName: string): string => {
let network: Option<string>;

switch (SUPPORTED_CHAIN) {
switch (SELECTED_CHAIN) {
case "terra":
network = Object.keys(TERRA_CHAINS).find(
(each) => TERRA_CHAINS[each as keyof Chain] === chainName
Expand All @@ -76,12 +76,12 @@ export const getNetworkByChainName = (chainName: string): string => {
);
break;
default:
throw new Error(`Unsupported chain: ${SUPPORTED_CHAIN}`);
throw new Error(`Unsupported chain: ${SELECTED_CHAIN}`);
}

if (!network)
throw new Error(
`Can't find network for chain name: ${chainName} and chain: ${SUPPORTED_CHAIN}`
`Can't find network for chain name: ${chainName} and chain: ${SELECTED_CHAIN}`
);

return network;
Expand Down
9 changes: 9 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,17 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
assetLists={[...assets, terra2testnetAssets]}
wallets={wallets}
endpointOptions={{
osmosis: {
rpc: ["https://rpc-osmosis.keplr.app/"],
rest: ["https://lcd-osmosis.keplr.app/"],
},
osmosistestnet: {
rpc: ["https://rpc-test.osmosis.zone/"],
rest: ["https://lcd-test.osmosis.zone/"],
},
terra2: {
rpc: ["https://terra-rpc.lavenderfive.com/"],
rest: ["https://phoenix-lcd.terra.dev/"],
},
terra2testnet: {
rpc: ["https://terra-testnet-rpc.polkachu.com/"],
Expand Down

1 comment on commit 8b2cae9

@vercel
Copy link

@vercel vercel bot commented on 8b2cae9 Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.