Closed y0unghe closed 2 months ago
yea. me too
Same
Hey @y0unghe @rosselpha @y4my4my4m where did you find this and Why do you assume that there should be a function like this?
createCreateMetadataAccountV3Instruction
is a type, not a function. The function for it would be createMetadataAccountV3
.
If you actually want to directly use that instruction you could use
import {
createMetadataAccountV3,
mplTokenMetadata,
} from "@metaplex-foundation/mpl-token-metadata";
import { none } from "@metaplex-foundation/umi";
const createMetadataAccountV3Ix = createMetadataAccountV3(umi, {
mint: mint.publicKey,
mintAuthority: umi.identity,
isMutable: true,
collectionDetails: none(),
data: {
name: "myToken",
uri: "https://arweave.net/7BzVsHRrEH0ldNOCCM4_E00BiAYuJP_EQiqvcEYz3YY",
symbol: "MT",
sellerFeeBasisPoints: 0,
creators: none(),
collection: none(),
uses: none(),
},
}).getInstructions()
We highly recommend to use the createV1
wrapper though:
import { createV1, mplTokenMetadata, TokenStandard } from "@metaplex-foundation/mpl-token-metadata";
import {
percentAmount,
} from "@metaplex-foundation/umi";
const createV1Ix = createV1(umi, {
mint: mint.publicKey,
authority: umi.identity,
name: "My NFT",
uri: "https://arweave.net/7BzVsHRrEH0ldNOCCM4_E00BiAYuJP_EQiqvcEYz3YY",
sellerFeeBasisPoints: percentAmount(5.5),
tokenStandard: TokenStandard.Fungible,
}).getInstructions()
or, depending on what kind of token you want to create there are Create Helpers that requires even less input. For example createFungible
:
await createFungible(umi, {
mint,
name: "myToken",
uri: "https://arweave.net/7BzVsHRrEH0ldNOCCM4_E00BiAYuJP_EQiqvcEYz3YY",
sellerFeeBasisPoints: percentAmount(0),
decimals: tokenAmount.decimals,
})
Also the official doc recommend using V2 version. https://solana.com/developers/courses/tokens-and-nfts/token-program#make-some-token-metadata
Do you have any examples about how to use createMetadataAccountV3
without using umi
?
If you are using the same packages as the package.json of the pirate-bootcamp suggests (which is very outdated) it should be working fine. The Solana.com docs you sent recommends to use package version 2 - which does not require Umi.
Personally i would absolutely recommend to follow our docs in the developer hub on how to use umi and how to create Metadata.
If you don't want to interact with umi more than needed this could work (untested code):
import {
createMetadataAccountV3,
mplTokenMetadata,
} from "@metaplex-foundation/mpl-token-metadata";
import { none, createNoopSigner} from "@metaplex-foundation/umi";
import { createUmi } from '@metaplex-foundation/umi-bundle-defaults'
import { toWeb3JsInstruction } from '@metaplex-foundation/umi-web3js-adapters';
const umi = createUmi('https://api.devnet.solana.com').use(mplTokenMetadata())
const createMetadataAccountV3Ix = createMetadataAccountV3(umi, {
mint: mint.publicKey,
mintAuthority: createNoopSigner(<your signing wallet pubkey>),
isMutable: true,
collectionDetails: none(),
data: {
name: "myToken",
uri: "https://arweave.net/7BzVsHRrEH0ldNOCCM4_E00BiAYuJP_EQiqvcEYz3YY",
symbol: "MT",
sellerFeeBasisPoints: 0,
creators: none(),
collection: none(),
uses: none(),
},
}).getInstructions()
const web3jsinstruction = toWeb3JsInstruction(createMetadataAccountV3Ix)
I am trying to use the function
createCreateMetadataAccountV3Instruction
to create an instruction. But I am getting the below error when importing to my Next.js project. The version I am using is the latest. But when I searched for the function in the current Github repo, this function did exist.