diff --git a/apps/web/src/components/Home/OpenActions/Zora/ZoraNft.tsx b/apps/web/src/components/Home/OpenActions/Zora/ZoraNft.tsx index fc4a52175..98f693b54 100644 --- a/apps/web/src/components/Home/OpenActions/Zora/ZoraNft.tsx +++ b/apps/web/src/components/Home/OpenActions/Zora/ZoraNft.tsx @@ -1,12 +1,8 @@ import CollectOutline from '@components/Common/Icons/CollectOutline' import UserPreview from '@components/Common/UserPreview' import Modal from '@components/UIElements/Modal' -import { LENSTUBE_ADDRESS } from '@lenstube/constants' -import { - getZoraChainIsMainnet, - trimLensHandle, - useZoraNft -} from '@lenstube/generic' +import { LENSTUBE_ADDRESS, ZORA_MAINNET_CHAINS } from '@lenstube/constants' +import { trimLensHandle, useZoraNft } from '@lenstube/generic' import type { Profile } from '@lenstube/lens' import type { BasicNftMetadata } from '@lenstube/lens/custom-types' import { getShortHandTime } from '@lib/formatTime' @@ -38,7 +34,7 @@ const ZoraNft: FC = ({ nftMetadata, sharedBy, postedAt }) => { return null } - const network = getZoraChainIsMainnet(chain) ? '' : 'testnet.' + const network = ZORA_MAINNET_CHAINS.includes(chain) ? '' : 'testnet.' const zoraLink = `https://${network}zora.co/collect/${chain}:${address}${ token ? `/${token}` : '' }?referrer=${LENSTUBE_ADDRESS}` diff --git a/packages/constants/general.ts b/packages/constants/general.ts index b20f5861c..4be1a87e5 100644 --- a/packages/constants/general.ts +++ b/packages/constants/general.ts @@ -201,3 +201,6 @@ export const ALLOWED_HEX_CHARACTERS = [ 'E', 'F' ] + +// open actions +export const ZORA_MAINNET_CHAINS = ['eth', 'oeth', 'base', 'zora'] diff --git a/packages/helpers/generic/functions/getZoraChainIsMainnet.ts b/packages/helpers/generic/functions/getZoraChainIsMainnet.ts deleted file mode 100644 index 890cdc8f1..000000000 --- a/packages/helpers/generic/functions/getZoraChainIsMainnet.ts +++ /dev/null @@ -1,5 +0,0 @@ -const mainnetChains = ['eth', 'oeth', 'base', 'zora'] - -export const getZoraChainIsMainnet = (chain: string): boolean => { - return mainnetChains.includes(chain) -} diff --git a/packages/helpers/generic/index.ts b/packages/helpers/generic/index.ts index d71b1b733..1545f09f7 100644 --- a/packages/helpers/generic/index.ts +++ b/packages/helpers/generic/index.ts @@ -18,7 +18,6 @@ export * from './functions/getSignature' export * from './functions/getThumbnailUrl' export * from './functions/getURLs' export * from './functions/getZoraChainInfo' -export * from './functions/getZoraChainIsMainnet' export * from './functions/imageCdn' export * from './functions/isWatchable' export * from './functions/omitKey' diff --git a/packages/workers/nfts/src/handlers/getZoraNft.ts b/packages/workers/nfts/src/handlers/getZoraNft.ts index 87ab0f0bf..13c730910 100644 --- a/packages/workers/nfts/src/handlers/getZoraNft.ts +++ b/packages/workers/nfts/src/handlers/getZoraNft.ts @@ -1,5 +1,6 @@ import { WorkerRequest } from '../types' -import { getZoraChainIsMainnet } from '@lenstube/generic' + +const ZORA_MAINNET_CHAINS = ['eth', 'oeth', 'base', 'zora'] export default async (request: WorkerRequest) => { const { chain, address, token } = request.query @@ -14,7 +15,9 @@ export default async (request: WorkerRequest) => { } try { - const network = getZoraChainIsMainnet(chain as string) ? '' : 'testnet.' + const network = ZORA_MAINNET_CHAINS.includes(chain as string) + ? '' + : 'testnet.' const zoraResponse = await fetch( `https://${network}zora.co/api/personalize/collection/${chain}:${address}/${ token || ''