Skip to content

Commit

Permalink
fix: fw-810 add twitter to claim requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
swkatmask committed Apr 29, 2024
1 parent fc8235f commit 0e2dbd0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function FireflyRedpacketConfirmDialog({
onCreated,
onClose,
}: FireflyRedpacketConfirmDialogProps) {
const { currentFarcasterProfile, currentLensProfile } = fireflyContext || {}
const { currentFarcasterProfile, currentLensProfile, currentTwitterProfile } = fireflyContext || {}
const t = useRedPacketTrans()
const { chainId, account } = useChainContext<NetworkPluginID.PLUGIN_EVM>()
const { data: ensName } = useReverseAddress(NetworkPluginID.PLUGIN_EVM, account, true)
Expand All @@ -137,9 +137,8 @@ export function FireflyRedpacketConfirmDialog({
true,
)
const { classes, theme } = useStyles()
const [currentAccount, setCurrentAccount] = useState(
currentLensProfile?.handle || currentFarcasterProfile?.handle || ensName || account,
)
const snsHandle = currentLensProfile?.handle || currentFarcasterProfile?.handle || currentTwitterProfile?.handle
const [currentAccount, setCurrentAccount] = useState(snsHandle || ensName || account)

const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)

Expand Down Expand Up @@ -173,7 +172,7 @@ export function FireflyRedpacketConfirmDialog({
const isLatest = urls?.length && currentIndex === urls.length - 1

const accounts = useMemo(() => {
const { currentFarcasterProfile, currentLensProfile } = fireflyContext
const { currentFarcasterProfile, currentLensProfile, currentTwitterProfile } = fireflyContext
return uniqBy(
compact([
currentLensProfile ?
Expand All @@ -185,6 +184,9 @@ export function FireflyRedpacketConfirmDialog({
currentLensProfile?.ownedBy ?
{ icon: <Icons.MaskWallet size={24} />, displayName: lensOwnerENS || currentLensProfile.address }
: undefined,
currentTwitterProfile ?
{ icon: <Icons.TwitterXRound size={24} />, displayName: currentTwitterProfile.handle }
: undefined,
currentFarcasterProfile?.ownedBy ?
{
icon: <Icons.MaskWallet size={24} />,
Expand Down Expand Up @@ -226,6 +228,12 @@ export function FireflyRedpacketConfirmDialog({
profileId: currentFarcasterProfile.profileId,
}
: undefined,
currentTwitterProfile ?
{
platform: FireflyRedPacketAPI.PlatformType.twitter,
profileId: currentTwitterProfile.profileId,
}
: undefined,
]),
}
: undefined,
Expand Down Expand Up @@ -264,7 +272,15 @@ export function FireflyRedpacketConfirmDialog({
publicKey: await FireflyRedPacket.createPublicKey(state.themeId, currentAccount, payload),
claimRequirements: payload,
}
}, [state?.themeId, currentLensProfile, currentFarcasterProfile, fireflySettings, chainId, currentAccount])
}, [
state?.themeId,
currentLensProfile,
currentFarcasterProfile,
currentTwitterProfile,
fireflySettings,
chainId,
currentAccount,
])

const { createRedpacket, isCreating } = useCreateFTRedpacketCallback(
value?.publicKey ?? '',
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/RedPacket/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type FireflySocialProfile = {
export interface FireflyContext {
currentLensProfile?: FireflySocialProfile | null
currentFarcasterProfile?: FireflySocialProfile | null
currentTwitterProfile?: FireflySocialProfile | null
}

export enum FireflyAccountSource {
Expand Down

0 comments on commit 0e2dbd0

Please sign in to comment.