0

When running the code below, I am getting the following error

SendTransactionError: failed to send transaction: Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.

I have tried to airdrop devnet sol to the program address that gets randomly generated however, I don't know the program address of the create tree before it gets deployed. I've tried creating a script to airdrop as soon as the umi is passed into the generate signer function, but it doesn't solve the problem (presumably because my script wasn't executed properly). I'm looking for some help to airdrop devnet sol to the address so that I can create the merkle tree to then mint some NFTs.

import {
      createSignerFromKeypair,
      generateSigner,
      isKeypairSigner,
      keypairIdentity,
      signerIdentity,
    } from "@metaplex-foundation/umi";
    import { createTree, mplBubblegum } from "@metaplex-foundation/mpl-bubblegum";
    
    import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
    
    const umi = createUmi("https://api.devnet.solana.com").use(mplBubblegum());
    
    const merkleTree = generateSigner(umi);
    
    umi.use(keypairIdentity(merkleTree));
    
    console.log(merkleTree);
    
    const builder = await createTree(umi, {
      merkleTree,
      maxDepth: 3,
      maxBufferSize: 8,
    });
    await builder.sendAndConfirm(umi);

1 Answer 1

1

there is a slight misunderstanding here. You do not have to send SOL to the tree, but to the wallet that you are using to create the tree. This can be an existing wallet or a generated one.

import {
      createSignerFromKeypair,
      generateSigner,
      isKeypairSigner,
      keypairIdentity,
      signerIdentity,
    } from "@metaplex-foundation/umi";
    import { createTree, mplBubblegum } from "@metaplex-foundation/mpl-bubblegum";
    
    import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
    
    const umi = createUmi("https://api.devnet.solana.com").use(mplBubblegum());

    const wallet = generateSigner(umi);

    umi.use(keypairIdentity(wallet));
    await umi.rpc.airdrop(wallet.publicKey, so
    console.log(merkleTree);

    const merkleTree = generateSigner(umi);

    const builder = await createTree(umi, {
      merkleTree,
      maxDepth: 3,
      maxBufferSize: 8,
    });
    await builder.sendAndConfirm(umi);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.