locallaunchsc-cloud/solana-dev-skills / metaplex-nft
solana-metaplex-nft
VerifiedUse this skill when the user wants to mint and manage NFT collections on Solana using Metaplex — Umi setup, Token Metadata vs MPL-Core (programmable assets), Arweave uploads, collection creation, minting, and verification.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.0 KB |
| scripts/create-collection.ts | script | 3.7 KB |
| scripts/mint-nft.ts | script | 4.0 KB |
| scripts/upload-asset.ts | script | 4.0 KB |
scripts/mint-nft.ts
View on GitHub/**
* mint-nft.ts
*
* Mints an MPL-Core AssetV1 into an existing CollectionV1. If the wallet
* running this is the collection's updateAuthority, the asset is auto-verified
* at mint time — no separate verifyCollection instruction needed (that was a
* Token Metadata legacy footgun).
*
* Usage:
* npx tsx scripts/mint-nft.ts <collectionPubkey> <assetMetadataUri> [name]
*
* Example:
* npx tsx scripts/mint-nft.ts 9Wq...Hzu https://arweave.net/xyz... "My NFT #1"
*
* Output:
* Asset pubkey + Explorer link.
*
* Notes:
* - The signer running this must own the collection's updateAuthority key
* for auto-verification. If a different wallet holds updateAuthority,
* pass an `authority: <signer>` arg to create() and have that key sign.
* - To mint a soulbound (non-transferable) asset, see the `plugins` example
* near the bottom — uncomment + adjust.
*/
import { createUmi } from '@metaplex-foundation/umi-bundle-defaults'
import {
generateSigner,
keypairIdentity,
publicKey,
} from '@metaplex-foundation/umi'
import { base58 } from '@metaplex-foundation/umi/serializers'
import {
create,
fetchCollection,
mplCore,
} from '@metaplex-foundation/mpl-core'
import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
const RPC_URL = process.env.SOLANA_RPC ?? 'https://api.devnet.solana.com'
const KEYPAIR_PATH =
process.env.SOLANA_KEYPAIR ?? path.join(os.homedir(), '.config', 'solana', 'id.json')
const CLUSTER = RPC_URL.includes('devnet') ? 'devnet' : 'mainnet-beta'
function loadKeypair(umi: ReturnType<typeof createUmi>) {
const secret = JSON.parse(fs.readFileSync(KEYPAIR_PATH, 'utf8'))
return umi.eddsa.createKeypairFromSecretKey(new Uint8Array(secret))
}
async function main() {
const [collectionArg, metadataUri, name = 'My NFT'] = process.argv.slice(2)
if (!collectionArg || !metadataUri) {
console.error(
'Usage: npx tsx scripts/mint-nft.ts <collectionPubkey> <assetMetadataUri> [name]',
)
process.exit(1)
}
const umi = createUmi(RPC_URL).use(mplCore())
umi.use(keypairIdentity(loadKeypair(umi)))
console.log('Minter:', umi.identity.publicKey)
// 1. Fetch the collection account. Pass the FETCHED account (not the
// pubkey) to create() — it carries updateAuthority + plugin context
// Core needs to auto-verify and apply collection-level plugins.
const collectionAddress = publicKey(collectionArg)
const collection = await fetchCollection(umi, collectionAddress)
console.log('Collection found:', collection.publicKey)
console.log(' updateAuthority:', collection.updateAuthority)
// 2. Fresh signer for the new asset account.
const asset = generateSigner(umi)
console.log('Asset pubkey (pre-tx):', asset.publicKey)
// 3. Mint. With the same signer as the collection's updateAuthority,
// the asset is automatically verified as part of the collection.
const tx = await create(umi, {
asset,
collection,
name,
uri: metadataUri,
// Per-asset plugin examples (uncomment to use):
//
// Soulbound (non-transferable):
// plugins: [
// { type: 'PermanentFreezeDelegate', frozen: true, authority: { type: 'None' } },
// ],
//
// On-chain attributes (separate from off-chain JSON attributes):
// plugins: [
// { type: 'Attributes', attributeList: [{ key: 'level', value: '1' }] },
// ],
}).sendAndConfirm(umi)
const signature = base58.deserialize(tx.signature)[0]
console.log('\nAsset minted.')
console.log(' asset: ', asset.publicKey)
console.log(' signature: ', signature)
console.log(
` explorer: https://explorer.solana.com/address/${asset.publicKey}?cluster=${CLUSTER}`,
)
console.log(
` tx: https://explorer.solana.com/tx/${signature}?cluster=${CLUSTER}`,
)
console.log(
'\nVerify the asset shows under the collection: open the collection address',
'in Explorer and check the "Assets" tab, or query Helius DAS by collection.',
)
}
main().catch((err) => {
console.error(err)
process.exit(1)
})
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |