@proton/wrap-constants 0.2.41 → 0.2.44
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/dist/parsers/dex.d.ts +279 -45
- package/dist/wrap-constants.cjs.development.js +35 -7
- package/dist/wrap-constants.cjs.development.js.map +1 -1
- package/dist/wrap-constants.cjs.production.min.js +1 -1
- package/dist/wrap-constants.cjs.production.min.js.map +1 -1
- package/dist/wrap-constants.esm.js +34 -8
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/parsers/dex.ts +37 -37
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proton/wrap-constants",
|
|
3
|
-
"author": "
|
|
3
|
+
"author": "Metallicus",
|
|
4
4
|
"module": "dist/wrap-constants.esm.js",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.2.
|
|
8
|
+
"version": "0.2.44",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"main": "dist/index.js",
|
|
11
11
|
"typings": "dist/index.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"resolutions": {
|
|
45
45
|
"typescript": "4.5"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ab27288121e2453ac76dfb6409540007a3d9f6da"
|
|
48
48
|
}
|
package/src/parsers/dex.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { ExtendedAsset, ExtendedSymbol } from '@bloks/numbers';
|
|
2
1
|
import * as z from 'zod';
|
|
3
2
|
|
|
4
|
-
// const numTransform = z.string().regex(/\d+/).transform(Number)
|
|
5
|
-
|
|
6
3
|
export const ohlcvParser = z.object({
|
|
7
4
|
time: z.number(),
|
|
8
5
|
open: z.number(),
|
|
@@ -17,9 +14,9 @@ export type OHLCV = z.infer<typeof ohlcvParser>
|
|
|
17
14
|
|
|
18
15
|
export const getOhlcvParser = z.object({
|
|
19
16
|
interval: z.string(),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
from: z.string(),
|
|
18
|
+
to: z.string(),
|
|
19
|
+
symbol: z.string(),
|
|
23
20
|
limit: z.number().default(500).refine(n => n <= 1000, 'Max limit is 1000'),
|
|
24
21
|
})
|
|
25
22
|
export type GetOHLCV = z.infer<typeof getOhlcvParser>
|
|
@@ -52,7 +49,7 @@ export type OrderHistory = z.infer<typeof orderHistoryParser>
|
|
|
52
49
|
|
|
53
50
|
export const getOrderHistoryParser = z.object({
|
|
54
51
|
account: z.string(),
|
|
55
|
-
|
|
52
|
+
symbol: z.string().optional(),
|
|
56
53
|
offset: z.number().default(0),
|
|
57
54
|
limit: z.number().default(100).refine(n => n <= 250, 'Max limit is 250'),
|
|
58
55
|
})
|
|
@@ -74,7 +71,7 @@ export const depthParser = z.object({
|
|
|
74
71
|
export type Depth = z.infer<typeof depthParser>
|
|
75
72
|
|
|
76
73
|
export const getDepthParser = z.object({
|
|
77
|
-
|
|
74
|
+
symbol: z.string(),
|
|
78
75
|
step: z.string(),
|
|
79
76
|
limit: z.number().default(100).refine(n => n <= 250, 'Max limit is 250'),
|
|
80
77
|
})
|
|
@@ -105,6 +102,37 @@ export const getDailyResponseParser = z.object({
|
|
|
105
102
|
})
|
|
106
103
|
export type GetDailyResponseParser = z.infer<typeof getDailyResponseParser>
|
|
107
104
|
|
|
105
|
+
export const marketParser = z.object({
|
|
106
|
+
market_id: z.number(),
|
|
107
|
+
symbol: z.string(),
|
|
108
|
+
status_code: z.number(),
|
|
109
|
+
type: z.string(),
|
|
110
|
+
maker_fee: z.number(),
|
|
111
|
+
taker_fee: z.number(),
|
|
112
|
+
order_min: z.number(),
|
|
113
|
+
bid_token: z.object({
|
|
114
|
+
sym: z.object({
|
|
115
|
+
code: z.string(),
|
|
116
|
+
precision: z.number(),
|
|
117
|
+
}),
|
|
118
|
+
contract: z.string()
|
|
119
|
+
}),
|
|
120
|
+
ask_token: z.object({
|
|
121
|
+
sym: z.object({
|
|
122
|
+
code: z.string(),
|
|
123
|
+
precision: z.number(),
|
|
124
|
+
}),
|
|
125
|
+
contract: z.string(),
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
export type Market = z.infer<typeof marketParser>
|
|
129
|
+
|
|
130
|
+
export const getMarketsResponseParser = z.object({
|
|
131
|
+
sync: z.number(),
|
|
132
|
+
data: z.array(marketParser)
|
|
133
|
+
})
|
|
134
|
+
export type GetMarketsResponse = z.infer<typeof getMarketsResponseParser>
|
|
135
|
+
|
|
108
136
|
export const tradeParser = z.object({
|
|
109
137
|
block_num: z.number(),
|
|
110
138
|
block_time: z.string(),
|
|
@@ -127,7 +155,7 @@ export const tradeParser = z.object({
|
|
|
127
155
|
export type Trade = z.infer<typeof tradeParser>
|
|
128
156
|
|
|
129
157
|
export const getTradesParser = z.object({
|
|
130
|
-
|
|
158
|
+
symbol: z.string(),
|
|
131
159
|
offset: z.number().default(0),
|
|
132
160
|
limit: z.number().default(100).refine(n => n <= 250, 'Max limit is 250'),
|
|
133
161
|
})
|
|
@@ -184,34 +212,6 @@ export interface CurrentOrder {
|
|
|
184
212
|
updated_at: string
|
|
185
213
|
}
|
|
186
214
|
|
|
187
|
-
export interface RawMarket {
|
|
188
|
-
market_id: number
|
|
189
|
-
order_min: number
|
|
190
|
-
status_code: number
|
|
191
|
-
maker_fee: number
|
|
192
|
-
taker_fee: number
|
|
193
|
-
bid_token: {
|
|
194
|
-
sym: string
|
|
195
|
-
contract: string
|
|
196
|
-
}
|
|
197
|
-
ask_token: {
|
|
198
|
-
quantity: string
|
|
199
|
-
contract: string
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface Market {
|
|
204
|
-
market_id: number
|
|
205
|
-
order_min: number
|
|
206
|
-
status_code: number
|
|
207
|
-
maker_fee: number
|
|
208
|
-
taker_fee: number
|
|
209
|
-
bid_token: ExtendedSymbol
|
|
210
|
-
ask_token: ExtendedAsset
|
|
211
|
-
bid_multiplier: number
|
|
212
|
-
ask_multiplier: number
|
|
213
|
-
}
|
|
214
|
-
|
|
215
215
|
export interface DbMarket {
|
|
216
216
|
market_id: number
|
|
217
217
|
order_min: number
|