• Creates a replay-safe EIP-712 typed data structure by wrapping the original typed data with chain ID and smart account address.

    Coinbase Smart Wallet Requirement: Due to the Coinbase Smart Wallet contract's ERC-1271 implementation, all EIP-712 messages must be wrapped in a replay-safe hash before signing. This prevents signature replay attacks across different chains or smart account addresses.

    The smart contract's isValidSignature() method expects signatures to be validated against this replay-safe hash, not the original message hash.

    Parameters

    • params: {
          chainId: bigint;
          smartAccountAddress: `0x${string}`;
          typedData: EIP712Message;
      }

      The replay-safe hash parameters

      • chainId: bigint

        The chain ID for replay protection

      • smartAccountAddress: `0x${string}`

        The smart account address for additional context

      • typedData: EIP712Message

        The original EIP-712 typed data to make replay-safe

    Returns EIP712Message

    The EIP-712 typed data structure for the replay-safe hash