@cpttrading/shared 0.1.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.
@@ -0,0 +1,331 @@
1
+ import { z } from "zod";
2
+ export declare const LANGUAGES: readonly [{
3
+ readonly code: "en";
4
+ readonly label: "English";
5
+ readonly flag: "lang-en.png";
6
+ readonly dir: "ltr";
7
+ }, {
8
+ readonly code: "ja";
9
+ readonly label: "日本語";
10
+ readonly flag: "lang-jp.png";
11
+ readonly dir: "ltr";
12
+ }, {
13
+ readonly code: "ko";
14
+ readonly label: "한국어";
15
+ readonly flag: "lang-kr.png";
16
+ readonly dir: "ltr";
17
+ }, {
18
+ readonly code: "zh-Hant";
19
+ readonly label: "繁体中文";
20
+ readonly flag: "lang-zh.png";
21
+ readonly dir: "ltr";
22
+ }, {
23
+ readonly code: "th";
24
+ readonly label: "ไทย";
25
+ readonly flag: "lang-th.png";
26
+ readonly dir: "ltr";
27
+ }, {
28
+ readonly code: "vi";
29
+ readonly label: "Tiếng Việt";
30
+ readonly flag: "lang-vn.png";
31
+ readonly dir: "ltr";
32
+ }, {
33
+ readonly code: "fr";
34
+ readonly label: "français";
35
+ readonly flag: "lang-fr.png";
36
+ readonly dir: "ltr";
37
+ }, {
38
+ readonly code: "de";
39
+ readonly label: "Deutsche";
40
+ readonly flag: "lang-de.png";
41
+ readonly dir: "ltr";
42
+ }, {
43
+ readonly code: "ru";
44
+ readonly label: "Русский язык";
45
+ readonly flag: "lang-ru.png";
46
+ readonly dir: "ltr";
47
+ }, {
48
+ readonly code: "es";
49
+ readonly label: "Español";
50
+ readonly flag: "lang-spa.png";
51
+ readonly dir: "ltr";
52
+ }, {
53
+ readonly code: "pt";
54
+ readonly label: "Português";
55
+ readonly flag: "lang-pt.png";
56
+ readonly dir: "ltr";
57
+ }, {
58
+ readonly code: "it";
59
+ readonly label: "Italiano";
60
+ readonly flag: "lang-it.png";
61
+ readonly dir: "ltr";
62
+ }, {
63
+ readonly code: "ar";
64
+ readonly label: "عربي";
65
+ readonly flag: "lang-ar.png";
66
+ readonly dir: "rtl";
67
+ }, {
68
+ readonly code: "tr";
69
+ readonly label: "Türkçe";
70
+ readonly flag: "lang-tr.png";
71
+ readonly dir: "ltr";
72
+ }, {
73
+ readonly code: "id";
74
+ readonly label: "Indonesia";
75
+ readonly flag: "lang-id.png";
76
+ readonly dir: "ltr";
77
+ }, {
78
+ readonly code: "fa";
79
+ readonly label: "فارسی";
80
+ readonly flag: "lang-fa.png";
81
+ readonly dir: "rtl";
82
+ }];
83
+ export declare const DEFAULT_MARKETS: readonly [{
84
+ readonly symbol: "BTC/USDT";
85
+ readonly base: "BTC";
86
+ readonly quote: "USDT";
87
+ readonly precision: 2;
88
+ }, {
89
+ readonly symbol: "ETH/USDT";
90
+ readonly base: "ETH";
91
+ readonly quote: "USDT";
92
+ readonly precision: 2;
93
+ }, {
94
+ readonly symbol: "BNB/USDT";
95
+ readonly base: "BNB";
96
+ readonly quote: "USDT";
97
+ readonly precision: 3;
98
+ }, {
99
+ readonly symbol: "SOL/USDT";
100
+ readonly base: "SOL";
101
+ readonly quote: "USDT";
102
+ readonly precision: 3;
103
+ }, {
104
+ readonly symbol: "XRP/USDT";
105
+ readonly base: "XRP";
106
+ readonly quote: "USDT";
107
+ readonly precision: 5;
108
+ }, {
109
+ readonly symbol: "DOGE/USDT";
110
+ readonly base: "DOGE";
111
+ readonly quote: "USDT";
112
+ readonly precision: 5;
113
+ }, {
114
+ readonly symbol: "ADA/USDT";
115
+ readonly base: "ADA";
116
+ readonly quote: "USDT";
117
+ readonly precision: 5;
118
+ }, {
119
+ readonly symbol: "AVAX/USDT";
120
+ readonly base: "AVAX";
121
+ readonly quote: "USDT";
122
+ readonly precision: 3;
123
+ }, {
124
+ readonly symbol: "DOT/USDT";
125
+ readonly base: "DOT";
126
+ readonly quote: "USDT";
127
+ readonly precision: 4;
128
+ }, {
129
+ readonly symbol: "MATIC/USDT";
130
+ readonly base: "MATIC";
131
+ readonly quote: "USDT";
132
+ readonly precision: 5;
133
+ }, {
134
+ readonly symbol: "LINK/USDT";
135
+ readonly base: "LINK";
136
+ readonly quote: "USDT";
137
+ readonly precision: 4;
138
+ }, {
139
+ readonly symbol: "UNI/USDT";
140
+ readonly base: "UNI";
141
+ readonly quote: "USDT";
142
+ readonly precision: 4;
143
+ }, {
144
+ readonly symbol: "ATOM/USDT";
145
+ readonly base: "ATOM";
146
+ readonly quote: "USDT";
147
+ readonly precision: 4;
148
+ }, {
149
+ readonly symbol: "LTC/USDT";
150
+ readonly base: "LTC";
151
+ readonly quote: "USDT";
152
+ readonly precision: 3;
153
+ }, {
154
+ readonly symbol: "ETC/USDT";
155
+ readonly base: "ETC";
156
+ readonly quote: "USDT";
157
+ readonly precision: 3;
158
+ }, {
159
+ readonly symbol: "NEAR/USDT";
160
+ readonly base: "NEAR";
161
+ readonly quote: "USDT";
162
+ readonly precision: 4;
163
+ }, {
164
+ readonly symbol: "BCH/USDT";
165
+ readonly base: "BCH";
166
+ readonly quote: "USDT";
167
+ readonly precision: 3;
168
+ }, {
169
+ readonly symbol: "APT/USDT";
170
+ readonly base: "APT";
171
+ readonly quote: "USDT";
172
+ readonly precision: 4;
173
+ }, {
174
+ readonly symbol: "FIL/USDT";
175
+ readonly base: "FIL";
176
+ readonly quote: "USDT";
177
+ readonly precision: 4;
178
+ }, {
179
+ readonly symbol: "ICP/USDT";
180
+ readonly base: "ICP";
181
+ readonly quote: "USDT";
182
+ readonly precision: 4;
183
+ }, {
184
+ readonly symbol: "OP/USDT";
185
+ readonly base: "OP";
186
+ readonly quote: "USDT";
187
+ readonly precision: 4;
188
+ }, {
189
+ readonly symbol: "ARB/USDT";
190
+ readonly base: "ARB";
191
+ readonly quote: "USDT";
192
+ readonly precision: 5;
193
+ }, {
194
+ readonly symbol: "TRX/USDT";
195
+ readonly base: "TRX";
196
+ readonly quote: "USDT";
197
+ readonly precision: 6;
198
+ }, {
199
+ readonly symbol: "SHIB/USDT";
200
+ readonly base: "SHIB";
201
+ readonly quote: "USDT";
202
+ readonly precision: 9;
203
+ }, {
204
+ readonly symbol: "PEPE/USDT";
205
+ readonly base: "PEPE";
206
+ readonly quote: "USDT";
207
+ readonly precision: 10;
208
+ }, {
209
+ readonly symbol: "WLD/USDT";
210
+ readonly base: "WLD";
211
+ readonly quote: "USDT";
212
+ readonly precision: 4;
213
+ }, {
214
+ readonly symbol: "SUI/USDT";
215
+ readonly base: "SUI";
216
+ readonly quote: "USDT";
217
+ readonly precision: 5;
218
+ }, {
219
+ readonly symbol: "TON/USDT";
220
+ readonly base: "TON";
221
+ readonly quote: "USDT";
222
+ readonly precision: 4;
223
+ }, {
224
+ readonly symbol: "INJ/USDT";
225
+ readonly base: "INJ";
226
+ readonly quote: "USDT";
227
+ readonly precision: 3;
228
+ }, {
229
+ readonly symbol: "SEI/USDT";
230
+ readonly base: "SEI";
231
+ readonly quote: "USDT";
232
+ readonly precision: 5;
233
+ }];
234
+ export declare const DERIVATIVE_MARKETS: readonly [{
235
+ readonly symbol: "BTC/USDT";
236
+ readonly base: "BTC";
237
+ readonly precision: 2;
238
+ }, {
239
+ readonly symbol: "ETH/USDT";
240
+ readonly base: "ETH";
241
+ readonly precision: 2;
242
+ }, {
243
+ readonly symbol: "BNB/USDT";
244
+ readonly base: "BNB";
245
+ readonly precision: 3;
246
+ }, {
247
+ readonly symbol: "SOL/USDT";
248
+ readonly base: "SOL";
249
+ readonly precision: 3;
250
+ }, {
251
+ readonly symbol: "XRP/USDT";
252
+ readonly base: "XRP";
253
+ readonly precision: 5;
254
+ }, {
255
+ readonly symbol: "DOGE/USDT";
256
+ readonly base: "DOGE";
257
+ readonly precision: 5;
258
+ }, {
259
+ readonly symbol: "AVAX/USDT";
260
+ readonly base: "AVAX";
261
+ readonly precision: 3;
262
+ }];
263
+ export declare const orderSideSchema: z.ZodEnum<{
264
+ buy: "buy";
265
+ sell: "sell";
266
+ }>;
267
+ export declare const orderTypeSchema: z.ZodEnum<{
268
+ limit: "limit";
269
+ market: "market";
270
+ }>;
271
+ export declare const orderStatusSchema: z.ZodEnum<{
272
+ open: "open";
273
+ filled: "filled";
274
+ canceled: "canceled";
275
+ expired: "expired";
276
+ }>;
277
+ export declare const createOrderSchema: z.ZodObject<{
278
+ symbol: z.ZodString;
279
+ side: z.ZodEnum<{
280
+ buy: "buy";
281
+ sell: "sell";
282
+ }>;
283
+ type: z.ZodDefault<z.ZodEnum<{
284
+ limit: "limit";
285
+ market: "market";
286
+ }>>;
287
+ price: z.ZodCoercedNumber<unknown>;
288
+ amount: z.ZodCoercedNumber<unknown>;
289
+ }, z.core.$strip>;
290
+ export declare const authLoginSchema: z.ZodObject<{
291
+ email: z.ZodString;
292
+ password: z.ZodString;
293
+ }, z.core.$strip>;
294
+ export declare const authRegisterSchema: z.ZodObject<{
295
+ email: z.ZodString;
296
+ password: z.ZodString;
297
+ inviteCode: z.ZodOptional<z.ZodString>;
298
+ }, z.core.$strip>;
299
+ export declare const withdrawSchema: z.ZodObject<{
300
+ asset: z.ZodString;
301
+ network: z.ZodString;
302
+ address: z.ZodString;
303
+ amount: z.ZodCoercedNumber<unknown>;
304
+ }, z.core.$strip>;
305
+ export declare const transferSchema: z.ZodObject<{
306
+ asset: z.ZodString;
307
+ amount: z.ZodCoercedNumber<unknown>;
308
+ to: z.ZodString;
309
+ }, z.core.$strip>;
310
+ export type Language = (typeof LANGUAGES)[number];
311
+ export type MarketSymbol = (typeof DEFAULT_MARKETS)[number]["symbol"];
312
+ export type OrderSide = z.infer<typeof orderSideSchema>;
313
+ export type OrderType = z.infer<typeof orderTypeSchema>;
314
+ export type OrderStatus = z.infer<typeof orderStatusSchema>;
315
+ export type CreateOrderInput = z.infer<typeof createOrderSchema>;
316
+ export interface Ticker {
317
+ symbol: string;
318
+ price: number;
319
+ change24h: number;
320
+ high24h: number;
321
+ low24h: number;
322
+ volume24h: number;
323
+ marketOpen?: boolean;
324
+ }
325
+ export interface WalletBalance {
326
+ asset: string;
327
+ available: number;
328
+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M,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf"}
package/dist/index.js ADDED
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+ export const LANGUAGES = [
3
+ { code: "en", label: "English", flag: "lang-en.png", dir: "ltr" },
4
+ { code: "ja", label: "日本語", flag: "lang-jp.png", dir: "ltr" },
5
+ { code: "ko", label: "한국어", flag: "lang-kr.png", dir: "ltr" },
6
+ { code: "zh-Hant", label: "繁体中文", flag: "lang-zh.png", dir: "ltr" },
7
+ { code: "th", label: "ไทย", flag: "lang-th.png", dir: "ltr" },
8
+ { code: "vi", label: "Tiếng Việt", flag: "lang-vn.png", dir: "ltr" },
9
+ { code: "fr", label: "français", flag: "lang-fr.png", dir: "ltr" },
10
+ { code: "de", label: "Deutsche", flag: "lang-de.png", dir: "ltr" },
11
+ { code: "ru", label: "Русский язык", flag: "lang-ru.png", dir: "ltr" },
12
+ { code: "es", label: "Español", flag: "lang-spa.png", dir: "ltr" },
13
+ { code: "pt", label: "Português", flag: "lang-pt.png", dir: "ltr" },
14
+ { code: "it", label: "Italiano", flag: "lang-it.png", dir: "ltr" },
15
+ { code: "ar", label: "عربي", flag: "lang-ar.png", dir: "rtl" },
16
+ { code: "tr", label: "Türkçe", flag: "lang-tr.png", dir: "ltr" },
17
+ { code: "id", label: "Indonesia", flag: "lang-id.png", dir: "ltr" },
18
+ { code: "fa", label: "فارسی", flag: "lang-fa.png", dir: "rtl" }
19
+ ];
20
+ export const DEFAULT_MARKETS = [
21
+ { symbol: "BTC/USDT", base: "BTC", quote: "USDT", precision: 2 },
22
+ { symbol: "ETH/USDT", base: "ETH", quote: "USDT", precision: 2 },
23
+ { symbol: "BNB/USDT", base: "BNB", quote: "USDT", precision: 3 },
24
+ { symbol: "SOL/USDT", base: "SOL", quote: "USDT", precision: 3 },
25
+ { symbol: "XRP/USDT", base: "XRP", quote: "USDT", precision: 5 },
26
+ { symbol: "DOGE/USDT", base: "DOGE", quote: "USDT", precision: 5 },
27
+ { symbol: "ADA/USDT", base: "ADA", quote: "USDT", precision: 5 },
28
+ { symbol: "AVAX/USDT", base: "AVAX", quote: "USDT", precision: 3 },
29
+ { symbol: "DOT/USDT", base: "DOT", quote: "USDT", precision: 4 },
30
+ { symbol: "MATIC/USDT", base: "MATIC", quote: "USDT", precision: 5 },
31
+ { symbol: "LINK/USDT", base: "LINK", quote: "USDT", precision: 4 },
32
+ { symbol: "UNI/USDT", base: "UNI", quote: "USDT", precision: 4 },
33
+ { symbol: "ATOM/USDT", base: "ATOM", quote: "USDT", precision: 4 },
34
+ { symbol: "LTC/USDT", base: "LTC", quote: "USDT", precision: 3 },
35
+ { symbol: "ETC/USDT", base: "ETC", quote: "USDT", precision: 3 },
36
+ { symbol: "NEAR/USDT", base: "NEAR", quote: "USDT", precision: 4 },
37
+ { symbol: "BCH/USDT", base: "BCH", quote: "USDT", precision: 3 },
38
+ { symbol: "APT/USDT", base: "APT", quote: "USDT", precision: 4 },
39
+ { symbol: "FIL/USDT", base: "FIL", quote: "USDT", precision: 4 },
40
+ { symbol: "ICP/USDT", base: "ICP", quote: "USDT", precision: 4 },
41
+ { symbol: "OP/USDT", base: "OP", quote: "USDT", precision: 4 },
42
+ { symbol: "ARB/USDT", base: "ARB", quote: "USDT", precision: 5 },
43
+ { symbol: "TRX/USDT", base: "TRX", quote: "USDT", precision: 6 },
44
+ { symbol: "SHIB/USDT", base: "SHIB", quote: "USDT", precision: 9 },
45
+ { symbol: "PEPE/USDT", base: "PEPE", quote: "USDT", precision: 10 },
46
+ { symbol: "WLD/USDT", base: "WLD", quote: "USDT", precision: 4 },
47
+ { symbol: "SUI/USDT", base: "SUI", quote: "USDT", precision: 5 },
48
+ { symbol: "TON/USDT", base: "TON", quote: "USDT", precision: 4 },
49
+ { symbol: "INJ/USDT", base: "INJ", quote: "USDT", precision: 3 },
50
+ { symbol: "SEI/USDT", base: "SEI", quote: "USDT", precision: 5 }
51
+ ];
52
+ export const DERIVATIVE_MARKETS = [
53
+ { symbol: "BTC/USDT", base: "BTC", precision: 2 },
54
+ { symbol: "ETH/USDT", base: "ETH", precision: 2 },
55
+ { symbol: "BNB/USDT", base: "BNB", precision: 3 },
56
+ { symbol: "SOL/USDT", base: "SOL", precision: 3 },
57
+ { symbol: "XRP/USDT", base: "XRP", precision: 5 },
58
+ { symbol: "DOGE/USDT", base: "DOGE", precision: 5 },
59
+ { symbol: "AVAX/USDT", base: "AVAX", precision: 3 }
60
+ ];
61
+ export const orderSideSchema = z.enum(["buy", "sell"]);
62
+ export const orderTypeSchema = z.enum(["limit", "market"]);
63
+ export const orderStatusSchema = z.enum(["open", "filled", "canceled", "expired"]);
64
+ export const createOrderSchema = z.object({
65
+ symbol: z.string().min(3),
66
+ side: orderSideSchema,
67
+ type: orderTypeSchema.default("limit"),
68
+ price: z.coerce.number().positive(),
69
+ amount: z.coerce.number().positive()
70
+ });
71
+ export const authLoginSchema = z.object({
72
+ email: z.string().email(),
73
+ password: z.string().min(6)
74
+ });
75
+ export const authRegisterSchema = authLoginSchema.extend({
76
+ inviteCode: z.string().optional()
77
+ });
78
+ export const withdrawSchema = z.object({
79
+ asset: z.string().min(2),
80
+ network: z.string().min(2),
81
+ address: z.string().min(6),
82
+ amount: z.coerce.number().positive()
83
+ });
84
+ export const transferSchema = z.object({
85
+ asset: z.string().min(2),
86
+ amount: z.coerce.number().positive(),
87
+ to: z.string().min(3)
88
+ });
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE;IACjE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE;IAC7D,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE;IAC7D,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE;IACnE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE;IAC7D,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE;IACpE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,EAAE;IAClE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa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AAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACtB,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@cpttrading/shared",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "build": "tsc -p tsconfig.json",
15
+ "lint": "tsc -p tsconfig.json --noEmit",
16
+ "test": "echo \"No shared tests yet\"",
17
+ "typecheck": "tsc -p tsconfig.json --noEmit"
18
+ },
19
+ "dependencies": {
20
+ "zod": "^4.2.0"
21
+ },
22
+ "devDependencies": {
23
+ "typescript": "6.0.3"
24
+ }
25
+ }
26
+
package/src/index.ts ADDED
@@ -0,0 +1,121 @@
1
+ import { z } from "zod";
2
+
3
+ export const LANGUAGES = [
4
+ { code: "en", label: "English", flag: "lang-en.png", dir: "ltr" },
5
+ { code: "ja", label: "日本語", flag: "lang-jp.png", dir: "ltr" },
6
+ { code: "ko", label: "한국어", flag: "lang-kr.png", dir: "ltr" },
7
+ { code: "zh-Hant", label: "繁体中文", flag: "lang-zh.png", dir: "ltr" },
8
+ { code: "th", label: "ไทย", flag: "lang-th.png", dir: "ltr" },
9
+ { code: "vi", label: "Tiếng Việt", flag: "lang-vn.png", dir: "ltr" },
10
+ { code: "fr", label: "français", flag: "lang-fr.png", dir: "ltr" },
11
+ { code: "de", label: "Deutsche", flag: "lang-de.png", dir: "ltr" },
12
+ { code: "ru", label: "Русский язык", flag: "lang-ru.png", dir: "ltr" },
13
+ { code: "es", label: "Español", flag: "lang-spa.png", dir: "ltr" },
14
+ { code: "pt", label: "Português", flag: "lang-pt.png", dir: "ltr" },
15
+ { code: "it", label: "Italiano", flag: "lang-it.png", dir: "ltr" },
16
+ { code: "ar", label: "عربي", flag: "lang-ar.png", dir: "rtl" },
17
+ { code: "tr", label: "Türkçe", flag: "lang-tr.png", dir: "ltr" },
18
+ { code: "id", label: "Indonesia", flag: "lang-id.png", dir: "ltr" },
19
+ { code: "fa", label: "فارسی", flag: "lang-fa.png", dir: "rtl" }
20
+ ] as const;
21
+
22
+ export const DEFAULT_MARKETS = [
23
+ { symbol: "BTC/USDT", base: "BTC", quote: "USDT", precision: 2 },
24
+ { symbol: "ETH/USDT", base: "ETH", quote: "USDT", precision: 2 },
25
+ { symbol: "BNB/USDT", base: "BNB", quote: "USDT", precision: 3 },
26
+ { symbol: "SOL/USDT", base: "SOL", quote: "USDT", precision: 3 },
27
+ { symbol: "XRP/USDT", base: "XRP", quote: "USDT", precision: 5 },
28
+ { symbol: "DOGE/USDT", base: "DOGE", quote: "USDT", precision: 5 },
29
+ { symbol: "ADA/USDT", base: "ADA", quote: "USDT", precision: 5 },
30
+ { symbol: "AVAX/USDT", base: "AVAX", quote: "USDT", precision: 3 },
31
+ { symbol: "DOT/USDT", base: "DOT", quote: "USDT", precision: 4 },
32
+ { symbol: "MATIC/USDT",base: "MATIC",quote: "USDT", precision: 5 },
33
+ { symbol: "LINK/USDT", base: "LINK", quote: "USDT", precision: 4 },
34
+ { symbol: "UNI/USDT", base: "UNI", quote: "USDT", precision: 4 },
35
+ { symbol: "ATOM/USDT", base: "ATOM", quote: "USDT", precision: 4 },
36
+ { symbol: "LTC/USDT", base: "LTC", quote: "USDT", precision: 3 },
37
+ { symbol: "ETC/USDT", base: "ETC", quote: "USDT", precision: 3 },
38
+ { symbol: "NEAR/USDT", base: "NEAR", quote: "USDT", precision: 4 },
39
+ { symbol: "BCH/USDT", base: "BCH", quote: "USDT", precision: 3 },
40
+ { symbol: "APT/USDT", base: "APT", quote: "USDT", precision: 4 },
41
+ { symbol: "FIL/USDT", base: "FIL", quote: "USDT", precision: 4 },
42
+ { symbol: "ICP/USDT", base: "ICP", quote: "USDT", precision: 4 },
43
+ { symbol: "OP/USDT", base: "OP", quote: "USDT", precision: 4 },
44
+ { symbol: "ARB/USDT", base: "ARB", quote: "USDT", precision: 5 },
45
+ { symbol: "TRX/USDT", base: "TRX", quote: "USDT", precision: 6 },
46
+ { symbol: "SHIB/USDT", base: "SHIB", quote: "USDT", precision: 9 },
47
+ { symbol: "PEPE/USDT", base: "PEPE", quote: "USDT", precision: 10 },
48
+ { symbol: "WLD/USDT", base: "WLD", quote: "USDT", precision: 4 },
49
+ { symbol: "SUI/USDT", base: "SUI", quote: "USDT", precision: 5 },
50
+ { symbol: "TON/USDT", base: "TON", quote: "USDT", precision: 4 },
51
+ { symbol: "INJ/USDT", base: "INJ", quote: "USDT", precision: 3 },
52
+ { symbol: "SEI/USDT", base: "SEI", quote: "USDT", precision: 5 }
53
+ ] as const;
54
+
55
+ export const DERIVATIVE_MARKETS = [
56
+ { symbol: "BTC/USDT", base: "BTC", precision: 2 },
57
+ { symbol: "ETH/USDT", base: "ETH", precision: 2 },
58
+ { symbol: "BNB/USDT", base: "BNB", precision: 3 },
59
+ { symbol: "SOL/USDT", base: "SOL", precision: 3 },
60
+ { symbol: "XRP/USDT", base: "XRP", precision: 5 },
61
+ { symbol: "DOGE/USDT", base: "DOGE", precision: 5 },
62
+ { symbol: "AVAX/USDT", base: "AVAX", precision: 3 }
63
+ ] as const;
64
+
65
+ export const orderSideSchema = z.enum(["buy", "sell"]);
66
+ export const orderTypeSchema = z.enum(["limit", "market"]);
67
+ export const orderStatusSchema = z.enum(["open", "filled", "canceled", "expired"]);
68
+
69
+ export const createOrderSchema = z.object({
70
+ symbol: z.string().min(3),
71
+ side: orderSideSchema,
72
+ type: orderTypeSchema.default("limit"),
73
+ price: z.coerce.number().positive(),
74
+ amount: z.coerce.number().positive()
75
+ });
76
+
77
+ export const authLoginSchema = z.object({
78
+ email: z.string().email(),
79
+ password: z.string().min(6)
80
+ });
81
+
82
+ export const authRegisterSchema = authLoginSchema.extend({
83
+ inviteCode: z.string().optional()
84
+ });
85
+
86
+ export const withdrawSchema = z.object({
87
+ asset: z.string().min(2),
88
+ network: z.string().min(2),
89
+ address: z.string().min(6),
90
+ amount: z.coerce.number().positive()
91
+ });
92
+
93
+ export const transferSchema = z.object({
94
+ asset: z.string().min(2),
95
+ amount: z.coerce.number().positive(),
96
+ to: z.string().min(3)
97
+ });
98
+
99
+ export type Language = (typeof LANGUAGES)[number];
100
+ export type MarketSymbol = (typeof DEFAULT_MARKETS)[number]["symbol"];
101
+ export type OrderSide = z.infer<typeof orderSideSchema>;
102
+ export type OrderType = z.infer<typeof orderTypeSchema>;
103
+ export type OrderStatus = z.infer<typeof orderStatusSchema>;
104
+ export type CreateOrderInput = z.infer<typeof createOrderSchema>;
105
+
106
+ export interface Ticker {
107
+ symbol: string;
108
+ price: number;
109
+ change24h: number;
110
+ high24h: number;
111
+ low24h: number;
112
+ volume24h: number;
113
+ marketOpen?: boolean;
114
+ }
115
+
116
+ export interface WalletBalance {
117
+ asset: string;
118
+ available: number;
119
+ frozen: number;
120
+ total: number;
121
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "ES2022",
5
+ "outDir": "dist",
6
+ "rootDir": "src",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "sourceMap": true
10
+ },
11
+ "include": ["src"]
12
+ }
13
+