@cowprotocol/cow-sdk 0.0.8-RC.0 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +95 -23
  2. package/dist/CowSdk.d.ts +2 -1
  3. package/dist/api/cow-subgraph/graphql.d.ts +2576 -0
  4. package/dist/api/cow-subgraph/index.d.ts +17 -0
  5. package/dist/api/cow-subgraph/queries.d.ts +3 -0
  6. package/dist/api/index.d.ts +1 -0
  7. package/dist/api/metadata/index.d.ts +3 -1
  8. package/dist/index.d.ts +3 -2
  9. package/dist/index.js +28 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.modern.js +28 -1
  12. package/dist/index.modern.js.map +1 -1
  13. package/dist/index.module.js +28 -1
  14. package/dist/index.module.js.map +1 -1
  15. package/dist/utils/context.d.ts +12 -3
  16. package/dist/utils/ipfs.d.ts +8 -0
  17. package/package.json +24 -7
  18. package/.babelrc +0 -4
  19. package/.eslintrc.json +0 -15
  20. package/.github/workflows/build.yml +0 -50
  21. package/.github/workflows/lint.yml +0 -19
  22. package/.github/workflows/publish.yml +0 -20
  23. package/.github/workflows/test.yml +0 -47
  24. package/.nvmrc +0 -1
  25. package/.prettierignore +0 -1
  26. package/.prettierrc +0 -5
  27. package/COPYRIGHT.md +0 -13
  28. package/babel.config.js +0 -3
  29. package/docs/images/CoW.png +0 -0
  30. package/src/CowSdk.ts +0 -53
  31. package/src/api/cow/errors/OperatorError.ts +0 -142
  32. package/src/api/cow/errors/QuoteError.ts +0 -115
  33. package/src/api/cow/index.ts +0 -367
  34. package/src/api/cow/types.ts +0 -82
  35. package/src/api/index.ts +0 -2
  36. package/src/api/metadata/index.ts +0 -37
  37. package/src/api/metadata/types.ts +0 -17
  38. package/src/constants/chains.ts +0 -11
  39. package/src/constants/index.ts +0 -16
  40. package/src/constants/tokens.ts +0 -16
  41. package/src/index.ts +0 -4
  42. package/src/schemas/appData.schema.json +0 -70
  43. package/src/types/index.ts +0 -6
  44. package/src/utils/appData.spec.ts +0 -109
  45. package/src/utils/appData.ts +0 -58
  46. package/src/utils/common.ts +0 -35
  47. package/src/utils/context.ts +0 -89
  48. package/src/utils/price.ts +0 -44
  49. package/src/utils/sign.ts +0 -224
  50. package/src/utils/tokens.ts +0 -12
  51. package/src/workflows/publish.sh +0 -49
  52. package/tsconfig.json +0 -17
