export interface SigningRequest {
  id: string;
  type: "signing_request";
  method: string;
  params: unknown;
}

export interface SigningResponseSuccess {
  id: string;
  type: "signing_response";
  result: string;
}

export interface SigningResponseError {
  id: string;
  type: "signing_response";
  error: { code: number; message: string };
}

export type SigningResponse = SigningResponseSuccess | SigningResponseError;

export interface AccountConnected {
  type: "account_connected";
  address: string;
}

export interface AccountDisconnected {
  type: "account_disconnected";
}

export type OutboundMessage =
  | SigningResponse
  | AccountConnected
  | AccountDisconnected;

export type PendingRequest = SigningRequest & {
  receivedAt: number;
};

// Decoded transaction params for display
export interface TransactionParams {
  from?: string;
  to?: string;
  value?: string;
  data?: string;
  input?: string; // geth/forge use `input` instead of `data`
  gas?: string;
  gasPrice?: string;
  maxFeePerGas?: string;
  maxPriorityFeePerGas?: string;
  nonce?: string;
  chainId?: string;
  type?: string;
  [key: string]: string | undefined;
}
