Delete an account
Constructor
Description
new AccountDeleteTransaction()Methods
Method
Type
Description
Requirement
//Create the transaction
AccountDeleteTransaction transaction = new AccountDeleteTransaction()
.setDeleteAccountId(accountId)
.setTransferAccountId(OPERATOR_ID);
//Build the unsigned transaction, sign with account key, sign with the client operator account private key and submit to a Hedera network
TransactionId txId = transaction.build(client).sign(newKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txId.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v1.3.2//Create the transaction
const transaction = await new AccountDeleteTransaction()
.setDeleteAccountId(accountId)
.setTransferAccountId(OPERATOR_ID)
.build(client);
//Sign the transaction with the account key
const signTx = await transaction.sign(accountKey);
//Sign with the client operator private key and submit to a Hedera network
const txId = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txId.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);Get transaction values
Method
Type
Description
Last updated