Similar to https://stackoverflow.com/questions/69701491/add-meta-data-to-solana-token-with-solana-web3-js, however, the only answer for that question is in Rust and the question asker ended up moving to eth instead!
I know I can create an NFT with SPL:
const mint = await createMint(
connection,
wallet,
wallet.publicKey,
wallet.publicKey,
0
);
Or with Metaplex:
const metaplexNFTs = Metaplex.make(connection)
.use(keypairIdentity(keypair))
.use(bundlrStorage())
.nfts()
createOutput = await metaplexNFTs.create(
{
uri: metadataURL,
name: "Some token name", <- I'd like to be able to add 'name' but also other metadata with @solana/spl-token
sellerFeeBasisPoints: 0,
}
);
But can I create an NFT with custom data just using web3.js and spl-token, not @metaplex-foundation/js
?
- Metaplex's metadata is focused on art NFTs (eg with images etc) rather than non-art NFTs.
@metaplex-foundation/js
is pre 1.0 software that changes very frequently- I would like to avoid using extra software if I can.
How do I mint an SPL token with custom Metadata using @solana/web3.js and @solana/spl-token?
Update: I found this answer in my research so I know it's possible:
Create an SPL token first with supply = 1 and decimal = 0 so the wallets can identify your asset (done, easy!)
Create another account preferably derived from the mint address of your SPL token using PDAs
Finally, save your custom metadata in the second account and use it in any way you need.
I just need help or a pointer to the right docs. I am comfortable adding instructions to a larger transaction with new Transaction().add()
etc. Just need to know what to add!