StaticcaptureCreates 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();
OptionalconstructorOpt: FunctionStaticprepareStaticstackThe 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.
ReadonlyhashThe hash of the transaction, derived from the signed transaction.
ReadonlysenderThe sender's address, as the transaction carries it.
ReadonlysequenceThe sequence number of the transaction.
ReadonlyexpirationThe expiration time of the transaction, in seconds since the Unix epoch.
ReadonlywaitThe error of the wait for hash, or undefined when the SDK did not wait.
ReadonlyreadAfter 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).
ReadonlyreadAfter a v11.7 Already scheduled refusal, the error of the read of hash when it failed; undefined
otherwise.
OptionalcauseOptionalstack
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,SupraNetworkErrororSupraAPIError) iscause.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 withsequenceNumber; not a helper call numbered by the client's counter) when a v11.7 node refuses it with a 400Already scheduled digest=<hash>, ...naming its hash, and the read of the hash that follows does not settle the outcome. The 400SupraAPIErrorof the refusal is thencause, and either:readStatusis 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; orreadErroris 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
hashup withgetTransactionByHash, or wait for it withwaitForTransaction, before sending the transaction again: a transaction the node accepted can commit until the chain's time reachesexpirationTimestampSecs. The SDK deriveshashfrom the signed transaction before it submits it; it is the hash the node gives the transaction.With
enableWaitForTransaction, the submit helper waits forhashwithin the wait timeout before it throws: a transaction that reaches a final status is returned (or throwsSupraTransactionFailedError) as after an accepted submission, and this error is thrown when the wait ends without a final status, with the wait'sSupraTransactionTimeoutErroraswaitError.