1
1
import { BN , web3 } from '@coral-xyz/anchor'
2
2
import { msg } from '@lingui/core/macro'
3
3
import { useLingui } from '@lingui/react'
4
- import { useLastRecognizedIdentity , usePostInfoDetails , usePostLink } from '@masknet/plugin-infra/content-script'
5
- import { requestLogin , share } from '@masknet/plugin-infra/content-script/context'
4
+ import { usePostInfoDetails , usePostLink } from '@masknet/plugin-infra/content-script'
5
+ import { share } from '@masknet/plugin-infra/content-script/context'
6
6
import { LoadingStatus , TransactionConfirmModal } from '@masknet/shared'
7
7
import { type NetworkPluginID , Sniffings } from '@masknet/shared-base'
8
8
import { queryClient } from '@masknet/shared-base-ui'
@@ -14,20 +14,19 @@ import {
14
14
useNetwork ,
15
15
useNetworkContext ,
16
16
} from '@masknet/web3-hooks-base'
17
- import { FireflyRedPacket , SolanaChainResolver } from '@masknet/web3-providers'
18
- import { FireflyRedPacketAPI , RedPacketStatus , type SolanaRedPacketJSONPayload } from '@masknet/web3-providers/types'
17
+ import { SolanaChainResolver } from '@masknet/web3-providers'
18
+ import { RedPacketStatus , type SolanaRedPacketJSONPayload } from '@masknet/web3-providers/types'
19
19
import { TokenType , formatBalance , minus } from '@masknet/web3-shared-base'
20
20
import { ChainId } from '@masknet/web3-shared-solana'
21
21
import { Card } from '@mui/material'
22
22
import { memo , useCallback , useMemo } from 'react'
23
+ import { useAsyncFn } from 'react-use'
23
24
import { RedPacketEnvelope } from '../components/RedPacketEnvelope.js'
24
25
import { getClaimRecord } from '../helpers/getClaimRecord.js'
25
26
import { useSolanaAvailability } from './hooks/useAvailability.js'
26
27
import { useClaimCallback } from './hooks/useClaimCallback.js'
27
28
import { OperationFooter } from './OperationFooter.js'
28
- import { RequestLoginFooter } from './RequestLoginFooter.js'
29
29
import { useRedPacketCover } from './useRedPacketCover.js'
30
- import { useAsyncFn } from 'react-use'
31
30
32
31
const useStyles = makeStyles ( ) ( ( theme ) => {
33
32
return {
@@ -126,9 +125,6 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({
126
125
)
127
126
const claimedShareText = useMemo ( ( ) => getShareText ( true ) , [ getShareText ] )
128
127
129
- const me = useLastRecognizedIdentity ( )
130
- const myProfileId = me ?. profileId
131
- const myHandle = me ?. identifier ?. userId
132
128
const [ { loading : isClaimingAndChecking } , onClaimOrRefund ] = useAsyncFn ( async ( ) => {
133
129
let hash : string | undefined
134
130
if ( canClaim ) {
@@ -139,15 +135,6 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({
139
135
tokenAddress : payload . token ! . address ,
140
136
tokenProgram : payload . tokenProgram ? new web3 . PublicKey ( payload . tokenProgram ) : undefined ,
141
137
} )
142
- if ( myProfileId && myHandle && hash ) {
143
- await FireflyRedPacket . finishClaiming (
144
- payload . rpid ,
145
- FireflyRedPacketAPI . PlatformType . twitter ,
146
- myProfileId ,
147
- myHandle ,
148
- hash ,
149
- )
150
- }
151
138
const claimRecord = await getClaimRecord ( {
152
139
cluster : payload . network ?? 'mainnet-beta' ,
153
140
accountId : payload . accountId ,
@@ -173,7 +160,7 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({
173
160
if ( typeof hash === 'string' ) {
174
161
refreshRedPacket ( )
175
162
}
176
- } , [ canClaim , canRefund , claimCallback , refreshRedPacket , payload . rpid , myProfileId , myHandle , account ] )
163
+ } , [ canClaim , canRefund , claimCallback , refreshRedPacket , payload . rpid , account ] )
177
164
178
165
const outdated = availability ?. isEmpty || ( ! canRefund && listOfStatus . includes ( RedPacketStatus . expired ) )
179
166
@@ -214,9 +201,7 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({
214
201
/>
215
202
</ SOLWeb3ContextProvider >
216
203
</ Card >
217
- { outdated ?
218
- null
219
- : myHandle ?
204
+ { outdated ? null : (
220
205
< NetworkContextProvider initialNetwork = { currentPluginID } >
221
206
{ /* ChainBoundary needs to know the current network */ }
222
207
< OperationFooter
@@ -229,13 +214,7 @@ export const SolanaRedPacketCard = memo(function SolanaRedPacketCard({
229
214
onClaimOrRefund = { onClaimOrRefund }
230
215
/>
231
216
</ NetworkContextProvider >
232
- : < RequestLoginFooter
233
- className = { classes . footer }
234
- onRequest = { ( ) => {
235
- requestLogin ?.( source )
236
- } }
237
- />
238
- }
217
+ ) }
239
218
</ >
240
219
)
241
220
} )
0 commit comments