@@ -1,367 +0,0 @@
1
- import log from 'loglevel'
2
- import fetch from 'cross-fetch'
3
- import { OrderKind, QuoteQuery } from '@gnosis.pm/gp-v2-contracts'
4
- import { SupportedChainId as ChainId } from '../../constants/chains'
5
- import { getSigningSchemeApiValue, OrderCreation } from '../../utils/sign'
6
- import OperatorError, { ApiErrorCodeDetails, ApiErrorCodes, ApiErrorObject } from './errors/OperatorError'
7
- import QuoteError, {
8
- GpQuoteErrorCodes,
9
- GpQuoteErrorObject,
10
- mapOperatorErrorToQuoteError,
11
- GpQuoteErrorDetails,
12
- } from './errors/QuoteError'
13
- import { toErc20Address } from '../../utils/tokens'
14
- import { FeeQuoteParams, PriceInformation, PriceQuoteParams, SimpleGetQuoteResponse } from '../../utils/price'
15
-
16
- import { ZERO_ADDRESS } from '../../constants'
17
- import {
18
- GetOrdersParams,
19
- GetTradesParams,
20
- OrderCancellationParams,
21
- OrderID,
22
- OrderMetaData,
23
- ProfileData,
24
- TradeMetaData,
25
- } from './types'
26
- import { CowError, logPrefix, objectToQueryString } from '../../utils/common'
27
- import { Context } from '../../utils/context'
28
-
29
- function getGnosisProtocolUrl(isDev: boolean): Partial<Record<ChainId, string>> {
30
- if (isDev) {
31
- return {
32
- [ChainId.MAINNET]: 'https://barn.api.cow.fi/mainnet/api',
33
- [ChainId.RINKEBY]: 'https://barn.api.cow.fi/rinkeby/api',
34
- [ChainId.GNOSIS_CHAIN]: 'https://barn.api.cow.fi/xdai/api',
35
- }
36
- }
37
-
38
- return {
39
- [ChainId.MAINNET]: 'https://api.cow.fi/mainnet/api',
40
- [ChainId.RINKEBY]: 'https://api.cow.fi/rinkeby/api',
41
- [ChainId.GNOSIS_CHAIN]: 'https://api.cow.fi/xdai/api',
42
- }
43
- }
44
-
45
- function getProfileUrl(isDev: boolean): Partial<Record<ChainId, string>> {
46
- if (isDev) {
47
- return {
48
- [ChainId.MAINNET]: 'https://barn.api.cow.fi/affiliate/api',
49
- }
50
- }
51
-
52
- return {
53
- [ChainId.MAINNET]: 'https://api.cow.fi/affiliate/api',
54
- }
55
- }
56
-
57
- const UNHANDLED_QUOTE_ERROR: GpQuoteErrorObject = {
58
- errorType: GpQuoteErrorCodes.UNHANDLED_ERROR,
59
- description: GpQuoteErrorDetails.UNHANDLED_ERROR,
60
- }
61
-
62
- const UNHANDLED_ORDER_ERROR: ApiErrorObject = {
63
- errorType: ApiErrorCodes.UNHANDLED_CREATE_ERROR,
64
- description: ApiErrorCodeDetails.UNHANDLED_CREATE_ERROR,
65
- }
66
-
67
- async function _handleQuoteResponse<T = any, P extends QuoteQuery = QuoteQuery>(
68
- response: Response,
69
- params?: P
70
- ): Promise<T> {
71
- if (!response.ok) {
72
- const errorObj: ApiErrorObject = await response.json()
73
-
74
- // we need to map the backend error codes to match our own for quotes
75
- const mappedError = mapOperatorErrorToQuoteError(errorObj)
76
- const quoteError = new QuoteError(mappedError)
77
-
78
- if (params) {
79
- const { sellToken, buyToken } = params
80
- log.error(logPrefix, `Error querying fee from API - sellToken: ${sellToken}, buyToken: ${buyToken}`)
81
- }
82
-
83
- throw quoteError
84
- } else {
85
- return response.json()
86
- }
87
- }
88
-
89
- export class CowApi {
90
- context: Context
91
-
92
- API_NAME = 'CoW Protocol'
93
-
94
- constructor(context: Context) {
95
- this.context = context
96
- }
97
-
98
- get DEFAULT_HEADERS() {
99
- return { 'Content-Type': 'application/json', 'X-AppId': this.context.appDataHash }
100
- }
101
-
102
- get API_BASE_URL() {
103
- return getGnosisProtocolUrl(this.context.isDevEnvironment)
104
- }
105
-
106
- get PROFILE_API_BASE_URL(): Partial<Record<ChainId, string>> {
107
- return getProfileUrl(this.context.isDevEnvironment)
108
- }
109
-
110
- async getProfileData(address: string): Promise<ProfileData | null> {
111
- const chainId = await this.context.chainId
112
- log.debug(logPrefix, `[api:${this.API_NAME}] Get profile data for`, chainId, address)
113
- if (chainId !== ChainId.MAINNET) {
114
- log.info(logPrefix, 'Profile data is only available for mainnet')
115
- return null
116
- }
117
-
118
- const response = await this.getProfile(`/profile/${address}`)
119
-
120
- if (!response.ok) {
121
- const errorResponse = await response.json()
122
- log.error(logPrefix, errorResponse)
123
- throw new CowError(errorResponse?.description)
124
- } else {
125
- return response.json()
126
- }
127
- }
128
-
129
- async getTrades(params: GetTradesParams): Promise<TradeMetaData[]> {
130
- const { owner, limit, offset } = params
131
- const qsParams = objectToQueryString({ owner, limit, offset })
132
- const chainId = await this.context.chainId
133
- log.debug(logPrefix, '[util:operator] Get trades for', chainId, owner, { limit, offset })
134
- try {
135
- const response = await this.get(`/trades${qsParams}`)
136
-
137
- if (!response.ok) {
138
- const errorResponse = await response.json()
139
- throw new CowError(errorResponse)
140
- } else {
141
- return response.json()
142
- }
143
- } catch (error) {
144
- log.error(logPrefix, 'Error getting trades:', error)
145
- throw new CowError('Error getting trades: ' + error)
146
- }
147
- }
148
-
149
- async getOrders(params: GetOrdersParams): Promise<OrderMetaData[]> {
150
- const { owner, limit = 1000, offset = 0 } = params
151
- const queryString = objectToQueryString({ limit, offset })
152
- const chainId = await this.context.chainId
153
- log.debug(logPrefix, `[api:${this.API_NAME}] Get orders for `, chainId, owner, limit, offset)
154
-
155
- try {
156
- const response = await this.get(`/account/${owner}/orders/${queryString}`)
157
-
158
- if (!response.ok) {
159
- const errorResponse: ApiErrorObject = await response.json()
160
- throw new OperatorError(errorResponse)
161
- } else {
162
- return response.json()
163
- }
164
- } catch (error) {
165
- log.error(logPrefix, 'Error getting orders information:', error)
166
- throw new OperatorError(UNHANDLED_ORDER_ERROR)
167
- }
168
- }
169
-
170
- async getTxOrders(txHash: string): Promise<OrderMetaData[]> {
171
- const chainId = await this.context.chainId
172
- log.debug(`[api:${this.API_NAME}] Get tx orders for `, chainId, txHash)
173
-
174
- try {
175
- const response = await this.get(`/transactions/${txHash}/orders`)
176
-
177
- if (!response.ok) {
178
- const errorResponse: ApiErrorObject = await response.json()
179
- throw new OperatorError(errorResponse)
180
- } else {
181
- return response.json()
182
- }
183
- } catch (error) {
184
- log.error('Error getting transaction orders information:', error)
185
- if (error instanceof OperatorError) throw error
186
- throw new OperatorError(UNHANDLED_ORDER_ERROR)
187
- }
188
- }
189
-
190
- async getOrder(orderId: string): Promise<OrderMetaData | null> {
191
- const chainId = await this.context.chainId
192
- log.debug(logPrefix, `[api:${this.API_NAME}] Get order for `, chainId, orderId)
193
- try {
194
- const response = await this.get(`/orders/${orderId}`)
195
-
196
- if (!response.ok) {
197
- const errorResponse: ApiErrorObject = await response.json()
198
- throw new OperatorError(errorResponse)
199
- } else {
200
- return response.json()
201
- }
202
- } catch (error) {
203
- log.error(logPrefix, 'Error getting order information:', error)
204
- throw new OperatorError(UNHANDLED_ORDER_ERROR)
205
- }
206
- }
207
-
208
- async getPriceQuoteLegacy(params: PriceQuoteParams): Promise<PriceInformation | null> {
209
- const { baseToken, quoteToken, amount, kind } = params
210
- const chainId = await this.context.chainId
211
- log.debug(logPrefix, `[api:${this.API_NAME}] Get price from API`, params, 'for', chainId)
212
-
213
- const response = await this.get(
214
- `/markets/${toErc20Address(baseToken, chainId)}-${toErc20Address(quoteToken, chainId)}/${kind}/${amount}`
215
- ).catch((error) => {
216
- log.error(logPrefix, 'Error getting price quote:', error)
217
- throw new QuoteError(UNHANDLED_QUOTE_ERROR)
218
- })
219
-
220
- return _handleQuoteResponse<PriceInformation | null>(response)
221
- }
222
-
223
- async getQuote(params: FeeQuoteParams): Promise<SimpleGetQuoteResponse> {
224
- const chainId = await this.context.chainId
225
- const quoteParams = this.mapNewToLegacyParams(params, chainId)
226
- const response = await this.post('/quote', quoteParams)
227
-
228
- return _handleQuoteResponse<SimpleGetQuoteResponse>(response)
229
- }
230
-
231
- async sendSignedOrderCancellation(params: OrderCancellationParams): Promise<void> {
232
- const { cancellation, owner: from } = params
233
- const chainId = await this.context.chainId
234
- log.debug(logPrefix, `[api:${this.API_NAME}] Delete signed order for network`, chainId, cancellation)
235
-
236
- const response = await this.delete(`/orders/${cancellation.orderUid}`, {
237
- signature: cancellation.signature,
238
- signingScheme: getSigningSchemeApiValue(cancellation.signingScheme),
239
- from,
240
- })
241
-
242
- if (!response.ok) {
243
- // Raise an exception
244
- const errorMessage = await OperatorError.getErrorFromStatusCode(response, 'delete')
245
- throw new CowError(errorMessage)
246
- }
247
-
248
- log.debug(logPrefix, `[api:${this.API_NAME}] Cancelled order`, cancellation.orderUid, chainId)
249
- }
250
-
251
- async sendOrder(params: { order: Omit<OrderCreation, 'appData'>; owner: string }): Promise<OrderID> {
252
- const fullOrder: OrderCreation = { ...params.order, appData: this.context.appDataHash }
253
- const chainId = await this.context.chainId
254
- const { owner } = params
255
- log.debug(logPrefix, `[api:${this.API_NAME}] Post signed order for network`, chainId, fullOrder)
256
-
257
- // Call API
258
- const response = await this.post(`/orders`, {
259
- ...fullOrder,
260
- signingScheme: getSigningSchemeApiValue(fullOrder.signingScheme),
261
- from: owner,
262
- })
263
-
264
- // Handle response
265
- if (!response.ok) {
266
- // Raise an exception
267
- const errorMessage = await OperatorError.getErrorFromStatusCode(response, 'create')
268
- throw new CowError(errorMessage)
269
- }
270
-
271
- const uid = (await response.json()) as string
272
- log.debug(logPrefix, `[api:${this.API_NAME}] Success posting the signed order`, uid)
273
- return uid
274
- }
275
-
276
- getOrderLink(orderId: OrderID): string {
277
- const baseUrl = this.getApiBaseUrl()
278
-
279
- return baseUrl + `/orders/${orderId}`
280
- }
281
-
282
- private mapNewToLegacyParams(params: FeeQuoteParams, chainId: ChainId): QuoteQuery {
283
- const { amount, kind, userAddress, receiver, validTo, sellToken, buyToken } = params
284
- const fallbackAddress = userAddress || ZERO_ADDRESS
285
-
286
- const baseParams = {
287
- sellToken: toErc20Address(sellToken, chainId),
288
- buyToken: toErc20Address(buyToken, chainId),
289
- from: fallbackAddress,
290
- receiver: receiver || fallbackAddress,
291
- appData: this.context.appDataHash,
292
- validTo,
293
- partiallyFillable: false,
294
- }
295
-
296
- const finalParams: QuoteQuery =
297
- kind === OrderKind.SELL
298
- ? {
299
- kind: OrderKind.SELL,
300
- sellAmountBeforeFee: amount,
301
- ...baseParams,
302
- }
303
- : {
304
- kind: OrderKind.BUY,
305
- buyAmountAfterFee: amount,
306
- ...baseParams,
307
- }
308
-
309
- return finalParams
310
- }
311
-
312
- private async getApiBaseUrl(): Promise<string> {
313
- const chainId = await this.context.chainId
314
- const baseUrl = this.API_BASE_URL[chainId]
315
-
316
- if (!baseUrl) {
317
- throw new CowError(`Unsupported Network. The ${this.API_NAME} API is not deployed in the Network ` + chainId)
318
- } else {
319
- return baseUrl + '/v1'
320
- }
321
- }
322
-
323
- private async getProfileApiBaseUrl(): Promise<string> {
324
- const chainId = await this.context.chainId
325
- const baseUrl = this.PROFILE_API_BASE_URL[chainId]
326
-
327
- if (!baseUrl) {
328
- throw new CowError(`Unsupported Network. The ${this.API_NAME} API is not deployed in the Network ` + chainId)
329
- } else {
330
- return baseUrl + '/v1'
331
- }
332
- }
333
-
334
- private async fetch(url: string, method: 'GET' | 'POST' | 'DELETE', data?: any): Promise<Response> {
335
- const baseUrl = await this.getApiBaseUrl()
336
- return fetch(baseUrl + url, {
337
- headers: this.DEFAULT_HEADERS,
338
- method,
339
- body: data !== undefined ? JSON.stringify(data) : data,
340
- })
341
- }
342
-
343
- private async fetchProfile(url: string, method: 'GET' | 'POST' | 'DELETE', data?: any): Promise<Response> {
344
- const baseUrl = await this.getProfileApiBaseUrl()
345
- return fetch(baseUrl + url, {
346
- headers: this.DEFAULT_HEADERS,
347
- method,
348
- body: data !== undefined ? JSON.stringify(data) : data,
349
- })
350
- }
351
-
352
- private post(url: string, data: any): Promise<Response> {
353
- return this.fetch(url, 'POST', data)
354
- }
355
-
356
- private get(url: string): Promise<Response> {
357
- return this.fetch(url, 'GET')
358
- }
359
-
360
- private getProfile(url: string): Promise<Response> {
361
- return this.fetchProfile(url, 'GET')
362
- }
363
-
364
- private delete(url: string, data: any): Promise<Response> {
365
- return this.fetch(url, 'DELETE', data)
366
- }
367
- }
@@ -1,82 +0,0 @@
1
- import { OrderKind } from '@gnosis.pm/gp-v2-contracts'
2
- import { SupportedChainId as ChainId } from '../../constants/chains'
3
- import { OrderCancellation, SigningSchemeValue } from '../../utils/sign'
4
-
5
- /**
6
- * Unique identifier for the order, calculated by keccak256(orderDigest, ownerAddress, validTo),
7
- * where orderDigest = keccak256(orderStruct). bytes32.
8
- */
9
- export type OrderID = string
10
- export type ApiOrderStatus = 'fulfilled' | 'expired' | 'cancelled' | 'presignaturePending' | 'open'
11
-
12
- export interface OrderMetaData {
13
- creationDate: string
14
- owner: string
15
- uid: OrderID
16
- availableBalance: string
17
- executedBuyAmount: string
18
- executedSellAmount: string
19
- executedSellAmountBeforeFees: string
20
- executedFeeAmount: string
21
- invalidated: false
22
- sellToken: string
23
- buyToken: string
24
- sellAmount: string
25
- buyAmount: string
26
- validTo: number
27
- appData: number
28
- feeAmount: string
29
- kind: OrderKind
30
- partiallyFillable: false
31
- signature: string
32
- signingScheme: SigningSchemeValue
33
- status: ApiOrderStatus
34
- receiver: string
35
- }
36
-
37
- export interface TradeMetaData {
38
- blockNumber: number
39
- logIndex: number
40
- orderUid: OrderID
41
- owner: string
42
- sellToken: string
43
- buyToken: string
44
- sellAmount: string
45
- buyAmount: string
46
- sellAmountBeforeFees: string
47
- txHash: string
48
- }
49
-
50
- export interface UnsupportedToken {
51
- [token: string]: {
52
- address: string
53
- dateAdded: number
54
- }
55
- }
56
-
57
- export type PaginationParams = {
58
- limit?: number
59
- offset?: number
60
- }
61
-
62
- export type OrderCancellationParams = {
63
- chainId: ChainId
64
- cancellation: OrderCancellation
65
- owner: string
66
- }
67
-
68
- export type GetOrdersParams = {
69
- owner: string
70
- } & PaginationParams
71
-
72
- export type GetTradesParams = {
73
- owner: string
74
- } & PaginationParams
75
-
76
- export type ProfileData = {
77
- totalTrades: number
78
- totalReferrals: number
79
- tradeVolumeUsd: number
80
- referralVolumeUsd: number
81
- lastUpdated: string
82
- }
package/src/api/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './cow'
2
- export * from './metadata'
@@ -1,37 +0,0 @@
1
- import log from 'loglevel'
2
- import { Context } from '../../utils/context'
3
- import { getSerializedCID, loadIpfsFromCid } from '../../utils/appData'
4
- import { AppDataDoc } from './types'
5
- import { CowError } from '../../utils/common'
6
-
7
- export class MetadataApi {
8
- context: Context
9
-
10
- constructor(context: Context) {
11
- this.context = context
12
- }
13
-
14
- async decodeAppData(hash: string): Promise<void | AppDataDoc> {
15
- try {
16
- const cidV0 = await getSerializedCID(hash)
17
- if (!cidV0) throw new CowError('Error getting serialized CID')
18
- return await loadIpfsFromCid(cidV0)
19
- } catch (error) {
20
- log.error('Error decoding AppData:', error)
21
- throw new CowError('Error decoding AppData: ' + error)
22
- }
23
- }
24
-
25
- async cidToAppDataHex(ipfsHash: string): Promise<string | void> {
26
- const { CID } = await import('multiformats/cid')
27
-
28
- const { digest } = CID.parse(ipfsHash).multihash
29
- return `0x${Buffer.from(digest).toString('hex')}`
30
- }
31
-
32
- async appDataHexToCid(hash: string): Promise<string | void> {
33
- const cidV0 = await getSerializedCID(hash)
34
- if (!cidV0) throw new CowError('Error getting serialized CID')
35
- return cidV0
36
- }
37
- }
@@ -1,17 +0,0 @@
1
- interface Metadata {
2
- version: string
3
- }
4
-
5
- export interface ReferralMetadata extends Metadata {
6
- address: string
7
- }
8
-
9
- export type MetadataDoc = {
10
- referrer?: ReferralMetadata
11
- }
12
-
13
- export type AppDataDoc = {
14
- version: string
15
- appCode?: string
16
- metadata: MetadataDoc
17
- }
@@ -1,11 +0,0 @@
1
- export enum SupportedChainId {
2
- MAINNET = 1,
3
- RINKEBY = 4,
4
- GNOSIS_CHAIN = 100,
5
- }
6
-
7
- export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = [
8
- SupportedChainId.MAINNET,
9
- SupportedChainId.RINKEBY,
10
- SupportedChainId.GNOSIS_CHAIN,
11
- ]
@@ -1,16 +0,0 @@
1
- import contractNetworks from '@gnosis.pm/gp-v2-contracts/networks.json'
2
- import { SupportedChainId as ChainId } from './chains'
3
-
4
- const { GPv2Settlement } = contractNetworks
5
-
6
- export const GP_SETTLEMENT_CONTRACT_ADDRESS: Partial<Record<number, string>> = {
7
- [ChainId.MAINNET]: GPv2Settlement[ChainId.MAINNET].address,
8
- [ChainId.RINKEBY]: GPv2Settlement[ChainId.RINKEBY].address,
9
- [ChainId.GNOSIS_CHAIN]: GPv2Settlement[ChainId.GNOSIS_CHAIN].address,
10
- }
11
-
12
- export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
13
-
14
- export const DEFAULT_APP_DATA_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000'
15
-
16
- export const DEFAULT_IPFS_GATEWAY_URI = 'https://gnosis.mypinata.cloud/ipfs'
@@ -1,16 +0,0 @@
1
- import { SupportedChainId as ChainId } from './chains'
2
- import { Token } from '../types'
3
-
4
- export const XDAI_SYMBOL = 'XDAI'
5
-
6
- export const WRAPPED_NATIVE_TOKEN: Record<ChainId, Token> = {
7
- [ChainId.MAINNET]: new Token('WETH', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
8
- [ChainId.RINKEBY]: new Token('WETH', '0xc778417E063141139Fce010982780140Aa0cD5Ab'),
9
- [ChainId.GNOSIS_CHAIN]: new Token('WXDAI', '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d'),
10
- }
11
-
12
- export const NATIVE: Record<ChainId, string> = {
13
- [ChainId.MAINNET]: 'ETH',
14
- [ChainId.RINKEBY]: 'ETH',
15
- [ChainId.GNOSIS_CHAIN]: XDAI_SYMBOL,
16
- }
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export { CowError } from './utils/common'
2
- export { ALL_SUPPORTED_CHAIN_IDS } from './constants/chains'
3
- export * from './types'
4
- export { CowSdk } from './CowSdk'
@@ -1,70 +0,0 @@
1
- {
2
- "$id": "https://cowswap.exchange/appdata.schema.json",
3
- "$schema": "http://json-schema.org/draft-07/schema",
4
- "description": "Metadata JSON document for adding information to orders.",
5
- "required": ["version", "metadata"],
6
- "title": "AppData Root Schema",
7
- "type": "object",
8
- "properties": {
9
- "version": {
10
- "$id": "#/properties/version",
11
- "description": "Semantic versioning of document",
12
- "examples": ["1.0.0", "1.2.3"],
13
- "title": "Semantic Versioning",
14
- "type": "string"
15
- },
16
- "appCode": {
17
- "$id": "#/properties/appCode",
18
- "description": "The code identifying the CLI, UI, service generating the order.",
19
- "examples": ["CowSwap"],
20
- "title": "App Code",
21
- "type": "string"
22
- },
23
- "metadata": {
24
- "$id": "#/properties/metadata",
25
- "default": {},
26
- "description": "Each metadata will specify one aspect of the order.",
27
- "required": [],
28
- "title": "Metadata descriptors",
29
- "type": "object",
30
- "properties": {
31
- "referrer": {
32
- "$ref": "#/definitions/kindMetadata/referrer"
33
- }
34
- }
35
- }
36
- },
37
- "definitions": {
38
- "version": {
39
- "$id": "#/definitions/version",
40
- "description": "Semantic versioning of document",
41
- "examples": ["1.0.0", "1.2.3"],
42
- "title": "Semantic Versioning",
43
- "type": "string"
44
- },
45
- "ethereumAddress": {
46
- "$id": "#/definitions/ethereumAddress",
47
- "pattern": "^0x[a-fA-F0-9]{40}$",
48
- "title": "Ethereum compatible address",
49
- "examples": ["0xb6BAd41ae76A11D10f7b0E664C5007b908bC77C9"],
50
- "type": "string"
51
- },
52
- "kindMetadata": {
53
- "referrer": {
54
- "$id": "#/definitions/referrer",
55
- "required": ["version", "address"],
56
- "title": "Referrer",
57
- "type": "object",
58
- "properties": {
59
- "version": {
60
- "$ref": "#/definitions/version"
61
- },
62
- "address": {
63
- "$ref": "#/definitions/ethereumAddress",
64
- "title": "Referrer address"
65
- }
66
- }
67
- }
68
- }
69
- }
70
- }
@@ -1,6 +0,0 @@
1
- export * from '../api/cow/types'
2
- export * from '../api/metadata/types'
3
- export { OrderKind } from '@gnosis.pm/gp-v2-contracts'
4
- export class Token {
5
- constructor(public symbol: string, public address: string) {}
6
- }