Skip to content

Page and retry policies

Describes @stxapp/stx-typescript 0.12.1, the current release.

new Page(items: T[], cursor: string | null)
Parameter Type Description
items T[]
cursor string | null
Property Type Description
cursor string | null
items T[]
hasMore boolean True when another page exists.
length number
[iterator](): Iterator<T>

Returns Iterator<T>.

at(index: number): T | undefined

The item at index; negative counts from the end.

Parameter Type Description
index number

Returns T \| undefined.

How many times to try a call, and how long to wait between tries. The default is 3 attempts, 500 ms initial backoff doubling to a 30 s cap, with jitter. new RetryPolicy({ maxAttempts: 1 }) (or NO_RETRY) turns retries off.

new RetryPolicy(opts?: RetryPolicyOptions)
Parameter Type Description
opts (optional) RetryPolicyOptions
opts.initialBackoffMs (optional) number Milliseconds before the first retry. Default 500.
opts.jitter (optional) boolean Randomise each wait between 50% and 100% of its value. Default true.
opts.maxAttempts (optional) number Total attempts, including the first. Default 3.
opts.maxBackoffMs (optional) number Cap on any one wait, in milliseconds. Default 30000.
opts.retryableExceptions (optional) readonly ExceptionClass[] Exception classes eligible for a retry.
Property Type Description
initialBackoffMs number
jitter boolean
maxAttempts number
maxBackoffMs number
retryableExceptions readonly ExceptionClass[]
computeBackoffMs(attempt: number, exc: STXException): number

Milliseconds to wait after attempt attempt (1-based) failed.

Parameter Type Description
attempt number
exc STXException

Returns number.

shouldRetry(exc: STXException, attempt: number, idempotent: boolean): boolean

Whether to try again after exc ended attempt number attempt.

Parameter Type Description
exc STXException
attempt number
idempotent boolean

Returns boolean.

Backoff between reconnect attempts.

new ReconnectPolicy(opts?: ReconnectPolicyOptions)
Parameter Type Description
opts (optional) ReconnectPolicyOptions
opts.initialBackoffMs (optional) number
opts.jitter (optional) boolean
opts.maxAttempts (optional) number | null null (the default) never gives up.
opts.maxBackoffMs (optional) number
Property Type Description
initialBackoffMs number
jitter boolean
maxAttempts number | null
maxBackoffMs number
delayMs(attempt: number): number
Parameter Type Description
attempt number

Returns number.

STX is operated by XV Exchange, LLC, a Designated Contract Market regulated by the U.S. Commodity Futures Trading Commission (CFTC). Contracts traded on STX are cleared by XV Clearing, LLC, a CFTC-registered Derivatives Clearing Organization. Trading involves substantial risk of loss and may not be appropriate for everyone. Members risk losing the cost to enter any transaction, including fees. Consider whether trading is appropriate for you in light of your experience and financial resources. Nothing on this site is investment advice or a recommendation to trade. Past performance is not indicative of future results.

© 2026 STX. All rights reserved.llms.txtllms-full.txtView as Markdown
Docs version v1.10.5