@proton/wrap-constants 0.2.39 → 0.2.43
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 +332 -57
- package/dist/wrap-constants.cjs.development.js +56 -13
- 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 +54 -14
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/parsers/dex.ts +59 -43
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.43",
|
|
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": "0f0768ea6522d5f7be650325a3b6c350918ee3e9"
|
|
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,10 +14,10 @@ export type OHLCV = z.infer<typeof ohlcvParser>
|
|
|
17
14
|
|
|
18
15
|
export const getOhlcvParser = z.object({
|
|
19
16
|
interval: z.string(),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
limit: z.number().
|
|
17
|
+
from: z.string(),
|
|
18
|
+
to: z.string(),
|
|
19
|
+
symbol: z.string(),
|
|
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>
|
|
26
23
|
|
|
@@ -52,9 +49,9 @@ export type OrderHistory = z.infer<typeof orderHistoryParser>
|
|
|
52
49
|
|
|
53
50
|
export const getOrderHistoryParser = z.object({
|
|
54
51
|
account: z.string(),
|
|
55
|
-
|
|
56
|
-
offset: z.number().
|
|
57
|
-
limit: z.number().
|
|
52
|
+
symbol: z.string().optional(),
|
|
53
|
+
offset: z.number().default(0),
|
|
54
|
+
limit: z.number().default(100).refine(n => n <= 250, 'Max limit is 250'),
|
|
58
55
|
})
|
|
59
56
|
export type GetOrderHistory = z.infer<typeof getOrderHistoryParser>
|
|
60
57
|
|
|
@@ -74,9 +71,9 @@ 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
|
-
limit: z.number().
|
|
76
|
+
limit: z.number().default(100).refine(n => n <= 250, 'Max limit is 250'),
|
|
80
77
|
})
|
|
81
78
|
export type GetDepth = z.infer<typeof getDepthParser>
|
|
82
79
|
|
|
@@ -105,6 +102,53 @@ 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 getMarketsParser = z.object({
|
|
131
|
+
sync: z.number(),
|
|
132
|
+
data: z.array(marketParser)
|
|
133
|
+
})
|
|
134
|
+
export type GetMarketsResponse = z.infer<typeof getMarketsParser>
|
|
135
|
+
|
|
136
|
+
export const getMarketsResponseParser = z.array(z.object({
|
|
137
|
+
market_id: z.number(),
|
|
138
|
+
symbol: z.string(),
|
|
139
|
+
status_code: z.number(),
|
|
140
|
+
base_id: z.string(),
|
|
141
|
+
quote_id: z.string(),
|
|
142
|
+
type: z.string(),
|
|
143
|
+
maker_fee: z.number(),
|
|
144
|
+
taker_fee: z.number(),
|
|
145
|
+
base_precision: z.number(),
|
|
146
|
+
quote_precision: z.number(),
|
|
147
|
+
base_contract: z.string(),
|
|
148
|
+
quote_contract: z.string(),
|
|
149
|
+
}))
|
|
150
|
+
export type GetMarketsResponseParser = z.infer<typeof getMarketsResponseParser>
|
|
151
|
+
|
|
108
152
|
export const tradeParser = z.object({
|
|
109
153
|
block_num: z.number(),
|
|
110
154
|
block_time: z.string(),
|
|
@@ -127,9 +171,9 @@ export const tradeParser = z.object({
|
|
|
127
171
|
export type Trade = z.infer<typeof tradeParser>
|
|
128
172
|
|
|
129
173
|
export const getTradesParser = z.object({
|
|
130
|
-
|
|
131
|
-
offset: z.number().
|
|
132
|
-
limit: z.number().
|
|
174
|
+
symbol: z.string(),
|
|
175
|
+
offset: z.number().default(0),
|
|
176
|
+
limit: z.number().default(100).refine(n => n <= 250, 'Max limit is 250'),
|
|
133
177
|
})
|
|
134
178
|
export type GetTrades = z.infer<typeof getTradesParser>
|
|
135
179
|
|
|
@@ -184,34 +228,6 @@ export interface CurrentOrder {
|
|
|
184
228
|
updated_at: string
|
|
185
229
|
}
|
|
186
230
|
|
|
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
231
|
export interface DbMarket {
|
|
216
232
|
market_id: number
|
|
217
233
|
order_min: number
|