Skip to content
type WalletOperation<T> = {
[K in T]: {
authorization?: AnvilAuthorization;
parameters: AnvilWalletOperationTypeParams<K>;
signature?: Bytes;
status: WalletOperationStatus;
transactionHash?: string;
type: K;
validationErrorResponse?: K extends keyof AnvilWalletOperationTypeErrorMap
? AnvilWalletOperationTypeErrorMap[K]
: never;
};
}[T];

Combination of a wallet operation, parameters, and its status, including relevant results of the operation.

Type Parameters

Type Parameter
T extends AnvilWalletOperationType

Remarks

This is a mapped type indexed by [T] rather than a plain interface so it distributes over T: instantiated with one operation type it is a single tagged object, and instantiated with the full AnvilWalletOperationType union (as every exposure site holding mixed-type operations does) it becomes the discriminated union of every variant, each with its own correlated parameters type. A plain generic interface does not distribute this way — applying it once to the full union would compute one object type whose parameters is the union of every operation’s params, with no correlation to type, so switch (op.type) would narrow nothing.

The indexed mapped-type form this discrimination requires does not get a rendered Type Declaration/Properties section the way a plain interface or intersection alias (such as AnvilTransactionRequest) does, so the per-field documentation lives here instead:

  • type — which protocol action this step performs; selects the shape of parameters and validationErrorResponse.
  • status — current lifecycle state. Use isTerminalOperationStatus to tell whether it can still change.
  • parameters — the inputs the step will be executed with; the exact type is AnvilWalletOperationTypeParams<T>.
  • transactionHash — set once a transaction step has been submitted (status AwaitingConfirmation or later). Absent for signature steps.
  • signature — set once a signature step reaches Signed. Absent for transaction steps.
  • authorization — exact typed data and protocol facts this signature step will authorize. Present on inspectable authorization workflows before execution.
  • validationErrorResponse — typed reason for a Failed step: validation issues, a wallet rejection, or a decoded revert. On an Indeterminate step with no transactionHash it reads root: ['UnknownOutcome']: the connection failed during the send and the outcome is unknown, not failed. Absent while the step is healthy.