Burn NFT (minted nft) issue on transaction submit
, using https://github.com/Berry-Pool/cardanocli-js.
Run this script:
const CardanocliJs = require("cardanocli-js");
const cardanocliJs = new CardanocliJs({
network: "testnet-magic 1097911063",
dir: __dirname + "/../",
shelleyGenesisPath: __dirname + "/../testnet-shelley-genesis.json"
});
// 1. Get the wallet
const wallet = cardanocliJs.wallet("TGRISE");
// Define functions
const createTransaction = (tx) => {
let raw = cardanocliJs.transactionBuildRaw(tx);
let fee = cardanocliJs.transactionCalculateMinFee({
...tx,
txBody: raw,
});
tx.txOut[0].value.lovelace -= fee;
return cardanocliJs.transactionBuildRaw({ ...tx, fee });
};
const signTransaction = (wallet, tx, script) => {
return cardanocliJs.transactionSign({
signingKeys: [wallet.payment.skey, wallet.payment.skey],
txBody: tx,
});
};
// 2. Define mint script
const mintScript = {
keyHash: cardanocliJs.addressKeyHash(wallet.name),
type: "sig",
};
// 3. Create POLICY_ID
const POLICY_ID = cardanocliJs.transactionPolicyid(mintScript);
// 4. Define ASSET_NAME
const ASSET_NAME = "Abaidullah";
// 5. Create ASSET_ID
const ASSET_ID = POLICY_ID + "." + ASSET_NAME;
// 6. Define metadata
const metadata = {
721: {
[POLICY_ID]: {
[ASSET_NAME]: {
name: ASSET_NAME,
image: "ipfs://QmQqzMTavQgT4f4T5v6PWBp7XNKtoPmC9jvn12WPT3gkSE",
description: "Super Fancy Berry Space Green NFT",
type: "image/png",
src: "ipfs://Qmaou5UzxPmPKVVTM9GzXPrDufP55EDZCtQmpy3T64ab9N",
// other properties of your choice
authors: ["TGRISE"]
}
}
}
}
// 7. Define transaction
const tx = {
txIn: wallet.balance().utxo,
txOut: [
{
address: wallet.paymentAddr,
value: { ...wallet.balance().value, [ASSET_ID]: 1 },
},
],
mint: [
{ action: "burn", quantity: 1, asset: ASSET_ID, script: mintScript },
],
metadata,
witnessCount: 2,
};
// 8. Build transaction
const raw = createTransaction(tx);
// 9. Sign transaction
const signed = signTransaction(wallet, raw);
console.log(cardanocliJs.transactionView({ txFile: signed }));
// 10. Submit transaction
const txHash = cardanocliJs.transactionSubmit(signed);
console.log(assets, 'txHash:', txHash);
Gives the issue:
auxiliary data: AuxiliaryDataRaw {txMetadata = fromList [(721,Map [(S "c3ddef916f0db22eb19df1701db91625633501d01e76ad66edf26395",Map
[(S "Abaidullah",Map [(S "authors",List [S "TGRISE",S "SBLYR"]),(S "description",S
"Super Fancy Berry Space Green NFT"),(S "image",S "ipfs://QmQuSwUFfCHCwEAMtmecjB1AYAo4gsocxFQ8Ph8uG62ueK"),(S
"name",S "Abaidullah"),(S "src",S "ipfs://QmQuSwUFfCHCwEAMtmecjB1AYAo4gsocxFQ8Ph8uG62ueK"),(S
"type",S "image/png")])])])], auxiliaryScripts = StrictSeq {fromStrict = fromList
[]}}
auxiliary data hash: AuxiliaryDataHash {unsafeAuxiliaryDataHash = SafeHash "7535c3c8130eeee22ce62f2e1170e55a02d339b59135a63e88f7b8525e3e333c"}
certificates: []
era: Mary
fee: 197445
inputs:
- 4c5e4e6d92443f9cf783cd9cfb23dcb3c073437c224cdcdd0df61b29329079c6#0
mint:
lovelace: 0
policies:
c3ddef916f0db22eb19df1701db91625633501d01e76ad66edf26395:
4162616964756c6c6168: -1
outputs:
- address:
Bech32: addr_test1qp56eal7uxkaz4zyylllcg2xj2vqv42jq62zng29y3v8e6f56lndw2dx3hhnltdwf7zan430pt7xaf2hr828qkdcddjsc3jmg4
credential:
key hash: 69acf7fee1add1544427fffc21469298065552069429a14524587ce9
network: Testnet
stake reference: StakeRefBase (KeyHashObj (KeyHash "34d7e6d729a68def3fadae4f85d9d62f0afc6ea55719d47059b86b65"))
amount:
lovelace: 8605110
policies:
c3ddef916f0db22eb19df1701db91625633501d01e76ad66edf26395:
4162616964756c6c6168: 1
update: null
validity interval:
invalid before: 0
invalid hereafter: 41156111
withdrawals: []
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 8802555 (fromList [])) (Value 8802555 (fromList [(PolicyID {policyID = ScriptHash "c3ddef916f0db22eb19df1701db91625633501d01e76ad66edf26395"},fromList [("Abaidullah",1)])])))))])
“cardanocli-js”: “^* 4.0.1”,
- cardano-node 1.30.1
- cardano-cli 1.30.1
Can anyone help me to resolve this blocker?