When making Token Extensions using token extensions metadata, many fields:
- name
- symbol
- attribute key/value pairs
Already appear in the JS/TS parameters for the mint. The token extensions with metadata example uses this TokenMetadata
type, from @solana/spl-token-metadata/src/state.ts
export interface TokenMetadata {
// The authority that can sign to update the metadata
updateAuthority?: PublicKey;
// The associated mint, used to counter spoofing to be sure that metadata belongs to a particular mint
mint: PublicKey;
// The longer name of the token
name: string;
// The shortened symbol for the token
symbol: string;
// The URI pointing to richer metadata
uri: string;
// Any additional metadata about the token as key-value pairs
additionalMetadata: [string, string][];
}
In older tokens, name
and symbol
and attributes
used to be in the JSON file in the URI:
{
"name": "OPOS",
"symbol": "OPOS",
"description": "Only Possible On Solana",
"image": "https://raw.githubusercontent.com/solana-developers/opos-asset/main/assets/CompressedCoil/image.png",
"attributes": [
{
"trait_type": "Item",
"value": "Compressed Coil"
}
]
}
Does this mean my 'richer metadata' should now just be:
{
"image": "https://raw.githubusercontent.com/solana-developers/opos-asset/main/assets/CompressedCoil/image.png"
}
... i.e. just using onchain metadata for name, symbol, etc.?
Also, is there a validation tool for JSON metadata files so I can confirm if a JSON file has the necessary fields and is formatted correctly?
attributes
anddescription
fields found in the off-chain URI metadata, but are a necessity for non-fungible tokens determining things like a rarity.attributes
inTokenMetadata
for rarity?