Class: SubmittedTransaction
A submitted v2 transaction whose confirmation mode is explicit in the gateway response.
Type Parameters
| Type Parameter | Default type |
|---|---|
TConfirmation | AppliedTrade | Position | null |
applied trade
Constructors
Constructor
new SubmittedTransaction<
TConfirmation>(options):SubmittedTransaction<TConfirmation>
Construct a submitted transaction from a successful gateway response.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | { blockNumber?: number | null; dexBackendBaseUrl: string; envelope?: unknown; httpRequestor: HttpRequestor; method: string; mode: "queued" | "sync"; positionConfirmation?: (signal) => Promise<PositionConfirmationResult>; requestTimeoutMs?: number; result: unknown; transactionId: string | null; uniqueKey: string; wire?: WireOptions; } | - |
options.blockNumber? | number | null | - |
options.dexBackendBaseUrl | string | - |
options.envelope? | unknown | - |
options.httpRequestor | HttpRequestor | - |
options.method | string | - |
options.mode | "queued" | "sync" | - |
options.positionConfirmation? | (signal) => Promise<PositionConfirmationResult> | - |
options.requestTimeoutMs? | number | - |
options.result | unknown | - |
options.transactionId | string | null | - |
options.uniqueKey | string | - |
options.wire? | WireOptions | Wire options of the apply-results polls confirm() makes. |
Returns
SubmittedTransaction<TConfirmation>
Example
const transaction = new SubmittedTransaction({
method: 'RequestTrade', mode: 'queued', uniqueKey: 'swap-1',
transactionId: 'request-tx', result: undefined,
dexBackendBaseUrl: 'https://dex.example', httpRequestor,
});
submitted transaction block number dex backend base url http requestor position confirmation result request timeout ms id unique key wire options
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
blockNumber | readonly | number | null | The block of the transaction, when the answer carried one; otherwise null. |
envelope | readonly | unknown | The gateway's whole JSON answer as it came ({ status, message, error, data }), for an app that hands the backend's own envelope to its callers; undefined for a transaction built from a uniqueKey alone. |
method | readonly | string | The chain method that was submitted (RequestTrade, AddLiquidity, ...). |
mode | readonly | "queued" | "sync" | The gateway's data.mode: 'sync' (executed, result is the chain result) or 'queued'. |
result | readonly | unknown | The synchronous gateway result, or undefined when mode === 'queued'. |
status | readonly | SubmitStatus | What the gateway's answer established: 'executed' for mode: 'sync', 'queued' for mode: 'queued' (accepted, NOT executed: await confirm() for the outcome). A refused answer never becomes a transaction, so there is no 'rejected' here; see classifySubmitEnvelope for classifying a raw envelope. |
transactionId | readonly | string | null | The request transaction id the gateway reported, or null when it gave none. |
uniqueKey | readonly | string | The write's durable correlation key: persist it, and confirm from it alone later. |
block number request trade add liquidity submit status transaction id unique key
Methods
confirm()
confirm(
options?):Promise<TConfirmation>
Confirm a queued RequestTrade or prove the affected position for a liquidity write.
For RequestTrade, calling this method is required to learn the outcome: the queued acknowledgement proves acceptance, not execution.
Every failure is the write's (it carries uniqueKey, so mayHaveBeenQueued is true): a
re-read that cannot succeed is CONFIRMATION_FAILED (a terminal HTTP status) or
CONFIRMATION_MALFORMED (an unusable answer); one that may (no answer, a 5xx, 404, 408,
429) is read again until the deadline, then CONFIRMATION_TIMEOUT with the last read error
as cause. Confirm the same transaction again; never resubmit the write.
Parameters
| Parameter | Type |
|---|---|
options? | ConfirmOptions |
Returns
Promise<TConfirmation>
Example
const applied = await submitted.confirm({ initialDelayMs: 3_000 });
unique key may have been queued confirmation failed malformed timeout confirm options