0

trying to partial sign a compressed NFT, console.log all params being used so that is not an issue.


const addNFTToTree = async (keypair, owner, metadata, collection) => {
  owner = new PublicKey(owner);

  let treeAddress = keypair.publicKey;

  collection = {
    collectionAuthority: new PublicKey(collection.collectionAuthority),
    collectionMint: new PublicKey(collection.collectionMint),
    collectionMetadata: new PublicKey(collection.collectionMetadata),
    editionAccount: new PublicKey(collection.editionAccount),
  };

  const [treeAuthority, _bump] = PublicKey.findProgramAddressSync(
    [treeAddress.toBuffer()],
    BUBBLEGUM_PROGRAM_ID
  );

  const [bubblegumSigner, __] = PublicKey.findProgramAddressSync(
    [Buffer.from("collection_cpi", "utf8")],
    BUBBLEGUM_PROGRAM_ID
  );

  metadata = {
    ...metadata,
    tokenProgramVersion: TokenProgramVersion.Original,
    tokenStandard: TokenStandard.NonFungible,
  };

  const compressedMintIx = createMintToCollectionV1Instruction(
    {
      payer: wallet.publicKey,
      merkleTree: treeAddress,
      treeAuthority: treeAuthority,
      treeDelegate: wallet.publicKey,

      leafOwner: owner,
      leafDelegate: owner,

      collectionAuthority: collection.collectionAuthority,
      collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID,
      collectionMint: collection.collectionMint,
      collectionMetadata: collection.collectionMetadata,
      collectionEdition: collection.editionAccount,

      compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID,
      logWrapper: SPL_NOOP_PROGRAM_ID,
      bubblegumSigner: bubblegumSigner,
      tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
    },
    {
      metadataArgs: Object.assign(metadata, {
        collection: {
          key: collection.collectionMint,
          verified: false,
        },
      }),
    }
  );

  const tx = new Transaction();
  tx.add(compressedMintIx);
  tx.feePayer = wallet.publicKey;
  tx.recentBlockhash = (await connection.getRecentBlockhash()).blockhash;
  tx.partialSign(wallet);

  console.log(
    tx.serialize({
      requireAllSignatures: false,
    })
  );
};

I tried to trace back the issue to accountsMeta array,

getting the last account as null

}
{
  pubkey: PublicKey [PublicKey(Buzo3LR2UMk8oFkcCMPHG3vZfUhw8qNPNnbvctANNxF9)] {
    _bn: <BN: a2286b42f74bcb2374911800ea2fc5cf4cc1ad72ec240e644637443eb0d00368>
  },
  isWritable: true,
  isSigner: false
}
{ pubkey: undefined, isWritable: false, isSigner: false }

the wallet is the fee payer and want to partialSign it and send back to the user to sign the tx, the user is the collection owner,

ARYAN
  • 1
  • 1

0 Answers0