diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a02af72a..ef873a703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Features +### Improvements + +- [#435](https://github.com/alleslabs/celatone-frontend/pull/435) Refactor chain's config, add new chain configs + +### Bug fixes + +## v1.1.0 + +### Features + - [#397](https://github.com/alleslabs/celatone-frontend/pull/397) Implement first version of Osmosis v16 pool - [#358](https://github.com/alleslabs/celatone-frontend/pull/358) Add Amp for Pool Detail page - [#355](https://github.com/alleslabs/celatone-frontend/pull/355) Add Amp for Pool List page diff --git a/src/config/chain/default.ts b/src/config/chain/default.ts new file mode 100644 index 000000000..70e3100cf --- /dev/null +++ b/src/config/chain/default.ts @@ -0,0 +1,45 @@ +import type { ContractAddr, HumanAddr, ValidatorAddr } from "lib/types"; + +import type { ChainConfig } from "./types"; + +export const DEFAULT_CHAIN_CONFIG: ChainConfig = { + chain: "", + registryChainName: "", + prettyName: "", + lcd: "", + rpc: "", + indexer: "", + api: "", + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: false, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: false, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 0, + denom: "", + }, + gasAdjustment: 1.0, + maxGasLimit: 0, + }, + exampleAddresses: { + user: "" as HumanAddr, + contract: "" as ContractAddr, + validator: "" as ValidatorAddr, + }, + explorerLink: { + validator: "", + proposal: "", + }, + hasSubHeader: false, +}; diff --git a/src/config/chain/index.ts b/src/config/chain/index.ts new file mode 100644 index 000000000..8810a3d05 --- /dev/null +++ b/src/config/chain/index.ts @@ -0,0 +1,15 @@ +import { NEUTRON_CHAIN_CONFIGS } from "./neutron"; +import { OSMOSIS_CHAIN_CONFIGS } from "./osmosis"; +import { SEI_CHAIN_CONFIGS } from "./sei"; +import { STARGAZE_CHAIN_CONFIGS } from "./stargaze"; +import type { ChainConfigs } from "./types"; + +export * from "./types"; +export * from "./default"; + +export const CHAIN_CONFIGS: ChainConfigs = { + ...OSMOSIS_CHAIN_CONFIGS, + ...SEI_CHAIN_CONFIGS, + ...NEUTRON_CHAIN_CONFIGS, + ...STARGAZE_CHAIN_CONFIGS, +}; diff --git a/src/config/chain/neutron.ts b/src/config/chain/neutron.ts new file mode 100644 index 000000000..b2e4ea601 --- /dev/null +++ b/src/config/chain/neutron.ts @@ -0,0 +1,96 @@ +import type { ContractAddr, HumanAddr, ValidatorAddr } from "lib/types"; + +import type { ChainConfigs } from "./types"; + +export const NEUTRON_CHAIN_CONFIGS: ChainConfigs = { + "neutron-1": { + chain: "neutron", + registryChainName: "neutron", + prettyName: "Neutron", + lcd: "https://rest-kralum.neutron-1.neutron.org", + rpc: "https://rpc-kralum.neutron-1.neutron.org", + indexer: "https://neutron-1-graphql.alleslabs.dev/v1/graphql", + api: "https://celatone-api.alleslabs.dev", + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: true, + storeCodeMaxFileSize: 800_000, + clearAdminGas: 50_000, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: true, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 0.025, + denom: "untrn", + }, + gasAdjustment: 1.5, + maxGasLimit: 25_000_000, + }, + exampleAddresses: { + user: "neutron19glux3jzdfyyz6ylmuksgxfj5phdaxfr2uhy86" as HumanAddr, + contract: + "neutron1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrstdxvff" as ContractAddr, + validator: + "neutronvaloper1c4k24jzduc365kywrsvf5ujz4ya6mwym69umfr" as ValidatorAddr, + }, + explorerLink: { + validator: "https://www.mintscan.io/neutron/validators", + proposal: "", + }, + hasSubHeader: false, + }, + "pion-1": { + chain: "neutron", + registryChainName: "neutrontestnet", + prettyName: "Neutron Testnet", + lcd: "https://rest-palvus.pion-1.ntrn.tech:443", + rpc: "https://rpc-palvus.pion-1.ntrn.tech:443", + indexer: "https://pion-1-graphql.alleslabs.dev/v1/graphql", + api: "https://celatone-api.alleslabs.dev", + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: true, + storeCodeMaxFileSize: 800_000, + clearAdminGas: 50_000, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: false, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 0.025, + denom: "untrn", + }, + gasAdjustment: 1.5, + maxGasLimit: 25_000_000, + }, + exampleAddresses: { + user: "neutron19glux3jzdfyyz6ylmuksgxfj5phdaxfr2uhy86" as HumanAddr, + contract: + "neutron1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrstdxvff" as ContractAddr, + validator: + "neutronvaloper1c4k24jzduc365kywrsvf5ujz4ya6mwym69umfr" as ValidatorAddr, + }, + explorerLink: { + validator: "https://www.mintscan.io/neutron/validators", + proposal: "", + }, + hasSubHeader: false, + }, +}; diff --git a/src/config/index.ts b/src/config/chain/osmosis.ts similarity index 51% rename from src/config/index.ts rename to src/config/chain/osmosis.ts index 5743858d5..5ac9b0e1e 100644 --- a/src/config/index.ts +++ b/src/config/chain/osmosis.ts @@ -1,52 +1,8 @@ import type { ContractAddr, HumanAddr, ValidatorAddr } from "lib/types"; -import type { ChainConfig, ChainConfigs, ProjectConstants } from "./types"; +import type { ChainConfigs } from "./types"; -export const DEFAULT_CHAIN_CONFIG: ChainConfig = { - chain: "", - registryChainName: "", - prettyName: "", - lcd: "", - rpc: "", - indexer: "", - api: "", - features: { - faucet: { - enabled: false, - }, - wasm: { - enabled: false, - }, - pool: { - enabled: false, - }, - publicProject: { - enabled: false, - }, - }, - gas: { - gasPrice: { - tokenPerGas: 0, - denom: "", - }, - gasAdjustment: 1.0, - maxGasLimit: 0, - }, - exampleAddresses: { - user: "" as HumanAddr, - contract: "" as ContractAddr, - validator: "" as ValidatorAddr, - }, - explorerLink: { - validator: "", - proposal: "", - }, - hasSubHeader: false, -}; - -const DEFAULT_CELATONE_API_ENDPOINT = "https://celatone-api.alleslabs.dev"; - -export const CHAIN_CONFIGS: ChainConfigs = { +export const OSMOSIS_CHAIN_CONFIGS: ChainConfigs = { "osmosis-1": { chain: "osmosis", registryChainName: "osmosis", @@ -54,7 +10,7 @@ export const CHAIN_CONFIGS: ChainConfigs = { lcd: "https://lcd.osmosis.zone", rpc: "https://rpc.osmosis.zone", indexer: "https://osmosis-mainnet-graphql.alleslabs.dev/v1/graphql", - api: DEFAULT_CELATONE_API_ENDPOINT, + api: "https://celatone-api.alleslabs.dev", features: { faucet: { enabled: false, @@ -100,7 +56,7 @@ export const CHAIN_CONFIGS: ChainConfigs = { lcd: "https://lcd.osmotest5.osmosis.zone", rpc: "https://rpc.osmotest5.osmosis.zone", indexer: "https://osmo-test-5-graphql.alleslabs.dev/v1/graphql", - api: DEFAULT_CELATONE_API_ENDPOINT, + api: "https://celatone-api.alleslabs.dev", features: { faucet: { enabled: true, @@ -140,96 +96,6 @@ export const CHAIN_CONFIGS: ChainConfigs = { }, hasSubHeader: false, }, - "pacific-1": { - chain: "sei", - registryChainName: "sei", - prettyName: "Sei", - lcd: "https://sei-api.polkachu.com", - rpc: "https://sei-rpc.polkachu.com", - indexer: "https://pacific-1-graphql.alleslabs.dev/v1/graphql", - api: DEFAULT_CELATONE_API_ENDPOINT, - features: { - faucet: { - enabled: false, - }, - wasm: { - enabled: true, - storeCodeMaxFileSize: 800_000, - clearAdminGas: 50_000, - }, - pool: { - enabled: false, - }, - publicProject: { - enabled: true, - }, - }, - gas: { - gasPrice: { - tokenPerGas: 0.025, - denom: "usei", - }, - gasAdjustment: 1.5, - maxGasLimit: 25_000_000, - }, - exampleAddresses: { - user: "sei1acqpnvg2t4wmqfdv8hq47d3petfksjs5xjfnyj" as HumanAddr, - contract: - "sei18l6zzyyhrl7j9zw2lew50677va25rtsa2s4yy5gdpg4nxz3y3j9se47f0k" as ContractAddr, - validator: - "seivaloper1hh0g5xf23e5zekg45cmerc97hs4n2004dy2t26" as ValidatorAddr, - }, - explorerLink: { - validator: "", - proposal: "", - }, - hasSubHeader: true, - }, - "atlantic-2": { - chain: "sei", - registryChainName: "seitestnet2", - prettyName: "Sei Testnet2", - lcd: "https://rest.atlantic-2.seinetwork.io", - rpc: "https://rpc.atlantic-2.seinetwork.io", - indexer: "https://atlantic-2-graphql.alleslabs.dev/v1/graphql", - api: DEFAULT_CELATONE_API_ENDPOINT, - features: { - faucet: { - enabled: false, - }, - wasm: { - enabled: true, - storeCodeMaxFileSize: 800_000, - clearAdminGas: 50_000, - }, - pool: { - enabled: false, - }, - publicProject: { - enabled: false, - }, - }, - gas: { - gasPrice: { - tokenPerGas: 0.025, - denom: "usei", - }, - gasAdjustment: 1.5, - maxGasLimit: 25_000_000, - }, - exampleAddresses: { - user: "sei1acqpnvg2t4wmqfdv8hq47d3petfksjs5xjfnyj" as HumanAddr, - contract: - "sei18l6zzyyhrl7j9zw2lew50677va25rtsa2s4yy5gdpg4nxz3y3j9se47f0k" as ContractAddr, - validator: - "seivaloper1hh0g5xf23e5zekg45cmerc97hs4n2004dy2t26" as ValidatorAddr, - }, - explorerLink: { - validator: "https://testnet.mintscan.io/sei-testnet/validators", - proposal: "https://testnet.mintscan.io/sei-testnet/proposals", - }, - hasSubHeader: true, - }, localosmosis: { chain: "osmosis", registryChainName: "localosmosis", @@ -277,11 +143,3 @@ export const CHAIN_CONFIGS: ChainConfigs = { hasSubHeader: false, }, }; - -export const PROJECT_CONSTANTS: ProjectConstants = { - maxListNameLength: 50, - maxContractNameLength: 50, - maxContractDescriptionLength: 250, - maxCodeNameLength: 50, - maxProposalTitleLength: 255, -}; diff --git a/src/config/chain/sei.ts b/src/config/chain/sei.ts new file mode 100644 index 000000000..083ce8ccd --- /dev/null +++ b/src/config/chain/sei.ts @@ -0,0 +1,96 @@ +import type { ContractAddr, HumanAddr, ValidatorAddr } from "lib/types"; + +import type { ChainConfigs } from "./types"; + +export const SEI_CHAIN_CONFIGS: ChainConfigs = { + "pacific-1": { + chain: "sei", + registryChainName: "sei", + prettyName: "Sei", + lcd: "https://sei-api.polkachu.com", + rpc: "https://sei-rpc.polkachu.com", + indexer: "https://pacific-1-graphql.alleslabs.dev/v1/graphql", + api: "https://celatone-api.alleslabs.dev", + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: true, + storeCodeMaxFileSize: 800_000, + clearAdminGas: 50_000, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: true, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 0.025, + denom: "usei", + }, + gasAdjustment: 1.5, + maxGasLimit: 25_000_000, + }, + exampleAddresses: { + user: "sei1acqpnvg2t4wmqfdv8hq47d3petfksjs5xjfnyj" as HumanAddr, + contract: + "sei18l6zzyyhrl7j9zw2lew50677va25rtsa2s4yy5gdpg4nxz3y3j9se47f0k" as ContractAddr, + validator: + "seivaloper1hh0g5xf23e5zekg45cmerc97hs4n2004dy2t26" as ValidatorAddr, + }, + explorerLink: { + validator: "", + proposal: "", + }, + hasSubHeader: true, + }, + "atlantic-2": { + chain: "sei", + registryChainName: "seitestnet2", + prettyName: "Sei Testnet2", + lcd: "https://rest.atlantic-2.seinetwork.io", + rpc: "https://rpc.atlantic-2.seinetwork.io", + indexer: "https://atlantic-2-graphql.alleslabs.dev/v1/graphql", + api: "https://celatone-api.alleslabs.dev", + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: true, + storeCodeMaxFileSize: 800_000, + clearAdminGas: 50_000, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: false, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 0.025, + denom: "usei", + }, + gasAdjustment: 1.5, + maxGasLimit: 25_000_000, + }, + exampleAddresses: { + user: "sei1acqpnvg2t4wmqfdv8hq47d3petfksjs5xjfnyj" as HumanAddr, + contract: + "sei18l6zzyyhrl7j9zw2lew50677va25rtsa2s4yy5gdpg4nxz3y3j9se47f0k" as ContractAddr, + validator: + "seivaloper1hh0g5xf23e5zekg45cmerc97hs4n2004dy2t26" as ValidatorAddr, + }, + explorerLink: { + validator: "https://testnet.mintscan.io/sei-testnet/validators", + proposal: "https://testnet.mintscan.io/sei-testnet/proposals", + }, + hasSubHeader: true, + }, +}; diff --git a/src/config/chain/stargaze.ts b/src/config/chain/stargaze.ts new file mode 100644 index 000000000..d040b699a --- /dev/null +++ b/src/config/chain/stargaze.ts @@ -0,0 +1,51 @@ +import type { ContractAddr, HumanAddr, ValidatorAddr } from "lib/types"; + +import type { ChainConfigs } from "./types"; + +export const STARGAZE_CHAIN_CONFIGS: ChainConfigs = { + "stargaze-1": { + chain: "stargaze", + registryChainName: "stargaze", + prettyName: "Stargaze", + lcd: "https://rest.stargaze-apis.com", + rpc: "https://rpc.stargaze-apis.com", + indexer: "https://stargaze-mainnet-graphql.alleslabs.dev/v1/graphql", + api: "https://celatone-api.alleslabs.dev", + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: true, + storeCodeMaxFileSize: 800_000, + clearAdminGas: 50_000, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: true, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 1.1, + denom: "ustars", + }, + gasAdjustment: 1.5, + maxGasLimit: 25_000_000, + }, + exampleAddresses: { + user: "stars16hetkn089m2s8nsjwppwhjed4ecp4dqtvltv82" as HumanAddr, + contract: + "stars1m4ns69zvkk2zv0946mw298tlky5ckvu08rtxggtg29p784kc5sxqwgx4h0" as ContractAddr, + validator: + "starsvaloper1mz2qks48v486d9m8wp4l9fxm2e9l0e0kzk79m5" as ValidatorAddr, + }, + explorerLink: { + validator: "https://www.mintscan.io/stargaze/validators", + proposal: "https://www.mintscan.io/stargaze/proposals", + }, + hasSubHeader: false, + }, +}; diff --git a/src/config/types.ts b/src/config/chain/types.ts similarity index 84% rename from src/config/types.ts rename to src/config/chain/types.ts index 87ed0c9dc..c89dcc6b1 100644 --- a/src/config/types.ts +++ b/src/config/chain/types.ts @@ -65,14 +65,3 @@ export interface ChainConfig { export interface ChainConfigs { [chainId: string]: ChainConfig; } - -export interface ProjectConstants { - // wasm - maxListNameLength: number; - maxContractNameLength: number; - maxContractDescriptionLength: number; - maxCodeNameLength: number; - - // proposal - maxProposalTitleLength: number; -} diff --git a/src/config/project/index.ts b/src/config/project/index.ts new file mode 100644 index 000000000..7bad4eea7 --- /dev/null +++ b/src/config/project/index.ts @@ -0,0 +1,11 @@ +import type { ProjectConstants } from "./types"; + +export * from "./types"; + +export const PROJECT_CONSTANTS: ProjectConstants = { + maxListNameLength: 50, + maxContractNameLength: 50, + maxContractDescriptionLength: 250, + maxCodeNameLength: 50, + maxProposalTitleLength: 255, +}; diff --git a/src/config/project/types.ts b/src/config/project/types.ts new file mode 100644 index 000000000..2c986e4d3 --- /dev/null +++ b/src/config/project/types.ts @@ -0,0 +1,10 @@ +export interface ProjectConstants { + // wasm + maxListNameLength: number; + maxContractNameLength: number; + maxContractDescriptionLength: number; + maxCodeNameLength: number; + + // proposal + maxProposalTitleLength: number; +} diff --git a/src/lib/app-provider/contexts/app.tsx b/src/lib/app-provider/contexts/app.tsx index f4af70003..d0870a9fb 100644 --- a/src/lib/app-provider/contexts/app.tsx +++ b/src/lib/app-provider/contexts/app.tsx @@ -13,8 +13,10 @@ import { import { useAmplitude } from "../hooks/useAmplitude"; import { useNetworkChange } from "../hooks/useNetworkChange"; -import { CHAIN_CONFIGS, DEFAULT_CHAIN_CONFIG, PROJECT_CONSTANTS } from "config"; -import type { ChainConfig, ProjectConstants } from "config/types"; +import { CHAIN_CONFIGS, DEFAULT_CHAIN_CONFIG } from "config/chain"; +import type { ChainConfig } from "config/chain"; +import { PROJECT_CONSTANTS } from "config/project"; +import type { ProjectConstants } from "config/project"; import { SUPPORTED_CHAIN_IDS } from "env"; import { LoadingOverlay } from "lib/components/LoadingOverlay"; import { NetworkErrorState } from "lib/components/state/NetworkErrorState"; diff --git a/src/lib/app-provider/hooks/useConfig.ts b/src/lib/app-provider/hooks/useConfig.ts index c9bae5d12..ff36d189b 100644 --- a/src/lib/app-provider/hooks/useConfig.ts +++ b/src/lib/app-provider/hooks/useConfig.ts @@ -1,5 +1,5 @@ import { useCelatoneApp } from "../contexts"; -import type { ChainConfig } from "config/types"; +import type { ChainConfig } from "config/chain/types"; import { useInternalNavigate } from "./useInternalNavigate"; diff --git a/src/lib/components/ExplorerLink.tsx b/src/lib/components/ExplorerLink.tsx index a8b082468..3b48fbe85 100644 --- a/src/lib/components/ExplorerLink.tsx +++ b/src/lib/components/ExplorerLink.tsx @@ -1,7 +1,7 @@ import type { BoxProps, TextProps } from "@chakra-ui/react"; import { Box, Text, Flex } from "@chakra-ui/react"; -import type { ExplorerConfig } from "config/types"; +import type { ExplorerConfig } from "config/chain/types"; import type { AddressReturnType } from "lib/app-provider"; import { useCelatoneApp } from "lib/app-provider/contexts"; import { useBaseApiRoute } from "lib/app-provider/hooks/useBaseApiRoute"; diff --git a/src/lib/layout/Header.tsx b/src/lib/layout/Header.tsx index 3087108e9..36bfa6d63 100644 --- a/src/lib/layout/Header.tsx +++ b/src/lib/layout/Header.tsx @@ -8,7 +8,7 @@ import { Image, } from "@chakra-ui/react"; -import { CHAIN_CONFIGS } from "config"; +import { CHAIN_CONFIGS } from "config/chain"; import { CURR_THEME } from "env"; import { useCelatoneApp, useSelectChain } from "lib/app-provider"; import { AppLink } from "lib/components/AppLink"; diff --git a/src/lib/layout/mobile/NavDrawer.tsx b/src/lib/layout/mobile/NavDrawer.tsx index e7af39dca..ef0c182d4 100644 --- a/src/lib/layout/mobile/NavDrawer.tsx +++ b/src/lib/layout/mobile/NavDrawer.tsx @@ -18,7 +18,7 @@ import { } from "@chakra-ui/react"; import type { MenuInfo } from "../navbar/type"; -import { CHAIN_CONFIGS } from "config"; +import { CHAIN_CONFIGS } from "config/chain"; import { useCelatoneApp, usePublicProjectConfig, diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 9a6becab3..3a32134f8 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -10,7 +10,7 @@ import type { AppProps } from "next/app"; import Head from "next/head"; import Script from "next/script"; -import { CHAIN_CONFIGS } from "config"; +import { CHAIN_CONFIGS } from "config/chain"; import { AppProvider } from "lib/app-provider/contexts/app"; import { localosmosis,