Skip to main content

ERC Metadata

Serves EIP-721/EIP-1155-compatible token metadata JSON for tokenized products over HTTP. This is the endpoint that token URIs generated by the ETH Minter adapter point to.

This is a routes-only plugin — it registers no adapter, just the HTTP endpoint.

Included in Base Preset

Registered automatically by registerBasePlugins() / registerAllPlugins().

Registration​

import { pluginRegistry } from '@unchainedshop/core';
import { ERCMetadataPlugin } from '@unchainedshop/plugins/warehousing/erc-metadata';

pluginRegistry.register(ERCMetadataPlugin);

Endpoint​

GET /erc-metadata/:productId/:localeOrTokenFilename{/:tokenFileName}

Two URL forms — the filename must end in .json:

/erc-metadata/{productId}/{tokenFileName}.json # locale resolved from request context
/erc-metadata/{productId}/{locale}/{tokenFileName}.json # explicit locale, e.g. de-CH

The handler loads the product, looks up the token by product and serial number (the filename without .json, matched case-sensitively, for ERC-721 and ERC-1155 alike) and returns the metadata built by the services.warehousing.ercMetadata service, which asks the first active VIRTUAL warehousing provider. It responds 404 for an unknown or non-tokenized product, an unknown token or missing metadata, and 503 on errors.

The route is public, so it only serves the keys of the EIP metadata standards (PUBLIC_ERC_METADATA_KEYS): name, description, image, properties, attributes, localization, external_url, animation_url, background_color and decimals. Everything else an adapter returns is left out, and token.meta is never part of it. properties carries the product's tokenization.ercMetadataProperties, so keep private data out of them.

See ETH Minter for the shape of the returned metadata document.

Environment Variables​

VariableDefaultDescription
ERC_METADATA_API_PATH/erc-metadataPath prefix the route is mounted at
ROOT_URLhttp://localhost:4010Base URL used to parse the request URL

Plugin Details​

PropertyValue
Keyshop.unchained.warehousing.erc-metadata
Version1.0.0
Sourcewarehousing/erc-metadata
  • ETH Minter - Creates the tokens and metadata this endpoint serves