The CoW Shed SDK enables account abstraction functionality for CoW Protocol, allowing smart contract wallets to pre-authorize and execute multiple calls on behalf of users. This acts as a user-owned smart contract (1/1 multisig) that can execute batched operations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cowprotocol/cow-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Overview
CoW Shed provides:- Pre-authorized calls: Sign calls off-chain and execute them later
- Batch execution: Execute multiple calls in a single transaction
- Gasless execution: Anyone can execute pre-authorized calls
- Smart wallet support: Works with any EIP-1271 compatible wallet
Installation
Basic Usage
Initialize CowShedSdk
Get CoW Shed Account Address
Sign and Execute Calls
Call Structure
ICoWShedCall Interface
Creating Calls
Advanced Features
Custom Nonce
Specify a custom nonce for replay protection:Custom Deadline
Set an expiration time for the pre-authorized calls:Gas Limit Configuration
Signing Schemes
Complete Example
Here’s a complete example of approving tokens and placing a CoW order:Use Cases
1. Gasless Order Placement
Users can sign orders off-chain and have relayers execute them:2. Batch Operations
Execute multiple operations atomically:3. Smart Wallet Integration
Use with Safe or other smart wallets:Custom Factory Options
Customize the CoW Shed factory configuration:Error Handling
Best Practices
Use allowFailure strategically
Use allowFailure strategically
Set
allowFailure: true for non-critical operations:Set appropriate deadlines
Set appropriate deadlines
Don’t use MAX_UINT256 for production - set reasonable expiration:
Estimate gas carefully
Estimate gas carefully
Provide default gas limit for complex operations:
Use unique nonces
Use unique nonces
Generate unique nonces to prevent replay attacks:
Next Steps
Hooks
Execute custom logic before and after orders
Partner Fee
Configure partner fee collection