java.lang.Object
com.hedera.hashgraph.sdk.TransactionResponse
When the client sends the node a transaction of any kind, the node replies with this, which simply says that the
transaction passed the pre-check (so the node will submit it to the network) or it failed (so it won't). To learn the
consensus result, the client should later obtain a receipt (free), or can buy a more detailed record (not free).
See Hedera Documentation
See Hedera Documentation
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe node IDfinal @Nullable TransactionIdDeprecated.byte[]The transaction hashThe transaction ID -
Constructor Summary
ConstructorsConstructorDescriptionTransactionResponse(AccountId nodeId, TransactionId transactionId, byte[] transactionHash, @Nullable TransactionId scheduledTransactionId, @Nullable Transaction transaction) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionExtract the node ID the transaction was submitted to.getReceipt(Client client) Fetch the receipt of the transaction.getReceipt(Client client, Duration timeout) Fetch the receipt of the transaction.getReceiptAsync(Client client) Fetch the receipt of the transaction asynchronously.getReceiptAsync(Client client, Duration timeout) Fetch the receipt of the transaction asynchronously.voidgetReceiptAsync(Client client, Duration timeout, BiConsumer<TransactionReceipt, Throwable> callback) Fetch the receipt of the transaction asynchronously.voidgetReceiptAsync(Client client, Duration timeout, Consumer<TransactionReceipt> onSuccess, Consumer<Throwable> onFailure) Fetch the receipt of the transaction asynchronously.voidgetReceiptAsync(Client client, BiConsumer<TransactionReceipt, Throwable> callback) Fetch the receipt of the transaction asynchronously.voidgetReceiptAsync(Client client, Consumer<TransactionReceipt> onSuccess, Consumer<Throwable> onFailure) Fetch the receipt of the transaction asynchronously.Create receipt query from thetransactionIdandtransactionHashgetReceiptQuery(Client client) Create receipt query from thetransactionIdandtransactionHashFetch the record of the transaction.Fetch the record of the transaction.getRecordAsync(Client client) Fetch the record of the transaction asynchronously.getRecordAsync(Client client, Duration timeout) Fetch the record of the transaction asynchronously.voidgetRecordAsync(Client client, Duration timeout, BiConsumer<TransactionRecord, Throwable> callback) Fetch the record of the transaction asynchronously.voidgetRecordAsync(Client client, Duration timeout, Consumer<TransactionRecord> onSuccess, Consumer<Throwable> onFailure) Fetch the record of the transaction asynchronously.voidgetRecordAsync(Client client, BiConsumer<TransactionRecord, Throwable> callback) Fetch the record of the transaction asynchronously.voidgetRecordAsync(Client client, Consumer<TransactionRecord> onSuccess, Consumer<Throwable> onFailure) Fetch the record of the transaction asynchronously.Create record query from thetransactionIdandtransactionHashgetRecordQuery(Client client) Create record query from thetransactionIdandtransactionHashbyte[]Extract the hash of the transaction that was submitted.Extract the ID of the transaction that was submitted.booleansetValidateStatus(boolean validateStatus) toJson()Serialize this response to a JSON string, matching the JS SDK'sJSON.stringify(response.toJSON())so all SDKs produce identical JSON.(package private) com.google.gson.JsonObjectBuild a JSON representation of this responsetoString()
-
Field Details
-
nodeId
The node ID -
transactionHash
public byte[] transactionHashThe transaction hash -
transactionId
The transaction ID -
scheduledTransactionId
Deprecated.The scheduled transaction ID
-
-
Constructor Details
-
TransactionResponse
TransactionResponse(AccountId nodeId, TransactionId transactionId, byte[] transactionHash, @Nullable TransactionId scheduledTransactionId, @Nullable Transaction transaction) Constructor.- Parameters:
nodeId- the node idtransactionId- the transaction idtransactionHash- the transaction hashscheduledTransactionId- the scheduled transaction id
-
-
Method Details
-
getValidateStatus
public boolean getValidateStatus()- Returns:
- whether getReceipt() or getRecord() will throw an exception if the receipt status is not SUCCESS
-
setValidateStatus
- Parameters:
validateStatus- whether getReceipt() or getRecord() will throw an exception if the receipt status is not SUCCESS- Returns:
this
-
getNodeId
Extract the node ID the transaction was submitted to.- Returns:
- the node ID
-
getTransactionHash
public byte[] getTransactionHash()Extract the hash of the transaction that was submitted.- Returns:
- the transaction hash
-
getTransactionId
Extract the ID of the transaction that was submitted.- Returns:
- the transaction ID
-
getReceipt
public TransactionReceipt getReceipt(Client client) throws TimeoutException, PrecheckStatusException, ReceiptStatusException Fetch the receipt of the transaction.- Parameters:
client- The client with which this will be executed.- Returns:
- the transaction receipt
- Throws:
TimeoutException- when the transaction times outPrecheckStatusException- when the precheck failsReceiptStatusException- when there is an issue with the receipt
-
getReceipt
public TransactionReceipt getReceipt(Client client, Duration timeout) throws TimeoutException, PrecheckStatusException, ReceiptStatusException Fetch the receipt of the transaction.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.- Returns:
- the transaction receipt
- Throws:
TimeoutException- when the transaction times outPrecheckStatusException- when the precheck failsReceiptStatusException- when there is an issue with the receipt
-
getReceiptQuery
Create receipt query from thetransactionIdandtransactionHash- Returns:
TransactionReceiptQuery
-
getReceiptQuery
Create receipt query from thetransactionIdandtransactionHash- Returns:
TransactionReceiptQuery
-
getReceiptAsync
Fetch the receipt of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.- Returns:
- future result of the transaction receipt
-
getReceiptAsync
Fetch the receipt of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.- Returns:
- the transaction receipt
-
getReceiptAsync
Fetch the receipt of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.callback- a BiConsumer which handles the result or error.
-
getReceiptAsync
public void getReceiptAsync(Client client, Duration timeout, BiConsumer<TransactionReceipt, Throwable> callback) Fetch the receipt of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.callback- a BiConsumer which handles the result or error.
-
getReceiptAsync
public void getReceiptAsync(Client client, Consumer<TransactionReceipt> onSuccess, Consumer<Throwable> onFailure) Fetch the receipt of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.onSuccess- a Consumer which consumes the result on success.onFailure- a Consumer which consumes the error on failure.
-
getReceiptAsync
public void getReceiptAsync(Client client, Duration timeout, Consumer<TransactionReceipt> onSuccess, Consumer<Throwable> onFailure) Fetch the receipt of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.onSuccess- a Consumer which consumes the result on success.onFailure- a Consumer which consumes the error on failure.
-
getRecord
public TransactionRecord getRecord(Client client) throws TimeoutException, PrecheckStatusException, ReceiptStatusException Fetch the record of the transaction.- Parameters:
client- The client with which this will be executed.- Returns:
- the transaction record
- Throws:
TimeoutException- when the transaction times outPrecheckStatusException- when the precheck failsReceiptStatusException- when there is an issue with the receipt
-
getRecord
public TransactionRecord getRecord(Client client, Duration timeout) throws TimeoutException, PrecheckStatusException, ReceiptStatusException Fetch the record of the transaction.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.- Returns:
- the transaction record
- Throws:
TimeoutException- when the transaction times outPrecheckStatusException- when the precheck failsReceiptStatusException- when there is an issue with the receipt
-
getRecordQuery
Create record query from thetransactionIdandtransactionHash- Returns:
TransactionRecordQuery
-
getRecordQuery
Create record query from thetransactionIdandtransactionHash- Returns:
TransactionRecordQuery
-
getRecordAsync
Fetch the record of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.- Returns:
- future result of the transaction record
-
getRecordAsync
Fetch the record of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.- Returns:
- future result of the transaction record
-
getRecordAsync
Fetch the record of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.callback- a BiConsumer which handles the result or error.
-
getRecordAsync
public void getRecordAsync(Client client, Duration timeout, BiConsumer<TransactionRecord, Throwable> callback) Fetch the record of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.callback- a BiConsumer which handles the result or error.
-
getRecordAsync
public void getRecordAsync(Client client, Consumer<TransactionRecord> onSuccess, Consumer<Throwable> onFailure) Fetch the record of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.onSuccess- a Consumer which consumes the result on success.onFailure- a Consumer which consumes the error on failure.
-
getRecordAsync
public void getRecordAsync(Client client, Duration timeout, Consumer<TransactionRecord> onSuccess, Consumer<Throwable> onFailure) Fetch the record of the transaction asynchronously.- Parameters:
client- The client with which this will be executed.timeout- The timeout after which the execution attempt will be cancelled.onSuccess- a Consumer which consumes the result on success.onFailure- a Consumer which consumes the error on failure.
-
toString
-
toJsonObject
com.google.gson.JsonObject toJsonObject()Build a JSON representation of this response- Returns:
- the JSON object
-
toJson
Serialize this response to a JSON string, matching the JS SDK'sJSON.stringify(response.toJSON())so all SDKs produce identical JSON.- Returns:
- the JSON string
-