Skip to main content

CoW Shed SDK

Pre-authorized hooks and smart account management

Overview

The CoW Shed SDK enables pre-authorization of hook calls using a deterministic smart account (cow-shed account). This allows users to sign hook calls off-chain that execute during order settlement without requiring on-chain approvals.

Installation

CowShedSdk

Main SDK class for managing cow-shed accounts and signing hook calls.

Constructor

AbstractProviderAdapter
Optional provider adapter (ethers v5, ethers v6, or viem). Uses global adapter if not provided.
ICoWShedOptions
Optional custom CoW Shed factory configuration
string
required
CoW Shed factory contract address
string
required
CoW Shed implementation contract address
string
Optional proxy creation code
CoWShedVersion
default:"latest"
CoW Shed version to use

getCowShedAccount()

Get the deterministic cow-shed account address for an owner.
SupportedChainId
required
Chain ID
string
required
Owner wallet address
string
Deterministic cow-shed account address

signCalls()

Sign multiple calls and encode them into a single pre-authorized transaction.
SignAndEncodeTxArgs
required
ICoWShedCall[]
required
Array of calls to pre-authorize
string
required
Target contract address
bigint
required
ETH value to send with the call
string
required
Encoded call data
boolean
required
Whether the call is allowed to fail
boolean
required
Whether to use delegatecall
SignerLike
Signer for the cow-shed owner account. Uses global signer if not provided.
SupportedChainId
required
Chain ID for the transaction
string
Transaction nonce. Uses current timestamp if not provided.
bigint
Transaction deadline as Unix timestamp. Uses max uint256 if not provided.
bigint
Gas limit override. Estimates gas if not provided.
bigint
Default gas limit to use if estimation fails
EcdsaSigningScheme
default:"EIP712"
Signing scheme to use
CowShedCall
string
Address of the cow-shed account
EvmCall
Signed transaction ready to be executed
string
CoW Shed factory address
string
Encoded call data including signature
bigint
ETH value (typically 0)
bigint
Estimated gas limit for the transaction

CoWShedHooks

Lower-level class for working with CoW Shed hooks.

Methods

proxyOf()

Compute the cow-shed proxy address for an owner.

signCalls()

Sign hook calls.

encodeExecuteHooksForFactory()

Encode hook execution for the factory contract.

Types

ICoWShedCall

Parameters for a single hook call.

ICoWShedOptions

Configuration for CoW Shed factory.

CowShedCall

Result from signing calls.

SignAndEncodeTxArgs

Arguments for signing calls.

Constants

Examples

Basic Hook Signing

Bridge Hook Integration

Multi-Call Hook

Custom Nonce Management

Gas Estimation

Getting CoW Shed Address

Integration with Trading SDK

The CoW Shed SDK is typically used together with the Trading SDK for creating orders with hooks:
Last modified on March 4, 2026