java.lang.Object
com.hedera.hashgraph.sdk.FeeEstimateQuery
Query the mirror node for fee estimates for a transaction.
This query allows users, SDKs, and tools to estimate expected fees without submitting transactions to the network.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) HttpRequestbuildRequest(Client client, Duration timeout, FeeEstimateMode resolvedMode) Build the FeeEstimateQuery protobuf message.Execute the query with preset timeout.Execute the query with user supplied timeout.executeAsync(Client client) Execute the query with preset timeout asynchronously.executeAsync(Client client, Duration timeout) Execute the query with user supplied timeout asynchronously.(package private) voidexecuteAsync(Client client, Duration timeout, FeeEstimateMode resolvedMode, CompletableFuture<FeeEstimateResponse> returnFuture, int attempt) Execute the query asynchronously (internal implementation).intExtract the high-volume throttle utilization in basis points.intExtract the maximum number of attempts.Extract the maximum backoff duration.getMode()Extract the fee estimate mode.Extract the transaction to estimate fees for.setHighVolumeThrottle(int highVolumeThrottle) Set the high-volume throttle utilization in basis points (0–10000, where 10000 = 100%).setMaxAttempts(int maxAttempts) Set the maximum number of attempts for the query.setMaxBackoff(Duration maxBackoff) Set the maximum backoff duration for retry attempts.setMode(FeeEstimateMode mode) Set the mode for fee estimation.setTransaction(Transaction transaction) Set the transaction to estimate fees for.<T extends Transaction<T>>
FeeEstimateQuerysetTransaction(Transaction<T> transaction) Set the transaction to estimate fees for from a Transaction object.
-
Constructor Details
-
FeeEstimateQuery
public FeeEstimateQuery()Constructor.
-
-
Method Details
-
getMode
Extract the fee estimate mode.- Returns:
- the fee estimate mode that was set, or null if not set
-
setMode
Set the mode for fee estimation.Defaults to
FeeEstimateMode.INTRINSICif not set.- Parameters:
mode- the fee estimate mode- Returns:
this
-
getHighVolumeThrottle
public int getHighVolumeThrottle()Extract the high-volume throttle utilization in basis points.- Returns:
- the high-volume throttle value (0–10000)
-
setHighVolumeThrottle
Set the high-volume throttle utilization in basis points (0–10000, where 10000 = 100%).When non-zero, the mirror node returns a high-volume pricing multiplier in the response.
- Parameters:
highVolumeThrottle- the throttle utilization in basis points- Returns:
this
-
getTransaction
Extract the transaction to estimate fees for.- Returns:
- the transaction that was set, or null if not set
-
setTransaction
Set the transaction to estimate fees for.This should be the raw HAPI transaction that will be estimated.
- Parameters:
transaction- the transaction proto- Returns:
this
-
setTransaction
Set the transaction to estimate fees for from a Transaction object.- Parameters:
transaction- the transaction to estimate- Returns:
this
-
getMaxAttempts
public int getMaxAttempts()Extract the maximum number of attempts.- Returns:
- the maximum number of attempts
-
setMaxAttempts
Set the maximum number of attempts for the query.- Parameters:
maxAttempts- the maximum number of attempts- Returns:
this
-
getMaxBackoff
Extract the maximum backoff duration.- Returns:
- the maximum backoff duration
-
setMaxBackoff
Set the maximum backoff duration for retry attempts.- Parameters:
maxBackoff- the maximum backoff duration- Returns:
this
-
execute
Execute the query with preset timeout.- Parameters:
client- the client object- Returns:
- the fee estimate response
- Throws:
IOException- if an I/O error occursInterruptedException- if the operation is interrupted
-
execute
public FeeEstimateResponse execute(Client client, Duration timeout) throws IOException, InterruptedException Execute the query with user supplied timeout.- Parameters:
client- the client objecttimeout- the user supplied timeout- Returns:
- the fee estimate response
- Throws:
IOException- if an I/O error occursInterruptedException- if the operation is interrupted
-
executeAsync
Execute the query with preset timeout asynchronously.- Parameters:
client- the client object- Returns:
- the fee estimate response
-
executeAsync
Execute the query with user supplied timeout asynchronously.- Parameters:
client- the client objecttimeout- the user supplied timeout- Returns:
- the fee estimate response
-
executeAsync
void executeAsync(Client client, Duration timeout, FeeEstimateMode resolvedMode, CompletableFuture<FeeEstimateResponse> returnFuture, int attempt) Execute the query asynchronously (internal implementation).- Parameters:
client- the client objectreturnFuture- the future to complete with the resultattempt- the current attempt number
-
buildRequest
Build the FeeEstimateQuery protobuf message.- Returns:
- the protobuf query
-