Skip to main content
POST
/
v1
/
simulate
Simulate Transaction
curl --request POST \
  --url https://api.example.com/v1/simulate \
  --header 'Content-Type: application/json' \
  --data '
{
  "transaction": "<string>"
}
'
{
  "resourceFee": "<string>",
  "latestLedger": 123,
  "transactionData": "<string>",
  "events": [
    {}
  ]
}

Documentation Index

Fetch the complete documentation index at: https://grat.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Interacts with the Soroban RPC to simulate the execution of a transaction. This is required for smart contract calls to determine resource fees and footprints.

Request Body

transaction
string
required
The base64-encoded XDR of the transaction to simulate.

Response Fields

resourceFee
string
The estimated Soroban resource fee in stroops.
latestLedger
number
The ledger number used for the simulation.
transactionData
string
The base64-encoded SorobanTransactionData containing the required footprints.
events
array
A list of diagnostic events emitted during the simulation.

Error Codes

CodeDescription
VALIDATION_ERRORThe provided XDR is not a valid Soroban transaction.
SIMULATION_FAILEDThe smart contract execution failed or panicked.

SDK Example

import { Grat } from '@grat-official-sdk/sdk';
const grat = Grat.testnet();

const simulation = await grat.simulate(sorobanTx);
console.log(simulation.resourceFee);
View on GitHub