Skip to main content
The @cowprotocol/sdk-contracts-ts package provides TypeScript utilities for interacting with CoW Protocol smart contracts, encoding settlements, and managing orders.

Installation

Order Types

Order

Gnosis Protocol v2 order data structure.

OrderKind

OrderBalance

Specifies how token balances are managed.
Example:

Signing Schemes

SigningScheme

Signature Types

Order Utilities

hashOrder

Computes the 32-byte signing hash for an order.
Parameters:
  • domain - EIP-712 domain separator
  • order - Order to hash
Returns: Hex-encoded 32-byte order digest

computeOrderUid

Computes the unique order identifier.
Returns: 56-byte order UID Example:

extractOrderUidParams

Extracts parameters from an order UID.

normalizeOrder

Normalizes an order for EIP-712 signing.

Settlement Encoding

SettlementEncoder

Encoder for CoW Protocol settlement transactions.
Example:

InteractionStage

TokenRegistry

Tracks tokens for settlement encoding.

Trade Encoding

Trade

encodeTradeFlags

Encodes trade flags as a bitfield.

decodeTradeFlags

Decodes trade flags from a bitfield.

decodeOrder

Decodes an order from a settlement trade.

Order Cancellations

OrderCancellations

hashOrderCancellation

Computes the hash for a single order cancellation.

hashOrderCancellations

Computes the hash for multiple order cancellations.

Settlement Types

EncodedSettlement

Prices

Example:

Interaction

Constants

Package Version