diff --git a/package.json b/package.json index ee42bc10f9da..fa9f5e8356fe 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "yarn": ">=999.0.0", "npm": ">=999.0.0" }, - "version": "2.31.1", + "version": "2.31.3", "private": true, "license": "AGPL-3.0-or-later", "scripts": { diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx index 9e08bc9edba1..8915f1ce4af6 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx @@ -1,15 +1,15 @@ import { msg } from '@lingui/core/macro' import { useLingui } from '@lingui/react' -import { useLastRecognizedIdentity, usePostInfoDetails, usePostLink } from '@masknet/plugin-infra/content-script' -import { requestLogin, share } from '@masknet/plugin-infra/content-script/context' +import { usePostInfoDetails, usePostLink } from '@masknet/plugin-infra/content-script' +import { share } from '@masknet/plugin-infra/content-script/context' import { LoadingStatus, TransactionConfirmModal } from '@masknet/shared' import { EMPTY_LIST, NetworkPluginID, Sniffings } from '@masknet/shared-base' import { queryClient } from '@masknet/shared-base-ui' import { makeStyles } from '@masknet/theme' import type { HappyRedPacketV4 } from '@masknet/web3-contracts/types/HappyRedPacketV4.js' import { NetworkContextProvider, useChainContext, useNetwork } from '@masknet/web3-hooks-base' -import { EVMChainResolver, FireflyRedPacket } from '@masknet/web3-providers' -import { FireflyRedPacketAPI, RedPacketStatus, type RedPacketJSONPayload } from '@masknet/web3-providers/types' +import { EVMChainResolver } from '@masknet/web3-providers' +import { RedPacketStatus, type RedPacketJSONPayload } from '@masknet/web3-providers/types' import { TokenType, formatBalance, isZero, minus } from '@masknet/web3-shared-base' import { ChainId } from '@masknet/web3-shared-evm' import { Card, Grow } from '@mui/material' @@ -21,7 +21,6 @@ import { useClaimCallback } from '../hooks/useClaimCallback.js' import { useRedPacketContract } from '../hooks/useRedPacketContract.js' import { useRefundCallback } from '../hooks/useRefundCallback.js' import { OperationFooter } from './OperationFooter.js' -import { RequestLoginFooter } from './RequestLoginFooter.js' import { useRedPacketCover } from './useRedPacketCover.js' const useStyles = makeStyles()((theme) => { @@ -166,9 +165,6 @@ export const RedPacket = memo(function RedPacket({ payload, currentPluginID }: R }, [token, redPacketContract, payload.rpid, account, claimedShareText, source]) const [showRequirements, setShowRequirements] = useState(false) - const me = useLastRecognizedIdentity() - const myProfileId = me?.profileId - const myHandle = me?.identifier?.userId const onClaimOrRefund = useCallback(async () => { let hash: string | undefined if (canClaim) { @@ -178,15 +174,6 @@ export const RedPacket = memo(function RedPacket({ payload, currentPluginID }: R return } hash = await claimCallback() - if (myProfileId && myHandle && hash) { - await FireflyRedPacket.finishClaiming( - payload.rpid, - FireflyRedPacketAPI.PlatformType.twitter, - myProfileId, - myHandle, - hash, - ) - } await checkResult() queryClient.invalidateQueries({ queryKey: ['redpacket', 'history'], @@ -197,17 +184,7 @@ export const RedPacket = memo(function RedPacket({ payload, currentPluginID }: R if (typeof hash === 'string') { checkAvailability() } - }, [ - canClaim, - canRefund, - claimCallback, - checkResult, - recheckClaimStatus, - checkAvailability, - payload.rpid, - myProfileId, - myHandle, - ]) + }, [canClaim, canRefund, claimCallback, checkResult, recheckClaimStatus, checkAvailability]) const outdated = isEmpty || (!canRefund && listOfStatus.includes(RedPacketStatus.expired)) @@ -261,18 +238,6 @@ export const RedPacket = memo(function RedPacket({ payload, currentPluginID }: R ) if (outdated) return card - if (!myHandle) - return ( - <> - {card} - { - requestLogin?.(source) - }} - /> - - ) return ( <> diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedPacket/SolanaRedPacketCard.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedPacket/SolanaRedPacketCard.tsx index 41ffefadc118..e5a3734013a9 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedPacket/SolanaRedPacketCard.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedPacket/SolanaRedPacketCard.tsx @@ -1,8 +1,8 @@ import { BN, web3 } from '@coral-xyz/anchor' import { msg } from '@lingui/core/macro' import { useLingui } from '@lingui/react' -import { useLastRecognizedIdentity, usePostInfoDetails, usePostLink } from '@masknet/plugin-infra/content-script' -import { requestLogin, share } from '@masknet/plugin-infra/content-script/context' +import { usePostInfoDetails, usePostLink } from '@masknet/plugin-infra/content-script' +import { share } from '@masknet/plugin-infra/content-script/context' import { LoadingStatus, TransactionConfirmModal } from '@masknet/shared' import { type NetworkPluginID, Sniffings } from '@masknet/shared-base' import { queryClient } from '@masknet/shared-base-ui' @@ -14,20 +14,19 @@ import { useNetwork, useNetworkContext, } from '@masknet/web3-hooks-base' -import { FireflyRedPacket, SolanaChainResolver } from '@masknet/web3-providers' -import { FireflyRedPacketAPI, RedPacketStatus, type SolanaRedPacketJSONPayload } from '@masknet/web3-providers/types' +import { SolanaChainResolver } from '@masknet/web3-providers' +import { RedPacketStatus, type SolanaRedPacketJSONPayload } from '@masknet/web3-providers/types' import { TokenType, formatBalance, minus } from '@masknet/web3-shared-base' import { ChainId } from '@masknet/web3-shared-solana' import { Card } from '@mui/material' import { memo, useCallback, useMemo } from 'react' +import { useAsyncFn } from 'react-use' import { RedPacketEnvelope } from '../components/RedPacketEnvelope.js' import { getClaimRecord } from '../helpers/getClaimRecord.js' import { useSolanaAvailability } from './hooks/useAvailability.js' import { useClaimCallback } from './hooks/useClaimCallback.js' import { OperationFooter } from './OperationFooter.js' -import { RequestLoginFooter } from './RequestLoginFooter.js' import { useRedPacketCover } from './useRedPacketCover.js' -import { useAsyncFn } from 'react-use' const useStyles = makeStyles()((theme) => { return { @@ -126,9 +125,6 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({ ) const claimedShareText = useMemo(() => getShareText(true), [getShareText]) - const me = useLastRecognizedIdentity() - const myProfileId = me?.profileId - const myHandle = me?.identifier?.userId const [{ loading: isClaimingAndChecking }, onClaimOrRefund] = useAsyncFn(async () => { let hash: string | undefined if (canClaim) { @@ -139,15 +135,6 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({ tokenAddress: payload.token!.address, tokenProgram: payload.tokenProgram ? new web3.PublicKey(payload.tokenProgram) : undefined, }) - if (myProfileId && myHandle && hash) { - await FireflyRedPacket.finishClaiming( - payload.rpid, - FireflyRedPacketAPI.PlatformType.twitter, - myProfileId, - myHandle, - hash, - ) - } const claimRecord = await getClaimRecord({ cluster: payload.network ?? 'mainnet-beta', accountId: payload.accountId, @@ -173,7 +160,7 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({ if (typeof hash === 'string') { refreshRedPacket() } - }, [canClaim, canRefund, claimCallback, refreshRedPacket, payload.rpid, myProfileId, myHandle, account]) + }, [canClaim, canRefund, claimCallback, refreshRedPacket, payload.rpid, account]) const outdated = availability?.isEmpty || (!canRefund && listOfStatus.includes(RedPacketStatus.expired)) @@ -214,9 +201,7 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({ /> - {outdated ? - null - : myHandle ? + {outdated ? null : ( {/* ChainBoundary needs to know the current network */} - : { - requestLogin?.(source) - }} - /> - } + )} ) }) diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedpacketDialog/CreateRedpacket.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedpacketDialog/CreateRedpacket.tsx index b33af2b7dedb..9728a4833ea7 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedpacketDialog/CreateRedpacket.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/SolanaRedpacketDialog/CreateRedpacket.tsx @@ -189,8 +189,8 @@ export function CreateSolRedPacket() { customThemes, setCustomThemes, setTheme, - message, - setMessage, + inputMessage, + setInputMessage, shares, setShares, isRandom, @@ -250,9 +250,9 @@ export function CreateSolRedPacket() { shares, // Avoid causing rpc rate limit due to too fast requests. new BigNumber('0.0001').toNumber(), - !!isRandom, + isRandom, publicKey, - message, + inputMessage, creator, token, cluster, @@ -308,9 +308,9 @@ export function CreateSolRedPacket() { <>
-