2

Getting the error below trying to get the asset Id when minting a compressed NFT

NotEnoughBytesError: Serializer [publicKey] expected 32 bytes, got 11.
    at Object.deserialize (/home/jimii/Documents/webcode/test-umi/node_modules/@metaplex-foundation/umi-serializers/src/publicKey.ts:41:15)
    at forEach (/home/jimii/Documents/webcode/test-umi/node_modules/@metaplex-foundation/umi-serializers/src/struct.ts:51:47)
    at Array.forEach (<anonymous>)
    at Object.deserialize (/home/jimii/Documents/webcode/test-umi/node_modules/@metaplex-foundation/umi-serializers/src/struct.ts:50:14)
    at Object.deserialize (/home/jimii/Documents/webcode/test-umi/node_modules/@metaplex-foundation/umi-serializers/src/dataEnum.ts:165:50)
    at parseLeafFromMintV1Transaction (/home/jimii/Documents/webcode/test-umi/node_modules/@metaplex-foundation/mpl-bubblegum/src/leafAssetId.ts:40:44)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async findAssetId (/home/jimii/Documents/webcode/test-umi/src/bubblegum.ts:108:27)

Below is the code I am using to find the asset id

async function findAssetId() {
    const merkleTree = publicKey("mzHgYPtHWb3e6XphQuomD2KsAtJoPbzpMriK9ow3Gs7");

    const leaf: LeafSchema = await parseLeafFromMintV1Transaction(
        umi,
        base58.serialize(
            "54TgSmMMLZLTFjTHTFPvmThJ3kyV2CvBiAoro962aQNpQCCqVHtuf7baEcfYyrPZnQuifoGCMFAQkZTkchSDD2KB"
        )
    );
    console.log("asset id from leaf id", leaf.id);

    const assetId = findLeafAssetIdPda(umi, {
        merkleTree: merkleTree,
        leafIndex: leaf.nonce,
    });
    console.log("asset Id from find pda", assetId);
}

findAssetId().then().catch(console.error);

1 Answer 1

2

Turns out that the culprit was me passing in the wrong transaction hash.

The parseLeafFromMintV1Transaction method expects a mintV1 transaction signature while I was passing in the tx hash from the create bubblegum instruction.

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.