0

I'm looking for a way to update my eddsa variable, am using metaplex, am new to updating a token in using metaplex.

there is my code

`import * as mpl from "@metaplex-foundation/mpl-token-metadata"
import {
    updateV1,
    fetchMetadataFromSeeds,
} from '@metaplex-foundation/mpl-token-metadata'
import  { PublicKey,  } from "@solana/web3.js"
const web3 = require("@solana/web3.js");
const fs = require('fs');

async function main() {
    const secretKey = Uint8Array.from(JSON.parse(fs.readFileSync('./hfbiuv34h43fbu43igf9348bcdbcu34u34uh.json')));
    const payer = web3.Keypair.fromSecretKey(secretKey);

    const METAPLEX_PROGRAM_ADDRESS = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
    const metaplexProgramPublicKey = new PublicKey(METAPLEX_PROGRAM_ADDRESS);
    // Connect to Solana cluster
    const programsObject = {
        metaplex: metaplexProgramPublicKey,
        // Add other programs as needed
    };
    const connection = new web3.Connection(web3.clusterApiUrl('mainnet-beta'));
    
    const umi = {
        connection: connection,
        programs: {
            metaplex: metaplexProgramPublicKey,
        },
        eddsa: null,
        identity: payer, 
        payer: payer
    };

    const mint = new web3.PublicKey('hfbiuv34h43fbu43igf9348bcdbcu34u34uh');
    const updateAuthority = payer.publicKey; 

    const newMetadata = {
         name: "test",
         symbol: "TSA",
         uri: "https://deufuerf/metadata.json", 
     };

    // Create a Metadata object
    const initialMetadata = await fetchMetadataFromSeeds(umi, { mint });

    // Update the metadata
    await updateV1(umi, {
        mint,
        authority: updateAuthority,
        data: { ...initialMetadata, newMetadata },
        primarySaleHappened: true,
        isMutable: true,
        // Add other attributes you want to update
    }).sendAndConfirm(umi);
}

main().catch(console.error);`

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.