Class AccountUpdateTransaction


public final class AccountUpdateTransaction extends Transaction<AccountUpdateTransaction>
Modify the current state of an account. ### Requirements - The `key` for this account MUST sign all account update transactions. - If the `key` field is set for this transaction, then _both_ the current `key` and the new `key` MUST sign this transaction, for security and to prevent setting the `key` field to an invalid value. - If the `auto_renew_account` field is set for this transaction, the account identified in that field MUST sign this transaction. - Fields set to non-default values in this transaction SHALL be updated on success. Fields not set to non-default values SHALL NOT be updated on success. - All fields that may be modified in this transaction SHALL have a default value of unset (a.k.a. `null`). ### Block Stream Effects None
  • Constructor Details

    • AccountUpdateTransaction

      public AccountUpdateTransaction()
      Constructor.
    • AccountUpdateTransaction

      AccountUpdateTransaction(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
    • AccountUpdateTransaction

      AccountUpdateTransaction(TransactionBody txBody)
      Constructor.
      Parameters:
      txBody - protobuf TransactionBody
  • Method Details

    • getAccountId

      @Nullable public AccountId getAccountId()
      Extract the account id.
      Returns:
      the account id
    • setAccountId

      public AccountUpdateTransaction setAccountId(AccountId accountId)
      Sets the account ID which is being updated in this transaction.
      Parameters:
      accountId - The AccountId to be set
      Returns:
      this
    • getKey

      @Nullable public Key getKey()
      Extract the key.
      Returns:
      the key
    • setKey

      public AccountUpdateTransaction setKey(Key key)
      An account key.
      This may be a "primitive" key (a singly cryptographic key), or a composite key.

      If set, this key MUST be a valid key.
      If set, the previous key and new key MUST both sign this transaction.

      Parameters:
      key - The Key to be set
      Returns:
      this
    • getAliasKey

      @Deprecated @Nullable public Key getAliasKey()
      Deprecated.
      with no replacement
      Returns:
      the alias key
    • setAliasKey

      @Deprecated public AccountUpdateTransaction setAliasKey(Key aliasKey)
      Deprecated.
      with no replacement Sets the new key.
      Parameters:
      aliasKey - The Key to be set
      Returns:
      this
    • getProxyAccountId

      @Nullable public AccountId getProxyAccountId()
      Extract the proxy account id.
      Returns:
      the proxy account id
    • setProxyAccountId

      public AccountUpdateTransaction setProxyAccountId(AccountId proxyAccountId)
      Sets the ID of the account to which this account is proxy staked.

      If proxyAccountID is null, or is an invalid account, or is an account that isn't a node, then this account is automatically proxy staked to a node chosen by the network, but without earning payments.

      If the proxyAccountID account refuses to accept proxy staking, or if it is not currently running a node, then it will behave as if proxyAccountID was null.

      Parameters:
      proxyAccountId - The AccountId to be set
      Returns:
      this
    • getExpirationTime

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

      public AccountUpdateTransaction setExpirationTime(Instant expirationTime)
      A new account expiration time, in seconds since the epoch.

      For this purpose, `epoch` SHALL be the UNIX epoch with 0 at `1970-01-01T00:00:00.000Z`.
      If set, this value MUST be later than the current consensus time.
      If set, this value MUST be earlier than the current consensus time extended by the current maximum expiration time configured for the network.

      Parameters:
      expirationTime - The Instant to be set as the expiration time
      Returns:
      this
    • setExpirationTime

      public AccountUpdateTransaction setExpirationTime(Duration expirationTime)
    • getAutoRenewPeriod

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

      public AccountUpdateTransaction setAutoRenewPeriod(Duration autoRenewPeriod)
      A duration to extend account expiration.
      An amount of time, in seconds, to extend the expiration date for this account when _automatically_ renewed.

      This duration MUST be between the current configured minimum and maximum values defined for the network.
      This duration SHALL be applied only when _automatically_ extending the account expiration.

      Parameters:
      autoRenewPeriod - The Duration to be set for auto renewal
      Returns:
      this
    • getReceiverSignatureRequired

      @Nullable public Boolean getReceiverSignatureRequired()
      Is the receiver required to sign?
      Returns:
      is the receiver required to sign
    • setReceiverSignatureRequired

      public AccountUpdateTransaction setReceiverSignatureRequired(boolean receiverSignatureRequired)
      Removed to distinguish between unset and a default value.
      Do NOT use this field to set a false value because the server cannot distinguish from the default value. Use receiverSigRequiredWrapper field for this purpose.
      Parameters:
      receiverSignatureRequired - The bool to be set
      Returns:
      this
    • getMaxAutomaticTokenAssociations

      @Nullable public Integer getMaxAutomaticTokenAssociations()
      Extract the maximum automatic token associations.
      Returns:
      the max automatic token associations
    • setMaxAutomaticTokenAssociations

      public AccountUpdateTransaction setMaxAutomaticTokenAssociations(int amount)
      A maximum number of tokens that can be auto-associated with this account.
      By default this value is 0 for all accounts except for automatically created accounts (i.e smart contracts) which default to -1.

      If this value is `0`, then this account MUST manually associate to a token before holding or transacting in that token.
      This value MAY also be `-1` to indicate no limit.
      If set, this value MUST NOT be less than `-1`.

      Parameters:
      amount - the amount of tokens
      Returns:
      this
    • getAccountMemo

      @Nullable public String getAccountMemo()
      Extract the account memo.
      Returns:
      the account memo
    • setAccountMemo

      public AccountUpdateTransaction setAccountMemo(String memo)
      A short description of this Account.

      This value, if set, MUST NOT exceed `transaction.maxMemoUtf8Bytes` (default 100) bytes when encoded as UTF-8.

      Parameters:
      memo - the memo
      Returns:
      this
    • clearMemo

      public AccountUpdateTransaction clearMemo()
      Erase the memo field.
      Returns:
      this
    • getStakedAccountId

      @Nullable public AccountId getStakedAccountId()
      ID of the account to which this account will stake
      Returns:
      ID of the account to which this account will stake.
    • setStakedAccountId

      public AccountUpdateTransaction setStakedAccountId(@Nullable AccountId stakedAccountId)
      ID of the account to which this account is staking its balances.

      If this account is not currently staking its balances, then this field, if set, MUST be the sentinel value of `0.0.0`.

      Parameters:
      stakedAccountId - ID of the account to which this account will stake.
      Returns:
      this
    • clearStakedAccountId

      public AccountUpdateTransaction clearStakedAccountId()
      Clear the staked account ID
      Returns:
      this
    • getStakedNodeId

      @Nullable public Long getStakedNodeId()
      The node to which this account will stake
      Returns:
      ID of the node this account will be staked to.
    • setStakedNodeId

      public AccountUpdateTransaction setStakedNodeId(@Nullable Long stakedNodeId)
      ID of the node this account is staked to.

      If this account is not currently staking its balances, then this field, if set, SHALL be the sentinel value of `-1`.
      Wallet software SHOULD surface staking issues to users and provide a simple mechanism to update staking to a new node ID in the event the prior staked node ID ceases to be valid.

      Parameters:
      stakedNodeId - ID of the node this account will be staked to.
      Returns:
      this
    • clearStakedNodeId

      public AccountUpdateTransaction clearStakedNodeId()
      Clear the staked node
      Returns:
      this
    • getDeclineStakingReward

      @Nullable public Boolean getDeclineStakingReward()
      If true, the account declines receiving a staking reward. The default value is false.
      Returns:
      If true, the account declines receiving a staking reward. The default value is false.
    • setDeclineStakingReward

      public AccountUpdateTransaction setDeclineStakingReward(boolean declineStakingReward)
      A boolean indicating that this account has chosen to decline rewards for staking its balances.

      This account MAY still stake its balances, but SHALL NOT receive reward payments for doing so, if this value is set, and `true`.

      Parameters:
      declineStakingReward - - If true, the account declines receiving a staking reward. The default value is false.
      Returns:
      this
    • clearDeclineStakingReward

      public AccountUpdateTransaction clearDeclineStakingReward()
      Clear decline staking reward
      Returns:
      this
    • addHookToCreate

      public AccountUpdateTransaction addHookToCreate(HookCreationDetails hookDetails)
      Add a hook to be created for the account.
      Parameters:
      hookDetails - the hook creation details to add
      Returns:
      this
    • setHooksToCreate

      public AccountUpdateTransaction setHooksToCreate(List<HookCreationDetails> hookDetails)
      Set hooks to be created with the account.
      Parameters:
      hookDetails - list of hook creation details
      Returns:
      this
    • addHookToDelete

      public AccountUpdateTransaction addHookToDelete(Long hookId)
      Mark a hook for deletion from the account.
      Parameters:
      hookId - the hook id to delete
      Returns:
      this
    • setHooksToDelete

      public AccountUpdateTransaction setHooksToDelete(List<Long> hookIds)
      Mark hooks for deletion from the account.
      Parameters:
      hookIds - list of hook ids to delete
      Returns:
      this
    • getHooksToCreate

      public List<HookCreationDetails> getHooksToCreate()
      Get the list of hooks to be created.
      Returns:
      a copy of the hook creation details list
    • getHooksToDelete

      public List<Long> getHooksToDelete()
      Get the list of hook IDs to be deleted.
      Returns:
      a copy of the hook IDs list
    • validateChecksums

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

      void initFromTransactionBody()
      Initialize from the transaction body.
    • 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<AccountUpdateTransaction,Transaction,TransactionResponse,TransactionResponse>
    • build

      Create the builder.
      Returns:
      the transaction builder
    • 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<AccountUpdateTransaction>
    • 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<AccountUpdateTransaction>