lib/soroban_rpc.js

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SorobanRpc = void 0;
/* tslint:disable-next-line:no-namespace */
/** @namespace SorobanRpc */
let SorobanRpc = exports.SorobanRpc = void 0;
(function (_SorobanRpc) {
  /** An XDR-parsed version of {@link RawLedgerEntryResult} */
  /** @see https://soroban.stellar.org/api/methods/getLedgerEntries */
  /** @see https://soroban.stellar.org/api/methods/getNetwork */
  /** @see https://soroban.stellar.org/api/methods/getLatestLedger */
  let GetTransactionStatus = /*#__PURE__*/function (GetTransactionStatus) {
    GetTransactionStatus["SUCCESS"] = "SUCCESS";
    GetTransactionStatus["NOT_FOUND"] = "NOT_FOUND";
    GetTransactionStatus["FAILED"] = "FAILED";
    return GetTransactionStatus;
  }({});
  _SorobanRpc.GetTransactionStatus = GetTransactionStatus;
  /** @see https://soroban.stellar.org/api/methods/getTransaction */
  /**
   * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces
   * based on status:
   *   - on success, this includes all fields, though `result` is only present
   *     if an invocation was simulated (since otherwise there's nothing to
   *     "resultify")
   *   - if there was an expiration error, this includes error and restoration
   *     fields
   *   - for all other errors, this only includes error fields
   *
   * @see https://soroban.stellar.org/api/methods/simulateTransaction#returns
   */
  /** Includes simplified fields only present on success. */
  /** Includes details about why the simulation failed */
  function isSimulationError(sim) {
    return 'error' in sim;
  }
  _SorobanRpc.isSimulationError = isSimulationError;
  function isSimulationSuccess(sim) {
    return 'transactionData' in sim;
  }
  _SorobanRpc.isSimulationSuccess = isSimulationSuccess;
  function isSimulationRestore(sim) {
    return isSimulationSuccess(sim) && 'restorePreamble' in sim && !!sim.restorePreamble.transactionData;
  }
  _SorobanRpc.isSimulationRestore = isSimulationRestore;
  function isSimulationRaw(sim) {
    return !sim._parsed;
  }
  _SorobanRpc.isSimulationRaw = isSimulationRaw;
  /** @see https://soroban.stellar.org/api/methods/simulateTransaction#returns */
})(SorobanRpc || (exports.SorobanRpc = SorobanRpc = {}));