Hedera
Search…
Wipe a token
Wipes the provided amount of fungible or non-fungible tokens from the specified Hedera account. This transaction does not delete tokens from the treasury account. This transaction must be signed by the token's Wipe Key and the key of the account is being wiped. Wiping an account's tokens burns the tokens and decreases the total supply.
    If the provided account is not found, the transaction will resolve to INVALID_ACCOUNT_ID.
    If the provided account has been deleted, the transaction will resolve to ACCOUNT_DELETED
    If the provided token is not found, the transaction will resolve to INVALID_TOKEN_ID.
    If the provided token has been deleted, the transaction will resolve to TOKEN_WAS_DELETED.
    If an Association between the provided token and account is not found, the transaction will resolve to TOKEN_NOT_ASSOCIATED_TO_ACCOUNT.
    If Wipe Key is not present in the Token, the transaction results in TOKEN_HAS_NO_WIPE_KEY.
    If the provided account is the token's Treasury Account, the transaction results in CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT
    On success, tokens are removed from the account and the total supply of the token is decreased by the wiped amount.
    The amount provided is in the lowest denomination possible.
      Example: Token A has 2 decimals. In order to wipe 100 tokens from an account, one must provide an amount of 10000. In order to wipe 100.55 tokens, one must provide an amount of 10055.
Transaction Signing Requirements:
    Wipe key
    Transaction fee payer account key
Constructor
Description
new TokenWipeTransaction()
Initializes a TokenWipeAccountTransaction object
1
new TokenWipeAccountTransaction()
Copied!

Methods

V2
V1
Method
Type
Description
Requirement
setTokenId(<tokenId>)
TokenId
The ID of the token to wipe from the account
Required
setAmount(<amount>)
long
Applicable to tokens of type FUNGIBLE_COMMON.The amount of token to wipe from the specified account. The amount must be a positive non-zero number in the lowest denomination possible, not bigger than the token balance of the account.
Optional
setAccount(<accountId>)
AccountId
Applicable to tokens of type NON_FUNGIBLE_UNIQUE.The account ID to wipe the NFT from.
Required
setSerials(<serials>)
List<long>
Applicable to tokens of type NON_FUNGIBLE_UNIQUE.The list of NFTs to wipe.
Optional
addSerial(<serial>)
long
Applicable to tokens of type NON_FUNGIBLE_UNIQUE.The NFT to wipe.
Optional
Java
1
//Wipe 100 tokens from an account
2
TokenWipeTransaction transaction = new TokenWipeTransaction()
3
.setAccountId(accountId)
4
.setTokenId(tokenId)
5
.setAmount(100);
6
7
//Freeze the unsigned transaction, sign with the private key of the account that is being wiped, sign with the wipe private key of the token, submit the transaction to a Hedera network
8
TransactionResponse txResponse = transaction.freezeWith(client).sign(accountKey).sign(wipeKey).execute(client);
9
10
//Request the receipt of the transaction
11
TransactionReceipt receipt = txResponse.getReceipt(client);
12
13
//Obtain the transaction consensus status
14
Status transactionStatus = receipt.status;
15
16
System.out.println("The transaction consensus status is " +transactionStatus);
17
//v2.0.1
Copied!
JavaScript
1
//Wipe 100 tokens from an account and freeze the unsigned transaction for manual signing
2
const transaction = await new TokenWipeTransaction()
3
.setAccountId(accountId)
4
.setTokenId(tokenId)
5
.setAmount(100)
6
.freezeWith(client);
7
8
//Sign with the private key of the account that is being wiped, sign with the wipe private key of the token
9
const signTx = await (await transaction.sign(accountKey)).sign(wipeKey);
10
11
//Submit the transaction to a Hedera network
12
const txResponse = await signTx.execute(client);
13
14
//Request the receipt of the transaction
15
const receipt = await txResponse.getReceipt(client);
16
17
//Obtain the transaction consensus status
18
const transactionStatus = receipt.status;
19
20
console.log("The transaction consensus status is " +transactionStatus.toString());
Copied!
Go
1
//Wipe 100 tokens and freeze the unsigned transaction for manual signing
2
transaction, err = hedera.NewTokenBurnTransaction().
3
SetAccountId(accountId).
4
SetTokenID(tokenId).
5
SetAmount(1000).
6
FreezeWith(client)
7
8
if err != nil {
9
panic(err)
10
}
11
12
//Sign with the private key of the account that is being wiped, sign with the wipe private key of the token
13
txResponse, err := transaction.Sign(accountKey).Sign(wipeKey).Execute(client)
14
15
if err != nil {
16
panic(err)
17
}
18
19
//Request the receipt of the transaction
20
receipt, err = txResponse.GetReceipt(client)
21
22
if err != nil {
23
panic(err)
24
}
25
26
//Get the transaction consensus status
27
status := receipt.Status
28
29
fmt.Printf("The transaction consensus status is %v\n", status)
30
31
//v2.1.0
Copied!
Method
Type
Description
Requirement
setTokenId(<tokenId>)
TokenId
The ID of the token to wipe from the account
Required
setAmount(<amount>)
long
The amount of token to wipe from the specified account. Amount must be a positive non-zero number in the lowest denomination possible, not bigger than the token balance of the account (0; balance]
Required
setAccount(<accountId>)
AccountId
The account ID to wipe the tokens from
Required
setSerials(<serials>)
List<long>
Applicable to tokens of type NON_FUNGIBLE_UNIQUE.The list of NFTs to wipe.
Optional
addSerial(<serial>)
long
Applicable to tokens of type NON_FUNGIBLE_UNIQUE.The NFT to wipe.
Optional
Java
1
//Wipe 100 tokens from an account
2
TokenWipeTransaction transaction = new TokenWipeTransaction()
3
.setAccountId(accountId)
4
.setTokenId(tokenId)
5
.setAmount(100);
6
7
//Build the unsigned transaction, sign with the private key of the account that is being wiped, sign with the wipe private key of the token, submit the transaction to a Hedera network
8
TransactionId transactionId = transaction.build(client).sign(accountKey).sign(wipeKey).execute(client);
9
10
//Request the receipt of the transaction
11
TransactionReceipt getReceipt = transactionId.getReceipt(client);
12
13
//Obtain the transaction consensus status
14
Status transactionStatus = getReceipt.status;
15
16
System.out.println("The transaction consensus status is " +transactionStatus);
17
//Version: 1.2.2
Copied!
JavaScript
1
//Wipe 100 tokens from an account
2
const transaction = new TokenWipeTransaction()
3
.setAccountId(accountId)
4
.setTokenId(tokenId)
5
.setAmount(100);
6
7
//Build the unsigned transaction, sign with the account private key of the token, sign with the wipe private key, submit the transaction to a Hedera network
8
const transactionId = await transaction.build(client).sign(accountKey).sign(wipeKey).execute(client);
9
10
//Request the receipt of the transaction
11
const getReceipt = await transactionId.getReceipt(client);
12
13
//Obtain the transaction consensus status
14
const transactionStatus = getReceipt.status;
15
16
console.log("The transaction consensus status is " +transactionStatus);
17
//Version 1.4.2
Copied!
Last modified 6d ago
Copy link
Contents
Methods