Skip to content

Commit

Permalink
fix: invoke redpacket parsing api on Firefly only (#11594)
Browse files Browse the repository at this point in the history
  • Loading branch information
swkatmask committed Apr 25, 2024
1 parent 3c78223 commit c082c4e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useLastRecognizedIdentity, usePostInfoDetails } from '@masknet/plugin-infra/content-script'
import { NetworkPluginID } from '@masknet/shared-base'
import { EnhanceableSite, NetworkPluginID } from '@masknet/shared-base'
import { useChainContext, useNetworkContext } from '@masknet/web3-hooks-base'
import { FireflyRedPacket } from '@masknet/web3-providers'
import type { FireflyRedPacketAPI } from '@masknet/web3-providers/types'
Expand All @@ -8,7 +8,8 @@ import { useQuery, type UseQueryResult } from '@tanstack/react-query'

type T = UseQueryResult
/**
* Parse RedPacket with post info
* Parse RedPacket with post info.
* Firefly only.
*/
export function useParseRedPacket(chainId: ChainId) {
const images = usePostInfoDetails.postMetadataImages()
Expand All @@ -20,9 +21,11 @@ export function useParseRedPacket(chainId: ChainId) {
const source = usePostInfoDetails.source()
const me = useLastRecognizedIdentity()
const myProfileId = me?.profileId
const site = usePostInfoDetails.site()
const isOnFirefly = site === EnhanceableSite.Firefly

const query = useQuery({
enabled: images.length > 0,
enabled: images.length > 0 && isOnFirefly,
queryKey: ['red-packet', 'parse', source, images[0], account],
queryFn: async () => {
const platform = source?.toLowerCase() as FireflyRedPacketAPI.PlatformType
Expand Down

0 comments on commit c082c4e

Please sign in to comment.