Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Burn Assets According to NFT CIP68 Standard #296

Open
independenceee opened this issue Sep 12, 2024 · 0 comments
Open

Cannot Burn Assets According to NFT CIP68 Standard #296

independenceee opened this issue Sep 12, 2024 · 0 comments

Comments

@independenceee
Copy link

independenceee commented Sep 12, 2024

I have some problems burning assets in CIP68 standard. I tried burning assets but it seems to not work. I am trying to find nft reference

  const mintScript: PlutusScript = {
        code: cbor.encode(Buffer.from(plutusV3.validators[0].compiledCode, "hex")).toString("hex"),
        version: "V3",
    };
    const storeScript: PlutusScript = {
        code: cbor.encode(Buffer.from(plutusV3.validators[2].compiledCode, "hex")).toString("hex"),
        version: "V3",
    };

    const { address: storeAddress } = serializePlutusScript(storeScript, undefined, 0, false);

    const storeUtxos = await provider.fetchAddressUTxOs(storeAddress);
    const redeemer = {
        data: { alternative: 1, fields: [] },
    };

    const txHashR = "d543920e462c312e5a31767eef893e02c0d1aec03d658f90d4a0bc1017d51f35";
    async function fetchUtxo(addr, txHash) {
        const utxos = await provider.fetchAddressUTxOs(addr);
        return utxos.find((utxo) => {
            return utxo.input.txHash == txHash;
        });
    }
    const userUtxo = await fetchUtxo(userAddress, txHashR);
    const storeUtxo = await fetchUtxo(storeAddress, txHashR);

    console.log(userUtxo);
    console.log(storeUtxo);

    const contributeAsset: Asset = {
        unit: "65ad4cd95f5357eaaa655f7edccf57067822e2ea33edaeef451cb457000de1404142434445",
        quantity: "1",
    };

    const referenceAsset: Asset = {
        unit: "65ad4cd95f5357eaaa655f7edccf57067822e2ea33edaeef451cb457000643b04142434445",
        quantity: "1",
    };
    const tx = new Transaction({ initiator: wallet });

    tx.setTxInputs([storeUtxo!, userUtxo!]);
    tx.burnAsset(mintScript, contributeAsset, redeemer);
    tx.burnAsset(mintScript, referenceAsset, redeemer);

    const unsignedTx = await tx.build();
    const signedTx = wallet.signTx(unsignedTx, true);
    const txHash = await wallet.submitTx(signedTx);
addr_test1qqk6p73fh30uq7ag89hya9cq0f2llugj68vp9xvs9cpjc20xug5mjfdyw5uy9wvs7w8xfw6wj8q84lht979j824l7drsfcjud7
[
  { unit: 'lovelace', quantity: '1159390' },
  {
    unit: '65ad4cd95f5357eaaa655f7edccf57067822e2ea33edaeef451cb457000de1404142434445',
    quantity: '1'
  }
]
[
  { unit: 'lovelace', quantity: '1762790' },
  {
    unit: '65ad4cd95f5357eaaa655f7edccf57067822e2ea33edaeef451cb457000643b04142434445',
    quantity: '1'
  }
]
Insufficient funds for 65ad4cd95f5357eaaa655f7edccf57067822e2ea33edaeef451cb457000defbfbd404142434445
Remaining quantity 1
Error: txBuildResult error:
    at CSLSerializer.serializeTxBody (file:///D:/Workspace/blockchain/cip68/contract/node_modules/@meshsdk/core-csl/dist/index.js:987:13)
    at MeshTxBuilder.complete (file:///D:/Workspace/blockchain/cip68/contract/node_modules/@meshsdk/transaction/dist/index.js:1419:33)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant