Signature Construction
ComposableCoW orders use EIP-1271 (smart contract) signatures rather than EOA signatures. This guide explains how to construct the signature bytes that the settlement contract needs to verify your programmatic order.This guide assumes you have already set up your Safe with the ExtensibleFallbackHandler and ComposableCoW as domain verifier, and created a programmatic order via
create() or createWithContext().How signature verification works
When the CoW Protocol settlement contract executes a trade for a ComposableCoW order, the following verification chain runs:ConditionalOrderParams and any offchain input, then uses these to regenerate the expected order and verify it matches.
Signature encoding
The signature for a ComposableCoW order is an ABI-encoded byte string containing two values:
The
ConditionalOrderParams struct consists of:
The encoding format is:
Step-by-step construction
Full example
Putting it all together, here is a complete example of constructing and submitting a ComposableCoW order signature:Common pitfalls
Verifying locally
Before submitting to the API, you can verify your signature will pass validation by calling theisValidSignature function directly on the Safe:
This call simulates the exact check the settlement contract performs during order execution. If it returns the magic value (
0x1626ba7e), your signature will be accepted.Next steps
- Creating orders — learn how to create the programmatic order on-chain
- Managing orders — revoke or update existing orders
- Signing schemes — understand all CoW Protocol signing methods
- Troubleshooting — debug common issues