umi
umi copied to clipboard
Migrateing to umi from js giving MissingEditionAccount error
Hey! I'm migrating my old metaplex JS code to UMI. This was my old code to update an NFT's metadata with JS:
const signerAccount = web3.Keypair.fromSecretKey(new Uint8Array(JSON.parse(keypair.secret_key)))
const metaplex = Metaplex.make(solConnection).use(keypairIdentity(signerAccount))
const mintKey = new web3.PublicKey(mint);
try{
const nft = await metaplex.nfts().findByMint(mintKey);
const { nft: updatedNft, transactionId } = await metaplex.nfts().update(nft, {
uri: uri,
});
console.log(`Successfully updated metadata URL`)
return transactionId
} catch (e) {
console.error(e)
}
And this is the new one with UMI:
const signerAccount = web3.Keypair.fromSecretKey(new Uint8Array(JSON.parse(keypair.secret_key)))
const umi = await createUmiInstance(signerAccount, solConnection.rpcEndpoint);
const mintKey = new web3.PublicKey(mint);
try{
const mintAddress = fromWeb3JsPublicKey(mintKey);
const initialMetadata = await fetchMetadataFromSeeds(umi, { mint: mintAddress });
const request = await updateV1(umi, {
mint: mintAddress,
authority: umi.payer,
data: { ...initialMetadata, uri: uri },
}).sendAndConfirm(umi);
console.log(`Successfully updated metadata URL`);
return bs58.encode(Buffer.from(request.signature));
} catch (e) {
console.error(e)
}
The JS one is working as expected, but the UMI one is throwing this error:
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
'Program log: IX: Update',
'Program log: Auth type: Metadata',
'Program log: This mint account has an edition but none was provided.',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 21230 of 200000 compute units',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x6c'
What am I missing?
Thanks!