Skip to main content

Account Abstraction with CoW Shed SDK

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

Use allowFailure strategically

Set allowFailure: true for non-critical operations:

Set appropriate deadlines

Don’t use MAX_UINT256 for production - set reasonable expiration:

Estimate gas carefully

Provide default gas limit for complex operations:

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
Last modified on March 4, 2026