@cowprotocol/sdk-order-book 0.2.0-beta.0 → 0.2.0
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.
- package/README.md +1 -4
- package/dist/index.js +6 -2
- package/dist/index.mjs +9 -5
- package/package.json +18 -19
package/README.md
CHANGED
|
@@ -18,8 +18,6 @@ yarn add @cowprotocol/sdk-order-book
|
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
|
-
### Individual package usage
|
|
22
|
-
|
|
23
21
|
```typescript
|
|
24
22
|
import { OrderBookApi, SupportedChainId, OrderQuoteRequest, OrderCreation } from '@cowprotocol/sdk-order-book'
|
|
25
23
|
import { setGlobalAdapter } from '@cowprotocol/sdk-common'
|
|
@@ -76,7 +74,7 @@ const trades = await orderBookApi.getTrades({
|
|
|
76
74
|
})
|
|
77
75
|
```
|
|
78
76
|
|
|
79
|
-
### Usage with
|
|
77
|
+
### Usage with CoW SDK
|
|
80
78
|
|
|
81
79
|
```typescript
|
|
82
80
|
import { CowSdk, SupportedChainId, OrderQuoteRequest } from '@cowprotocol/cow-sdk'
|
|
@@ -94,7 +92,6 @@ const sdk = new CowSdk({
|
|
|
94
92
|
adapter,
|
|
95
93
|
})
|
|
96
94
|
|
|
97
|
-
// Use Order Book through the umbrella SDK
|
|
98
95
|
const { quote } = await sdk.orderBook.getQuote(quoteRequest)
|
|
99
96
|
const orderId = await sdk.orderBook.sendOrder(signedOrder)
|
|
100
97
|
const order = await sdk.orderBook.getOrder(orderId)
|
package/dist/index.js
CHANGED
|
@@ -183,7 +183,9 @@ var ORDER_BOOK_PROD_CONFIG = {
|
|
|
183
183
|
[import_sdk_config2.SupportedChainId.POLYGON]: `${PROD_BASE_URL}/polygon`,
|
|
184
184
|
[import_sdk_config2.SupportedChainId.AVALANCHE]: `${PROD_BASE_URL}/avalanche`,
|
|
185
185
|
[import_sdk_config2.SupportedChainId.LENS]: `${PROD_BASE_URL}/lens`,
|
|
186
|
-
[import_sdk_config2.SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb
|
|
186
|
+
[import_sdk_config2.SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb`,
|
|
187
|
+
[import_sdk_config2.SupportedChainId.LINEA]: `${PROD_BASE_URL}/linea`,
|
|
188
|
+
[import_sdk_config2.SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`
|
|
187
189
|
};
|
|
188
190
|
var ORDER_BOOK_STAGING_CONFIG = {
|
|
189
191
|
[import_sdk_config2.SupportedChainId.MAINNET]: `${STAGING_BASE_URL}/mainnet`,
|
|
@@ -194,7 +196,9 @@ var ORDER_BOOK_STAGING_CONFIG = {
|
|
|
194
196
|
[import_sdk_config2.SupportedChainId.POLYGON]: `${STAGING_BASE_URL}/polygon`,
|
|
195
197
|
[import_sdk_config2.SupportedChainId.AVALANCHE]: `${STAGING_BASE_URL}/avalanche`,
|
|
196
198
|
[import_sdk_config2.SupportedChainId.LENS]: `${STAGING_BASE_URL}/lens`,
|
|
197
|
-
[import_sdk_config2.SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb
|
|
199
|
+
[import_sdk_config2.SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb`,
|
|
200
|
+
[import_sdk_config2.SupportedChainId.LINEA]: `${STAGING_BASE_URL}/linea`,
|
|
201
|
+
[import_sdk_config2.SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`
|
|
198
202
|
};
|
|
199
203
|
function cleanObjectFromUndefinedValues(obj) {
|
|
200
204
|
return Object.keys(obj).reduce(
|
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import "cross-fetch/polyfill";
|
|
3
3
|
import { RateLimiter } from "limiter";
|
|
4
4
|
import {
|
|
5
|
-
SupportedChainId,
|
|
6
5
|
DEFAULT_COW_API_CONTEXT,
|
|
7
|
-
ENVS_LIST
|
|
6
|
+
ENVS_LIST,
|
|
7
|
+
SupportedChainId
|
|
8
8
|
} from "@cowprotocol/sdk-config";
|
|
9
|
-
import { CowError,
|
|
9
|
+
import { CowError, jsonWithBigintReplacer, log } from "@cowprotocol/sdk-common";
|
|
10
10
|
|
|
11
11
|
// src/request.ts
|
|
12
12
|
import { backOff } from "exponential-backoff";
|
|
@@ -137,7 +137,9 @@ var ORDER_BOOK_PROD_CONFIG = {
|
|
|
137
137
|
[SupportedChainId.POLYGON]: `${PROD_BASE_URL}/polygon`,
|
|
138
138
|
[SupportedChainId.AVALANCHE]: `${PROD_BASE_URL}/avalanche`,
|
|
139
139
|
[SupportedChainId.LENS]: `${PROD_BASE_URL}/lens`,
|
|
140
|
-
[SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb
|
|
140
|
+
[SupportedChainId.BNB]: `${PROD_BASE_URL}/bnb`,
|
|
141
|
+
[SupportedChainId.LINEA]: `${PROD_BASE_URL}/linea`,
|
|
142
|
+
[SupportedChainId.PLASMA]: `${PROD_BASE_URL}/plasma`
|
|
141
143
|
};
|
|
142
144
|
var ORDER_BOOK_STAGING_CONFIG = {
|
|
143
145
|
[SupportedChainId.MAINNET]: `${STAGING_BASE_URL}/mainnet`,
|
|
@@ -148,7 +150,9 @@ var ORDER_BOOK_STAGING_CONFIG = {
|
|
|
148
150
|
[SupportedChainId.POLYGON]: `${STAGING_BASE_URL}/polygon`,
|
|
149
151
|
[SupportedChainId.AVALANCHE]: `${STAGING_BASE_URL}/avalanche`,
|
|
150
152
|
[SupportedChainId.LENS]: `${STAGING_BASE_URL}/lens`,
|
|
151
|
-
[SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb
|
|
153
|
+
[SupportedChainId.BNB]: `${STAGING_BASE_URL}/bnb`,
|
|
154
|
+
[SupportedChainId.LINEA]: `${STAGING_BASE_URL}/linea`,
|
|
155
|
+
[SupportedChainId.PLASMA]: `${STAGING_BASE_URL}/plasma`
|
|
152
156
|
};
|
|
153
157
|
function cleanObjectFromUndefinedValues(obj) {
|
|
154
158
|
return Object.keys(obj).reduce(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-order-book",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CowProtocol Order Book package",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,20 +13,7 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
18
|
-
"prebuild": "pnpm swagger:codegen",
|
|
19
|
-
"lint": "eslint src/**/*.ts --quiet",
|
|
20
|
-
"test": "jest",
|
|
21
|
-
"test:coverage": "jest --coverage --json --outputFile=jest.results.json && npx coveralls < ./coverage/lcov.info",
|
|
22
|
-
"test:coverage:html": "jest --silent=false --coverage --coverageReporters html",
|
|
23
|
-
"swagger:codegen": "openapi --input https://raw.githubusercontent.com/cowprotocol/services/v2.291.0/crates/orderbook/openapi.yml --output src/generated --exportServices false --exportCore false",
|
|
24
|
-
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
25
|
-
"typecheck": "tsc --noEmit",
|
|
26
|
-
"prepublishOnly": "npm run build"
|
|
27
|
-
},
|
|
28
16
|
"devDependencies": {
|
|
29
|
-
"@cow-sdk/typescript-config": "workspace:*",
|
|
30
17
|
"@types/jest": "^29.4.0",
|
|
31
18
|
"@types/node": "^20.17.31",
|
|
32
19
|
"@types/semver-sort": "^0.0.1",
|
|
@@ -37,13 +24,25 @@
|
|
|
37
24
|
"ts-jest": "^29.0.0",
|
|
38
25
|
"tsup": "^7.2.0",
|
|
39
26
|
"tsx": "^4.19.4",
|
|
40
|
-
"typescript": "^5.2.2"
|
|
27
|
+
"typescript": "^5.2.2",
|
|
28
|
+
"@cow-sdk/typescript-config": "0.0.0-beta.0"
|
|
41
29
|
},
|
|
42
30
|
"dependencies": {
|
|
43
|
-
"@cowprotocol/sdk-config": "workspace:*",
|
|
44
|
-
"@cowprotocol/sdk-common": "workspace:*",
|
|
45
31
|
"cross-fetch": "^3.2.0",
|
|
46
32
|
"exponential-backoff": "^3.1.2",
|
|
47
|
-
"limiter": "^3.0.0"
|
|
33
|
+
"limiter": "^3.0.0",
|
|
34
|
+
"@cowprotocol/sdk-config": "0.3.0",
|
|
35
|
+
"@cowprotocol/sdk-common": "0.3.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
39
|
+
"prebuild": "pnpm swagger:codegen",
|
|
40
|
+
"lint": "eslint src/**/*.ts --quiet",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"test:coverage": "jest --coverage --json --outputFile=jest.results.json && npx coveralls < ./coverage/lcov.info",
|
|
43
|
+
"test:coverage:html": "jest --silent=false --coverage --coverageReporters html",
|
|
44
|
+
"swagger:codegen": "openapi --input https://raw.githubusercontent.com/cowprotocol/services/v2.291.0/crates/orderbook/openapi.yml --output src/generated --exportServices false --exportCore false",
|
|
45
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
46
|
+
"typecheck": "tsc --noEmit"
|
|
48
47
|
}
|
|
49
|
-
}
|
|
48
|
+
}
|