Overview
The CoW Protocol SDK provides utilities for creating, encoding, and decoding app data — metadata that attaches referral information, custom UI parameters, partner fees, and application-specific data to orders.Key Concepts
App Data consists of three components:- AppDataDoc: A JSON document containing metadata
- AppDataHash: A keccak256 hash of the document (used in orders)
- AppDataCid: An IPFS Content Identifier for the document
Creating App Data
Basic Implementation
Custom Metadata
Utility Functions
Generate App Data
With Referrer
With Partner Fees
Upload and Retrieval
Upload to Order Book
Retrieve App Data
IPFS CID Conversion
Multi-Chain Deployment
App Data Schema
Utilities
Deterministic Serialization
Hash Computation
Existence Check
Constants
Best Practices
Upload Before Use: Always upload app data to the order book before using it in orders. Solvers need to retrieve it for order validation.
- Unique Hashes: Different content produces different hashes, enabling unique orders with identical token pairs
- Partner Fees: Verify recipient addresses carefully; fees derive from order surplus
Use Cases
- Referral tracking via referrer addresses
- Partner revenue through fees
- Campaign attribution using UTM parameters
- Order identification with unique graffiti
- Version tracking for debugging