尝试对压缩的 NFT 进行部分签名,console.log 记录所有正在使用的参数,这样就不是问题了。
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,
})
);
};
我尝试将问题追溯到accountsMeta数组,
将最后一个帐户设为空
}
{
pubkey: PublicKey [PublicKey(Buzo3LR2UMk8oFkcCMPHG3vZfUhw8qNPNnbvctANNxF9)] {
_bn: <BN: a2286b42f74bcb2374911800ea2fc5cf4cc1ad72ec240e644637443eb0d00368>
},
isWritable: true,
isSigner: false
}
{ pubkey: undefined, isWritable: false, isSigner: false }
钱包是费用支付者,想要对其进行部分签名并发回给用户签署tx,用户是集合所有者,
你是否找到了解决方案,即使我得到相同的错误,相同的 toString for null 也会给出错误,即使我检查类似的 pubkey?.toString() 方法也在程序的所有剩余行中给出错误:(