1- # @cowprotocol/app-data
1+ <p align =" center " >
2+ <img width =" 400 " src =" https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png " />
3+ </p >
4+
5+ # Cow AppData SDK
26
37AppData schema definitions
48
59These schemas are used in the data encoded on ` appData ` field for CowProtocol orders.
610
7- For more details, check [ the docs] ( https://docs.cow.fi/cow-sdk/order-meta- data-appdata ) .
11+ For more details, check [ the docs] ( https://docs.cow.fi/cow-protocol/reference/core/intents/app- data ) .
812
913## Installation
1014
1115``` bash
12- pnpm add @cowprotocol/app-data
16+ pnpm add @cowprotocol/sdk- app-data
1317```
1418
1519## Usage
1620
1721``` typescript
18- import { MetadataApi } from ' @cowprotocol/app-data'
22+ import { MetadataApi } from ' @cowprotocol/sdk- app-data'
1923import { EthersV6Adapter } from ' @cowprotocol/sdk-ethers-v6-adapter'
2024import { JsonRpcProvider , Wallet } from ' ethers'
2125
@@ -85,7 +89,7 @@ Schemas are exposed as json files, where the version is the file name:
8589``` js
8690// Getting the version v0.4.0
8791// If you use TypeScript, enable `resolveJsonModule` in tsconfig.
88- const schema = require (' @cowprotocol/app-data/schemas/v0.4.0.json' )
92+ const schema = require (' @cowprotocol/sdk- app-data/schemas/v0.4.0.json' )
8993
9094// Now you can for example run validation against a schema
9195```
@@ -95,7 +99,7 @@ const schema = require('@cowprotocol/app-data/schemas/v0.4.0.json')
9599There are also type definitions
96100
97101``` js
98- import { v0_4_0 } from ' @cowprotocol/app-data'
102+ import { v0_4_0 } from ' @cowprotocol/sdk- app-data'
99103
100104// Note: this example is
101105function createAppDataV0_4_0 (appCode : v0_4_0 .AppCode , metadata : v0_4_0 .Metadata ): v0_4_0.AppDataRootSchema {
@@ -116,7 +120,7 @@ import {
116120 LATEST_APP_DATA_VERSION ,
117121 LATEST_QUOTE_METADATA_VERSION ,
118122 LATEST_REFERRER_METADATA_VERSION ,
119- } from ' @cowprotocol/app-data'
123+ } from ' @cowprotocol/sdk- app-data'
120124```
121125
122126### Utils
@@ -126,7 +130,7 @@ _Get appData schema_
126130To get a schema definition by version
127131
128132``` js
129- import { getAppDataSchema } from ' @cowprotocol/app-data'
133+ import { getAppDataSchema } from ' @cowprotocol/sdk- app-data'
130134
131135const schema = getAppDataSchema (' 0.1.0' )
132136```
@@ -140,7 +144,7 @@ It'll return an object with a boolean indicating `success` and `errors`, if any.
140144The version to validate against will be taken from the doc itself.
141145
142146``` js
143- import { validateAppDataDoc } from ' @cowprotocol/app-data'
147+ import { validateAppDataDoc } from ' @cowprotocol/sdk- app-data'
144148
145149let doc = { version: ' 0.4.0' , metadata: {} }
146150
0 commit comments