Deleting assets
Authorized by: Asset Manager
Created assets can be destroyed only by the asset manager account. All of the assets must be owned by the creator of the asset before the asset can be deleted.
sp = algod_client.suggested_params()# Create asset destroy transaction to destroy the assetdestroy_txn = transaction.AssetDestroyTxn( sender=acct1.address, sp=sp, index=created_asset,)signed_destroy_txn = destroy_txn.sign(acct1.private_key)txid = algod_client.send_transaction(signed_destroy_txn)print(f"Sent destroy transaction with txid: {txid}")
results = transaction.wait_for_confirmation(algod_client, txid, 4)print(f"Result confirmed in round: {results['confirmed-round']}")
# now, trying to fetch the asset info should result in an errortry: info = algod_client.asset_info(created_asset)except Exception as e: print("Expected Error:", e)
const deleteTxn = algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject({ from: manager.addr, suggestedParams, assetIndex,});
const signedDeleteTxn = deleteTxn.signTxn(manager.privateKey);await algodClient.sendRawTransaction(signedDeleteTxn).do();await algosdk.waitForConfirmation( algodClient, deleteTxn.txID().toString(), 3);
goal asset destroy --creator <creator-address> --manager <asset-manager-address> --asset <asset-name> -d data
See also