Class TokenUpdateTransaction


public class TokenUpdateTransaction extends Transaction<TokenUpdateTransaction>
Update an existing token. This transaction SHALL NOT update any field that is not set.
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
  • Constructor Details

    • TokenUpdateTransaction

      public TokenUpdateTransaction()
      Constructor.
    • TokenUpdateTransaction

      TokenUpdateTransaction(LinkedHashMap<TransactionId,LinkedHashMap<AccountId,Transaction>> txs) throws com.google.protobuf.InvalidProtocolBufferException
      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

      @Nullable public TokenId getTokenId()
      Extract the token id.
      Returns:
      the token id
    • setTokenId

      public TokenUpdateTransaction setTokenId(TokenId tokenId)
      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

      @Nullable public String getTokenName()
      Extract the token name.
      Returns:
      the token name
    • setTokenName

      public TokenUpdateTransaction setTokenName(String name)
      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

      public String getTokenSymbol()
      Extract the token symbol.
      Returns:
      the token symbol
    • setTokenSymbol

      public TokenUpdateTransaction setTokenSymbol(String symbol)
      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

      @Nullable public AccountId getTreasuryAccountId()
      Extract the treasury account id.
      Returns:
      the treasury account id
    • setTreasuryAccountId

      public TokenUpdateTransaction setTreasuryAccountId(AccountId accountId)
      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

      @Nullable public Key getAdminKey()
      Extract the admin key.
      Returns:
      the admin key
    • setAdminKey

      public TokenUpdateTransaction setAdminKey(Key key)
      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

      @Nullable public Key getKycKey()
      Extract the kyc key.
      Returns:
      the kyc key
    • setKycKey

      public TokenUpdateTransaction setKycKey(Key key)
      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

      @Nullable public Key getFreezeKey()
      Extract the freeze key.
      Returns:
      the freeze key
    • setFreezeKey

      public TokenUpdateTransaction setFreezeKey(Key key)
      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

      @Nullable public Key getWipeKey()
      Extract the wipe key.
      Returns:
      the wipe key
    • setWipeKey

      public TokenUpdateTransaction setWipeKey(Key key)
      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

      @Nullable public Key getSupplyKey()
      Extract the supply key.
      Returns:
      the supply key
    • setSupplyKey

      public TokenUpdateTransaction setSupplyKey(Key key)
      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

      @Nullable public Key getFeeScheduleKey()
      Extract the fee schedule key.
      Returns:
      the fee schedule key
    • setFeeScheduleKey

      public TokenUpdateTransaction setFeeScheduleKey(Key key)
      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

      @Nullable public Key getPauseKey()
      Extract the pause key.
      Returns:
      the pause key
    • setPauseKey

      public TokenUpdateTransaction setPauseKey(Key key)
      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

      @Nullable public Key getMetadataKey()
      Extract the metadata key.
      Returns:
      the metadata key
    • setMetadataKey

      public TokenUpdateTransaction setMetadataKey(Key key)
      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

      @Nullable public Instant getExpirationTime()
      Extract the expiration time.
      Returns:
      the expiration time
    • setExpirationTime

      public TokenUpdateTransaction setExpirationTime(Instant expirationTime)
      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

      public TokenUpdateTransaction setExpirationTime(Duration expirationTime)
    • getAutoRenewAccountId

      @Nullable public AccountId getAutoRenewAccountId()
      Extract the auto renew account id.
      Returns:
      the auto renew account id
    • setAutoRenewAccountId

      public TokenUpdateTransaction 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.

      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 account's HBAR balance is `0` when the token must be renewed, then the token SHALL be expired, and MAY be subsequently removed from state.
      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

      @Nullable public Duration getAutoRenewPeriod()
      Extract the auto renew period.
      Returns:
      the auto renew period
    • setAutoRenewPeriod

      public TokenUpdateTransaction 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. 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

      @Nullable public String getTokenMemo()
      Extract the token memo.
      Returns:
      the token memo
    • setTokenMemo

      public TokenUpdateTransaction setTokenMemo(String memo)
      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

      public TokenUpdateTransaction clearMemo()
      Remove the token memo.
      Returns:
      this
    • getTokenMetadata

      @Nullable public byte[] getTokenMetadata()
      Extract the metadata.
      Returns:
      the metadata
    • setTokenMetadata

      public TokenUpdateTransaction setTokenMetadata(byte[] tokenMetadata)
      Assign the metadata.
      Parameters:
      tokenMetadata - the metadata
      Returns:
      this
    • getKeyVerificationMode

      public TokenKeyValidation getKeyVerificationMode()
      Extract the key verification mode
      Returns:
      the key verification mode
    • setKeyVerificationMode

      public TokenUpdateTransaction setKeyVerificationMode(TokenKeyValidation tokenKeyVerificationMode)
      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

      void validateChecksums(Client client) throws BadEntityIdException
      Specified by:
      validateChecksums in class Transaction<TokenUpdateTransaction>
      Throws:
      BadEntityIdException
    • getMethodDescriptor

      io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()
      Description copied from class: Executable
      Called to direct the invocation of the query to the appropriate gRPC service.
      Specified by:
      getMethodDescriptor in class Executable<TokenUpdateTransaction,Transaction,TransactionResponse,TransactionResponse>
    • onFreeze

      void onFreeze(TransactionBody.Builder bodyBuilder)
      Description copied from class: Transaction
      Called in Transaction.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:
      onFreeze in class Transaction<TokenUpdateTransaction>
    • onScheduled

      void onScheduled(SchedulableTransactionBody.Builder scheduled)
      Description copied from class: Transaction
      Called in Transaction.schedule() when converting transaction into a scheduled version.
      Specified by:
      onScheduled in class Transaction<TokenUpdateTransaction>