Application specific data
There are times when attaching additional information to an order is useful. For example:
- An integration partner might want to track the volume they bring to the protocol
- A user might want to include a referral address in their order
- A user might want to specify additional order options, such as CoW Hooks
CoW Protocol facilitates the inclusion of this additional information to any order through a special data field known as appData
. This field is a bytes32
that points to an IPFS document that is a JSON file containing this information. Utilizing only on-chain data and IPFS, the content of this document can be retrieved and parsed.
AppData Document
The AppData document is a JSON file that follows a specific JSON schema. It is versioned and the version is specified in the document itself. Versioning follows Semantic Versioning.
An example of an AppData document is:
{
"version": "1.3.0",
"appCode": "MyAwesomeUi",
"metadata": {
"referral": "0x1234567890123456789012345678901234567890"
}
}
Avoid all the pain of creating and parsing appData
by using either the:
- CoW Explorer appData utility; or
- app-data SDK
If not using the CoW Explorer appData utility or the app-data SDK, make sure to follow the appData schema and upload your file to IPFS before placing orders using the resulting digest.
Schema
The schema for the AppData document is defined in JSON schema. The schema is available in the app-data SDK. The schema is shown below: