getCredentialNFTFromLocator(locator): Promise<object>

Retrieves a Verifiable Credential NFT from a locator.

This function performs the following steps:

  1. Parses the locator string to extract NFT details.
  2. Verifies that the NFT belongs to a supported Verifiable Credentials chain.
  3. Fetches the NFT’s metadata and verifies it belongs to a Verifiable Credentials collection.
  4. Returns the NFT and the corresponding credentials collection.

Parameters

ParameterTypeDescription
locatorstringThe locator string of the credential, formatted as “chain:contractAddress:tokenId” (e.g., “polygon:0x1B887669437644aA348c518844660ef8d63bd643:1”).

Returns

Promise<object>

An object containing:

  • collection: The collection that the NFT belongs to, including the credential metadata.
  • nft: The NFT with its metadata.

collection

collection: CredentialsCollection

nft

nft: NftWithMetadata = vcNft

Throws

Will throw an error if the NFT is not on a supported Verifiable Credentials chain or if the NFT is not associated with a Verifiable Credentials collection.

Defined in

verifiableCredentialsSDK/presentation/nftByLocator.ts:25