import type { SignatureProtocol, SignRequestKind } from "../../evm/remote-signing/constants"; import type { ChainNamespace } from "./wallet"; /** * Per-request context the signature-request endpoint requires alongside the * payload. The wallet client supplies these from the bound chain + a * caller-defined origin (e.g. `"fox-sdk"`). * * `chainId` is the chain's native identifier — for EVM the EIP-155 numeric id, * for Solana the cluster slug (mainnet/devnet/…), for BTC the network magic, * etc. The backend treats it as opaque per `namespace`. */ export type SignatureRequestContext = { chainId: number; origin: string; /** Optional human-readable summary of what is being signed/sent, forwarded on the request body. */ intent?: string; /** Optional client-supplied correlation id; defaults to a generated UUID at POST time. */ requestId?: string; /** * Bridge-api server-assigned quote id (`randomUUID`) for the quote this * transaction executes, forwarded on transaction-request bodies. Lets the * remote signing service link the request to the served quote — for * quote-anchored policy checks and quote status write-back (ADR-0059). * Pass-through only; no client-side behavior. */ bridgeQuoteId?: string; /** Trading protocol for typed-data requests only; forwarded in payload. */ protocol?: SignatureProtocol; /** Decoded action behind the typed-data hash; typed-data only. */ protocolPayload?: Record; }; /** * Opaque handle returned from `submit*` methods. Carries both the * service-issued `pollingId` and the `kind` discriminator the SDK needs to * pick the right status endpoint (`/transaction-requests/:id` vs * `/signature-requests/:id`). The CLI persists both fields when it intends to * resume polling later (e.g. `mm watch `). * * `kind` is chain-agnostic — every chain's submissions flow through one of * the two backend routes, distinguished by this discriminator. */ export type JobHandle = { pollingId: string; kind: SignRequestKind; }; /** * Minimal shape every `submit*` initial response satisfies. Used by * {@link pendingJobFromInitial} so the CLI can build its persistable * pending-job entry without reaching into chain-specific status types. */ export type JobInitial = { requestId: string; kind: SignRequestKind; }; /** * Persistable pending-job entry. The CLI writes this to its `pendingJobs` * file so it can resume polling later (e.g. `mm watch ` after a * cold restart). `submittedAt` is an ISO-8601 timestamp captured at the * moment the submit response was received. */ export type PendingJobEntry = { pollingId: string; kind: SignRequestKind; namespace: ChainNamespace; submittedAt: string; };