Skip to content

Commit

Permalink
constants
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenlejoe committed Jan 9, 2024
1 parent ebfe635 commit a3b207b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { GRK_SIZES } from "@/utils/constants/shared.constants";
import {
GRK_SIZES,
allowedCacheChains,
} from "@/utils/constants/shared.constants";
import { type Option, Some, None } from "@/utils/option";
import type {
MarketFloorPriceItem,
Expand Down Expand Up @@ -46,16 +49,7 @@ export const NFTCollectionTokenListView: React.FC<
const handleNftsToken = async () => {
setResult(None);
let response;
const allowedCacheChains = [
"bsc-mainnet",
"eth-mainnet",
"bsc-testnet",
"eth-sepolia",
"gnosis-mainnet",
"gnosis-testnet",
"matic-mainnet",
"matic-mumbai",
];

const cache = !allowedCacheChains.includes(chain_name);
try {
response =
Expand Down
15 changes: 4 additions & 11 deletions src/components/Organisms/NFTs/NFTDetailView/NFTDetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { type NFTDetailViewProps } from "@/utils/types/organisms.types";
import { type NftTokenContract } from "@covalenthq/client-sdk";
import { useEffect, useState } from "react";
import { Skeleton } from "@/components/ui/skeleton";
import { GRK_SIZES } from "@/utils/constants/shared.constants";
import {
GRK_SIZES,
allowedCacheChains,
} from "@/utils/constants/shared.constants";

export const NFTDetailView: React.FC<NFTDetailViewProps> = ({
chain_name,
Expand All @@ -20,16 +23,6 @@ export const NFTDetailView: React.FC<NFTDetailViewProps> = ({

useEffect(() => {
let response;
const allowedCacheChains = [
"bsc-mainnet",
"eth-mainnet",
"bsc-testnet",
"eth-sepolia",
"gnosis-mainnet",
"gnosis-testnet",
"matic-mainnet",
"matic-mumbai",
];
const cache = !allowedCacheChains.includes(chain_name);
(async () => {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { GRK_SIZES } from "@/utils/constants/shared.constants";
import {
GRK_SIZES,
allowedCacheChains,
} from "@/utils/constants/shared.constants";
import { type Option, Some, None } from "@/utils/option";
import type { ChainItem } from "@covalenthq/client-sdk";
import {
Expand Down Expand Up @@ -38,16 +41,6 @@ export const NFTWalletTokenListView: React.FC<NFTWalletTokenListViewProps> = ({
const handleNftsToken = async () => {
setResult(None);
const promises = chain_names.map(async (chain) => {
const allowedCacheChains = [
"bsc-mainnet",
"eth-mainnet",
"bsc-testnet",
"eth-sepolia",
"gnosis-mainnet",
"gnosis-testnet",
"matic-mainnet",
"matic-mumbai",
];
const cache = !allowedCacheChains.includes(chain);
let response;
try {
Expand Down
11 changes: 11 additions & 0 deletions src/utils/constants/shared.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,14 @@ export enum CURRENCY {
USD,
NATIVE,
}

export const allowedCacheChains = [
"bsc-mainnet",
"eth-mainnet",
"bsc-testnet",
"eth-sepolia",
"gnosis-mainnet",
"gnosis-testnet",
"matic-mainnet",
"matic-mumbai",
];

0 comments on commit a3b207b

Please sign in to comment.