Introduction
The CoW Protocol TypeScript SDK provides a comprehensive set of utilities for interacting with Gnosis Protocol v2 (CoW Protocol) smart contracts. This SDK enables developers to:- Create and sign orders
- Encode settlements
- Manage interactions with the protocol
- Handle order execution and validation
Installation
Core Modules
The SDK is organized into several key modules:Orders
Create and manage CoW Protocol orders with type-safe interfaces
Signing
Sign orders using EIP-712, EthSign, EIP-1271, or PreSign schemes
Settlement
Encode settlements and manage trade execution
Interactions
Create pre, intra, and post-settlement interactions
Quick Start
Creating a Domain
Every order must be signed with an EIP-712 domain to prevent replay attacks across different chains and contract deployments:Creating an Order
Signing an Order
TypeScript Support
The SDK is written in TypeScript and provides full type definitions for all interfaces, enums, and functions. This ensures type safety and excellent IDE support with autocompletion and inline documentation.ethers.js Integration
The SDK is built on top of ethers.js v5 and seamlessly integrates with ethers providers, signers, and utilities. All addresses, amounts, and bytes are represented using ethers.js types:BigNumberish- For amounts and numeric valuesBytesLike- For signatures and calldatastring- For addresses (checksummed)
Make sure you have
ethers version 5.x installed as a peer dependency.Next Steps
Order Interface
Learn about the Order interface and related types
Settlement Encoding
Encode settlements for solver execution
