prepare Transaction
Prepares a transaction by simulating it and applying resource estimates.
This is a convenience method that:
Calls simulateTransaction to get resource estimates
Calls prepareTransaction with the simulation results
The returned transaction is ready for signing and submission. The fee will be updated to include estimated resource fees.
Example
val prepared = server.prepareTransaction(transaction)
prepared.sign(keypair)
server.sendTransaction(prepared)Return
A copy of the transaction with footprint and fees populated
Parameters
The transaction to prepare
Throws
If simulation fails
If the RPC request fails
Prepares a transaction using existing simulation results.
Applies simulation results to the transaction without re-simulating. Use this when you've already called simulateTransaction and want to inspect results before preparing.
The method:
Validates simulation succeeded (no error)
Applies resource footprint from simulation
Updates authorization entries (if applicable)
Calculates total fee (base fee + resource fee)
Return
A copy of the transaction with simulation results applied
Parameters
The transaction to prepare
The simulation results to apply
Throws
If simulation contains an error