Skip to content

Commit 9b572ea

Browse files
authored
fix(farcaster): mf-6717 use username for farcaster identity (#12232)
1 parent 84ede17 commit 9b572ea

File tree

4 files changed

+10
-20
lines changed
  • packages
    • mask/popups/pages/Friends/ContactCard/ConnectedAccounts
    • plugins/Web3Profile/src/SiteAdaptor/components/SocialBadges
    • shared/src/UI/components/SocialAccountList
    • web3-providers/src/Web3Bio

4 files changed

+10
-20
lines changed

packages/mask/popups/pages/Friends/ContactCard/ConnectedAccounts/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface ConnectedAccountsProps {
3636
localProfile?: ProfileIdentifier
3737
}
3838

39-
export const ConnectedAccounts = memo<ConnectedAccountsProps>(function ({
39+
export const ConnectedAccounts = memo<ConnectedAccountsProps>(function ConnectedAccounts({
4040
avatar,
4141
nextId,
4242
profiles,

packages/plugins/Web3Profile/src/SiteAdaptor/components/SocialBadges/FarcasterList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ interface FarcasterListItemProps {
7474

7575
const FarcasterListItem = memo<FarcasterListItemProps>(function FarcasterListItem({ account }) {
7676
const { classes } = useStyles()
77-
const profileUri = `https://firefly.social/profile/farcaster/${account.fid}`
77+
const profileUri = `https://firefly.social/profile/farcaster/${account.username}`
7878
const farcasterIcon = <Icons.Farcaster size={30} />
7979

8080
return (
81-
<ListItem className={classes.listItem} key={account.fid}>
81+
<ListItem className={classes.listItem} key={account.username}>
8282
<div className={classes.avatarContainer}>
8383
{profileUri.length ?
8484
<Image

packages/shared/src/UI/components/SocialAccountList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const FireflyLensToWeb3BioProfile = (account: FireflyConfigAPI.LensAccount): Web
7373
const FireflyFarcasterToWeb3bioProfile = (account: FireflyConfigAPI.FarcasterProfile): Web3BioProfile => {
7474
return {
7575
platform: NextIDPlatform.Farcaster,
76-
identity: account.fid.toString(),
76+
identity: account.username,
7777
address: account.signer_address,
7878
displayName: account.display_name,
7979
avatar: account.avatar.url,

packages/web3-providers/src/Web3Bio/index.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ type Response<T> =
1212
error: string
1313
}
1414

15-
function patchProfile(profile: Web3BioProfile): Web3BioProfile {
16-
if (profile.platform === NextIDPlatform.Farcaster && profile.social?.uid) {
17-
return {
18-
...profile,
19-
identity: profile.social.uid.toString(),
20-
}
21-
}
22-
return profile
23-
}
24-
2515
export class Web3Bio {
2616
static fetchFromWeb3Bio<T>(request: Request | RequestInfo, init?: RequestInit) {
2717
return fetchCachedJSON<T>(request, {
@@ -34,21 +24,21 @@ export class Web3Bio {
3424

3525
static async getProfilesByTwitterId(handle: string) {
3626
const url = urlcat(WEB3_BIO_HOST, `/profile/twitter,${handle.toLowerCase()}`)
37-
const res = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
38-
return Array.isArray(res) ? res.map(patchProfile) : []
27+
const profiles = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
28+
return Array.isArray(profiles) ? profiles : []
3929
}
4030

4131
/** Get profiles by address or domain */
4232
static async getProfilesBy(domainOrAddress: string) {
4333
const url = urlcat(WEB3_BIO_HOST, '/profile/:id', { id: domainOrAddress })
44-
const res = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
45-
return Array.isArray(res) ? res.map(patchProfile) : []
34+
const profiles = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
35+
return Array.isArray(profiles) ? profiles : []
4636
}
4737

4838
static async getProfilesByNextId(pubkey: string) {
4939
const url = urlcat(WEB3_BIO_HOST, '/profile/nextid,:pubkey', { pubkey })
50-
const res = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
51-
return Array.isArray(res) ? res.map(patchProfile) : []
40+
const profiles = await Web3Bio.fetchFromWeb3Bio<Response<Web3BioProfile[]>>(url)
41+
return Array.isArray(profiles) ? profiles : []
5242
}
5343

5444
static async getAllLens(twitterId: string) {

0 commit comments

Comments
 (0)