Skip to content

Commit

Permalink
fix: resolve issue with address display (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
martines3000 authored Dec 5, 2023
1 parent 5929343 commit 5d6ae05
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-masks-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blockchain-lab-um/dapp': patch
---

Fixes crash when address is not a string.
1 change: 1 addition & 0 deletions packages/dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@vercel/og": "^0.5.20",
"clsx": "^2.0.0",
"did-jwt-vc": "^3.2.13",
"ethers": "^6.9.0",
"file-saver": "^2.0.5",
"googleapis": "^128.0.0",
"headless-stepper": "^1.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import { DocumentDuplicateIcon } from '@heroicons/react/24/outline';
import { VerifiableCredential } from '@veramo/core';
import clsx from 'clsx';
import { isAddress } from 'ethers/address';
import { useTranslations } from 'next-intl';

import Tooltip from '@/components/Tooltip';
Expand Down Expand Up @@ -93,7 +94,9 @@ const CredentialSubject = ({
<Fragment key={key}>
{(() => {
if (key === 'id') return <DIDDisplay did={value} />;
if (key === 'address') return <AddressDisplay address={value} />;
if (key === 'address' && isAddress(value)) {
return <AddressDisplay address={value} />;
}

const isObject = !(
typeof value === 'string' || typeof value === 'number'
Expand Down
69 changes: 40 additions & 29 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d6ae05

Please sign in to comment.