Skip to content

Commit

Permalink
fix: gate mainnet only for non-identity API
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Apr 12, 2024
1 parent 564e2a8 commit 6d2d8cf
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions packages/wagmi/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,30 +289,28 @@ export class Web3Modal extends Web3ModalScaffold {
}

private async syncProfile(address: Hex, chainId: Chain['id']) {
if (chainId !== mainnet.id) {
this.setProfileName(null)
this.setProfileImage(null)

return
}

try {
const { name, avatar } = await this.fetchIdentity({
address
})
this.setProfileName(name)
this.setProfileImage(avatar)
} catch {
const profileName = await getEnsName(this.wagmiConfig, { address, chainId })
if (profileName) {
this.setProfileName(profileName)
const profileImage = await getEnsAvatar(this.wagmiConfig, {
name: profileName,
chainId
})
if (profileImage) {
this.setProfileImage(profileImage)
if (chainId === mainnet.id) {
const profileName = await getEnsName(this.wagmiConfig, { address, chainId })
if (profileName) {
this.setProfileName(profileName)
const profileImage = await getEnsAvatar(this.wagmiConfig, {
name: profileName,
chainId
})
if (profileImage) {
this.setProfileImage(profileImage)
}
}
} else {
this.setProfileName(null)
this.setProfileImage(null)
}
}
}
Expand Down

0 comments on commit 6d2d8cf

Please sign in to comment.