Order
The Order module provides structures and utilities for managing CoW Protocol orders, including creation, hashing, and management functions.
Types
Order
OrderKind
- SELL - Exact sell amount with minimum buy amount guaranteed
- BUY - Exact buy amount with maximum sell amount capped
OrderBalance
- ERC20 - Standard ERC20 token balances
- EXTERNAL - Balancer Vault external balances
- INTERNAL - Balancer Vault internal balances
Functions
normalizeOrder
Prepares orders for EIP-712 hashing by converting Date objects to timestamps and normalizing optional fields.
hashOrder
Generates the EIP-712 signing hash for an order.
computeOrderUid
Creates a unique 56-byte order identifier combining order digest, owner address, and expiration.
Decodes order UID components back into individual parameters.
Constants
BUY_ETH_ADDRESS enables purchasing native ETH and should only be used in the buyToken field.
Example