SimulateTransactionRequest
public final class SimulateTransactionRequest : @unchecked Sendable
Request parameters for simulating a Soroban transaction.
SimulateTransactionRequest configures how a transaction should be simulated by the Soroban RPC server.
Parameters:
- transaction: The transaction to simulate (must contain InvokeHostFunction operation)
- resourceConfig: Optional resource budget configuration (default: 3000000 instruction leeway)
- authMode: Authorization simulation mode (protocol 23+)
- useUpgradedAuth: Request protocol-27 V2 credential arms in the simulation response (default false)
Authorization modes (protocol 23+):
- “enforce”: Strict authorization checking (default)
- “record”: Record auth entries without enforcing
- “record_allow_nonroot”: Allow non-root authorization
useUpgradedAuth flag
When useUpgradedAuth is true, the key "useUpgradedAuth": true is included as a sibling of
"transaction" in the JSON-RPC params. The key is omitted entirely when false
(never sent as "useUpgradedAuth": false). Emitting V2 credential arms on a network below
protocol 27 invalidates the transaction, so this flag defaults to false.
RPC servers that do not support useUpgradedAuth silently ignore the key and return legacy
ADDRESS credential arms. The caller must detect V2 support by inspecting the
credential arm of the returned entries, not by expecting an error.
Example:
let request = SimulateTransactionRequest(
transaction: transaction,
resourceConfig: ResourceConfig(instructionLeeway: 5000000)
)
let response = await server.simulateTransaction(simulateTxRequest: request)
See also:
- [SorobanServer.simulateTransaction] for running simulations
- [SimulateTransactionResponse] for simulation results
- [ResourceConfig] for resource configuration
-
Transaction to simulate (must contain InvokeHostFunction operation).
Declaration
Swift
public let transaction: Transaction -
Resource limits for simulation (instruction leeway, memory bounds).
Declaration
Swift
public let resourceConfig: ResourceConfig? -
Support for non-root authorization. Only available for protocol >= 23 Possible values: “enforce” | “record” | “record_allow_nonroot”
Declaration
Swift
public let authMode: String? -
Request protocol-27 V2 credential arms in the simulation response.
When
true,"useUpgradedAuth": trueis included in the JSON-RPC params. The key is omitted entirely whenfalse. Requires protocol 27; emitting V2 on older networks invalidates the transaction. RPC servers without support silently ignore this flag and return legacyADDRESSentries.Declaration
Swift
public let useUpgradedAuth: Bool -
Creates a request for simulating Soroban transaction execution.
Declaration
Swift
public init(transaction: Transaction, resourceConfig: ResourceConfig? = nil, authMode: String? = nil, useUpgradedAuth: Bool = false) -
Builds JSON-RPC request parameters from the simulation configuration.
Declaration
Swift
public func buildRequestParams() -> [String : Any]
View on GitHub
Install in Dash