3

I am trying to add metadata to my token, so I wrote the following function:

import {clusterApiUrl} from "@solana/web3.js";
import {createUmi} from "@metaplex-foundation/umi-bundle-defaults";
import {createSignerFromKeypair} from "@metaplex-foundation/umi";
import {fromWeb3JsPublicKey} from '@metaplex-foundation/umi-web3js-adapters'

export async function addMetadataToToken(mintAccountPubkey, platformKeypair) {
  const chain = clusterApiUrl("devnet");
  const umi = createUmi(chain);

  const signer = createSignerFromKeypair(umi, platformKeypair);
  umi.identity = signer
  umi.payer = signer;

  const CreateMetadataAccountV3Args = {
    mint: fromWeb3JsPublicKey(mintAccountPubkey),
    mintAuthority: null,
    payer: signer,
    updateAuthority: fromWeb3JsPublicKey(platformKeypair.publicKey),
    data: {
        name: "my Token",
        symbol: "MYY",
        uri: "google.com",
        sellerFeeBasisPoints: 0,
        creators: null,
        collection: null,
        uses: null
    },
    isMutable: false,
    collectionDetails: null
  }

  let transactionBuilder = createMetadataAccountV3(umi, CreateMetadataAccountV3Args)
  let transaction = await transactionBuilder.buildAndSign(umi)
  let txHash = await umi.rpc.sendTransaction(transaction)
}

But I am hitting the following error:

Error: The provided signer is not required to sign this transaction.

I am using the same signer (keypair) who created the mint account - what am I missing here?

2
  • Have you tried setting the mint authority to the keypair’s public key?
    – wei1769
    Jan 22 at 23:55
  • Yes, unfortunately didn't work.
    – Udi Hakim
    Jan 23 at 13:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.