Skip to content

Commit 7c44e0d

Browse files
guanbinruiguanbinruinuanyang233UncleBillJack-Works
authored
[Release] Hotfix 2.23.9 => 2.23.10 (patch) (#11122)
* [Release] Hotfix 2.23.9 => 2.23.10 (patch) * feat: upgrade lens (#11124) * chore: pick commit * chore: build error * chore: revert test code * fix: mf-5473 lower spam score (#10965) * fix: bugfix for lens (#11132) * feat: lens sign less api (#11133) * fix: unit test (#11139) * fix: canParse * Update setups/index.ts * fix: threads * refactor: remove patch --------- Co-authored-by: Jack Works <[email protected]> Co-authored-by: guanbinrui <[email protected]> Co-authored-by: guanbinrui <[email protected]> --------- Co-authored-by: guanbinrui <[email protected]> Co-authored-by: nuanyang233 <[email protected]> Co-authored-by: UncleBill <[email protected]> Co-authored-by: Jack Works <[email protected]>
1 parent ea9e67f commit 7c44e0d

File tree

24 files changed

+3600
-1367
lines changed

24 files changed

+3600
-1367
lines changed

Diff for: cspell.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"./packages/app/postcss.config.cjs",
77
"./packages/app/src/styles/index.css",
88
"./packages/app/tailwind.config.cjs",
9-
"./packages/web3-contracts/types/**",
109
"./packages/icons/countries/**",
10+
"./packages/web3-contracts/types/**",
1111
".github",
1212
".gitignore",
1313
".prettierignore",
@@ -108,6 +108,7 @@
108108
"fbid",
109109
"filelist",
110110
"fileservice",
111+
"finalised",
111112
"flashloan",
112113
"flowns",
113114
"forcaster",
@@ -266,6 +267,7 @@
266267
"shiden",
267268
"siddomains",
268269
"sidjs",
270+
"signless",
269271
"sinonjs",
270272
"sniffings",
271273
"solana",
@@ -303,6 +305,7 @@
303305
"typeson",
304306
"unencrypted",
305307
"unfollow",
308+
"unfollower",
306309
"unreviewed",
307310
"unstake",
308311
"unstoppabledomains",

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"yarn": ">=999.0.0",
99
"npm": ">=999.0.0"
1010
},
11-
"version": "2.23.9",
11+
"version": "2.23.10",
1212
"private": true,
1313
"license": "AGPL-3.0-or-later",
1414
"scripts": {
@@ -24,7 +24,7 @@
2424
"lint:ci-report": "pnpm run lint:ci --format=junit --output-file=reports/junit/eslint-results.xml --max-warnings=0",
2525
"prepare": "husky install",
2626
"svgo": "svgo packages/icons/*/*.svg",
27-
"test": "vitest",
27+
"test": "vitest --no-threads",
2828
"spellcheck": "cspell lint --no-must-find-files",
2929
"clean": "npx gulp clean"
3030
},

Diff for: packages/mask/src/extension/popups/hooks/useSearchValue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function useSearchValue(value: string, type?: NextIDPlatform): AsyncState
1111

1212
if (value.endsWith('.eth')) return (await ENS.lookup(value))?.toLowerCase()
1313

14-
if (value.endsWith('.lens')) return (await Lens.getProfileByHandle(value)).ownedBy?.toLowerCase()
14+
if (value.endsWith('.lens')) return (await Lens.getProfileByHandle(value)).ownedBy.address?.toLowerCase()
1515

1616
return value.toLowerCase()
1717
}, [value])

Diff for: packages/plugins/Web3Profile/src/SiteAdaptor/components/FollowLensDialog.tsx

