All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hedera.hapi.node.transaction.TransactionReceipt Maven / Gradle / Ivy

There is a newer version: 0.54.0
Show newest version
package com.hedera.hapi.node.transaction;

import com.hedera.hapi.node.base.*;
import com.hedera.hapi.node.transaction.*;
import com.hedera.pbj.runtime.*;
import com.hedera.pbj.runtime.io.*;
import com.hedera.pbj.runtime.io.buffer.*;
import com.hedera.pbj.runtime.io.stream.*;
import edu.umd.cs.findbugs.annotations.*;
import java.util.*;

import com.hedera.pbj.runtime.Codec;
import java.util.function.Consumer;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.NonNull;
import static java.util.Objects.requireNonNull;

/**
 * The summary of a transaction's result so far. If the transaction has not reached consensus, this
 * result will be necessarily incomplete.
 *
 * @param status (1) The consensus status of the transaction; is UNKNOWN if consensus has not been reached, or if
 *               the associated transaction did not have a valid payer signature
 * @param accountID (2) In the receipt of a CryptoCreate, the id of the newly created account
 * @param fileID (3) In the receipt of a FileCreate, the id of the newly created file
 * @param contractID (4) In the receipt of a ContractCreate, the id of the newly created contract
 * @param exchangeRate (5) The exchange rates in effect when the transaction reached consensus
 * @param topicID (6) In the receipt of a ConsensusCreateTopic, the id of the newly created topic.
 * @param topicSequenceNumber (7) In the receipt of a ConsensusSubmitMessage, the new sequence number of the topic that
 *                            received the message
 * @param topicRunningHash (8) In the receipt of a `ConsensusSubmitMessage`, the new running hash of the topic that
 *                         received the message.
* This 48-byte field is the output of a SHA-384 digest with input data determined by the * value of the `topicRunningHashVersion` field.
* All new transactions SHALL use `topicRunningHashVersion` `3`.
* The bytes of each uint64 or uint32 encoded for the hash input MUST be in Big-Endian format. *

*


* If the `topicRunningHashVersion` is '0' or '1', then the input data to the SHA-384 digest are, * in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The topic's shard (8 bytes)
  4. *
  5. The topic's realm (8 bytes)
  6. *
  7. The topic's number (8 bytes)
  8. *
  9. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  10. *
  11. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  12. *
  13. The `topicSequenceNumber` (8 bytes)
  14. *
  15. The message bytes from the `ConsensusSubmitMessage` (variable).
  16. *
*
* If the `topicRunningHashVersion` is '2', then the input data to the SHA-384 digest are, in * order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The topic's shard (8 bytes)
  6. *
  7. The topic's realm (8 bytes)
  8. *
  9. The topic's number (8 bytes)
  10. *
  11. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  12. *
  13. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  14. *
  15. The `topicSequenceNumber` (8 bytes)
  16. *
  17. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  18. *
*
* If the `topicRunningHashVersion` is '3', then the input data to the SHA-384 digest * are, in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The payer account's shard (8 bytes)
  6. *
  7. The payer account's realm (8 bytes)
  8. *
  9. The payer account's number (8 bytes)
  10. *
  11. The topic's shard (8 bytes)
  12. *
  13. The topic's realm (8 bytes)
  14. *
  15. The topic's number (8 bytes)
  16. *
  17. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  18. *
  19. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  20. *
  21. The `topicSequenceNumber` (8 bytes)
  22. *
  23. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  24. *
* @param topicRunningHashVersion (9) In the receipt of a ConsensusSubmitMessage, the version of the SHA-384 digest used to update * the running hash. * @param tokenID (10) In the receipt of a CreateToken, the id of the newly created token * @param newTotalSupply (11) In the receipt of TokenMint, TokenWipe, TokenBurn, For fungible tokens - the current total * supply of this token. For non fungible tokens - the total number of NFTs issued for a given * tokenID * @param scheduleID (12) In the receipt of a ScheduleCreate, the id of the newly created Scheduled Entity * @param scheduledTransactionID (13) In the receipt of a ScheduleCreate or ScheduleSign that resolves to SUCCESS, the * TransactionID that should be used to query for the receipt or record of the relevant * scheduled transaction * @param serialNumbers (14) In the receipt of a TokenMint for tokens of type NON_FUNGIBLE_UNIQUE, the serial numbers of * the newly created NFTs * @param nodeId (15) In the receipt of a NodeCreate, NodeUpdate, NodeDelete, the id of the newly created node. * An affected node identifier.
* This value SHALL be set following a `createNode` transaction.
* This value SHALL be set following a `updateNode` transaction.
* This value SHALL be set following a `deleteNode` transaction.
* This value SHALL NOT be set following any other transaction. */ public record TransactionReceipt( ResponseCodeEnum status, @Nullable AccountID accountID, @Nullable FileID fileID, @Nullable ContractID contractID, @Nullable ExchangeRateSet exchangeRate, @Nullable TopicID topicID, long topicSequenceNumber, @NonNull Bytes topicRunningHash, long topicRunningHashVersion, @Nullable TokenID tokenID, long newTotalSupply, @Nullable ScheduleID scheduleID, @Nullable TransactionID scheduledTransactionID, @NonNull List serialNumbers, long nodeId ) { /** Protobuf codec for reading and writing in protobuf format */ public static final Codec PROTOBUF = new com.hedera.hapi.node.transaction.codec.TransactionReceiptProtoCodec(); /** JSON codec for reading and writing in JSON format */ public static final JsonCodec JSON = new com.hedera.hapi.node.transaction.codec.TransactionReceiptJsonCodec(); /** Default instance with all fields set to default values */ public static final TransactionReceipt DEFAULT = newBuilder().build(); /** * Create a pre-populated TransactionReceipt. * * @param status (1) The consensus status of the transaction; is UNKNOWN if consensus has not been reached, or if * the associated transaction did not have a valid payer signature, * @param accountID (2) In the receipt of a CryptoCreate, the id of the newly created account, * @param fileID (3) In the receipt of a FileCreate, the id of the newly created file, * @param contractID (4) In the receipt of a ContractCreate, the id of the newly created contract, * @param exchangeRate (5) The exchange rates in effect when the transaction reached consensus, * @param topicID (6) In the receipt of a ConsensusCreateTopic, the id of the newly created topic., * @param topicSequenceNumber (7) In the receipt of a ConsensusSubmitMessage, the new sequence number of the topic that * received the message, * @param topicRunningHash (8) In the receipt of a `ConsensusSubmitMessage`, the new running hash of the topic that * received the message.
* This 48-byte field is the output of a SHA-384 digest with input data determined by the * value of the `topicRunningHashVersion` field.
* All new transactions SHALL use `topicRunningHashVersion` `3`.
* The bytes of each uint64 or uint32 encoded for the hash input MUST be in Big-Endian format. *

*


* If the `topicRunningHashVersion` is '0' or '1', then the input data to the SHA-384 digest are, * in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The topic's shard (8 bytes)
  4. *
  5. The topic's realm (8 bytes)
  6. *
  7. The topic's number (8 bytes)
  8. *
  9. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  10. *
  11. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  12. *
  13. The `topicSequenceNumber` (8 bytes)
  14. *
  15. The message bytes from the `ConsensusSubmitMessage` (variable).
  16. *
*
* If the `topicRunningHashVersion` is '2', then the input data to the SHA-384 digest are, in * order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The topic's shard (8 bytes)
  6. *
  7. The topic's realm (8 bytes)
  8. *
  9. The topic's number (8 bytes)
  10. *
  11. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  12. *
  13. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  14. *
  15. The `topicSequenceNumber` (8 bytes)
  16. *
  17. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  18. *
*
* If the `topicRunningHashVersion` is '3', then the input data to the SHA-384 digest * are, in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The payer account's shard (8 bytes)
  6. *
  7. The payer account's realm (8 bytes)
  8. *
  9. The payer account's number (8 bytes)
  10. *
  11. The topic's shard (8 bytes)
  12. *
  13. The topic's realm (8 bytes)
  14. *
  15. The topic's number (8 bytes)
  16. *
  17. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  18. *
  19. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  20. *
  21. The `topicSequenceNumber` (8 bytes)
  22. *
  23. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  24. *
, * @param topicRunningHashVersion (9) In the receipt of a ConsensusSubmitMessage, the version of the SHA-384 digest used to update * the running hash., * @param tokenID (10) In the receipt of a CreateToken, the id of the newly created token, * @param newTotalSupply (11) In the receipt of TokenMint, TokenWipe, TokenBurn, For fungible tokens - the current total * supply of this token. For non fungible tokens - the total number of NFTs issued for a given * tokenID, * @param scheduleID (12) In the receipt of a ScheduleCreate, the id of the newly created Scheduled Entity, * @param scheduledTransactionID (13) In the receipt of a ScheduleCreate or ScheduleSign that resolves to SUCCESS, the * TransactionID that should be used to query for the receipt or record of the relevant * scheduled transaction, * @param serialNumbers (14) In the receipt of a TokenMint for tokens of type NON_FUNGIBLE_UNIQUE, the serial numbers of * the newly created NFTs, * @param nodeId (15) In the receipt of a NodeCreate, NodeUpdate, NodeDelete, the id of the newly created node. * An affected node identifier.
* This value SHALL be set following a `createNode` transaction.
* This value SHALL be set following a `updateNode` transaction.
* This value SHALL be set following a `deleteNode` transaction.
* This value SHALL NOT be set following any other transaction. */ public TransactionReceipt(ResponseCodeEnum status, AccountID accountID, FileID fileID, ContractID contractID, ExchangeRateSet exchangeRate, TopicID topicID, long topicSequenceNumber, Bytes topicRunningHash, long topicRunningHashVersion, TokenID tokenID, long newTotalSupply, ScheduleID scheduleID, TransactionID scheduledTransactionID, List serialNumbers, long nodeId) { this.status = status; this.accountID = accountID; this.fileID = fileID; this.contractID = contractID; this.exchangeRate = exchangeRate; this.topicID = topicID; this.topicSequenceNumber = topicSequenceNumber; this.topicRunningHash = topicRunningHash != null ? topicRunningHash : Bytes.EMPTY; this.topicRunningHashVersion = topicRunningHashVersion; this.tokenID = tokenID; this.newTotalSupply = newTotalSupply; this.scheduleID = scheduleID; this.scheduledTransactionID = scheduledTransactionID; this.serialNumbers = serialNumbers == null ? Collections.emptyList() : serialNumbers; this.nodeId = nodeId; } /** * Override the default hashCode method for * all other objects to make hashCode */ @Override public int hashCode() { int result = 1; if (status != null && !status.equals(DEFAULT.status)) { result = 31 * result + Integer.hashCode(status.protoOrdinal()); } if (accountID != null && !accountID.equals(DEFAULT.accountID)) { result = 31 * result + accountID.hashCode(); } if (fileID != null && !fileID.equals(DEFAULT.fileID)) { result = 31 * result + fileID.hashCode(); } if (contractID != null && !contractID.equals(DEFAULT.contractID)) { result = 31 * result + contractID.hashCode(); } if (exchangeRate != null && !exchangeRate.equals(DEFAULT.exchangeRate)) { result = 31 * result + exchangeRate.hashCode(); } if (topicID != null && !topicID.equals(DEFAULT.topicID)) { result = 31 * result + topicID.hashCode(); } if (topicSequenceNumber != DEFAULT.topicSequenceNumber) { result = 31 * result + Long.hashCode(topicSequenceNumber); } if (topicRunningHash != null && !topicRunningHash.equals(DEFAULT.topicRunningHash)) { result = 31 * result + topicRunningHash.hashCode(); } if (topicRunningHashVersion != DEFAULT.topicRunningHashVersion) { result = 31 * result + Long.hashCode(topicRunningHashVersion); } if (tokenID != null && !tokenID.equals(DEFAULT.tokenID)) { result = 31 * result + tokenID.hashCode(); } if (newTotalSupply != DEFAULT.newTotalSupply) { result = 31 * result + Long.hashCode(newTotalSupply); } if (scheduleID != null && !scheduleID.equals(DEFAULT.scheduleID)) { result = 31 * result + scheduleID.hashCode(); } if (scheduledTransactionID != null && !scheduledTransactionID.equals(DEFAULT.scheduledTransactionID)) { result = 31 * result + scheduledTransactionID.hashCode(); } java.util.List list$serialNumbers = serialNumbers; if (list$serialNumbers != null) { for (Object o : list$serialNumbers) { if (o != null) { result = 31 * result + o.hashCode(); } else { result = 31 * result; } } } if (nodeId != DEFAULT.nodeId) { result = 31 * result + Long.hashCode(nodeId); } long hashCode = result; // Shifts: 30, 27, 16, 20, 5, 18, 10, 24, 30 hashCode += hashCode << 30; hashCode ^= hashCode >>> 27; hashCode += hashCode << 16; hashCode ^= hashCode >>> 20; hashCode += hashCode << 5; hashCode ^= hashCode >>> 18; hashCode += hashCode << 10; hashCode ^= hashCode >>> 24; hashCode += hashCode << 30; return (int)hashCode; } /** * Override the default equals method for */ @Override public boolean equals(Object that) { if (that == null || this.getClass() != that.getClass()) { return false; } TransactionReceipt thatObj = (TransactionReceipt)that; if (status == null && thatObj.status != null) { return false; } if (status != null && !status.equals(thatObj.status)) { return false; } if (accountID == null && thatObj.accountID != null) { return false; } if (accountID != null && !accountID.equals(thatObj.accountID)) { return false; } if (fileID == null && thatObj.fileID != null) { return false; } if (fileID != null && !fileID.equals(thatObj.fileID)) { return false; } if (contractID == null && thatObj.contractID != null) { return false; } if (contractID != null && !contractID.equals(thatObj.contractID)) { return false; } if (exchangeRate == null && thatObj.exchangeRate != null) { return false; } if (exchangeRate != null && !exchangeRate.equals(thatObj.exchangeRate)) { return false; } if (topicID == null && thatObj.topicID != null) { return false; } if (topicID != null && !topicID.equals(thatObj.topicID)) { return false; } if (topicSequenceNumber != thatObj.topicSequenceNumber) { return false; } if (topicRunningHash == null && thatObj.topicRunningHash != null) { return false; } if (topicRunningHash != null && !topicRunningHash.equals(thatObj.topicRunningHash)) { return false; } if (topicRunningHashVersion != thatObj.topicRunningHashVersion) { return false; } if (tokenID == null && thatObj.tokenID != null) { return false; } if (tokenID != null && !tokenID.equals(thatObj.tokenID)) { return false; } if (newTotalSupply != thatObj.newTotalSupply) { return false; } if (scheduleID == null && thatObj.scheduleID != null) { return false; } if (scheduleID != null && !scheduleID.equals(thatObj.scheduleID)) { return false; } if (scheduledTransactionID == null && thatObj.scheduledTransactionID != null) { return false; } if (scheduledTransactionID != null && !scheduledTransactionID.equals(thatObj.scheduledTransactionID)) { return false; } if (this.serialNumbers == null && thatObj.serialNumbers != null) { return false; } if (this.serialNumbers != null && !serialNumbers.equals(thatObj.serialNumbers)) { return false; } if (nodeId != thatObj.nodeId) { return false; } return true; } /** * Convenience method to check if the accountID has a value * * @return true of the accountID has a value */ public boolean hasAccountID() { return accountID != null; } /** * Gets the value for accountID if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if accountID is null * @return the value for accountID if it has a value, or else returns the default value */ public AccountID accountIDOrElse(@NonNull final AccountID defaultValue) { return hasAccountID() ? accountID : defaultValue; } /** * Gets the value for accountID if it has a value, or else throws an NPE. * value for the type. * * @return the value for accountID if it has a value * @throws NullPointerException if accountID is null */ public @NonNull AccountID accountIDOrThrow() { return requireNonNull(accountID, "Field accountID is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the accountID has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifAccountID(@NonNull final Consumer ifPresent) { if (hasAccountID()) { ifPresent.accept(accountID); } } /** * Convenience method to check if the fileID has a value * * @return true of the fileID has a value */ public boolean hasFileID() { return fileID != null; } /** * Gets the value for fileID if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if fileID is null * @return the value for fileID if it has a value, or else returns the default value */ public FileID fileIDOrElse(@NonNull final FileID defaultValue) { return hasFileID() ? fileID : defaultValue; } /** * Gets the value for fileID if it has a value, or else throws an NPE. * value for the type. * * @return the value for fileID if it has a value * @throws NullPointerException if fileID is null */ public @NonNull FileID fileIDOrThrow() { return requireNonNull(fileID, "Field fileID is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the fileID has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifFileID(@NonNull final Consumer ifPresent) { if (hasFileID()) { ifPresent.accept(fileID); } } /** * Convenience method to check if the contractID has a value * * @return true of the contractID has a value */ public boolean hasContractID() { return contractID != null; } /** * Gets the value for contractID if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if contractID is null * @return the value for contractID if it has a value, or else returns the default value */ public ContractID contractIDOrElse(@NonNull final ContractID defaultValue) { return hasContractID() ? contractID : defaultValue; } /** * Gets the value for contractID if it has a value, or else throws an NPE. * value for the type. * * @return the value for contractID if it has a value * @throws NullPointerException if contractID is null */ public @NonNull ContractID contractIDOrThrow() { return requireNonNull(contractID, "Field contractID is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the contractID has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifContractID(@NonNull final Consumer ifPresent) { if (hasContractID()) { ifPresent.accept(contractID); } } /** * Convenience method to check if the exchangeRate has a value * * @return true of the exchangeRate has a value */ public boolean hasExchangeRate() { return exchangeRate != null; } /** * Gets the value for exchangeRate if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if exchangeRate is null * @return the value for exchangeRate if it has a value, or else returns the default value */ public ExchangeRateSet exchangeRateOrElse(@NonNull final ExchangeRateSet defaultValue) { return hasExchangeRate() ? exchangeRate : defaultValue; } /** * Gets the value for exchangeRate if it has a value, or else throws an NPE. * value for the type. * * @return the value for exchangeRate if it has a value * @throws NullPointerException if exchangeRate is null */ public @NonNull ExchangeRateSet exchangeRateOrThrow() { return requireNonNull(exchangeRate, "Field exchangeRate is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the exchangeRate has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifExchangeRate(@NonNull final Consumer ifPresent) { if (hasExchangeRate()) { ifPresent.accept(exchangeRate); } } /** * Convenience method to check if the topicID has a value * * @return true of the topicID has a value */ public boolean hasTopicID() { return topicID != null; } /** * Gets the value for topicID if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if topicID is null * @return the value for topicID if it has a value, or else returns the default value */ public TopicID topicIDOrElse(@NonNull final TopicID defaultValue) { return hasTopicID() ? topicID : defaultValue; } /** * Gets the value for topicID if it has a value, or else throws an NPE. * value for the type. * * @return the value for topicID if it has a value * @throws NullPointerException if topicID is null */ public @NonNull TopicID topicIDOrThrow() { return requireNonNull(topicID, "Field topicID is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the topicID has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifTopicID(@NonNull final Consumer ifPresent) { if (hasTopicID()) { ifPresent.accept(topicID); } } /** * Convenience method to check if the tokenID has a value * * @return true of the tokenID has a value */ public boolean hasTokenID() { return tokenID != null; } /** * Gets the value for tokenID if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if tokenID is null * @return the value for tokenID if it has a value, or else returns the default value */ public TokenID tokenIDOrElse(@NonNull final TokenID defaultValue) { return hasTokenID() ? tokenID : defaultValue; } /** * Gets the value for tokenID if it has a value, or else throws an NPE. * value for the type. * * @return the value for tokenID if it has a value * @throws NullPointerException if tokenID is null */ public @NonNull TokenID tokenIDOrThrow() { return requireNonNull(tokenID, "Field tokenID is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the tokenID has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifTokenID(@NonNull final Consumer ifPresent) { if (hasTokenID()) { ifPresent.accept(tokenID); } } /** * Convenience method to check if the scheduleID has a value * * @return true of the scheduleID has a value */ public boolean hasScheduleID() { return scheduleID != null; } /** * Gets the value for scheduleID if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if scheduleID is null * @return the value for scheduleID if it has a value, or else returns the default value */ public ScheduleID scheduleIDOrElse(@NonNull final ScheduleID defaultValue) { return hasScheduleID() ? scheduleID : defaultValue; } /** * Gets the value for scheduleID if it has a value, or else throws an NPE. * value for the type. * * @return the value for scheduleID if it has a value * @throws NullPointerException if scheduleID is null */ public @NonNull ScheduleID scheduleIDOrThrow() { return requireNonNull(scheduleID, "Field scheduleID is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the scheduleID has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifScheduleID(@NonNull final Consumer ifPresent) { if (hasScheduleID()) { ifPresent.accept(scheduleID); } } /** * Convenience method to check if the scheduledTransactionID has a value * * @return true of the scheduledTransactionID has a value */ public boolean hasScheduledTransactionID() { return scheduledTransactionID != null; } /** * Gets the value for scheduledTransactionID if it has a value, or else returns the default * value for the type. * * @param defaultValue the default value to return if scheduledTransactionID is null * @return the value for scheduledTransactionID if it has a value, or else returns the default value */ public TransactionID scheduledTransactionIDOrElse(@NonNull final TransactionID defaultValue) { return hasScheduledTransactionID() ? scheduledTransactionID : defaultValue; } /** * Gets the value for scheduledTransactionID if it has a value, or else throws an NPE. * value for the type. * * @return the value for scheduledTransactionID if it has a value * @throws NullPointerException if scheduledTransactionID is null */ public @NonNull TransactionID scheduledTransactionIDOrThrow() { return requireNonNull(scheduledTransactionID, "Field scheduledTransactionID is null"); } /** * Executes the supplied {@link Consumer} if, and only if, the scheduledTransactionID has a value * * @param ifPresent the {@link Consumer} to execute */ public void ifScheduledTransactionID(@NonNull final Consumer ifPresent) { if (hasScheduledTransactionID()) { ifPresent.accept(scheduledTransactionID); } } /** * Return a builder for building a copy of this model object. It will be pre-populated with all the data from this * model object. * * @return a pre-populated builder */ public Builder copyBuilder() { return new Builder(status, accountID, fileID, contractID, exchangeRate, topicID, topicSequenceNumber, topicRunningHash, topicRunningHashVersion, tokenID, newTotalSupply, scheduleID, scheduledTransactionID, serialNumbers, nodeId); } /** * Return a new builder for building a model object. This is just a shortcut for new Model.Builder(). * * @return a new builder */ public static Builder newBuilder() { return new Builder(); } /** * Builder class for easy creation, ideal for clean code where performance is not critical. In critical performance * paths use the constructor directly. */ public static final class Builder { private ResponseCodeEnum status = ResponseCodeEnum.fromProtobufOrdinal(0); @Nullable private AccountID accountID = null; @Nullable private FileID fileID = null; @Nullable private ContractID contractID = null; @Nullable private ExchangeRateSet exchangeRate = null; @Nullable private TopicID topicID = null; private long topicSequenceNumber = 0; @NonNull private Bytes topicRunningHash = Bytes.EMPTY; private long topicRunningHashVersion = 0; @Nullable private TokenID tokenID = null; private long newTotalSupply = 0; @Nullable private ScheduleID scheduleID = null; @Nullable private TransactionID scheduledTransactionID = null; @NonNull private List serialNumbers = Collections.emptyList(); private long nodeId = 0; /** * Create an empty builder */ public Builder() {} /** * Create a pre-populated Builder. * * @param status (1) The consensus status of the transaction; is UNKNOWN if consensus has not been reached, or if * the associated transaction did not have a valid payer signature, * @param accountID (2) In the receipt of a CryptoCreate, the id of the newly created account, * @param fileID (3) In the receipt of a FileCreate, the id of the newly created file, * @param contractID (4) In the receipt of a ContractCreate, the id of the newly created contract, * @param exchangeRate (5) The exchange rates in effect when the transaction reached consensus, * @param topicID (6) In the receipt of a ConsensusCreateTopic, the id of the newly created topic., * @param topicSequenceNumber (7) In the receipt of a ConsensusSubmitMessage, the new sequence number of the topic that * received the message, * @param topicRunningHash (8) In the receipt of a `ConsensusSubmitMessage`, the new running hash of the topic that * received the message.
* This 48-byte field is the output of a SHA-384 digest with input data determined by the * value of the `topicRunningHashVersion` field.
* All new transactions SHALL use `topicRunningHashVersion` `3`.
* The bytes of each uint64 or uint32 encoded for the hash input MUST be in Big-Endian format. *

*


* If the `topicRunningHashVersion` is '0' or '1', then the input data to the SHA-384 digest are, * in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The topic's shard (8 bytes)
  4. *
  5. The topic's realm (8 bytes)
  6. *
  7. The topic's number (8 bytes)
  8. *
  9. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  10. *
  11. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  12. *
  13. The `topicSequenceNumber` (8 bytes)
  14. *
  15. The message bytes from the `ConsensusSubmitMessage` (variable).
  16. *
*
* If the `topicRunningHashVersion` is '2', then the input data to the SHA-384 digest are, in * order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The topic's shard (8 bytes)
  6. *
  7. The topic's realm (8 bytes)
  8. *
  9. The topic's number (8 bytes)
  10. *
  11. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  12. *
  13. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  14. *
  15. The `topicSequenceNumber` (8 bytes)
  16. *
  17. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  18. *
*
* If the `topicRunningHashVersion` is '3', then the input data to the SHA-384 digest * are, in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The payer account's shard (8 bytes)
  6. *
  7. The payer account's realm (8 bytes)
  8. *
  9. The payer account's number (8 bytes)
  10. *
  11. The topic's shard (8 bytes)
  12. *
  13. The topic's realm (8 bytes)
  14. *
  15. The topic's number (8 bytes)
  16. *
  17. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  18. *
  19. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  20. *
  21. The `topicSequenceNumber` (8 bytes)
  22. *
  23. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  24. *
, * @param topicRunningHashVersion (9) In the receipt of a ConsensusSubmitMessage, the version of the SHA-384 digest used to update * the running hash., * @param tokenID (10) In the receipt of a CreateToken, the id of the newly created token, * @param newTotalSupply (11) In the receipt of TokenMint, TokenWipe, TokenBurn, For fungible tokens - the current total * supply of this token. For non fungible tokens - the total number of NFTs issued for a given * tokenID, * @param scheduleID (12) In the receipt of a ScheduleCreate, the id of the newly created Scheduled Entity, * @param scheduledTransactionID (13) In the receipt of a ScheduleCreate or ScheduleSign that resolves to SUCCESS, the * TransactionID that should be used to query for the receipt or record of the relevant * scheduled transaction, * @param serialNumbers (14) In the receipt of a TokenMint for tokens of type NON_FUNGIBLE_UNIQUE, the serial numbers of * the newly created NFTs, * @param nodeId (15) In the receipt of a NodeCreate, NodeUpdate, NodeDelete, the id of the newly created node. * An affected node identifier.
* This value SHALL be set following a `createNode` transaction.
* This value SHALL be set following a `updateNode` transaction.
* This value SHALL be set following a `deleteNode` transaction.
* This value SHALL NOT be set following any other transaction. */ public Builder(ResponseCodeEnum status, AccountID accountID, FileID fileID, ContractID contractID, ExchangeRateSet exchangeRate, TopicID topicID, long topicSequenceNumber, Bytes topicRunningHash, long topicRunningHashVersion, TokenID tokenID, long newTotalSupply, ScheduleID scheduleID, TransactionID scheduledTransactionID, List serialNumbers, long nodeId) { this.status = status; this.accountID = accountID; this.fileID = fileID; this.contractID = contractID; this.exchangeRate = exchangeRate; this.topicID = topicID; this.topicSequenceNumber = topicSequenceNumber; this.topicRunningHash = topicRunningHash != null ? topicRunningHash : Bytes.EMPTY; this.topicRunningHashVersion = topicRunningHashVersion; this.tokenID = tokenID; this.newTotalSupply = newTotalSupply; this.scheduleID = scheduleID; this.scheduledTransactionID = scheduledTransactionID; this.serialNumbers = serialNumbers == null ? Collections.emptyList() : serialNumbers; this.nodeId = nodeId; } /** * Build a new model record with data set on builder * * @return new model record with data set */ public TransactionReceipt build() { return new TransactionReceipt(status, accountID, fileID, contractID, exchangeRate, topicID, topicSequenceNumber, topicRunningHash, topicRunningHashVersion, tokenID, newTotalSupply, scheduleID, scheduledTransactionID, serialNumbers, nodeId); } /** * (1) The consensus status of the transaction; is UNKNOWN if consensus has not been reached, or if * the associated transaction did not have a valid payer signature * * @param status value to set * @return builder to continue building with */ public Builder status(ResponseCodeEnum status) { this.status = status; return this; } /** * (2) In the receipt of a CryptoCreate, the id of the newly created account * * @param accountID value to set * @return builder to continue building with */ public Builder accountID(@Nullable AccountID accountID) { this.accountID = accountID; return this; } /** * (2) In the receipt of a CryptoCreate, the id of the newly created account * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder accountID(AccountID.Builder builder) { this.accountID = builder.build() ; return this; } /** * (3) In the receipt of a FileCreate, the id of the newly created file * * @param fileID value to set * @return builder to continue building with */ public Builder fileID(@Nullable FileID fileID) { this.fileID = fileID; return this; } /** * (3) In the receipt of a FileCreate, the id of the newly created file * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder fileID(FileID.Builder builder) { this.fileID = builder.build() ; return this; } /** * (4) In the receipt of a ContractCreate, the id of the newly created contract * * @param contractID value to set * @return builder to continue building with */ public Builder contractID(@Nullable ContractID contractID) { this.contractID = contractID; return this; } /** * (4) In the receipt of a ContractCreate, the id of the newly created contract * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder contractID(ContractID.Builder builder) { this.contractID = builder.build() ; return this; } /** * (5) The exchange rates in effect when the transaction reached consensus * * @param exchangeRate value to set * @return builder to continue building with */ public Builder exchangeRate(@Nullable ExchangeRateSet exchangeRate) { this.exchangeRate = exchangeRate; return this; } /** * (5) The exchange rates in effect when the transaction reached consensus * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder exchangeRate(ExchangeRateSet.Builder builder) { this.exchangeRate = builder.build() ; return this; } /** * (6) In the receipt of a ConsensusCreateTopic, the id of the newly created topic. * * @param topicID value to set * @return builder to continue building with */ public Builder topicID(@Nullable TopicID topicID) { this.topicID = topicID; return this; } /** * (6) In the receipt of a ConsensusCreateTopic, the id of the newly created topic. * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder topicID(TopicID.Builder builder) { this.topicID = builder.build() ; return this; } /** * (7) In the receipt of a ConsensusSubmitMessage, the new sequence number of the topic that * received the message * * @param topicSequenceNumber value to set * @return builder to continue building with */ public Builder topicSequenceNumber(long topicSequenceNumber) { this.topicSequenceNumber = topicSequenceNumber; return this; } /** * (8) In the receipt of a `ConsensusSubmitMessage`, the new running hash of the topic that * received the message.
* This 48-byte field is the output of a SHA-384 digest with input data determined by the * value of the `topicRunningHashVersion` field.
* All new transactions SHALL use `topicRunningHashVersion` `3`.
* The bytes of each uint64 or uint32 encoded for the hash input MUST be in Big-Endian format. *

*


* If the `topicRunningHashVersion` is '0' or '1', then the input data to the SHA-384 digest are, * in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The topic's shard (8 bytes)
  4. *
  5. The topic's realm (8 bytes)
  6. *
  7. The topic's number (8 bytes)
  8. *
  9. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  10. *
  11. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  12. *
  13. The `topicSequenceNumber` (8 bytes)
  14. *
  15. The message bytes from the `ConsensusSubmitMessage` (variable).
  16. *
*
* If the `topicRunningHashVersion` is '2', then the input data to the SHA-384 digest are, in * order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The topic's shard (8 bytes)
  6. *
  7. The topic's realm (8 bytes)
  8. *
  9. The topic's number (8 bytes)
  10. *
  11. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  12. *
  13. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  14. *
  15. The `topicSequenceNumber` (8 bytes)
  16. *
  17. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  18. *
*
* If the `topicRunningHashVersion` is '3', then the input data to the SHA-384 digest * are, in order: *
    *
  1. The previous running hash of the topic (48 bytes)
  2. *
  3. The `topicRunningHashVersion` (8 bytes)
  4. *
  5. The payer account's shard (8 bytes)
  6. *
  7. The payer account's realm (8 bytes)
  8. *
  9. The payer account's number (8 bytes)
  10. *
  11. The topic's shard (8 bytes)
  12. *
  13. The topic's realm (8 bytes)
  14. *
  15. The topic's number (8 bytes)
  16. *
  17. The number of seconds since the epoch when the `ConsensusSubmitMessage` reached * consensus (8 bytes)
  18. *
  19. The number of nanoseconds within the second when the `ConsensusSubmitMessage` reached * consensus (4 bytes)
  20. *
  21. The `topicSequenceNumber` (8 bytes)
  22. *
  23. The output of a SHA-384 digest of the message bytes from the `ConsensusSubmitMessage` * (48 bytes)
  24. *
* * @param topicRunningHash value to set * @return builder to continue building with */ public Builder topicRunningHash(@NonNull Bytes topicRunningHash) { this.topicRunningHash = topicRunningHash != null ? topicRunningHash : Bytes.EMPTY; return this; } /** * (9) In the receipt of a ConsensusSubmitMessage, the version of the SHA-384 digest used to update * the running hash. * * @param topicRunningHashVersion value to set * @return builder to continue building with */ public Builder topicRunningHashVersion(long topicRunningHashVersion) { this.topicRunningHashVersion = topicRunningHashVersion; return this; } /** * (10) In the receipt of a CreateToken, the id of the newly created token * * @param tokenID value to set * @return builder to continue building with */ public Builder tokenID(@Nullable TokenID tokenID) { this.tokenID = tokenID; return this; } /** * (10) In the receipt of a CreateToken, the id of the newly created token * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder tokenID(TokenID.Builder builder) { this.tokenID = builder.build() ; return this; } /** * (11) In the receipt of TokenMint, TokenWipe, TokenBurn, For fungible tokens - the current total * supply of this token. For non fungible tokens - the total number of NFTs issued for a given * tokenID * * @param newTotalSupply value to set * @return builder to continue building with */ public Builder newTotalSupply(long newTotalSupply) { this.newTotalSupply = newTotalSupply; return this; } /** * (12) In the receipt of a ScheduleCreate, the id of the newly created Scheduled Entity * * @param scheduleID value to set * @return builder to continue building with */ public Builder scheduleID(@Nullable ScheduleID scheduleID) { this.scheduleID = scheduleID; return this; } /** * (12) In the receipt of a ScheduleCreate, the id of the newly created Scheduled Entity * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder scheduleID(ScheduleID.Builder builder) { this.scheduleID = builder.build() ; return this; } /** * (13) In the receipt of a ScheduleCreate or ScheduleSign that resolves to SUCCESS, the * TransactionID that should be used to query for the receipt or record of the relevant * scheduled transaction * * @param scheduledTransactionID value to set * @return builder to continue building with */ public Builder scheduledTransactionID(@Nullable TransactionID scheduledTransactionID) { this.scheduledTransactionID = scheduledTransactionID; return this; } /** * (13) In the receipt of a ScheduleCreate or ScheduleSign that resolves to SUCCESS, the * TransactionID that should be used to query for the receipt or record of the relevant * scheduled transaction * * @param builder A pre-populated builder * @return builder to continue building with */ public Builder scheduledTransactionID(TransactionID.Builder builder) { this.scheduledTransactionID = builder.build() ; return this; } /** * (14) In the receipt of a TokenMint for tokens of type NON_FUNGIBLE_UNIQUE, the serial numbers of * the newly created NFTs * * @param serialNumbers value to set * @return builder to continue building with */ public Builder serialNumbers(@NonNull List serialNumbers) { this.serialNumbers = serialNumbers != null ? serialNumbers : Collections.emptyList(); return this; } /** * (14) In the receipt of a TokenMint for tokens of type NON_FUNGIBLE_UNIQUE, the serial numbers of * the newly created NFTs * * @param values varargs value to be built into a list * @return builder to continue building with */ public Builder serialNumbers(Long ... values) { this.serialNumbers = values == null ? Collections.emptyList() : List.of(values) ; return this; } /** * (15) In the receipt of a NodeCreate, NodeUpdate, NodeDelete, the id of the newly created node. * An affected node identifier.
* This value SHALL be set following a `createNode` transaction.
* This value SHALL be set following a `updateNode` transaction.
* This value SHALL be set following a `deleteNode` transaction.
* This value SHALL NOT be set following any other transaction. * * @param nodeId value to set * @return builder to continue building with */ public Builder nodeId(long nodeId) { this.nodeId = nodeId; return this; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy