Skip to content

Commit

Permalink
Revert "fix: worker env (#1048)"
Browse files Browse the repository at this point in the history
This reverts commit 9d8fbb4.
  • Loading branch information
sasicodes authored Oct 1, 2023
1 parent 9d8fbb4 commit f55c89a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
10 changes: 7 additions & 3 deletions apps/web/src/components/Home/OpenActions/Zora/ZoraNft.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import CollectOutline from '@components/Common/Icons/CollectOutline'
import UserPreview from '@components/Common/UserPreview'
import Modal from '@components/UIElements/Modal'
import { LENSTUBE_ADDRESS, ZORA_MAINNET_CHAINS } from '@lenstube/constants'
import { trimLensHandle, useZoraNft } from '@lenstube/generic'
import { LENSTUBE_ADDRESS } from '@lenstube/constants'
import {
getZoraChainIsMainnet,
trimLensHandle,
useZoraNft
} from '@lenstube/generic'
import type { Profile } from '@lenstube/lens'
import type { BasicNftMetadata } from '@lenstube/lens/custom-types'
import { getShortHandTime } from '@lib/formatTime'
Expand Down Expand Up @@ -34,7 +38,7 @@ const ZoraNft: FC<Props> = ({ nftMetadata, sharedBy, postedAt }) => {
return null
}

const network = ZORA_MAINNET_CHAINS.includes(chain) ? '' : 'testnet.'
const network = getZoraChainIsMainnet(chain) ? '' : 'testnet.'
const zoraLink = `https://${network}zora.co/collect/${chain}:${address}${
token ? `/${token}` : ''
}?referrer=${LENSTUBE_ADDRESS}`
Expand Down
3 changes: 0 additions & 3 deletions packages/constants/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,3 @@ export const ALLOWED_HEX_CHARACTERS = [
'E',
'F'
]

// open actions
export const ZORA_MAINNET_CHAINS = ['eth', 'oeth', 'base', 'zora']
5 changes: 5 additions & 0 deletions packages/helpers/generic/functions/getZoraChainIsMainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const mainnetChains = ['eth', 'oeth', 'base', 'zora']

export const getZoraChainIsMainnet = (chain: string): boolean => {
return mainnetChains.includes(chain)
}
1 change: 1 addition & 0 deletions packages/helpers/generic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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'
Expand Down
7 changes: 2 additions & 5 deletions packages/workers/nfts/src/handlers/getZoraNft.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { WorkerRequest } from '../types'

const ZORA_MAINNET_CHAINS = ['eth', 'oeth', 'base', 'zora']
import { getZoraChainIsMainnet } from '@lenstube/generic'

export default async (request: WorkerRequest) => {
const { chain, address, token } = request.query
Expand All @@ -15,9 +14,7 @@ export default async (request: WorkerRequest) => {
}

try {
const network = ZORA_MAINNET_CHAINS.includes(chain as string)
? ''
: 'testnet.'
const network = getZoraChainIsMainnet(chain as string) ? '' : 'testnet.'
const zoraResponse = await fetch(
`https://${network}zora.co/api/personalize/collection/${chain}:${address}/${
token || ''
Expand Down

0 comments on commit f55c89a

Please sign in to comment.