diff --git a/explorer/.env.dev b/explorer/.env.dev index d8c4d4547b..013d526f82 100644 --- a/explorer/.env.dev +++ b/explorer/.env.dev @@ -9,4 +9,3 @@ BIG_DIPPER_URL=https://sandbox-blocks.nymtech.net CURRENCY_DENOM=unym CURRENCY_STAKING_DENOM=unyx NYM_MIXNET_CONTRACT=n17srjznxl9dvzdkpwpw24gg668wc73val88a6m5ajg6ankwvz9wtst0cznr -COSMOS_KIT_USE_CHAIN=nyx diff --git a/explorer/.env.prod b/explorer/.env.prod index e71e710e15..2e927b2947 100644 --- a/explorer/.env.prod +++ b/explorer/.env.prod @@ -3,5 +3,4 @@ NYM_API_URL=https://validator.nymtech.net VALIDATOR_URL=https://rpc.nymtech.net BIG_DIPPER_URL=https://blocks.nymtech.net CURRENCY_DENOM=unym -CURRENCY_STAKING_DENOM=unyx -COSMOS_KIT_USE_CHAIN=nyx \ No newline at end of file +CURRENCY_STAKING_DENOM=unyx \ No newline at end of file diff --git a/explorer/package.json b/explorer/package.json index 377c5d1c4e..9079de0104 100644 --- a/explorer/package.json +++ b/explorer/package.json @@ -52,6 +52,7 @@ "bs58": "^5.0.0", "buffer": "^6.0.3", "chain-registry": "^1.29.1", + "@chain-registry/types": "^0.18.1", "cosmjs-types": "^0.9.0", "d3-scale": "^4.0.0", "date-fns": "^2.24.0", @@ -70,7 +71,6 @@ }, "devDependencies": { "@babel/core": "^7.15.0", - "@chain-registry/types": "^0.18.1", "@nymproject/eslint-config-react-typescript": "^1.0.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.4", "@storybook/addon-actions": "^6.5.8", diff --git a/explorer/src/api/constants.ts b/explorer/src/api/constants.ts index 372708f9cc..fbb8c18d6b 100644 --- a/explorer/src/api/constants.ts +++ b/explorer/src/api/constants.ts @@ -1,7 +1,7 @@ // master APIs export const API_BASE_URL = process.env.EXPLORER_API_URL; export const NYM_API_BASE_URL = process.env.NYM_API_URL; -export const VALIDATOR_BASE_URL = process.env.VALIDATOR_URL; +export const VALIDATOR_BASE_URL = process.env.VALIDATOR_URL || 'https://rpc.nymtech.net'; export const BIG_DIPPER = process.env.BIG_DIPPER_URL; // specific API routes diff --git a/explorer/src/context/cosmos-kit.tsx b/explorer/src/context/cosmos-kit.tsx index 3069882fa5..8fa164bf00 100644 --- a/explorer/src/context/cosmos-kit.tsx +++ b/explorer/src/context/cosmos-kit.tsx @@ -6,6 +6,7 @@ import { wallets as cosmosstation } from '@cosmos-kit/cosmostation-extension'; import { wallets as leap } from '@cosmos-kit/leap-extension'; import { assets, chains } from 'chain-registry'; import { Chain, AssetList } from '@chain-registry/types'; +import { VALIDATOR_BASE_URL } from '@src/api/constants'; const nymSandbox: Chain = { chain_name: 'sandbox', @@ -37,21 +38,37 @@ const nymSandboxAssets: AssetList = { ], }; -const CosmosKitProvider = ({ children }: { children: React.ReactNode }) => ( - { + // Only use the nyx chains + const chainsFixedUp = React.useMemo(() => { + const nyx = chains.find((chain) => chain.chain_id === 'nyx'); + + return nyx ? [nymSandbox, nyx] : [nymSandbox]; + }, [chains]); + + // Only use the nyx assets + const assetsFixedUp = React.useMemo(() => { + const nyx = assets.find((asset) => asset.chain_name === 'nyx'); + + return nyx ? [nymSandboxAssets, nyx] : [nymSandboxAssets]; + }, [assets]); + + return ( + - {children} - -); + }} + > + {children} + + ); +}; export default CosmosKitProvider; diff --git a/explorer/src/context/delegations.tsx b/explorer/src/context/delegations.tsx index ecb15b686d..28a50345e0 100644 --- a/explorer/src/context/delegations.tsx +++ b/explorer/src/context/delegations.tsx @@ -173,7 +173,7 @@ export const DelegationsProvider = ({ children }: { children: React.ReactNode }) }; const handleUndelegate = async (mixId: number) => { - const tx = await nymClient?.undelegateFromMixnode({ mixId }, fee); + const tx = await nymClient?.undelegateFromMixnode({ mixId }, fee, 'Undelegation from Nym Explorer'); return tx as unknown as ExecuteResult; };