Skip to content

Commit b76445e

Browse files
authored
refactor: mf-6776 remove all NFT functionality across the entire codebase (#12383)
* refactor: remove all NFT functionality across the entire codebase Phase 1: Delete pure NFT plugins (Avatar, Collectible, ArtBlocks) Phase 2: Clean NFT parts from mixed plugins (RedPacket, Tips, Trader, RSS3, Approval, ProfileCard) Phase 3: Delete content-script NFT injections (Twitter, Facebook, Instagram) Phase 4: Delete popup NFT pages (CollectibleDetail, NFTAvatarPicker, UnlockERC721Token, NonFungibleTokenSection, WalletCollections) Phase 5: Delete shared NFT UI components (NFTCard, NFTFallbackImage, NFTList, CollectibleList, AddCollectibles, ERC721Boundary, modals) Phase 6: Delete NFT web3 hooks (10 useNonFungible* + 2 useERC721* hooks) Phase 7: Delete NFT web3 providers (NFTScan, NFTSpam, HubNonFungible) Phase 8: Delete NFT types, contracts, constants, events, telemetry, icons, locales Phase 9: Final verification - fix TypeScript errors, remove dead code (Zora, Alchemy, OpenSea, LooksRare, MagicEden, SimpleHash, AvatarStore, etc.), add back needed SourceType values, simplify TransactionPreview/TokenTransactionConfirmModal Retained: ERC721.json/ERC1155.json ABIs for transaction decoding, ERC721 transaction descriptor, token redpacket (non-NFT) functionality * fixup! refactor: remove all NFT functionality across the entire codebase
1 parent f38ad4e commit b76445e

389 files changed

Lines changed: 2157 additions & 30570 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,4 @@ quick-lint-js.config
125125
.aider*
126126

127127
.claude
128+
.pnpm-store/

packages/icons/brands/NFTScan.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/icons/general/NFTRedPacket.svg

Lines changed: 0 additions & 82 deletions
This file was deleted.

packages/icons/icon-generated-as-jsx.js

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/icons/icon-generated-as-url.js

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/icons/plugins/NFTAvatar.svg

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/mask/content-script/components/CompositionDialog/useSubmit.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import Services from '#services'
22
import { encodeByNetwork } from '@masknet/encryption'
3-
import {
4-
PluginID,
5-
RedPacketMetaKey,
6-
RedPacketNftMetaKey,
7-
Sniffings,
8-
SOCIAL_MEDIA_NAME,
9-
SolanaRedPacketMetaKey,
10-
} from '@masknet/shared-base'
3+
import { PluginID, RedPacketMetaKey, Sniffings, SOCIAL_MEDIA_NAME, SolanaRedPacketMetaKey } from '@masknet/shared-base'
114
import type { Meta } from '@masknet/typed-message'
125
import { Telemetry } from '@masknet/web3-telemetry'
136
import { EventID, EventType } from '@masknet/web3-telemetry/types'
@@ -73,11 +66,7 @@ export function useSubmit(onClose: () => void, reason: 'timeline' | 'popup' | 'r
7366
})
7467
}
7568

76-
if (
77-
content.meta?.has(RedPacketMetaKey) ||
78-
content.meta?.has(RedPacketNftMetaKey) ||
79-
content.meta?.has(SolanaRedPacketMetaKey)
80-
)
69+
if (content.meta?.has(RedPacketMetaKey) || content.meta?.has(SolanaRedPacketMetaKey))
8170
Telemetry.captureEvent(EventType.Interact, EventID.EntryAppLuckSend)
8271
Telemetry.captureEvent(EventType.Interact, EventID.EntryMaskComposeEncrypt)
8372

