Skip to content

Commit

Permalink
Merge pull request #351 from Concordium/add-contract-address-vc-details
Browse files Browse the repository at this point in the history
Add contract address to verifiableCredentialDetails
  • Loading branch information
shjortConcordium authored Aug 24, 2023
2 parents 2e596c6 + 85f5444 commit 1ad0470
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
4 changes: 4 additions & 0 deletions packages/browser-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Added

- Display contract address of issuer in verifiable credential details.

### Fixed

- Incorrect verifiable presentations created, due to incorrect identity/identityProviderIndex used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
getCredentialHolderId,
getCredentialRegistryContractAddress,
getRevokeTransactionExecutionEnergyEstimate,
getContractAddressFromIssuerDID,
} from '@shared/utils/verifiable-credential-helpers';
import { fetchContractName } from '@shared/utils/token-helpers';
import { TimeStampUnit, dateFromTimestamp, ClassName } from 'wallet-common-helpers';
Expand All @@ -36,38 +37,34 @@ import { DisplayAttribute, VerifiableCredentialCard, VerifiableCredentialCardHea
function DisplayIssuerMetadata({ issuer }: { issuer: string }) {
const { t } = useTranslation('verifiableCredential');
const issuerMetadata = useIssuerMetadata(issuer);

if (
issuerMetadata === undefined ||
(issuerMetadata.description === undefined &&
issuerMetadata.icon === undefined &&
issuerMetadata.name === undefined &&
issuerMetadata.url === undefined)
) {
return null;
}
const issuerContract = getContractAddressFromIssuerDID(issuer);

return (
<div className="verifiable-credential__body-attributes">
<h3>{t('details.issuer.title')}</h3>
{issuerMetadata.icon && <Img className="issuer-logo" src={issuerMetadata.icon.url} withDefaults />}
{issuerMetadata.name && (
<DisplayAttribute
attributeKey="issuerContract"
attributeTitle={t('details.issuer.contract')}
attributeValue={`${issuerContract.index.toString()} (${issuerContract.subindex.toString()})`}
/>
{issuerMetadata?.icon && <Img className="issuer-logo" src={issuerMetadata.icon.url} withDefaults />}
{issuerMetadata?.name && (
<DisplayAttribute
attributeKey="issuerName"
attributeTitle={t('details.issuer.name')}
attributeValue={issuerMetadata.name}
/>
)}
{issuerMetadata.description && (
{issuerMetadata?.description && (
<DisplayAttribute
attributeKey="issuerName"
attributeKey="issuerDescription"
attributeTitle={t('details.issuer.description')}
attributeValue={issuerMetadata.description}
/>
)}
{issuerMetadata.url && (
{issuerMetadata?.url && (
<DisplayAttribute
attributeKey="issuerName"
attributeKey="issuerUrl"
attributeTitle={t('details.issuer.url')}
attributeValue={issuerMetadata.url}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const t: typeof en = {
validUntil: 'Gyldig indtil',
issuer: {
title: 'Udstedt af',
contract: 'kontraktindeks, subindeks',
name: 'Navn',
description: 'Beskrivelse',
url: 'Hjemmeside',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const t = {
validUntil: 'Valid until',
issuer: {
title: 'Issued by',
contract: 'contract index, subindex',
name: 'Name',
description: 'Description',
url: 'Website',
Expand Down

0 comments on commit 1ad0470

Please sign in to comment.