+61-35
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import { NetworkPluginID } from '@masknet/shared-base'
1212
import { ActionButton, makeStyles, useCustomSnackbar } from '@masknet/theme'
1313
import { useChainContext, useFungibleTokenBalance, useNetworkContext, useWallet } from '@masknet/web3-hooks-base'
1414
import { Lens } from '@masknet/web3-providers'
15-
import { FollowModuleType } from '@masknet/web3-providers/types'
16-
import { formatBalance, isLessThan, isSameAddress, resolveIPFS_URL, ZERO } from '@masknet/web3-shared-base'
15+
import { FollowModuleType, type LensBaseAPI } from '@masknet/web3-providers/types'
16+
import { formatBalance, isLessThan, isSameAddress, ZERO } from '@masknet/web3-shared-base'
1717
import { ChainId, createERC20Token, formatAmount, ProviderType } from '@masknet/web3-shared-evm'
1818
import { Avatar, Box, Button, buttonClasses, CircularProgress, DialogContent, Typography } from '@mui/material'
1919
import { Translate, useI18N } from '../../locales/i18n_generated.js'
2020
import { getLensterLink } from '../../utils.js'
2121
import { useFollow } from '../hooks/Lens/useFollow.js'
2222
import { useUnfollow } from '../hooks/Lens/useUnfollow.js'
23+
import { useQuery } from '@tanstack/react-query'
2324
import { HandlerDescription } from './HandlerDescription.js'
2425
import { useConfettiExplosion } from '../hooks/ConfettiExplosion/index.js'
2526

@@ -111,6 +112,7 @@ export function FollowLensDialog({ handle, onClose }: Props) {
111112
const t = useI18N()
112113

113114
const wallet = useWallet()
115+
const [currentProfile, setCurrentProfile] = useState<LensBaseAPI.Profile>()
114116
const [isFollowing, setIsFollowing] = useState(false)
115117
const [isHovering, setIsHovering] = useState(false)
116118
const { classes } = useStyles({ account: !!wallet })
@@ -125,22 +127,35 @@ export function FollowLensDialog({ handle, onClose }: Props) {
125127
const profile = await Lens.getProfileByHandle(handle)
126128

127129
if (!profile) return
128-
const isFollowing = await Lens.queryFollowStatus(account, profile.id)
129130

130131
const defaultProfile = await Lens.queryDefaultProfileByAddress(account)
131132

132133
const profiles = await Lens.queryProfilesByAddress(account)
133134

134-
setIsFollowing(!!isFollowing)
135+
setCurrentProfile((prev) => {
136+
if (!prev) return defaultProfile ?? first(profiles)
137+
return prev
138+
})
135139
return {
136140
profile,
137-
isSelf: isSameAddress(profile.ownedBy, account),
138-
isFollowing,
141+
isSelf: isSameAddress(profile.ownedBy.address, account),
142+
profiles,
139143
defaultProfile: defaultProfile ?? first(profiles),
140144
}
141145
}, [handle, open, account])
142146

143-
const { profile, defaultProfile, isSelf } = value ?? {}
147+
const { profile, defaultProfile, isSelf, profiles } = value ?? {}
148+
149+
const { isLoading } = useQuery({
150+
queryKey: ['lens', 'following-status', currentProfile?.id, value?.profile.id],
151+
queryFn: async () => {
152+
if (!value?.profile.id || !currentProfile) return false
153+
const result = await Lens.queryFollowStatus(currentProfile.id, value?.profile.id)
154+
setIsFollowing(result)
155+
return result
156+
},
157+
refetchOnWindowFocus: false,
158+
})
144159

