import type { RemoteSigningErrorCode } from "./constants"; import type { JobStatus } from "./types"; /** * Whether `status` is one the remote signing service won't transition out * of. Dispatches on `kind` because the lifecycles diverge: transaction * jobs broadcast (`CONFIRMED` is success), sign-only jobs end at `SIGNED`. */ export declare function isTerminalStatus(status: JobStatus): boolean; /** * Tagged failure for a remote-signing job that ended in a non-success * terminal status. Carries the full {@link JobStatus} so callers can * surface `failureCode` / `failureDescription` / `approval.violations` in * the CLI without re-fetching. */ export declare class JobFailedError extends Error { readonly status: JobStatus; constructor(status: JobStatus); } /** * Tagged error for remote-signing HTTP failures. `code` mirrors the HTTP * failure mode so callers can map to user-facing UX without parsing * messages. */ export declare class RemoteSigningError extends Error { readonly code: RemoteSigningErrorCode; readonly status?: number; /** Machine-readable error code from the upstream API (e.g. Mimir `code` field). */ readonly apiCode?: string; constructor(code: RemoteSigningErrorCode, message: string, status?: number, apiCode?: string); } export type { RemoteSigningErrorCode } from "./constants"; /** * Thrown when a `ControllerEVMWalletClient` operation isn't supported in * remote (server) mode. The remote signing service always broadcasts and * doesn't yet expose RBF endpoints. The SDK fails closed rather than * silently falling through to the local-mode flow. */ export declare class UnsupportedInRemoteMode extends Error { readonly operation: string; constructor(operation: string); } export type PollOpts = { /** Hard ceiling on total wait. Default 5 minutes — long enough for an MFA prompt. */ timeoutMs?: number; /** Bail out early on user cancel. */ signal?: AbortSignal; /** First wait between polls. Default 1s; doubles up to `maxDelayMs`. */ initialDelayMs?: number; /** Cap on the per-tick wait. Default 15s. */ maxDelayMs?: number; }; /** Per-call options for remote submit + poll paths; extends {@link PollOpts} with correlation id. */ export type RemoteRequestOpts = PollOpts & { /** Optional client-supplied correlation id; defaults to a generated UUID at POST time. */ requestId?: string; /** Bridge-api quote id this transaction executes; forwarded on the request body (pass-through). */ bridgeQuoteId?: string; }; /** * Poll `fetchStatus(pollingId)` with exponential backoff until the status * is terminal (per its `kind`). Resolves with the final {@link JobStatus} * regardless of success/failure — callers inspect `status.status` (and * `kind`) to decide what to do. * * Decoupled from any concrete HTTP client: the caller passes a status * fetcher closure. `ServerKeyring.awaitJob` binds it to its own * `getJobStatus`. */ export declare function pollUntilTerminal(fetchStatus: (pollingId: string) => Promise, pollingId: string, opts?: PollOpts): Promise; /** * Fail closed if a tx carries the legacy `gasPrice` field — the remote * signing service's `TransactionTxDto` is EIP-1559 only. */ export declare function assertEip1559Tx(tx: { gasPrice?: bigint; }): void;