Most changes MUST be signed by the current `admin_key` of the token. If the token does not currently have a valid `admin_key`, then this transaction MUST NOT set any value other than `expiry` or a non-admin key.
If the `treasury` is set to a new account, the new account MUST sign this transaction.
If the `treasury` is set to a new account for a _non-fungible/unique_ token, The current treasury MUST NOT hold any tokens, or the network configuration property `tokens.nfts.useTreasuryWildcards` MUST be set. #### Requirements for Keys Any of the key values may be changed, even without an admin key, but the key to be changed MUST have an existing valid key assigned, and both the current key and the new key MUST sign the transaction.
A key value MAY be set to an empty `KeyList`. In this case the existing key MUST sign this transaction, but the new value is not a valid key, and the update SHALL effectively remove the existing key. ### Block Stream Effects None
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Transaction
Transaction.SignableNodeTransactionBodyBytesNested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Executable
Executable.GrpcRequest -
Field Summary
Fields inherited from class com.hedera.hashgraph.sdk.Transaction
customFeeLimits, DEFAULT_AUTO_RENEW_PERIOD, defaultMaxTransactionFee, DUMMY_ACCOUNT_ID, DUMMY_TRANSACTION_ID, frozenBodyBuilder, innerSignedTransactions, outerTransactions, publicKeys, regenerateTransactionId, signers, sigPairLists, sourceTransactionBody, transactionIdsFields inherited from class com.hedera.hashgraph.sdk.Executable
attemptedAllNodes, blockingUnaryCall, grpcDeadline, logger, maxAttempts, maxBackoff, minBackoff, nodeAccountIds, nodes, random, RST_STREAM -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) TokenUpdateTransactionBody.Builderbuild()Build the transaction body.Remove the token memo.Extract the admin key.Extract the auto renew account id.Extract the auto renew period.Extract the expiration time.Extract the fee schedule key.Extract the freeze key.Extract the key verification modeExtract the kyc key.Extract the metadata key.(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.Extract the pause key.Extract the supply key.Extract the token id.Extract the token memo.byte[]Extract the metadata.Extract the token name.Extract the token symbol.Extract the treasury account id.Extract the wipe key.(package private) voidInitialize from the transaction body.(package private) voidonFreeze(TransactionBody.Builder bodyBuilder) Called inTransaction.freezeWith(Client)just before the transaction body is built.(package private) voidonScheduled(SchedulableTransactionBody.Builder scheduled) Called inTransaction.schedule()when converting transaction into a scheduled version.setAdminKey(Key key) A Hedera key for token administration.setAutoRenewAccountId(AccountId accountId) An identifier for the account to be charged renewal fees at the token's expiry to extend the lifetime of the token.setAutoRenewPeriod(Duration period) A duration between token automatic renewals.
All entities in state may be charged "rent" occasionally (typically every 90 days) to prevent unnecessary growth of the ledger.setExpirationTime(Duration expirationTime) setExpirationTime(Instant expirationTime) An expiration timestamp.setFeeScheduleKey(Key key) An Hedera key for managing the token custom fee schedule.setFreezeKey(Key key) A Hedera key for managing asset "freeze".setKeyVerificationMode(TokenKeyValidation tokenKeyVerificationMode) Set a key validation mode.
Any key may be updated by a transaction signed by the token `admin_key`.A Hedera key for managing account KYC.setMetadataKey(Key key) A Hedera key for managing the token `metadata`.setPauseKey(Key key) An Hedera key for managing token "pause".setSupplyKey(Key key) An Hedera key for "minting" and "burning" tokens.setTokenId(TokenId tokenId) A token identifier.setTokenMemo(String memo) A short description for this token.setTokenMetadata(byte[] tokenMetadata) Assign the metadata.setTokenName(String name) A new name for the token.
This is generally the "full name" displayed in wallet software.setTokenSymbol(String symbol) A new symbol to use for the token.setTreasuryAccountId(AccountId accountId) A new treasury account identifier.setWipeKey(Key key) A Hedera key for wiping tokens from accounts.(package private) voidvalidateChecksums(Client client) Methods inherited from class com.hedera.hashgraph.sdk.Transaction
addSignature, addSignature, batchify, buildAllTransactions, buildTransaction, doSchedule, estimateFee, freeze, freezeWith, fromBytes, fromScheduledTransaction, generateTransactionIds, getBatchKey, getDefaultMaxTransactionFee, getExecutionState, getHighVolume, getMaxTransactionFee, getRegenerateTransactionId, getRequiredChunks, getSignableNodeBodyBytesList, getSignatures, getSignaturesAtOffset, getTransactionBodySize, getTransactionHash, getTransactionHashPerNode, getTransactionId, getTransactionIdInternal, getTransactionMemo, getTransactionSize, getTransactionValidDuration, hash, isBatchedAndNotBatchTransaction, isFrozen, keyAlreadySigned, makeRequest, mapResponse, mapResponseStatus, onExecute, onExecuteAsync, regenerateTransactionId, requireNotFrozen, requireOneNodeAccountId, schedule, setBatchKey, setHighVolume, setMaxTransactionFee, setNodeAccountIds, setRegenerateTransactionId, setTransactionId, setTransactionMemo, setTransactionValidDuration, sign, signTransaction, signWith, signWithOperator, spawnBodyBuilder, toBytes, toString, wipeTransactionListsMethods inherited from class com.hedera.hashgraph.sdk.Executable
advanceRequest, checkNodeAccountIds, execute, execute, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, getGrpcRequest, getMaxAttempts, getMaxBackoff, getMaxRetry, getMinBackoff, getNodeAccountIds, getNodeForExecute, grpcDeadline, logTransaction, mergeFromClient, setGrpcDeadline, setLogger, setMaxAttempts, setMaxBackoff, setMaxRetry, setMinBackoff, setNodesFromNodeAccountIds, setRequestListener, setResponseListener, shouldRetryExceptionally
-
Constructor Details
-
TokenUpdateTransaction
public TokenUpdateTransaction()Constructor. -
TokenUpdateTransaction
TokenUpdateTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, throws com.google.protobuf.InvalidProtocolBufferExceptionTransaction>> txs) Constructor.- Parameters:
txs- Compound list of transaction id's list of (AccountId, Transaction) records- Throws:
com.google.protobuf.InvalidProtocolBufferException- when there is an issue with the protobuf
-
TokenUpdateTransaction
TokenUpdateTransaction(TransactionBody txBody) Constructor.- Parameters:
txBody- protobuf TransactionBody
-
-
Method Details
-
getTokenId
Extract the token id.- Returns:
- the token id
-
setTokenId
A token identifier.This SHALL identify the token type to delete.
The identified token MUST exist, and MUST NOT be deleted.
If any field other than `expiry` is set, the identified token MUST have a valid `admin_key`.- Parameters:
tokenId- the token id- Returns:
this
-
getTokenName
Extract the token name.- Returns:
- the token name
-
setTokenName
A new name for the token.
This is generally the "full name" displayed in wallet software.This value, if set, MUST NOT exceed 100 bytes when encoded as UTF-8.
This value, if set, MUST NOT contain the Unicode NUL codepoint.- Parameters:
name- the token name- Returns:
this
-
getTokenSymbol
Extract the token symbol.- Returns:
- the token symbol
-
setTokenSymbol
A new symbol to use for the token.This value, if set, MUST NOT exceed 100 bytes when encoded as UTF-8.
This value, if set, MUST NOT contain the Unicode NUL codepoint.- Parameters:
symbol- the token symbol- Returns:
this
-
getTreasuryAccountId
Extract the treasury account id.- Returns:
- the treasury account id
-
setTreasuryAccountId
A new treasury account identifier.If set, - The identified account SHALL be designated the "treasury" for the token, and all tokens "minted" SHALL be delivered to that account following this transaction.
- The identified account MUST exist, MUST NOT be expired, MUST NOT be deleted, and SHOULD have a non-zero HBAR balance.
- The identified account SHALL be associated to this token. - The full balance of this token held by the prior treasury account SHALL be transferred to the new treasury account, if the token type is fungible/common. - If the token type is non-fungible/unique, the previous treasury account MUST NOT hold any tokens of this type. - The new treasury account key MUST sign this transaction.- Parameters:
accountId- the account id- Returns:
this
-
getAdminKey
Extract the admin key.- Returns:
- the admin key
-
setAdminKey
A Hedera key for token administration.This key, if set, SHALL have administrative authority for this token and MAY authorize token update and/or token delete transactions.
If this key is set to an empty `KeyList`, this token SHALL be immutable thereafter, except for expiration and renewal.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the key- Returns:
this
-
getKycKey
Extract the kyc key.- Returns:
- the kyc key
-
setKycKey
A Hedera key for managing account KYC.This key, if set, SHALL have KYC authority for this token and MAY authorize transactions to grant or revoke KYC for accounts.
If this key is not set, or is an empty `KeyList`, KYC status for this token SHALL NOT be granted or revoked for any account.
If this key is removed after granting KYC, those grants SHALL remain and cannot be revoked.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the kyc key- Returns:
this
-
getFreezeKey
Extract the freeze key.- Returns:
- the freeze key
-
setFreezeKey
A Hedera key for managing asset "freeze".This key, if set, SHALL have "freeze" authority for this token and MAY authorize transactions to freeze or unfreeze accounts with respect to this token.
If this key is set to an empty `KeyList`, this token SHALL NOT be frozen or unfrozen for any account.
If this key is removed after freezing accounts, those accounts SHALL remain frozen and cannot be unfrozen.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the freeze key- Returns:
this
-
getWipeKey
Extract the wipe key.- Returns:
- the wipe key
-
setWipeKey
A Hedera key for wiping tokens from accounts.This key, if set, SHALL have "wipe" authority for this token and MAY authorize transactions to "wipe" any amount of this token from any account, effectively burning the tokens "wiped".
If this key is set to an empty `KeyList`, it SHALL NOT be possible to "wipe" this token from an account.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the wipe key- Returns:
this
-
getSupplyKey
Extract the supply key.- Returns:
- the supply key
-
setSupplyKey
An Hedera key for "minting" and "burning" tokens.This key, if set, MAY authorize transactions to "mint" new tokens to be delivered to the token treasury or "burn" tokens held by the token treasury.
If this key is set to an empty `KeyList`, it SHALL NOT be possible to change the supply of tokens and neither "mint" nor "burn" transactions SHALL be permitted.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the supply key- Returns:
this
-
getFeeScheduleKey
Extract the fee schedule key.- Returns:
- the fee schedule key
-
setFeeScheduleKey
An Hedera key for managing the token custom fee schedule.This key, if set, MAY authorize transactions to modify the `custom_fees` for this token.
If this key is set to an empty `KeyList`, the `custom_fees` for this token SHALL NOT be modified.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the fee schedule key- Returns:
this
-
getPauseKey
Extract the pause key.- Returns:
- the pause key
-
setPauseKey
An Hedera key for managing token "pause".This key, if set, SHALL have "pause" authority for this token and MAY authorize transactions to pause or unpause this token.
If this key is set to an empty `KeyList`, this token SHALL NOT be paused or unpaused.
If this key is removed while the token is paused, the token cannot be unpaused and SHALL remain paused.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the pause key- Returns:
this
-
getMetadataKey
Extract the metadata key.- Returns:
- the metadata key
-
setMetadataKey
A Hedera key for managing the token `metadata`.This key, if set, MAY authorize transactions to modify the `metadata` for this token.
If this key is set to an empty `KeyList`, the `metadata` for this token SHALL NOT be modified.
If set, this key MUST be a valid key or an empty `KeyList`.
If set to a valid key, the previous key and new key MUST both sign this transaction.- Parameters:
key- the metadata key- Returns:
this
-
getExpirationTime
Extract the expiration time.- Returns:
- the expiration time
-
setExpirationTime
An expiration timestamp.If this value is set, the automatic renewal account is not set for the identified token, and token expiration is enabled in network configuration, this token SHALL expire when the consensus time exceeds this value, and MAY be subsequently removed from the network state.
If `autoRenewAccount` is set or the `auto_renew_account_id` is set for the identified token, the token SHALL be subject to automatic renewal when the consensus time exceeds this value.- Parameters:
expirationTime- the expiration time- Returns:
this
-
setExpirationTime
-
getAutoRenewAccountId
Extract the auto renew account id.- Returns:
- the auto renew account id
-
setAutoRenewAccountId
An identifier for the account to be charged renewal fees at the token's expiry to extend the lifetime of the token.If this value is set for the identified token, the token lifetime SHALL be extended by the _smallest_ of the following at expiration:
- The current `autoRenewPeriod` duration.
- The maximum duration that this account has funds to purchase.
- The configured MAX_AUTORENEW_PERIOD at the time of automatic renewal.
If this value is set, the referenced account MUST sign this transaction.Note
It is not currently possible to remove an automatic renewal account. Once set, it can only be replaced by a valid account.
- Parameters:
accountId- the account id- Returns:
this
-
getAutoRenewPeriod
Extract the auto renew period.- Returns:
- the auto renew period
-
setAutoRenewPeriod
A duration between token automatic renewals.
All entities in state may be charged "rent" occasionally (typically every 90 days) to prevent unnecessary growth of the ledger. This value sets the interval between such events for this token.If set, this value MUST be greater than the configured `MIN_AUTORENEW_PERIOD`.
If set, this value MUST be less than the configured `MAX_AUTORENEW_PERIOD`.- Parameters:
period- the auto renew period- Returns:
this
-
getTokenMemo
Extract the token memo.- Returns:
- the token memo
-
setTokenMemo
A short description for this token.This value, if set, MUST NOT exceed `transaction.maxMemoUtf8Bytes` (default 100) bytes when encoded as UTF-8.
- Parameters:
memo- the token memo 100 bytes max- Returns:
this
-
clearMemo
Remove the token memo.- Returns:
this
-
getTokenMetadata
@Nullable public byte[] getTokenMetadata()Extract the metadata.- Returns:
- the metadata
-
setTokenMetadata
Assign the metadata.- Parameters:
tokenMetadata- the metadata- Returns:
this
-
getKeyVerificationMode
Extract the key verification mode- Returns:
- the key verification mode
-
setKeyVerificationMode
Set a key validation mode.
Any key may be updated by a transaction signed by the token `admin_key`. Each role key may _also_ sign a transaction to update that key. If a role key signs an update to change that role key both old and new key must sign the transaction, _unless_ this field is set to `NO_VALIDATION`, in which case the _new_ key is not required to sign the transaction (the existing key is still required).
The primary intent for this field is to allow a role key (e.g. a `pause_key`) holder to "remove" that key from the token by signing a transaction to set that role key to an empty `KeyList`.If set to `FULL_VALIDATION`, either the `admin_key` or _both_ current and new key MUST sign this transaction to update a "key" field for the identified token.
If set to `NO_VALIDATION`, either the `admin_key` or the current key MUST sign this transaction to update a "key" field for the identified token.
This field SHALL be treated as `FULL_VALIDATION` if not set.- Parameters:
tokenKeyVerificationMode- the key verification mode- Returns:
this
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
build
Build the transaction body.- Returns:
TokenUpdateTransactionBody
-
validateChecksums
- Specified by:
validateChecksumsin classTransaction<TokenUpdateTransaction>- Throws:
BadEntityIdException
-
getMethodDescriptor
io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()Description copied from class:ExecutableCalled to direct the invocation of the query to the appropriate gRPC service.- Specified by:
getMethodDescriptorin classExecutable<TokenUpdateTransaction,Transaction, TransactionResponse, TransactionResponse>
-
onFreeze
Description copied from class:TransactionCalled inTransaction.freezeWith(Client)just before the transaction body is built. The intent is for the derived class to assign their data variant to the transaction body.- Specified by:
onFreezein classTransaction<TokenUpdateTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<TokenUpdateTransaction>
-