145160
const followModule = useMemo(() => {
146161
if (profile?.followModule?.type === FollowModuleType.ProfileFollowModule && defaultProfile) {
@@ -152,7 +167,7 @@ export function FollowLensDialog({ handle, onClose }: Props) {
152167
} else if (profile?.followModule?.type === FollowModuleType.FeeFollowModule && profile.followModule.amount) {
153168
return {
154169
feeFollowModule: {
155-
currency: profile.followModule.amount.asset.address,
170+
currency: profile.followModule.amount.asset.contract.address,
156171
value: profile.followModule.amount.value,
157172
},
158173
}
@@ -163,7 +178,12 @@ export function FollowLensDialog({ handle, onClose }: Props) {
163178

164179
const approved = useMemo(() => {
165180
if (!profile?.followModule?.amount?.asset) return { amount: ZERO.toFixed() }
166-
const { address, name, symbol, decimals } = profile.followModule.amount.asset
181+
const {
182+
contract: { address },
183+
name,
184+
symbol,
185+
decimals,
186+
} = profile.followModule.amount.asset
167187
const token = createERC20Token(chainId, address, name, symbol, decimals)
168188
const amount = formatAmount(profile.followModule.amount.value, decimals)
169189

@@ -177,8 +197,9 @@ export function FollowLensDialog({ handle, onClose }: Props) {
177197
const { showConfettiExplosion, canvasRef } = useConfettiExplosion()
178198
const { loading: followLoading, handleFollow } = useFollow(
179199
profile?.id,
200+
currentProfile?.id,
180201
followModule,
181-
!!defaultProfile,
202+
currentProfile?.signless,
182203
(event: MouseEvent<HTMLElement>) => {
183204
showConfettiExplosion(event.currentTarget.offsetWidth, event.currentTarget.offsetHeight)
184205
setIsFollowing(true)
@@ -187,6 +208,8 @@ export function FollowLensDialog({ handle, onClose }: Props) {
187208
)
188209
const { loading: unfollowLoading, handleUnfollow } = useUnfollow(
189210
profile?.id,
211+
currentProfile?.id,
212+
currentProfile?.signless,
190213
(event: MouseEvent<HTMLElement>) => {
191214
setIsFollowing(false)
192215
},
@@ -196,7 +219,7 @@ export function FollowLensDialog({ handle, onClose }: Props) {
196219

197220
const { data: feeTokenBalance, isLoading: getBalanceLoading } = useFungibleTokenBalance(
198221
NetworkPluginID.PLUGIN_EVM,
199-
profile?.followModule?.amount?.asset.address ?? '',
222+
profile?.followModule?.amount?.asset.contract.address ?? '',
200223
)
201224

202225
const handleClick = useCallback(
@@ -217,11 +240,13 @@ export function FollowLensDialog({ handle, onClose }: Props) {
217240
const disabled = useMemo(() => {
218241
if (
219242
!account ||
243+
!currentProfile ||
220244
!!wallet?.owner ||
221245
pluginID !== NetworkPluginID.PLUGIN_EVM ||
222246
providerType === ProviderType.Fortmatic ||
223247
followLoading ||
224248
unfollowLoading ||
249+
profile?.followModule?.type === FollowModuleType.UnknownFollowModule ||
225250
(profile?.followModule?.type === FollowModuleType.ProfileFollowModule && !defaultProfile) ||
226251
(profile?.followModule?.type === FollowModuleType.FeeFollowModule &&
227252
profile.followModule.amount &&
@@ -236,6 +261,7 @@ export function FollowLensDialog({ handle, onClose }: Props) {
236261

237262
return false
238263
}, [
264+
currentProfile,
239265
account,
240266
wallet?.owner,
241267
chainId,
@@ -249,6 +275,8 @@ export function FollowLensDialog({ handle, onClose }: Props) {
249275
const buttonText = useMemo(() => {
250276
if (isFollowing) {
251277
return isHovering ? t.unfollow() : t.following_action()
278+
} else if (profile?.followModule?.type === FollowModuleType.UnknownFollowModule) {
279+
return t.can_not_follow()
252280
} else if (profile?.followModule?.type === FollowModuleType.FeeFollowModule && profile.followModule.amount) {
253281
return t.follow_for_fees({
254282
value: profile.followModule.amount.value,
@@ -260,7 +288,7 @@ export function FollowLensDialog({ handle, onClose }: Props) {
260288
}, [isFollowing, isHovering, profile])
261289

262290
const tips = useMemo(() => {
263-
if (isSelf && profile) return t.edit_profile_tips({ profile: profile.handle })
291+
if (isSelf && profile) return t.edit_profile_tips({ profile: profile.handle.localName })
264292
if (wallet?.owner || pluginID !== NetworkPluginID.PLUGIN_EVM || providerType === ProviderType.Fortmatic)
265293
return t.follow_wallet_tips()
266294
else if (profile?.followModule?.type === FollowModuleType.ProfileFollowModule && !defaultProfile)
@@ -276,16 +304,16 @@ export function FollowLensDialog({ handle, onClose }: Props) {
276304
)
277305
return t.follow_with_charge_tips()
278306
else if (profile?.followModule?.type === FollowModuleType.RevertFollowModule) return t.follow_with_revert_tips()
279-
else if (!defaultProfile) {
280-
return t.follow_gas_tips()
307+
else if (!currentProfile) {
308+
return t.follow_with_out_handle_tips()
281309
}
282310
return
283-
}, [wallet?.owner, chainId, profile, feeTokenBalance, pluginID, providerType, isSelf])
311+
}, [wallet?.owner, chainId, profile, feeTokenBalance, pluginID, providerType, isSelf, currentProfile])
284312

285313
const avatar = useMemo(() => {
286-
if (!profile?.picture?.original) return
287-
return resolveIPFS_URL(profile?.picture?.original.url)
288-
}, [profile?.picture?.original])
314+
if (!profile?.metadata?.picture?.optimized.uri) return
315+
return profile?.metadata?.picture.optimized.uri
316+
}, [profile?.metadata?.picture?.optimized.uri])
289317

290318
return (
291319
<InjectedDialog
@@ -304,24 +332,26 @@ export function FollowLensDialog({ handle, onClose }: Props) {
304332
src={avatar ?? new URL('../assets/Lens.png', import.meta.url).toString()}
305333
sx={{ width: 64, height: 64 }}
306334
/>
307-
<Typography className={classes.name}>{profile?.name}</Typography>
308-
<Typography className={classes.handle}>@{profile?.handle}</Typography>
335+
<Typography className={classes.name}>
336+
{profile?.metadata?.displayName ?? profile?.handle.localName}
337+
</Typography>
338+
<Typography className={classes.handle}>@{profile?.handle.localName}</Typography>
309339
<Typography className={classes.followers}>
310340
<Translate.followers
311341
components={{ strong: <strong /> }}
312-
values={{ followers: String(profile?.stats?.totalFollowers ?? '0') }}
342+
values={{ followers: String(profile?.stats.followers ?? '0') }}
313343
/>
314344
<Translate.following
315345
components={{ strong: <strong /> }}
316-
values={{ following: String(profile?.stats?.totalFollowing ?? '0') }}
346+
values={{ following: String(profile?.stats?.following ?? '0') }}
317347
/>
318348
</Typography>
319349
<Box className={classes.actions}>
320350
{isSelf ? (
321351
<Button
322352
variant="roundedContained"
323353
className={classes.followAction}
324-
href={profile?.handle ? getLensterLink(profile.handle) : '#'}
354+
href={profile?.handle ? getLensterLink(profile.handle.localName) : '#'}
325355
target="_blank"
326356
rel="noopener noreferrer"
327357
endIcon={<Icons.LinkOut size={18} />}
@@ -331,7 +361,7 @@ export function FollowLensDialog({ handle, onClose }: Props) {
331361
) : (
332362
<>
333363
<EthereumERC20TokenApprovedBoundary
334-
spender={value?.profile.followModule?.contractAddress}
364+
spender={value?.profile.followModule?.contract?.address}
335365
amount={approved.amount}
336366
token={!isFollowing ? approved.token : undefined}
337367
showHelperToken={false}
@@ -363,7 +393,7 @@ export function FollowLensDialog({ handle, onClose }: Props) {
363393
variant="roundedContained"
364394
className={classes.followAction}
365395
disabled={disabled}
366-
loading={followLoading || unfollowLoading || loading}
396+
loading={followLoading || unfollowLoading || loading || isLoading}
367397
onClick={handleClick}
368398
onMouseOver={() => setIsHovering(true)}
369399
onMouseOut={() => setIsHovering(false)}>
@@ -374,12 +404,12 @@ export function FollowLensDialog({ handle, onClose }: Props) {
374404
<Button
375405
className={classes.linkButton}
376406
variant="roundedOutlined"
377-
href={profile?.handle ? getLensterLink(profile.handle) : '#'}
407+
href={profile?.handle ? getLensterLink(profile.handle.localName) : '#'}
378408
target="_blank"
379409
rel="noopener noreferrer"
380410
endIcon={<Icons.LinkOut size={18} />}
381411
sx={{ cursor: 'pointer' }}>
382-
{t.lenster()}
412+
{t.hey()}
383413
</Button>
384414
</>
385415
)}
@@ -391,15 +421,11 @@ export function FollowLensDialog({ handle, onClose }: Props) {
391421
expectedChainId={ChainId.Matic}
392422
ActionButtonProps={{ variant: 'roundedContained' }}>
393423
{tips ? <Typography className={classes.tips}>{tips}</Typography> : null}
424+
394425
<HandlerDescription
395-
profile={
396-
defaultProfile
397-
? {
398-
avatar: defaultProfile.picture?.original?.url,
399-
handle: defaultProfile.handle,
400-
}
401-
: undefined
402-
}
426+
currentProfile={currentProfile}
427+
profiles={profiles}
428+
onChange={(profile) => setCurrentProfile(profile)}
403429
/>
404430
</WalletConnectedBoundary>
405431
</Box>

0 commit comments

Comments
 (0)