supra-ts-sdk - v2.0.0
    Preparing search index...

    Class SupraSubmissionOutcomeUnknownError

    SupraSubmissionOutcomeUnknownError is thrown by a submit helper when the request that submits the transaction fails in a way that leaves it open whether the node accepted the transaction: the request times out, the connection fails before the node answers, or the node answers with a 5xx status other than 503. The error of the request (a SupraTimeoutError, SupraNetworkError or SupraAPIError) is cause.

    It is also thrown for a transaction whose sequence number is the caller's (transaction.submit.*, the submit methods of a built transaction, helper calls with sequenceNumber; not a helper call numbered by the client's counter) when a v11.7 node refuses it with a 400 Already scheduled digest=<hash>, ... naming its hash, and the read of the hash that follows does not settle the outcome. The 400 SupraAPIError of the refusal is then cause, and either:

    • readStatus is the status the read returned: Pending (the node's pool holds the transaction from an earlier submission, whose forward to a validator may have failed) or another non-final status; or
    • readError is the error of the read, which failed other than with a 404: a timeout (SupraTimeoutError), a connection failure (SupraNetworkError), or a 429 or 5xx (SupraAPIError).

    A v11.7 node does not forward a copy of a transaction its pool holds, so sending the same signed transaction to the same node again does not reach a validator while that copy is in the node's pool; the transaction leaves it when it commits or expires.

    Look hash up with getTransactionByHash, or wait for it with waitForTransaction, before sending the transaction again: a transaction the node accepted can commit until the chain's time reaches expirationTimestampSecs. The SDK derives hash from the signed transaction before it submits it; it is the hash the node gives the transaction.

    With enableWaitForTransaction, the submit helper waits for hash within the wait timeout before it throws: a transaction that reaches a final status is returned (or throws SupraTransactionFailedError) as after an accepted submission, and this error is thrown when the wait ends without a final status, with the wait's SupraTransactionTimeoutError as waitError.

    Hierarchy (View Summary)

    Index
    • Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

      const myObject = {};
      Error.captureStackTrace(myObject);
      myObject.stack; // Similar to `new Error().stack`

      The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

      The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

      The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

      function a() {
      b();
      }

      function b() {
      c();
      }

      function c() {
      // Create an error without stack trace to avoid calculating the stack trace twice.
      const { stackTraceLimit } = Error;
      Error.stackTraceLimit = 0;
      const error = new Error();
      Error.stackTraceLimit = stackTraceLimit;

      // Capture the stack trace above function b
      Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
      throw error;
      }

      a();

      Parameters

      • targetObject: object
      • OptionalconstructorOpt: Function

      Returns void

    • Returns {
          name: string;
          message: string;
          hash: string;
          sender: string;
          sequenceNumber: string;
          expirationTimestampSecs: string;
          readStatus: string | undefined;
          readError: string | undefined;
      }

    stackTraceLimit: number

    The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

    The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

    If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

    hash: string

    The hash of the transaction, derived from the signed transaction.

    sender: string

    The sender's address, as the transaction carries it.

    sequenceNumber: bigint

    The sequence number of the transaction.

    expirationTimestampSecs: bigint

    The expiration time of the transaction, in seconds since the Unix epoch.

    waitError: SupraTransactionTimeoutError | undefined

    The error of the wait for hash, or undefined when the SDK did not wait.

    readStatus: string | undefined

    After a v11.7 Already scheduled refusal, the status that the read of hash returned (for example Pending); undefined otherwise, including when that read failed (readError).

    readError: SupraError | undefined

    After a v11.7 Already scheduled refusal, the error of the read of hash when it failed; undefined otherwise.

    cause?: unknown
    name: string
    message: string
    stack?: string