@@ -92,11 +81,11 @@ export function useSubmit(onClose: () => void, reason: 'timeline' | 'popup' | 'r
9281
function decorateEncryptedText(encrypted: string, _: I18nContext['_'], meta?: Meta): string | null {
9382
if (!meta) return null
9483
const hasOfficialAccount = Sniffings.is_twitter_page || Sniffings.is_facebook_page
95-
const token = meta.has(RedPacketMetaKey) || meta.has(SolanaRedPacketMetaKey) ? _(msg`a token`) : _(msg`an NFT`)
84+
const token = _(msg`a token`)
9685
const sns = SOCIAL_MEDIA_NAME[activatedSiteAdaptorUI!.networkIdentifier]
9786

9887
// Note: since this is in the composition stage, we can assume plugins don't insert old version of meta.
99-
if (meta.has(RedPacketMetaKey) || meta.has(RedPacketNftMetaKey) || meta.has(SolanaRedPacketMetaKey)) {
88+
if (meta.has(RedPacketMetaKey) || meta.has(SolanaRedPacketMetaKey)) {
10089
const promote_red_packet = _(msg`Hi friends, I just created ${token} Lucky Drop. Download Mask.io to claim.`)
10190
const promote_red_packet2 = _(msg`🧧🧧🧧 Try sending Lucky Drop to your friends with Mask.io.`)
10291
return hasOfficialAccount ?

packages/mask/content-script/components/InjectedComponents/DecryptedPost/DecryptedPost.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { Fragment, useContext, useEffect, useReducer, type Dispatch, type SetStateAction } from 'react'
22
import { extractTextFromTypedMessage, isTypedMessageEqual, type TypedMessage } from '@masknet/typed-message'
3-
import {
4-
RedPacketMetaKey,
5-
RedPacketNftMetaKey,
6-
SolanaRedPacketMetaKey,
7-
type ProfileIdentifier,
8-
} from '@masknet/shared-base'
3+
import { RedPacketMetaKey, SolanaRedPacketMetaKey, type ProfileIdentifier } from '@masknet/shared-base'
94

105
import Services, { GeneratorServices } from '#services'
116
import type { DecryptionProgress, FailureDecryption, SuccessDecryption } from './types.js'
@@ -155,11 +150,7 @@ export function DecryptPost({ whoAmI, onImageDecrypted }: DecryptPostProps) {
155150
})
156151
if (!message.meta) return
157152
// For now, we only care about RedPacket payload
158-
if (
159-
message.meta.has(RedPacketMetaKey) ||
160-
message.meta.has(RedPacketNftMetaKey) ||
161-
message.meta.has(SolanaRedPacketMetaKey)
162-
) {
153+
if (message.meta.has(RedPacketMetaKey) || message.meta.has(SolanaRedPacketMetaKey)) {
163154
onImageDecrypted((images) => (images.includes(url) ? images : [...images, url]))
164155
}
165156
},

packages/mask/content-script/components/InjectedComponents/ProfileCard/AvatarDecoration.tsx

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/mask/content-script/components/InjectedComponents/ProfileCard/ProfileBar.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ import { ChainId } from '@masknet/web3-shared-evm'
1212
import { Box, Link, Skeleton, Typography } from '@mui/material'
1313
import type { BoxProps } from '@mui/system'
1414
import { PluginTraderMessages } from '@masknet/plugin-trader'
15-
import { AvatarDecoration } from './AvatarDecoration.js'
1615
import { useLingui } from '@lingui/react/macro'
1716

18-
const useStyles = makeStyles<void, 'avatarDecoration'>()((theme, _, refs) => ({
17+
const useStyles = makeStyles()((theme) => ({
1918
root: {
2019
display: 'flex',
2120
alignItems: 'center',
@@ -38,19 +37,10 @@ const useStyles = makeStyles<void, 'avatarDecoration'>()((theme, _, refs) => ({
3837
// Adjust to fit the rainbow border.
3938
transform: 'scale(0.94, 0.96) translate(0, 1px)',
4039
},
41-
[`& .${refs.avatarDecoration}`]: {
42-
position: 'absolute',
43-
left: 0,
44-
top: 0,
45-
width: '100%',
46-
height: '100%',
47-
transform: 'scale(1)',
48-
},
4940
},
5041
avatarImageContainer: {
5142
borderRadius: '50%',
5243
},
53-
avatarDecoration: {},
5444
description: {
5545
height: 40,
5646
marginLeft: 10,
@@ -152,7 +142,6 @@ export const ProfileBar = memo<ProfileBarProps>(function ProfileBar({
152142
className: classes.avatarImageContainer,
153143
}}
154144
/>
155-
<AvatarDecoration className={classes.avatarDecoration} userId={identity.identifier?.userId} size={40} />
156145
</div>
157146
<Box className={classes.description}>
158147
<Typography className={classes.nickname} title={identity.nickname}>

0 commit comments

Comments
 (0)