FeeStatsService
open class FeeStatsService : @unchecked Sendable
Service for querying network fee statistics from the Stellar Horizon API.
Provides current fee statistics including min, mode, and percentile fees from recent ledgers. Use this to determine appropriate fee levels for transaction submission.
Example usage:
let sdk = StellarSDK()
let response = await sdk.feeStats.getFeeStats()
switch response {
case .success(let feeStats):
print("Min fee: \(feeStats.minAcceptedFee)")
print("Mode fee: \(feeStats.modeAcceptedFee)")
print("P90 fee: \(feeStats.feeCharged.p90)")
case .failure(let error):
print("Error: \(error)")
}
See also:
-
getFeeStats()AsynchronousThis endpoint gives useful information about per-operation fee stats in the last 5 ledgers. It can be used to predict a fee set on the transaction that will be submitted to the network. See Stellar developer docs
Declaration
Swift
open func getFeeStats() async -> FeeStatsResponseEnumReturn Value
FeeStatsResponseEnum with fee statistics on success or error on failure
View on GitHub
Install in Dash