Skip to content

Widget: add EIP-712 typed data signing #12576

Description

@linear

Problem

The widget cannot sign typed data. Grepping packages/swap-widget/src for signTypedData, permit2 or signatureRequired returns nothing — useSwapExecution only handles raw transactions (evm, utxo, solana_instructions, solana_serialized_tx).

This blocks two swappers on its own:

  • 0x — permit2 quotes carry signatureRequired: { type: 'zrx_permit2', eip712 } (packages/public-api/src/routes/quote/extractTransactionData.ts:29-32). Without a handler the widget would either skip these routes or fail at execution.
  • CoW Swap — signs an off-chain EIP-712 order instead of a transaction entirely.

Work

  • Add typed-data signing to the EVM signing path (useEvmSigning.ts) — AppKit/wagmi already exposes signTypedData on the connected wallet
  • Handle signatureRequired in useSwapExecution before broadcasting: sign the permit2 payload, attach the signature, then send the transaction
  • Surface the extra signature prompt in the UI — this is a two-prompt flow, and a wallet popping twice with no explanation reads as a bug
  • Cover the rejection case: declining the signature must leave the swap recoverable, not stuck mid-execution

Why this over a redirect

CoW and 0x are the only two swappers the widget genuinely cannot execute. Adding signing keeps those swaps in the widget; the alternative — treating them as redirect-only and bouncing the user to app.shapeshift.com — trades a completed swap for a handoff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions