Simulate Transaction

Given a transaction object, the Simulate Transaction pipeline will communicate with the RPC server to simulate the transaction execution and receive the simulation parameters. The pipeline will throw an error in case any issues arise when communicating with the RPC server or in case the simulation wasn't successful.

It is important to note that in case any underlying state for this invocation is expired and a restore is required, the simulation will still come back as successful and move forward with the pipeline. In these cases, the output response will be of type SorobanRpc.Api.SimulateTransactionRestoreResponse. An AutoRestore plugin can be used to automatically perform the restore transaction before exiting the Simulate Transaction pipeline.

For further details on this scenario, refer to Soroban's official documentation on State Archival.

Input

type SimulateTransactionPipelineInput = {
  transaction: Transaction
  rpcHandler: RpcHandler
}
  • transaction: Transaction to be simulated with the RPC server.

  • rpcHandler: The RPC handler to be used when communicating with the RPC. Refer to the RPCsection for further details.

Output

type SimulateTransactionPipelineOutput = {
  response: SorobanRpc.Api.SimulateTransactionSuccessResponse | SorobanRpc.Api.SimulateTransactionRestoreResponse
  output?: SimulatedInvocationOutput & ResourcesOutput
  assembledTransaction: Transaction
}
  • response: The successful simulation response from the RPC server. This response might be either of type SorobanRpc.Api.SimulateTransactionSuccessResponse or SorobanRpc.Api.SimulateTransactionRestoreResponse from js-stellar-sdk.

  • output: Optional output to be included by different plugins, attaching specific information to the pipeline output.

Last updated