Delete a smart contract
Methods
Method
Type
Description
Requirement
//Create the transaction
ContractDeleteTransaction transaction = new ContractDeleteTransaction()
.setContractId(contractId);
//Freeze the transaction for signing, sign with the admin key on the contract, sign with the client operator private key and submit to a Hedera network
TransactionResponse txResponse = transaction.freezeWith(client).sign(adminKey).execute(client);
//Get the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.0.0//Create the transaction
const transaction = await new ContractDeleteTransaction()
.setContractId(contractId)
.freezeWith(client);
//Sign with the admin key on the contract
const signTx = await transaction.sign(adminKey)
//Sign the transaction with the client operator's private key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Get the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//v2.0.5Last updated