simulateTransaction method

Future<SimulateTransactionResponse> simulateTransaction(
  1. Transaction transaction
)

Submit a trial contract invocation to get back return values, expected ledger footprint, and expected costs. See: https://soroban.stellar.org/api/methods/simulateTransaction

Implementation

Future<SimulateTransactionResponse> simulateTransaction(
    Transaction transaction) async {
  String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64();

  JsonRpcMethod getAccount =
      JsonRpcMethod("simulateTransaction", args: transactionEnvelopeXdr);
  dio.Response response = await _dio.post(_serverUrl,
      data: json.encode(getAccount), options: dio.Options(headers: _headers));
  if (enableLogging) {
    print("simulateTransaction response: $response");
  }
  return SimulateTransactionResponse.fromJson(response.data);
}