-
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 TypeMethodDescriptionaddHook(HookCreationDetails hookDetails) Add a hook creation detail to this account.(package private) CryptoCreateTransactionBody.Builderbuild()Build the transaction body.Extract the account memo.getAlias()The bytes to be used as the account's alias.Extract the duration for the auto renew period.booleanIf true, the account declines receiving a staking reward.getHooks()Get the hook creation details for this account.Extract the amount in hbar.getKey()Extract the key.intExtract the maximum automatic token associations.(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.Deprecated.with no replacement Extract the proxy account id.booleanIs the receiver required to sign?ID of the account to which this account will stakeThe node to which this account will stake(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.setAccountMemo(String memo) A short description of this Account.setAlias(EvmAddress alias) The bytes to be used as the account's alias.The ethereum account 20-byte EVM address to be used as the account's alias.setAutoRenewPeriod(Duration autoRenewPeriod) Set the auto renew period for this account.setDeclineStakingReward(boolean declineStakingReward) If true, the account declines receiving a staking reward.setHooks(List<HookCreationDetails> hookDetails) Set the hook creation details for this account.setInitialBalance(Hbar initialBalance) An amount, in tinybar, to deposit to the newly created account.Deprecated.setKeyWithAlias(Key key) Sets ECDSA private key, derives and sets it's EVM address in the background.setKeyWithAlias(Key key, Key ecdsaKey) Sets the account key and a separate ECDSA key that the EVM address is derived from.setKeyWithoutAlias(Key key) Sets key where it is explicitly called out that the alias is not setsetMaxAutomaticTokenAssociations(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 (e.g.setProxyAccountId(AccountId proxyAccountId) Deprecated.with no replacement Set the ID of the account to which this account is proxy staked.setReceiverSignatureRequired(boolean receiveSignatureRequired) A flag indicating the account holder must authorize all incoming token transfers.setStakedAccountId(AccountId stakedAccountId) Set the account to which this account will stakesetStakedNodeId(Long stakedNodeId) ID of the node this account is staked to.(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
-
AccountCreateTransaction
public AccountCreateTransaction()Constructor. -
AccountCreateTransaction
AccountCreateTransaction(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
-
AccountCreateTransaction
AccountCreateTransaction(TransactionBody txBody) Constructor.- Parameters:
txBody- protobuf TransactionBody
-
-
Method Details
-
getKey
Extract the key.- Returns:
- the creating account's key
-
setKey
Deprecated.The identifying key for this account. This key represents the account owner, and is required for most actions involving this account that do not modify the account itself. This key may also identify the account for smart contracts.This field is REQUIRED. This `Key` MUST NOT be an empty `KeyList` and MUST contain at least one "primitive" (i.e. cryptographic) key value.
- Parameters:
key- the key for this account.- Returns:
this
-
setKeyWithAlias
Sets ECDSA private key, derives and sets it's EVM address in the background. Essentially doessetKey(Key)+setAlias(EvmAddress)- Parameters:
key-- Returns:
- this
-
setKeyWithAlias
Sets the account key and a separate ECDSA key that the EVM address is derived from. A user must sign the transaction with both keys for this flow to be successful.- Parameters:
key-ecdsaKey-- Returns:
- this
-
setKeyWithoutAlias
Sets key where it is explicitly called out that the alias is not set- Parameters:
key-- Returns:
- this
-
getInitialBalance
Extract the amount in hbar.- Returns:
- the initial balance for the new account
-
setInitialBalance
An amount, in tinybar, to deposit to the newly created account.The deposited amount SHALL be debited to the "payer" account for this transaction.
- Parameters:
initialBalance- the initial balance.- Returns:
this
-
getReceiverSignatureRequired
public boolean getReceiverSignatureRequired()Is the receiver required to sign?- Returns:
- is the receiver required to sign
-
setReceiverSignatureRequired
A flag indicating the account holder must authorize all incoming token transfers.If this flag is set then any transaction that would result in adding hbar or other tokens to this account balance MUST be signed by the identifying key of this account (that is, the `key` field).
If this flag is set, then the account key (`key` field) MUST sign this create transaction, in addition to the transaction payer.- Parameters:
receiveSignatureRequired- true to require a signature when receiving hbars.- Returns:
this
-
getProxyAccountId
Deprecated.with no replacement Extract the proxy account id.- Returns:
- the proxy account id
-
setProxyAccountId
Deprecated.with no replacement Set the ID of the account to which this account is proxy staked. Use `staked_id` instead.
An account identifier for a staking proxy.- Parameters:
proxyAccountId- the proxy account ID.- Returns:
this
-
getAutoRenewPeriod
Extract the duration for the auto renew period.- Returns:
- the duration for auto-renew
-
setAutoRenewPeriod
Set the auto renew period for this account.A Hederaâ„¢ account is charged to extend its expiration date every renew period. If it doesn't have enough balance, it extends as long as possible. If the balance is zero when it expires, then the account is deleted.
This is defaulted to 3 months by the SDK.
- Parameters:
autoRenewPeriod- the auto renew period for this account.- Returns:
this
-
getMaxAutomaticTokenAssociations
public int getMaxAutomaticTokenAssociations()Extract the maximum automatic token associations.- Returns:
- the max automatic token associations
-
setMaxAutomaticTokenAssociations
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 (e.g. 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.
This value MUST NOT be less than `-1`.- Parameters:
amount- the amount of tokens- Returns:
this
-
getAccountMemo
Extract the account memo.- Returns:
- the account memo
-
setAccountMemo
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
-
getStakedAccountId
ID of the account to which this account will stake- Returns:
- ID of the account to which this account will stake.
-
setStakedAccountId
Set the account to which this account will stake- Parameters:
stakedAccountId- ID of the account to which this account will stake.- Returns:
this
-
getStakedNodeId
The node to which this account will stake- Returns:
- ID of the node this account will be staked to.
-
setStakedNodeId
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
-
getDeclineStakingReward
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
If true, the account declines receiving a staking reward. The default value is false.- Parameters:
declineStakingReward- - If true, the account declines receiving a staking reward. The default value is false.- Returns:
this
-
getAlias
The bytes to be used as the account's alias.The bytes must be formatted as the calcluated last 20 bytes of the keccak-256 of the ECDSA primitive key.
All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and delegatable_contract_id, are not supported.
At most only one account can ever have a given alias on the network.
-
setAlias
The bytes to be used as the account's alias.The bytes must be formatted as the calcluated last 20 bytes of the keccak-256 of the ECDSA primitive key.
All other types of keys, including but not limited to ED25519, ThresholdKey, KeyList, ContractID, and delegatable_contract_id, are not supported.
At most only one account can ever have a given alias on the network.
- Parameters:
alias- The ethereum account 20-byte EVM address- Returns:
this
-
setAlias
The ethereum account 20-byte EVM address to be used as the account's alias. This EVM address may be either the encoded form of the shard.realm.num or the keccak-256 hash of a ECDSA_SECP256K1 primitive key.A given alias can map to at most one account on the network at a time. This uniqueness will be enforced relative to aliases currently on the network at alias assignment.
If a transaction creates an account using an alias, any further crypto transfers to that alias will simply be deposited in that account, without creating anything, and with no creation fee being charged.
- Parameters:
aliasEvmAddress- The ethereum account 20-byte EVM address- Returns:
this- Throws:
IllegalArgumentException- when evmAddress is invalid
-
getHooks
Get the hook creation details for this account.- Returns:
- a copy of the hook creation details list
-
addHook
Add a hook creation detail to this account.- Parameters:
hookDetails- the hook creation details to add- Returns:
this
-
setHooks
Set the hook creation details for this account.- Parameters:
hookDetails- the list of hook creation details- Returns:
this
-
build
Build the transaction body.- Returns:
CryptoCreateTransactionBody
-
validateChecksums
- Specified by:
validateChecksumsin classTransaction<AccountCreateTransaction>- Throws:
BadEntityIdException
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
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<AccountCreateTransaction,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<AccountCreateTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<AccountCreateTransaction>
-