IPreviewRenderer
Interface (ABI only), OPTIONAL. Implement it on a renderer to support rendering a hypothetical token for a caller-supplied seed with no token needing to exist.
An optional extension a renderer implements to render the output for a
caller-supplied seed with no token existing. A preview is a pure function of
chain state, like the live view, so an integrator can eth_call sample outputs
without a token.
A renderer that can render from (tokenId, seed) alone implements this;
ScriptyRenderer (historical template, removed from the current source tree) does. A renderer
whose output depends on state a seed cannot supply (sibling tokens, companion
contracts, mint-time data recorded by a mint hook) does not. Detection is a
try/catch eth_call, the repo convention, not ERC-165.
A preview document injects tokenData.context = "preview" (see the
Injection convention) so the
work's code can distinguish a preview render from a token render. Preview
metadata carries no provenance attributes.
Read functions
previewURI
function previewURI(address collection, uint256 tokenId, bytes32 seed) external view returns (string)view; renders preview metadata for a token that need not exist. collection is
the collection the preview is for; its name and render settings are read live.
tokenId is the token id to render; a work keyed to mint order reads it, so a
caller previews the next token by passing minted + 1. seed is a caller-supplied
value in place of the token's seed; any value is valid. Returns a
data:application/json;base64, URI shaped like tokenURI output (name marked as
a preview, animation_url built from seed, seed attribute only).