A utility script for creating and managing SPL token metadata using the Metaplex Umi framework on Solana.
- Clone the Repository:
git clone https://github.com/wormhole-foundation/demo-metaplex-metadata
cd demo-metaplex-metadata- Install Dependencies:
npm install- Setup Keypair:
You can load your keypair in two ways:
Option A: Environment Variable (create a .env file):
SOL_PRIVATE_KEY="INSERT_PRIVATE_KEY"Option B: Keypair File (use existing Solana CLI keypair):
# No setup needed - just pass the --keypair-file flag when running commands
# Example keypair location: ~/.config/solana/id.jsonYou can run the script to create or update metadata for an SPL token using the Metaplex Umi framework.
Creates the metadata for your SPL token:
npm run create-metadata
# Or with a keypair file:
npm run create-metadata ~/.config/solana/id.jsonUpdates the metadata:
npm run update-metadataTransfer the update authority of your token to a new wallet address. This is useful when you want to hand over control of the token metadata to another party (e.g., a DAO, multisig, or another wallet).
npm run transfer-authority <NEW_AUTHORITY_PUBKEY>- Never commit your private key or sensitive information
- Before transferring update authority: Make sure you have the correct new authority pubkey. This action is irreversible!
- Update the following TODOs in the scripts:
- token-metadata.ts:
- Token mint account
- Metadata details (name, symbol, URI, etc.)
- transfer-updateAuthority.ts:
- Token mint account (should match the one in token-metadata.ts)
- Network (mainnet-beta or devnet)
- New update authority pubkey (via command line argument)
- token-metadata.ts: