Skip to main content
The domain module provides utilities for creating EIP-712 typed data domains used for signing CoW Protocol orders.

domain

Returns the Gnosis Protocol v2 domain used for signing orders.
function domain(
  chainId: number,
  verifyingContract: string
): TypedDataDomain
chainId
number
required
The EIP-155 chain ID where the contract is deployed.
verifyingContract
string
required
The address of the GPv2Settlement contract that will verify the signature.
TypedDataDomain
TypedDataDomain
An EIP-712 compatible typed domain data structure containing:
  • name: “Gnosis Protocol”
  • version: “v2”
  • chainId: The provided chain ID
  • verifyingContract: The settlement contract address

Example

import { domain } from "@cowprotocol/contracts";

// Create domain for Ethereum mainnet
const settlementDomain = domain(
  1, // Ethereum mainnet chain ID
  "0x9008D19f58AAbD9eD0D60971565AA8510560ab41" // GPv2Settlement address
);
The domain is used throughout the SDK to ensure orders cannot be replayed across different chains or contract deployments. It’s mixed into all EIP-712 signatures.

TypedDataDomain

EIP-712 typed data domain structure.
interface TypedDataDomain {
  name?: string;
  version?: string;
  chainId?: number;
  verifyingContract?: string;
  salt?: string;
}
name
string
The user-readable name of the signing domain.
version
string
The current version of the signing domain.
chainId
number
The EIP-155 chain ID.
verifyingContract
string
The address of the contract that will verify the signature.
salt
string
A disambiguating salt for the protocol.

Build docs developers (and LLMs) love