Domain
The domain module supplies utilities for constructing EIP-712 typed data domains necessary for signing CoW Protocol orders.
domain()
Generates the Gnosis Protocol v2 domain structure used in order signing.
function domain(
chainId: number,
verifyingContract: string
): TypedDataDomain
Parameters:
| Name | Type | Description |
|---|
chainId | number | The EIP-155 chain identifier where the contract operates |
verifyingContract | string | The GPv2Settlement contract address for signature verification |
Returns: A TypedDataDomain object containing:
name: "Gnosis Protocol"
version: "v2"
chainId: Supplied chain ID
verifyingContract: Settlement contract address
Example
import { domain } from "@cowprotocol/contracts";
const settlementDomain = domain(
1, // Ethereum mainnet
"0x9008D19f58AAbD9eD0D60971565AA8510560ab41"
);
console.log(settlementDomain);
// {
// name: "Gnosis Protocol",
// version: "v2",
// chainId: 1,
// verifyingContract: "0x9008D19f58AAbD9eD0D60971565AA8510560ab41"
// }
TypedDataDomain Interface
interface TypedDataDomain {
name?: string;
version?: string;
chainId?: number;
verifyingContract?: string;
salt?: string;
}
Purpose
The domain structure prevents order replay across different chains and contract instances by being incorporated into all EIP-712 signatures. Always use the correct chain ID and settlement contract address for your target network.
Common Chain IDs
| Network | Chain ID |
|---|
| Ethereum Mainnet | 1 |
| Gnosis Chain | 100 |
| Arbitrum One | 42161 |
| Optimism | 10 |
| Polygon | 137 |
| BSC | 56 |
| Base | 8453 |
| Avalanche | 43114 |
| Sepolia | 11155111 |
Last modified on March 4, 2026