1

This is the code I have:

const { Metaplex, keypairIdentity, bundlrStorage } = require("@metaplex-foundation/js");
const { Connection, clusterApiUrl, Keypair } = require("@solana/web3.js");
const fs = require("fs");

const connection = new Connection(clusterApiUrl("devnet"));

let keypair = JSON.parse(fs.readFileSync("keypair.json", "utf8"));
keypair = Keypair.fromSeed(Uint8Array.from(keypair.slice(0, 32)));

const metaplex = Metaplex.make(connection)
    .use(keypairIdentity(keypair))
    .use(bundlrStorage());;


(async () => {
    let crt = await metaplex.nfts().builders().create({
        uri: "url",
        name: `Test`,
        isCollection: false,
    });

    let tx = crt.toTransaction({
        blockhash: (await connection.getLatestBlockhash()).blockhash,
    });
    let nftKeypair = crt.records[1].signers[0];

// add sol-transfer instruciton
// add token-transfer instruction

    tx.partialSign(keypair);
    tx.partialSign(nftKeypair);

    console.log(crt);

    let sig = await connection.sendTransaction(tx, [keypair], { skipPreflight: true, preflightCommitment: "recent" });

    console.log(sig);

    setTimeout(() => {}, 1000000000);
})();```

My goal is to be able to append custom instructions, like sol-transfers and token-transfers along with the mint transaction. For some reason when I run this program, it throws `Signature verification failed`.

I am aware I don't need to use the builder to create nfts but I need access to the transaction object like mentioned above.

0

Your Answer

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