Skip to content

Commit

Permalink
rough dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
chalabi2 committed Dec 28, 2023
1 parent f2dd4df commit ff4b545
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 24 deletions.
9 changes: 7 additions & 2 deletions web-ui/.env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NEXT_PUBLIC_CHAIN_ENV="testnet"
NEXT_PUBLIC_TESTNET_LCD_ENDPOINT_QUICKSILVER="https://lcd.test.quicksilver.zone/"
NEXT_PUBLIC_TESTNET_RPC_ENDPOINT_QUICKSILVER="https://rpc.test.quicksilver.zone/"
NEXT_PUBLIC_TESTNET_LCD_ENDPOINT_COSMOSHUB=https://lcd.cosmoshub-4.quicksilver.zone
NEXT_PUBLIC_TESTNET_LCD_ENDPOINT_COSMOSHUB=https://lcd.provider.test.quicksilver.zone
NEXT_PUBLIC_TESTNET_RPC_ENDPOINT_COSMOSHUB=https://rpc.provider.test.quicksilver.zone
NEXT_PUBLIC_TESTNET_LCD_ENDPOINT_OSMOSIS="https://lcd.osmo-test-5.test.quicksilver.zone/"
NEXT_PUBLIC_TESTNET_RPC_ENDPOINT_OSMOSIS="https://rpc.osmo-test-5.test.quicksilver.zone/"
Expand All @@ -21,4 +21,9 @@ REACT_APP_ENABLE_CLAIMS="true"
APY_ZONES_ENDPOINT = "https://chains.cosmos.directory"
NEXT_PUBLIC_OSMOSIS_API="https://api.osmosis.zone"
NEXT_PUBLIC_WHITELISTED_DENOM="uatom,ustars,uosmo,usomm,uregen"
NEXT_PUBLIC_WHITELISTED_ZONES="osmosis-1,stargaze-1,regen-1,cosmoshub-4,sommelier-3"
NEXT_PUBLIC_WHITELISTED_ZONES="osmosis-1,stargaze-1,regen-1,cosmoshub-4,sommelier-3"
NEXT_PUBLIC_COSMOSHUB_CHAIN_ID=provider
NEXT_PUBLIC_OSMOSIS_CHAIN_ID=osmo-test-5
NEXT_PUBLIC_STARGAZE_CHAIN_ID=elgafar-1
NEXT_PUBLIC_REGEN_CHAIN_ID=regen-redwood-1
NEXT_PUBLIC_SOMMELIER_CHAIN_ID=sommelier-3
7 changes: 6 additions & 1 deletion web-ui/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ REACT_APP_ENABLE_CLAIMS="true"
APY_ZONES_ENDPOINT = "https://chains.cosmos.directory"
NEXT_PUBLIC_OSMOSIS_API="https://api.osmosis.zone"
NEXT_PUBLIC_WHITELISTED_DENOM="uatom,ustars,uosmo,usomm,uregen"
NEXT_PUBLIC_WHITELISTED_ZONES="osmosis-1,stargaze-1,regen-1,cosmoshub-4,sommelier-3"
NEXT_PUBLIC_WHITELISTED_ZONES="osmosis-1,stargaze-1,regen-1,cosmoshub-4,sommelier-3"
NEXT_PUBLIC_COSMOSHUB_CHAIN_ID=cosmoshub-4
NEXT_PUBLIC_OSMOSIS_CHAIN_ID=osmosis-1
NEXT_PUBLIC_STARGAZE_CHAIN_ID=stargaze-1
NEXT_PUBLIC_REGEN_CHAIN_ID=regen-1
NEXT_PUBLIC_SOMMELIER_CHAIN_ID=sommelier-3
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const MultiModal: React.FC<MultiModalProps> = ({
const { validatorsData, isLoading, isError } = useValidatorsQuery(selectedChainName);

const { missedBlocksData } = useMissedBlocks(selectedChainName);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable missedBlocksData.
console.log(missedBlocksData);
const { data: logos, isLoading: isFetchingLogos } = useValidatorLogos(selectedChainName, validatorsData || []);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isFetchingLogos.

const validators = validatorsData;
Expand Down
4 changes: 3 additions & 1 deletion web-ui/components/Staking/networkSelectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { Menu, MenuButton, MenuList, MenuItem, Button, Flex, Image, Text, useDis
import React, { Dispatch, SetStateAction, useState } from 'react';
import { BsArrowDown } from 'react-icons/bs';

import { networks } from '@/state/chains/prod';
import { networks as prodNetworks, testNetworks as devNetworks } from '@/state/chains/prod';

const networks = process.env.NEXT_PUBLIC_CHAIN_ENV === 'mainnet' ? prodNetworks : devNetworks;

interface CustomMenuProps {
buttonTextColor?: string;
Expand Down
41 changes: 23 additions & 18 deletions web-ui/pages/assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ type APYRates = {
};

function Home() {
const { address: qAddress, isWalletConnected } = useChain('quicksilver');
const { address } = useChain('quicksilver');
const { address, isWalletConnected } = useChain('quicksilver');
// Function to fetch token price from an API
const fetchTokenPrice = async (token: any) => {
try {
Expand All @@ -47,25 +46,31 @@ function Home() {
}
};

const COSMOSHUB_CHAIN_ID = process.env.NEXT_PUBLIC_COSMOSHUB_CHAIN_ID;
const OSMOSIS_CHAIN_ID = process.env.NEXT_PUBLIC_OSMOSIS_CHAIN_ID;
const STARGAZE_CHAIN_ID = process.env.NEXT_PUBLIC_STARGAZE_CHAIN_ID;
const REGEN_CHAIN_ID = process.env.NEXT_PUBLIC_REGEN_CHAIN_ID;
const SOMMELIER_CHAIN_ID = process.env.NEXT_PUBLIC_SOMMELIER_CHAIN_ID;

// Retrieve balance for each token
const { balance: qAtom, isLoading: qAtomIsLoading, isError: qAtomIsError } = useQBalanceQuery('quicksilver', qAddress ?? '', 'atom');
const { balance: qOsmo, isLoading: qOsmoIsLoading, isError: qOsmoIsError } = useQBalanceQuery('quicksilver', qAddress ?? '', 'osmo');
const { balance: qStars, isLoading: qStarsIsLoading, isError: qStarsIsError } = useQBalanceQuery('quicksilver', qAddress ?? '', 'stars');
const { balance: qRegen, isLoading: qRegenIsLoading, isError: qRegenIsError } = useQBalanceQuery('quicksilver', qAddress ?? '', 'regen');
const { balance: qSomm, isLoading: qSommIsLoading, isError: qSommIsError } = useQBalanceQuery('quicksilver', qAddress ?? '', 'somm');
const { balance: qAtom, isLoading: qAtomIsLoading, isError: qAtomIsError } = useQBalanceQuery('quicksilver', address ?? '', 'atom');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qAtomIsLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qAtomIsError.
const { balance: qOsmo, isLoading: qOsmoIsLoading, isError: qOsmoIsError } = useQBalanceQuery('quicksilver', address ?? '', 'osmo');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qOsmoIsLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qOsmoIsError.
const { balance: qStars, isLoading: qStarsIsLoading, isError: qStarsIsError } = useQBalanceQuery('quicksilver', address ?? '', 'stars');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qStarsIsLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qStarsIsError.
const { balance: qRegen, isLoading: qRegenIsLoading, isError: qRegenIsError } = useQBalanceQuery('quicksilver', address ?? '', 'regen');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qRegenIsLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qRegenIsError.
const { balance: qSomm, isLoading: qSommIsLoading, isError: qSommIsError } = useQBalanceQuery('quicksilver', address ?? '', 'somm');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qSommIsLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable qSommIsError.

// Retrieve zone data for each token
const { data: CosmosZone, isLoading: isCosmosZoneLoading, isError: isCosmosZoneError } = useZoneQuery('cosmoshub-4');
const { data: OsmoZone, isLoading: isOsmoZoneLoading, isError: isOsmoZoneError } = useZoneQuery('osmosis-1');
const { data: StarZone, isLoading: isStarZoneLoading, isError: isStarZoneError } = useZoneQuery('stargaze-1');
const { data: RegenZone, isLoading: isRegenZoneLoading, isError: isRegenZoneError } = useZoneQuery('regen-1');
const { data: SommZone, isLoading: isSommZoneLoading, isError: isSommZoneError } = useZoneQuery('sommelier-3');
const { data: CosmosZone, isLoading: isCosmosZoneLoading, isError: isCosmosZoneError } = useZoneQuery(COSMOSHUB_CHAIN_ID ?? '');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isCosmosZoneLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isCosmosZoneError.
const { data: OsmoZone, isLoading: isOsmoZoneLoading, isError: isOsmoZoneError } = useZoneQuery(OSMOSIS_CHAIN_ID ?? '');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isOsmoZoneLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isOsmoZoneError.
const { data: StarZone, isLoading: isStarZoneLoading, isError: isStarZoneError } = useZoneQuery(STARGAZE_CHAIN_ID ?? '');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isStarZoneLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isStarZoneError.
const { data: RegenZone, isLoading: isRegenZoneLoading, isError: isRegenZoneError } = useZoneQuery(REGEN_CHAIN_ID ?? '');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isRegenZoneLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isRegenZoneError.
const { data: SommZone, isLoading: isSommZoneLoading, isError: isSommZoneError } = useZoneQuery(SOMMELIER_CHAIN_ID ?? '');

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isSommZoneLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isSommZoneError.
// Retrieve APY data for each token
const { APY: cosmosAPY, isLoading: isCosmosAPYLoading, isError: isCosmosAPYError } = useAPYQuery('cosmoshub-4');
const { APY: osmoAPY, isLoading: isOsmoAPYLoading, isError: isOsmoAPYError } = useAPYQuery('osmosis-1');
const { APY: starsAPY, isLoading: isStarsAPYLoading, isError: isStarsAPYError } = useAPYQuery('stargaze-1');
const { APY: regenAPY, isLoading: isRegenAPYLoading, isError: isRegenAPYError } = useAPYQuery('regen-1');
const { APY: sommAPY, isLoading: isSommAPYLoading, isError: isSommAPYError } = useAPYQuery('sommelier-3');
const { APY: cosmosAPY, isLoading: isCosmosAPYLoading, isError: isCosmosAPYError } = useAPYQuery(COSMOSHUB_CHAIN_ID);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isCosmosAPYLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isCosmosAPYError.
const { APY: osmoAPY, isLoading: isOsmoAPYLoading, isError: isOsmoAPYError } = useAPYQuery(OSMOSIS_CHAIN_ID);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isOsmoAPYLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isOsmoAPYError.
const { APY: starsAPY, isLoading: isStarsAPYLoading, isError: isStarsAPYError } = useAPYQuery(STARGAZE_CHAIN_ID);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isStarsAPYLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isStarsAPYError.
const { APY: regenAPY, isLoading: isRegenAPYLoading, isError: isRegenAPYError } = useAPYQuery(REGEN_CHAIN_ID);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isRegenAPYLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isRegenAPYError.
const { APY: sommAPY, isLoading: isSommAPYLoading, isError: isSommAPYError } = useAPYQuery(SOMMELIER_CHAIN_ID);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isSommAPYLoading.

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable isSommAPYError.

// useMemo hook to cache APY data
const qAPYRates: APYRates = useMemo(
Expand Down Expand Up @@ -255,7 +260,7 @@ function Home() {
<Spacer />
{/* Unbonding Table */}
<Box mt="20px">
<UnbondingAssetsTable isWalletConnected={isWalletConnected} address={qAddress ?? ''} chainName="cosmoshub" />
<UnbondingAssetsTable isWalletConnected={isWalletConnected} address={address ?? ''} chainName="cosmoshub" />
</Box>
<Box h="40px"></Box>
</Container>
Expand Down
4 changes: 3 additions & 1 deletion web-ui/pages/staking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { StakingBox } from '@/components';
import { InfoBox } from '@/components';
import { AssetsAccordian } from '@/components';
import { useAPYQuery } from '@/hooks/useQueries';
import { networks } from '@/state/chains/prod';
import { networks as prodNetworks, testNetworks as devNetworks } from '@/state/chains/prod';
import { useChain } from '@cosmos-kit/react';

const DynamicStakingBox = dynamic(() => Promise.resolve(StakingBox), {
Expand All @@ -39,6 +39,8 @@ const DynamicAssetBox = dynamic(() => Promise.resolve(AssetsAccordian), {
ssr: false,
});

const networks = process.env.NEXT_PUBLIC_CHAIN_ENV === 'mainnet' ? prodNetworks : devNetworks;

export default function Staking() {
const [selectedNetwork, setSelectedNetwork] = useState(networks[0]);
const [isModalOpen, setModalOpen] = useState(false);
Expand Down
44 changes: 44 additions & 0 deletions web-ui/state/chains/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,50 @@ export const networks = [
},
];

export const testNetworks = [
{
value: 'ATOM',
logo: '/quicksilver/img/networks/atom.svg',
qlogo: '/quicksilver/img/networks/qatom.svg',
name: 'Cosmos Hub',
chainName: 'cosmoshub',
chainId: 'provider',
},
{
value: 'OSMO',
logo: '/quicksilver/img/networks/osmosis.svg',
qlogo: '/quicksilver/img/networks/qosmo.svg',
name: 'Osmosis',
chainName: 'osmosis',
chainId: 'osmo-test-5',
},
{
value: 'STARS',
logo: '/quicksilver/img/networks/stargaze.svg',
qlogo: '/quicksilver/img/networks/qstars.svg',
name: 'Stargaze',
chainName: 'stargaze',
chainId: 'elgafar-1',
},
{
value: 'REGEN',
logo: '/quicksilver/img/networks/regen.svg',
qlogo: '/quicksilver/img/networks/regen.svg',
name: 'Regen',
chainName: 'regen',
chainId: 'regen-redwood-1',
},
{
value: 'SOMM',
logo: '/quicksilver/img/networks/sommelier.png',
qlogo: '/quicksilver/img/networks/sommelier.png',
name: 'Sommelier',
chainName: 'sommelier',
chainId: 'sommelier-3',
},
];


export const ProdQuickSilverChainInfo = {
chainId: "quicksilver-2",
chainName: "Quicksilver Protocol",
Expand Down

0 comments on commit ff4b545

Please sign in to comment.