Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account NFT loading fix #1434

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions src/hooks/useAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,30 @@ export const useAccount = () => {

if (mapped) {
const identityRepository = container.get<IdentityRepository>(Symbols.IdentityRepository);
const nftRepository = container.get<INftRepository>(Symbols.NftRepository);
// const nftRepository = container.get<INftRepository>(Symbols.NftRepository);
const identity = await identityRepository.getIdentity(isEvmAddress ? mapped : address);
const name = identity?.display || '';

let avatarUrl: string | undefined;
let nft: NftMetadata | undefined;

const avatarContractAddress = identity?.getAvatarContractAddress();
const avatarTokenId = identity?.getAvatarTokenId();
if (avatarContractAddress && avatarTokenId) {
nft = await nftRepository.getNftMetadata(
currentNetworkName.value.toLowerCase(),
avatarContractAddress,
avatarTokenId
);

if (nft) {
avatarUrl = getProxiedUrl(nft.image);
}
}
// const avatarContractAddress = identity?.getAvatarContractAddress();
// const avatarTokenId = identity?.getAvatarTokenId();
// if (avatarContractAddress && avatarTokenId) {
// try {
// nft = await nftRepository.getNftMetadata(
// currentNetworkName.value.toLowerCase(),
// avatarContractAddress,
// avatarTokenId
// );

// if (nft) {
// avatarUrl = getProxiedUrl(nft.image);
// }
// } catch (error) {
// console.error('Unable to fetch nft metadata', error);
// }
// }

const account: UnifiedAccount = {
nativeAddress: isEvmAddress ? mapped : address,
Expand Down
Loading