CRISP partnersSDK methods

crisp.recoverOperation()

Look up an uncertain execution intent without submitting it again.

One read using the original operation kind and intent key. Supports order.place, order.cancel and position.redeem. Inspect outcomeUnknown and state.

recovery workflow · All SDK methods

Import and runtime

@crisp-trade/partner-sdk — server only; never expose credentials to the browser.

Client setup and shared behavior

Arguments

ArgumentPresenceReleased TypeScript type
userRequired
string
operationRequired
Operations["findOperation"]["input"]["query"]["operation"]
idempotencyKeyRequired
string
optionsOptional
{
        signal?: AbortSignal;
    }

Named types are expanded under “Exact released types” below. Parameters are in call order; optional does not imply nullable.

Example

Example IDs and intent keys are illustrative. Replace them with authenticated account resources and your persisted intent. Browser route names are example routes you implement on your own backend.

// Use a reused, server-only CrispClient (see client setup).
const result = await crisp.recoverOperation(
  'user-123',
  'order.place',
  'persisted-intent-0001',
);
console.log(result.data.operation);

Returns

Returns a promise for a typed response wrapper. Inspect data and its state; a resolved request is not necessarily a successful financial outcome.

Return type
Promise<Response<{
        operation: {
            "id": string;
            "operation": "order.place" | "order.cancel" | "position.redeem";
            "state": "queued" | "running" | "retryable" | "succeeded" | "failed" | "ambiguous";
            "terminal": boolean;
            "outcomeUnknown": boolean;
            "failureCode": string | null;
            "orderId": string | null;
            "redemption": {
                "transactionHash": string | null;
                "count": number;
                "total": number;
                "conditionIds": Array<string>;
                "fallback": boolean;
            } | null;
            "createdAt": string;
            "updatedAt": string;
        };
    }>>

Errors and lifecycle

Errors and retry policy. Financial uncertainty requires recovery with the original intent, never a new key. Realtime helpers must be stopped on logout/account switch.

Exact released types

Extracted from the shipped SDK 0.13.0, not separately maintained signatures.

Full signature
crisp.recoverOperation(user: string, operation: Operations["findOperation"]["input"]["query"]["operation"], idempotencyKey: string, options?: {
        signal?: AbortSignal;
    }): Promise<Response<{
        operation: {
            "id": string;
            "operation": "order.place" | "order.cancel" | "position.redeem";
            "state": "queued" | "running" | "retryable" | "succeeded" | "failed" | "ambiguous";
            "terminal": boolean;
            "outcomeUnknown": boolean;
            "failureCode": string | null;
            "orderId": string | null;
            "redemption": {
                "transactionHash": string | null;
                "count": number;
                "total": number;
                "conditionIds": Array<string>;
                "fallback": boolean;
            } | null;
            "createdAt": string;
            "updatedAt": string;
        };
    }>>
Response
export interface Response<T> {
    data: T;
    status: number;
    requestId: string;
    retryAfterMs: number | null;
    asOf?: string | null;
    freshness?: string | null;
}
CRISP Partner Documentation