pub async fn estimate_fee<P>(
envelope: &TransactionEnvelope,
provider: &P,
operations_override: Option<usize>,
) -> Result<u64, StellarTransactionUtilsError>Expand description
Estimate transaction fee in XLM (stroops) based on envelope content
This function intelligently estimates fees by:
- Checking if the transaction needs simulation (contains Soroban operations)
- If simulation is needed, performs simulation and uses
min_resource_feefrom the response - If simulation is not needed, counts operations and uses
estimate_base_fee
§Arguments
envelope- The transaction envelope to estimate fees forprovider- Stellar provider for simulation (required if simulation is needed)operations_override- Optional override for operations count (useful when operations will be added, e.g., +1 for fee payment)
§Returns
Estimated fee in stroops (XLM)