Skip to main content
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.

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

Or use it directly from the main SDK:

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

Set allowFailure: true for non-critical operations:
Don’t use MAX_UINT256 for production - set reasonable expiration:
Provide default gas limit for complex operations:
Generate unique nonces to prevent replay attacks:

Next Steps

Hooks

Execute custom logic before and after orders

Partner Fee

Configure partner fee collection