@0xarchive/sdk 0.3.1 → 0.3.3

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/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { z } from 'zod';
2
+
1
3
  /**
2
4
  * Configuration options for the 0xarchive client
3
5
  */
@@ -8,6 +10,8 @@ interface ClientOptions {
8
10
  baseUrl?: string;
9
11
  /** Request timeout in milliseconds (defaults to 30000) */
10
12
  timeout?: number;
13
+ /** Enable runtime validation of API responses using Zod schemas (defaults to false) */
14
+ validate?: boolean;
11
15
  }
12
16
  /**
13
17
  * Response metadata
@@ -92,8 +96,8 @@ interface OrderBookHistoryParams extends TimeRangeParams {
92
96
  type TradeSide = 'A' | 'B';
93
97
  /** Position direction */
94
98
  type TradeDirection = 'Open Long' | 'Open Short' | 'Close Long' | 'Close Short';
95
- /** Data source */
96
- type DataSource = 's3' | 'ws' | 'api';
99
+ /** Data source: 's3' (historical), 'api' (REST backfill), 'ws' (websocket), 'live' (real-time ingestion) */
100
+ type DataSource = 's3' | 'ws' | 'api' | 'live';
97
101
  /**
98
102
  * Trade/fill record with full execution details
99
103
  */
@@ -128,8 +132,12 @@ interface Trade {
128
132
  start_position?: string;
129
133
  /** Data source */
130
134
  source?: DataSource;
131
- /** User's wallet address */
135
+ /** User's wallet address (for fill-level data from REST API) */
132
136
  user_address?: string;
137
+ /** Maker's wallet address (for market-level WebSocket trades) */
138
+ maker_address?: string;
139
+ /** Taker's wallet address (for market-level WebSocket trades) */
140
+ taker_address?: string;
133
141
  }
134
142
  /**
135
143
  * @deprecated Use GetTradesCursorParams instead for better performance with large datasets
@@ -450,6 +458,8 @@ interface HttpClientOptions {
450
458
  baseUrl: string;
451
459
  apiKey: string;
452
460
  timeout: number;
461
+ /** Enable runtime validation of API responses using Zod schemas (default: false) */
462
+ validate?: boolean;
453
463
  }
454
464
  /**
455
465
  * Internal HTTP client for making API requests
@@ -458,11 +468,18 @@ declare class HttpClient {
458
468
  private baseUrl;
459
469
  private apiKey;
460
470
  private timeout;
471
+ private validate;
461
472
  constructor(options: HttpClientOptions);
473
+ /** Whether validation is enabled */
474
+ get validationEnabled(): boolean;
462
475
  /**
463
476
  * Make a GET request to the API
477
+ *
478
+ * @param path - API endpoint path
479
+ * @param params - Query parameters
480
+ * @param schema - Optional Zod schema for validation (used when validation is enabled)
464
481
  */
465
- get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
482
+ get<T>(path: string, params?: Record<string, unknown>, schema?: z.ZodType<T>): Promise<T>;
466
483
  }
467
484
 
468
485
  /**
@@ -999,4 +1016,1573 @@ declare class OxArchiveWs {
999
1016
  private handleMessage;
1000
1017
  }
1001
1018
 
1002
- export { type ApiError, type ApiMeta, type ApiResponse, type ClientOptions, type DataSource, type FundingRate, type GetOrderBookParams, type GetTradesParams, type Instrument, type InstrumentType, type OpenInterest, type OrderBook, type OrderBookHistoryParams, OxArchive, OxArchiveError, OxArchiveWs, type PaginationParams, type PriceLevel, type TimeRangeParams, type Timestamp, type TimestampedRecord, type Trade, type TradeDirection, type TradeSide, type WsChannel, type WsClientMessage, type WsConnectionState, type WsData, type WsError, type WsEventHandlers, type WsHistoricalBatch, type WsHistoricalData, type WsOptions, type WsPing, type WsPong, type WsReplay, type WsReplayCompleted, type WsReplayPause, type WsReplayPaused, type WsReplayResume, type WsReplayResumed, type WsReplaySeek, type WsReplayStarted, type WsReplayStop, type WsReplayStopped, type WsServerMessage, type WsStream, type WsStreamCompleted, type WsStreamProgress, type WsStreamStarted, type WsStreamStop, type WsStreamStopped, type WsSubscribe, type WsSubscribed, type WsUnsubscribe, type WsUnsubscribed, OxArchive as default };
1019
+ /**
1020
+ * Zod schemas for runtime validation of API responses
1021
+ *
1022
+ * @example
1023
+ * ```typescript
1024
+ * import { OrderBookSchema, TradeSchema } from '@0xarchive/sdk';
1025
+ *
1026
+ * // Validate data manually
1027
+ * const result = OrderBookSchema.safeParse(data);
1028
+ * if (result.success) {
1029
+ * console.log(result.data.mid_price);
1030
+ * } else {
1031
+ * console.error(result.error);
1032
+ * }
1033
+ * ```
1034
+ */
1035
+
1036
+ declare const ApiMetaSchema: z.ZodObject<{
1037
+ count: z.ZodNumber;
1038
+ next_cursor: z.ZodOptional<z.ZodString>;
1039
+ request_id: z.ZodString;
1040
+ }, "strip", z.ZodTypeAny, {
1041
+ count: number;
1042
+ request_id: string;
1043
+ next_cursor?: string | undefined;
1044
+ }, {
1045
+ count: number;
1046
+ request_id: string;
1047
+ next_cursor?: string | undefined;
1048
+ }>;
1049
+ declare const ApiResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
1050
+ success: z.ZodBoolean;
1051
+ data: T;
1052
+ meta: z.ZodObject<{
1053
+ count: z.ZodNumber;
1054
+ next_cursor: z.ZodOptional<z.ZodString>;
1055
+ request_id: z.ZodString;
1056
+ }, "strip", z.ZodTypeAny, {
1057
+ count: number;
1058
+ request_id: string;
1059
+ next_cursor?: string | undefined;
1060
+ }, {
1061
+ count: number;
1062
+ request_id: string;
1063
+ next_cursor?: string | undefined;
1064
+ }>;
1065
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
1066
+ success: z.ZodBoolean;
1067
+ data: T;
1068
+ meta: z.ZodObject<{
1069
+ count: z.ZodNumber;
1070
+ next_cursor: z.ZodOptional<z.ZodString>;
1071
+ request_id: z.ZodString;
1072
+ }, "strip", z.ZodTypeAny, {
1073
+ count: number;
1074
+ request_id: string;
1075
+ next_cursor?: string | undefined;
1076
+ }, {
1077
+ count: number;
1078
+ request_id: string;
1079
+ next_cursor?: string | undefined;
1080
+ }>;
1081
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
1082
+ success: z.ZodBoolean;
1083
+ data: T;
1084
+ meta: z.ZodObject<{
1085
+ count: z.ZodNumber;
1086
+ next_cursor: z.ZodOptional<z.ZodString>;
1087
+ request_id: z.ZodString;
1088
+ }, "strip", z.ZodTypeAny, {
1089
+ count: number;
1090
+ request_id: string;
1091
+ next_cursor?: string | undefined;
1092
+ }, {
1093
+ count: number;
1094
+ request_id: string;
1095
+ next_cursor?: string | undefined;
1096
+ }>;
1097
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
1098
+ declare const PriceLevelSchema: z.ZodObject<{
1099
+ px: z.ZodString;
1100
+ sz: z.ZodString;
1101
+ n: z.ZodNumber;
1102
+ }, "strip", z.ZodTypeAny, {
1103
+ px: string;
1104
+ sz: string;
1105
+ n: number;
1106
+ }, {
1107
+ px: string;
1108
+ sz: string;
1109
+ n: number;
1110
+ }>;
1111
+ declare const OrderBookSchema: z.ZodObject<{
1112
+ coin: z.ZodString;
1113
+ timestamp: z.ZodString;
1114
+ bids: z.ZodArray<z.ZodObject<{
1115
+ px: z.ZodString;
1116
+ sz: z.ZodString;
1117
+ n: z.ZodNumber;
1118
+ }, "strip", z.ZodTypeAny, {
1119
+ px: string;
1120
+ sz: string;
1121
+ n: number;
1122
+ }, {
1123
+ px: string;
1124
+ sz: string;
1125
+ n: number;
1126
+ }>, "many">;
1127
+ asks: z.ZodArray<z.ZodObject<{
1128
+ px: z.ZodString;
1129
+ sz: z.ZodString;
1130
+ n: z.ZodNumber;
1131
+ }, "strip", z.ZodTypeAny, {
1132
+ px: string;
1133
+ sz: string;
1134
+ n: number;
1135
+ }, {
1136
+ px: string;
1137
+ sz: string;
1138
+ n: number;
1139
+ }>, "many">;
1140
+ mid_price: z.ZodOptional<z.ZodString>;
1141
+ spread: z.ZodOptional<z.ZodString>;
1142
+ spread_bps: z.ZodOptional<z.ZodString>;
1143
+ }, "strip", z.ZodTypeAny, {
1144
+ coin: string;
1145
+ timestamp: string;
1146
+ bids: {
1147
+ px: string;
1148
+ sz: string;
1149
+ n: number;
1150
+ }[];
1151
+ asks: {
1152
+ px: string;
1153
+ sz: string;
1154
+ n: number;
1155
+ }[];
1156
+ mid_price?: string | undefined;
1157
+ spread?: string | undefined;
1158
+ spread_bps?: string | undefined;
1159
+ }, {
1160
+ coin: string;
1161
+ timestamp: string;
1162
+ bids: {
1163
+ px: string;
1164
+ sz: string;
1165
+ n: number;
1166
+ }[];
1167
+ asks: {
1168
+ px: string;
1169
+ sz: string;
1170
+ n: number;
1171
+ }[];
1172
+ mid_price?: string | undefined;
1173
+ spread?: string | undefined;
1174
+ spread_bps?: string | undefined;
1175
+ }>;
1176
+ declare const TradeSideSchema: z.ZodEnum<["A", "B"]>;
1177
+ declare const TradeDirectionSchema: z.ZodEnum<["Open Long", "Open Short", "Close Long", "Close Short"]>;
1178
+ declare const DataSourceSchema: z.ZodEnum<["s3", "ws", "api", "live"]>;
1179
+ declare const TradeSchema: z.ZodObject<{
1180
+ coin: z.ZodString;
1181
+ side: z.ZodEnum<["A", "B"]>;
1182
+ price: z.ZodString;
1183
+ size: z.ZodString;
1184
+ timestamp: z.ZodString;
1185
+ tx_hash: z.ZodOptional<z.ZodString>;
1186
+ trade_id: z.ZodOptional<z.ZodNumber>;
1187
+ order_id: z.ZodOptional<z.ZodNumber>;
1188
+ crossed: z.ZodOptional<z.ZodBoolean>;
1189
+ fee: z.ZodOptional<z.ZodString>;
1190
+ fee_token: z.ZodOptional<z.ZodString>;
1191
+ closed_pnl: z.ZodOptional<z.ZodString>;
1192
+ direction: z.ZodOptional<z.ZodEnum<["Open Long", "Open Short", "Close Long", "Close Short"]>>;
1193
+ start_position: z.ZodOptional<z.ZodString>;
1194
+ source: z.ZodOptional<z.ZodEnum<["s3", "ws", "api", "live"]>>;
1195
+ user_address: z.ZodOptional<z.ZodString>;
1196
+ maker_address: z.ZodOptional<z.ZodString>;
1197
+ taker_address: z.ZodOptional<z.ZodString>;
1198
+ }, "strip", z.ZodTypeAny, {
1199
+ coin: string;
1200
+ timestamp: string;
1201
+ side: "A" | "B";
1202
+ price: string;
1203
+ size: string;
1204
+ tx_hash?: string | undefined;
1205
+ trade_id?: number | undefined;
1206
+ order_id?: number | undefined;
1207
+ crossed?: boolean | undefined;
1208
+ fee?: string | undefined;
1209
+ fee_token?: string | undefined;
1210
+ closed_pnl?: string | undefined;
1211
+ direction?: "Open Long" | "Open Short" | "Close Long" | "Close Short" | undefined;
1212
+ start_position?: string | undefined;
1213
+ source?: "s3" | "ws" | "api" | "live" | undefined;
1214
+ user_address?: string | undefined;
1215
+ maker_address?: string | undefined;
1216
+ taker_address?: string | undefined;
1217
+ }, {
1218
+ coin: string;
1219
+ timestamp: string;
1220
+ side: "A" | "B";
1221
+ price: string;
1222
+ size: string;
1223
+ tx_hash?: string | undefined;
1224
+ trade_id?: number | undefined;
1225
+ order_id?: number | undefined;
1226
+ crossed?: boolean | undefined;
1227
+ fee?: string | undefined;
1228
+ fee_token?: string | undefined;
1229
+ closed_pnl?: string | undefined;
1230
+ direction?: "Open Long" | "Open Short" | "Close Long" | "Close Short" | undefined;
1231
+ start_position?: string | undefined;
1232
+ source?: "s3" | "ws" | "api" | "live" | undefined;
1233
+ user_address?: string | undefined;
1234
+ maker_address?: string | undefined;
1235
+ taker_address?: string | undefined;
1236
+ }>;
1237
+ declare const InstrumentTypeSchema: z.ZodEnum<["perp", "spot"]>;
1238
+ declare const InstrumentSchema: z.ZodObject<{
1239
+ name: z.ZodString;
1240
+ szDecimals: z.ZodNumber;
1241
+ maxLeverage: z.ZodOptional<z.ZodNumber>;
1242
+ onlyIsolated: z.ZodOptional<z.ZodBoolean>;
1243
+ instrumentType: z.ZodOptional<z.ZodEnum<["perp", "spot"]>>;
1244
+ isActive: z.ZodBoolean;
1245
+ }, "strip", z.ZodTypeAny, {
1246
+ name: string;
1247
+ szDecimals: number;
1248
+ isActive: boolean;
1249
+ maxLeverage?: number | undefined;
1250
+ onlyIsolated?: boolean | undefined;
1251
+ instrumentType?: "perp" | "spot" | undefined;
1252
+ }, {
1253
+ name: string;
1254
+ szDecimals: number;
1255
+ isActive: boolean;
1256
+ maxLeverage?: number | undefined;
1257
+ onlyIsolated?: boolean | undefined;
1258
+ instrumentType?: "perp" | "spot" | undefined;
1259
+ }>;
1260
+ declare const FundingRateSchema: z.ZodObject<{
1261
+ coin: z.ZodString;
1262
+ timestamp: z.ZodString;
1263
+ funding_rate: z.ZodString;
1264
+ premium: z.ZodOptional<z.ZodString>;
1265
+ }, "strip", z.ZodTypeAny, {
1266
+ coin: string;
1267
+ timestamp: string;
1268
+ funding_rate: string;
1269
+ premium?: string | undefined;
1270
+ }, {
1271
+ coin: string;
1272
+ timestamp: string;
1273
+ funding_rate: string;
1274
+ premium?: string | undefined;
1275
+ }>;
1276
+ declare const OpenInterestSchema: z.ZodObject<{
1277
+ coin: z.ZodString;
1278
+ timestamp: z.ZodString;
1279
+ open_interest: z.ZodString;
1280
+ mark_price: z.ZodOptional<z.ZodString>;
1281
+ oracle_price: z.ZodOptional<z.ZodString>;
1282
+ day_ntl_volume: z.ZodOptional<z.ZodString>;
1283
+ prev_day_price: z.ZodOptional<z.ZodString>;
1284
+ mid_price: z.ZodOptional<z.ZodString>;
1285
+ impact_bid_price: z.ZodOptional<z.ZodString>;
1286
+ impact_ask_price: z.ZodOptional<z.ZodString>;
1287
+ }, "strip", z.ZodTypeAny, {
1288
+ coin: string;
1289
+ timestamp: string;
1290
+ open_interest: string;
1291
+ mid_price?: string | undefined;
1292
+ mark_price?: string | undefined;
1293
+ oracle_price?: string | undefined;
1294
+ day_ntl_volume?: string | undefined;
1295
+ prev_day_price?: string | undefined;
1296
+ impact_bid_price?: string | undefined;
1297
+ impact_ask_price?: string | undefined;
1298
+ }, {
1299
+ coin: string;
1300
+ timestamp: string;
1301
+ open_interest: string;
1302
+ mid_price?: string | undefined;
1303
+ mark_price?: string | undefined;
1304
+ oracle_price?: string | undefined;
1305
+ day_ntl_volume?: string | undefined;
1306
+ prev_day_price?: string | undefined;
1307
+ impact_bid_price?: string | undefined;
1308
+ impact_ask_price?: string | undefined;
1309
+ }>;
1310
+ declare const WsChannelSchema: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1311
+ declare const WsConnectionStateSchema: z.ZodEnum<["connecting", "connected", "disconnected", "reconnecting"]>;
1312
+ declare const WsSubscribedSchema: z.ZodObject<{
1313
+ type: z.ZodLiteral<"subscribed">;
1314
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1315
+ coin: z.ZodOptional<z.ZodString>;
1316
+ }, "strip", z.ZodTypeAny, {
1317
+ type: "subscribed";
1318
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1319
+ coin?: string | undefined;
1320
+ }, {
1321
+ type: "subscribed";
1322
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1323
+ coin?: string | undefined;
1324
+ }>;
1325
+ declare const WsUnsubscribedSchema: z.ZodObject<{
1326
+ type: z.ZodLiteral<"unsubscribed">;
1327
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1328
+ coin: z.ZodOptional<z.ZodString>;
1329
+ }, "strip", z.ZodTypeAny, {
1330
+ type: "unsubscribed";
1331
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1332
+ coin?: string | undefined;
1333
+ }, {
1334
+ type: "unsubscribed";
1335
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1336
+ coin?: string | undefined;
1337
+ }>;
1338
+ declare const WsPongSchema: z.ZodObject<{
1339
+ type: z.ZodLiteral<"pong">;
1340
+ }, "strip", z.ZodTypeAny, {
1341
+ type: "pong";
1342
+ }, {
1343
+ type: "pong";
1344
+ }>;
1345
+ declare const WsErrorSchema: z.ZodObject<{
1346
+ type: z.ZodLiteral<"error">;
1347
+ message: z.ZodString;
1348
+ }, "strip", z.ZodTypeAny, {
1349
+ message: string;
1350
+ type: "error";
1351
+ }, {
1352
+ message: string;
1353
+ type: "error";
1354
+ }>;
1355
+ declare const WsDataSchema: z.ZodObject<{
1356
+ type: z.ZodLiteral<"data">;
1357
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1358
+ coin: z.ZodString;
1359
+ data: z.ZodUnknown;
1360
+ }, "strip", z.ZodTypeAny, {
1361
+ type: "data";
1362
+ coin: string;
1363
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1364
+ data?: unknown;
1365
+ }, {
1366
+ type: "data";
1367
+ coin: string;
1368
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1369
+ data?: unknown;
1370
+ }>;
1371
+ declare const WsReplayStartedSchema: z.ZodObject<{
1372
+ type: z.ZodLiteral<"replay_started">;
1373
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1374
+ coin: z.ZodString;
1375
+ start: z.ZodNumber;
1376
+ end: z.ZodNumber;
1377
+ speed: z.ZodNumber;
1378
+ }, "strip", z.ZodTypeAny, {
1379
+ start: number;
1380
+ end: number;
1381
+ type: "replay_started";
1382
+ coin: string;
1383
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1384
+ speed: number;
1385
+ }, {
1386
+ start: number;
1387
+ end: number;
1388
+ type: "replay_started";
1389
+ coin: string;
1390
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1391
+ speed: number;
1392
+ }>;
1393
+ declare const WsReplayPausedSchema: z.ZodObject<{
1394
+ type: z.ZodLiteral<"replay_paused">;
1395
+ current_timestamp: z.ZodNumber;
1396
+ }, "strip", z.ZodTypeAny, {
1397
+ type: "replay_paused";
1398
+ current_timestamp: number;
1399
+ }, {
1400
+ type: "replay_paused";
1401
+ current_timestamp: number;
1402
+ }>;
1403
+ declare const WsReplayResumedSchema: z.ZodObject<{
1404
+ type: z.ZodLiteral<"replay_resumed">;
1405
+ current_timestamp: z.ZodNumber;
1406
+ }, "strip", z.ZodTypeAny, {
1407
+ type: "replay_resumed";
1408
+ current_timestamp: number;
1409
+ }, {
1410
+ type: "replay_resumed";
1411
+ current_timestamp: number;
1412
+ }>;
1413
+ declare const WsReplayCompletedSchema: z.ZodObject<{
1414
+ type: z.ZodLiteral<"replay_completed">;
1415
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1416
+ coin: z.ZodString;
1417
+ snapshots_sent: z.ZodNumber;
1418
+ }, "strip", z.ZodTypeAny, {
1419
+ type: "replay_completed";
1420
+ coin: string;
1421
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1422
+ snapshots_sent: number;
1423
+ }, {
1424
+ type: "replay_completed";
1425
+ coin: string;
1426
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1427
+ snapshots_sent: number;
1428
+ }>;
1429
+ declare const WsReplayStoppedSchema: z.ZodObject<{
1430
+ type: z.ZodLiteral<"replay_stopped">;
1431
+ }, "strip", z.ZodTypeAny, {
1432
+ type: "replay_stopped";
1433
+ }, {
1434
+ type: "replay_stopped";
1435
+ }>;
1436
+ declare const WsHistoricalDataSchema: z.ZodObject<{
1437
+ type: z.ZodLiteral<"historical_data">;
1438
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1439
+ coin: z.ZodString;
1440
+ timestamp: z.ZodNumber;
1441
+ data: z.ZodUnknown;
1442
+ }, "strip", z.ZodTypeAny, {
1443
+ type: "historical_data";
1444
+ coin: string;
1445
+ timestamp: number;
1446
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1447
+ data?: unknown;
1448
+ }, {
1449
+ type: "historical_data";
1450
+ coin: string;
1451
+ timestamp: number;
1452
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1453
+ data?: unknown;
1454
+ }>;
1455
+ declare const WsStreamStartedSchema: z.ZodObject<{
1456
+ type: z.ZodLiteral<"stream_started">;
1457
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1458
+ coin: z.ZodString;
1459
+ start: z.ZodNumber;
1460
+ end: z.ZodNumber;
1461
+ }, "strip", z.ZodTypeAny, {
1462
+ start: number;
1463
+ end: number;
1464
+ type: "stream_started";
1465
+ coin: string;
1466
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1467
+ }, {
1468
+ start: number;
1469
+ end: number;
1470
+ type: "stream_started";
1471
+ coin: string;
1472
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1473
+ }>;
1474
+ declare const WsStreamProgressSchema: z.ZodObject<{
1475
+ type: z.ZodLiteral<"stream_progress">;
1476
+ snapshots_sent: z.ZodNumber;
1477
+ }, "strip", z.ZodTypeAny, {
1478
+ type: "stream_progress";
1479
+ snapshots_sent: number;
1480
+ }, {
1481
+ type: "stream_progress";
1482
+ snapshots_sent: number;
1483
+ }>;
1484
+ declare const TimestampedRecordSchema: z.ZodObject<{
1485
+ timestamp: z.ZodNumber;
1486
+ data: z.ZodUnknown;
1487
+ }, "strip", z.ZodTypeAny, {
1488
+ timestamp: number;
1489
+ data?: unknown;
1490
+ }, {
1491
+ timestamp: number;
1492
+ data?: unknown;
1493
+ }>;
1494
+ declare const WsHistoricalBatchSchema: z.ZodObject<{
1495
+ type: z.ZodLiteral<"historical_batch">;
1496
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1497
+ coin: z.ZodString;
1498
+ data: z.ZodArray<z.ZodObject<{
1499
+ timestamp: z.ZodNumber;
1500
+ data: z.ZodUnknown;
1501
+ }, "strip", z.ZodTypeAny, {
1502
+ timestamp: number;
1503
+ data?: unknown;
1504
+ }, {
1505
+ timestamp: number;
1506
+ data?: unknown;
1507
+ }>, "many">;
1508
+ }, "strip", z.ZodTypeAny, {
1509
+ data: {
1510
+ timestamp: number;
1511
+ data?: unknown;
1512
+ }[];
1513
+ type: "historical_batch";
1514
+ coin: string;
1515
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1516
+ }, {
1517
+ data: {
1518
+ timestamp: number;
1519
+ data?: unknown;
1520
+ }[];
1521
+ type: "historical_batch";
1522
+ coin: string;
1523
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1524
+ }>;
1525
+ declare const WsStreamCompletedSchema: z.ZodObject<{
1526
+ type: z.ZodLiteral<"stream_completed">;
1527
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1528
+ coin: z.ZodString;
1529
+ snapshots_sent: z.ZodNumber;
1530
+ }, "strip", z.ZodTypeAny, {
1531
+ type: "stream_completed";
1532
+ coin: string;
1533
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1534
+ snapshots_sent: number;
1535
+ }, {
1536
+ type: "stream_completed";
1537
+ coin: string;
1538
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1539
+ snapshots_sent: number;
1540
+ }>;
1541
+ declare const WsStreamStoppedSchema: z.ZodObject<{
1542
+ type: z.ZodLiteral<"stream_stopped">;
1543
+ snapshots_sent: z.ZodNumber;
1544
+ }, "strip", z.ZodTypeAny, {
1545
+ type: "stream_stopped";
1546
+ snapshots_sent: number;
1547
+ }, {
1548
+ type: "stream_stopped";
1549
+ snapshots_sent: number;
1550
+ }>;
1551
+ declare const WsServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1552
+ type: z.ZodLiteral<"subscribed">;
1553
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1554
+ coin: z.ZodOptional<z.ZodString>;
1555
+ }, "strip", z.ZodTypeAny, {
1556
+ type: "subscribed";
1557
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1558
+ coin?: string | undefined;
1559
+ }, {
1560
+ type: "subscribed";
1561
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1562
+ coin?: string | undefined;
1563
+ }>, z.ZodObject<{
1564
+ type: z.ZodLiteral<"unsubscribed">;
1565
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1566
+ coin: z.ZodOptional<z.ZodString>;
1567
+ }, "strip", z.ZodTypeAny, {
1568
+ type: "unsubscribed";
1569
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1570
+ coin?: string | undefined;
1571
+ }, {
1572
+ type: "unsubscribed";
1573
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1574
+ coin?: string | undefined;
1575
+ }>, z.ZodObject<{
1576
+ type: z.ZodLiteral<"pong">;
1577
+ }, "strip", z.ZodTypeAny, {
1578
+ type: "pong";
1579
+ }, {
1580
+ type: "pong";
1581
+ }>, z.ZodObject<{
1582
+ type: z.ZodLiteral<"error">;
1583
+ message: z.ZodString;
1584
+ }, "strip", z.ZodTypeAny, {
1585
+ message: string;
1586
+ type: "error";
1587
+ }, {
1588
+ message: string;
1589
+ type: "error";
1590
+ }>, z.ZodObject<{
1591
+ type: z.ZodLiteral<"data">;
1592
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1593
+ coin: z.ZodString;
1594
+ data: z.ZodUnknown;
1595
+ }, "strip", z.ZodTypeAny, {
1596
+ type: "data";
1597
+ coin: string;
1598
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1599
+ data?: unknown;
1600
+ }, {
1601
+ type: "data";
1602
+ coin: string;
1603
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1604
+ data?: unknown;
1605
+ }>, z.ZodObject<{
1606
+ type: z.ZodLiteral<"replay_started">;
1607
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1608
+ coin: z.ZodString;
1609
+ start: z.ZodNumber;
1610
+ end: z.ZodNumber;
1611
+ speed: z.ZodNumber;
1612
+ }, "strip", z.ZodTypeAny, {
1613
+ start: number;
1614
+ end: number;
1615
+ type: "replay_started";
1616
+ coin: string;
1617
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1618
+ speed: number;
1619
+ }, {
1620
+ start: number;
1621
+ end: number;
1622
+ type: "replay_started";
1623
+ coin: string;
1624
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1625
+ speed: number;
1626
+ }>, z.ZodObject<{
1627
+ type: z.ZodLiteral<"replay_paused">;
1628
+ current_timestamp: z.ZodNumber;
1629
+ }, "strip", z.ZodTypeAny, {
1630
+ type: "replay_paused";
1631
+ current_timestamp: number;
1632
+ }, {
1633
+ type: "replay_paused";
1634
+ current_timestamp: number;
1635
+ }>, z.ZodObject<{
1636
+ type: z.ZodLiteral<"replay_resumed">;
1637
+ current_timestamp: z.ZodNumber;
1638
+ }, "strip", z.ZodTypeAny, {
1639
+ type: "replay_resumed";
1640
+ current_timestamp: number;
1641
+ }, {
1642
+ type: "replay_resumed";
1643
+ current_timestamp: number;
1644
+ }>, z.ZodObject<{
1645
+ type: z.ZodLiteral<"replay_completed">;
1646
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1647
+ coin: z.ZodString;
1648
+ snapshots_sent: z.ZodNumber;
1649
+ }, "strip", z.ZodTypeAny, {
1650
+ type: "replay_completed";
1651
+ coin: string;
1652
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1653
+ snapshots_sent: number;
1654
+ }, {
1655
+ type: "replay_completed";
1656
+ coin: string;
1657
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1658
+ snapshots_sent: number;
1659
+ }>, z.ZodObject<{
1660
+ type: z.ZodLiteral<"replay_stopped">;
1661
+ }, "strip", z.ZodTypeAny, {
1662
+ type: "replay_stopped";
1663
+ }, {
1664
+ type: "replay_stopped";
1665
+ }>, z.ZodObject<{
1666
+ type: z.ZodLiteral<"historical_data">;
1667
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1668
+ coin: z.ZodString;
1669
+ timestamp: z.ZodNumber;
1670
+ data: z.ZodUnknown;
1671
+ }, "strip", z.ZodTypeAny, {
1672
+ type: "historical_data";
1673
+ coin: string;
1674
+ timestamp: number;
1675
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1676
+ data?: unknown;
1677
+ }, {
1678
+ type: "historical_data";
1679
+ coin: string;
1680
+ timestamp: number;
1681
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1682
+ data?: unknown;
1683
+ }>, z.ZodObject<{
1684
+ type: z.ZodLiteral<"stream_started">;
1685
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1686
+ coin: z.ZodString;
1687
+ start: z.ZodNumber;
1688
+ end: z.ZodNumber;
1689
+ }, "strip", z.ZodTypeAny, {
1690
+ start: number;
1691
+ end: number;
1692
+ type: "stream_started";
1693
+ coin: string;
1694
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1695
+ }, {
1696
+ start: number;
1697
+ end: number;
1698
+ type: "stream_started";
1699
+ coin: string;
1700
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1701
+ }>, z.ZodObject<{
1702
+ type: z.ZodLiteral<"stream_progress">;
1703
+ snapshots_sent: z.ZodNumber;
1704
+ }, "strip", z.ZodTypeAny, {
1705
+ type: "stream_progress";
1706
+ snapshots_sent: number;
1707
+ }, {
1708
+ type: "stream_progress";
1709
+ snapshots_sent: number;
1710
+ }>, z.ZodObject<{
1711
+ type: z.ZodLiteral<"historical_batch">;
1712
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1713
+ coin: z.ZodString;
1714
+ data: z.ZodArray<z.ZodObject<{
1715
+ timestamp: z.ZodNumber;
1716
+ data: z.ZodUnknown;
1717
+ }, "strip", z.ZodTypeAny, {
1718
+ timestamp: number;
1719
+ data?: unknown;
1720
+ }, {
1721
+ timestamp: number;
1722
+ data?: unknown;
1723
+ }>, "many">;
1724
+ }, "strip", z.ZodTypeAny, {
1725
+ data: {
1726
+ timestamp: number;
1727
+ data?: unknown;
1728
+ }[];
1729
+ type: "historical_batch";
1730
+ coin: string;
1731
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1732
+ }, {
1733
+ data: {
1734
+ timestamp: number;
1735
+ data?: unknown;
1736
+ }[];
1737
+ type: "historical_batch";
1738
+ coin: string;
1739
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1740
+ }>, z.ZodObject<{
1741
+ type: z.ZodLiteral<"stream_completed">;
1742
+ channel: z.ZodEnum<["orderbook", "trades", "ticker", "all_tickers"]>;
1743
+ coin: z.ZodString;
1744
+ snapshots_sent: z.ZodNumber;
1745
+ }, "strip", z.ZodTypeAny, {
1746
+ type: "stream_completed";
1747
+ coin: string;
1748
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1749
+ snapshots_sent: number;
1750
+ }, {
1751
+ type: "stream_completed";
1752
+ coin: string;
1753
+ channel: "orderbook" | "trades" | "ticker" | "all_tickers";
1754
+ snapshots_sent: number;
1755
+ }>, z.ZodObject<{
1756
+ type: z.ZodLiteral<"stream_stopped">;
1757
+ snapshots_sent: z.ZodNumber;
1758
+ }, "strip", z.ZodTypeAny, {
1759
+ type: "stream_stopped";
1760
+ snapshots_sent: number;
1761
+ }, {
1762
+ type: "stream_stopped";
1763
+ snapshots_sent: number;
1764
+ }>]>;
1765
+ declare const OrderBookResponseSchema: z.ZodObject<{
1766
+ success: z.ZodBoolean;
1767
+ data: z.ZodObject<{
1768
+ coin: z.ZodString;
1769
+ timestamp: z.ZodString;
1770
+ bids: z.ZodArray<z.ZodObject<{
1771
+ px: z.ZodString;
1772
+ sz: z.ZodString;
1773
+ n: z.ZodNumber;
1774
+ }, "strip", z.ZodTypeAny, {
1775
+ px: string;
1776
+ sz: string;
1777
+ n: number;
1778
+ }, {
1779
+ px: string;
1780
+ sz: string;
1781
+ n: number;
1782
+ }>, "many">;
1783
+ asks: z.ZodArray<z.ZodObject<{
1784
+ px: z.ZodString;
1785
+ sz: z.ZodString;
1786
+ n: z.ZodNumber;
1787
+ }, "strip", z.ZodTypeAny, {
1788
+ px: string;
1789
+ sz: string;
1790
+ n: number;
1791
+ }, {
1792
+ px: string;
1793
+ sz: string;
1794
+ n: number;
1795
+ }>, "many">;
1796
+ mid_price: z.ZodOptional<z.ZodString>;
1797
+ spread: z.ZodOptional<z.ZodString>;
1798
+ spread_bps: z.ZodOptional<z.ZodString>;
1799
+ }, "strip", z.ZodTypeAny, {
1800
+ coin: string;
1801
+ timestamp: string;
1802
+ bids: {
1803
+ px: string;
1804
+ sz: string;
1805
+ n: number;
1806
+ }[];
1807
+ asks: {
1808
+ px: string;
1809
+ sz: string;
1810
+ n: number;
1811
+ }[];
1812
+ mid_price?: string | undefined;
1813
+ spread?: string | undefined;
1814
+ spread_bps?: string | undefined;
1815
+ }, {
1816
+ coin: string;
1817
+ timestamp: string;
1818
+ bids: {
1819
+ px: string;
1820
+ sz: string;
1821
+ n: number;
1822
+ }[];
1823
+ asks: {
1824
+ px: string;
1825
+ sz: string;
1826
+ n: number;
1827
+ }[];
1828
+ mid_price?: string | undefined;
1829
+ spread?: string | undefined;
1830
+ spread_bps?: string | undefined;
1831
+ }>;
1832
+ meta: z.ZodObject<{
1833
+ count: z.ZodNumber;
1834
+ next_cursor: z.ZodOptional<z.ZodString>;
1835
+ request_id: z.ZodString;
1836
+ }, "strip", z.ZodTypeAny, {
1837
+ count: number;
1838
+ request_id: string;
1839
+ next_cursor?: string | undefined;
1840
+ }, {
1841
+ count: number;
1842
+ request_id: string;
1843
+ next_cursor?: string | undefined;
1844
+ }>;
1845
+ }, "strip", z.ZodTypeAny, {
1846
+ data: {
1847
+ coin: string;
1848
+ timestamp: string;
1849
+ bids: {
1850
+ px: string;
1851
+ sz: string;
1852
+ n: number;
1853
+ }[];
1854
+ asks: {
1855
+ px: string;
1856
+ sz: string;
1857
+ n: number;
1858
+ }[];
1859
+ mid_price?: string | undefined;
1860
+ spread?: string | undefined;
1861
+ spread_bps?: string | undefined;
1862
+ };
1863
+ success: boolean;
1864
+ meta: {
1865
+ count: number;
1866
+ request_id: string;
1867
+ next_cursor?: string | undefined;
1868
+ };
1869
+ }, {
1870
+ data: {
1871
+ coin: string;
1872
+ timestamp: string;
1873
+ bids: {
1874
+ px: string;
1875
+ sz: string;
1876
+ n: number;
1877
+ }[];
1878
+ asks: {
1879
+ px: string;
1880
+ sz: string;
1881
+ n: number;
1882
+ }[];
1883
+ mid_price?: string | undefined;
1884
+ spread?: string | undefined;
1885
+ spread_bps?: string | undefined;
1886
+ };
1887
+ success: boolean;
1888
+ meta: {
1889
+ count: number;
1890
+ request_id: string;
1891
+ next_cursor?: string | undefined;
1892
+ };
1893
+ }>;
1894
+ declare const OrderBookArrayResponseSchema: z.ZodObject<{
1895
+ success: z.ZodBoolean;
1896
+ data: z.ZodArray<z.ZodObject<{
1897
+ coin: z.ZodString;
1898
+ timestamp: z.ZodString;
1899
+ bids: z.ZodArray<z.ZodObject<{
1900
+ px: z.ZodString;
1901
+ sz: z.ZodString;
1902
+ n: z.ZodNumber;
1903
+ }, "strip", z.ZodTypeAny, {
1904
+ px: string;
1905
+ sz: string;
1906
+ n: number;
1907
+ }, {
1908
+ px: string;
1909
+ sz: string;
1910
+ n: number;
1911
+ }>, "many">;
1912
+ asks: z.ZodArray<z.ZodObject<{
1913
+ px: z.ZodString;
1914
+ sz: z.ZodString;
1915
+ n: z.ZodNumber;
1916
+ }, "strip", z.ZodTypeAny, {
1917
+ px: string;
1918
+ sz: string;
1919
+ n: number;
1920
+ }, {
1921
+ px: string;
1922
+ sz: string;
1923
+ n: number;
1924
+ }>, "many">;
1925
+ mid_price: z.ZodOptional<z.ZodString>;
1926
+ spread: z.ZodOptional<z.ZodString>;
1927
+ spread_bps: z.ZodOptional<z.ZodString>;
1928
+ }, "strip", z.ZodTypeAny, {
1929
+ coin: string;
1930
+ timestamp: string;
1931
+ bids: {
1932
+ px: string;
1933
+ sz: string;
1934
+ n: number;
1935
+ }[];
1936
+ asks: {
1937
+ px: string;
1938
+ sz: string;
1939
+ n: number;
1940
+ }[];
1941
+ mid_price?: string | undefined;
1942
+ spread?: string | undefined;
1943
+ spread_bps?: string | undefined;
1944
+ }, {
1945
+ coin: string;
1946
+ timestamp: string;
1947
+ bids: {
1948
+ px: string;
1949
+ sz: string;
1950
+ n: number;
1951
+ }[];
1952
+ asks: {
1953
+ px: string;
1954
+ sz: string;
1955
+ n: number;
1956
+ }[];
1957
+ mid_price?: string | undefined;
1958
+ spread?: string | undefined;
1959
+ spread_bps?: string | undefined;
1960
+ }>, "many">;
1961
+ meta: z.ZodObject<{
1962
+ count: z.ZodNumber;
1963
+ next_cursor: z.ZodOptional<z.ZodString>;
1964
+ request_id: z.ZodString;
1965
+ }, "strip", z.ZodTypeAny, {
1966
+ count: number;
1967
+ request_id: string;
1968
+ next_cursor?: string | undefined;
1969
+ }, {
1970
+ count: number;
1971
+ request_id: string;
1972
+ next_cursor?: string | undefined;
1973
+ }>;
1974
+ }, "strip", z.ZodTypeAny, {
1975
+ data: {
1976
+ coin: string;
1977
+ timestamp: string;
1978
+ bids: {
1979
+ px: string;
1980
+ sz: string;
1981
+ n: number;
1982
+ }[];
1983
+ asks: {
1984
+ px: string;
1985
+ sz: string;
1986
+ n: number;
1987
+ }[];
1988
+ mid_price?: string | undefined;
1989
+ spread?: string | undefined;
1990
+ spread_bps?: string | undefined;
1991
+ }[];
1992
+ success: boolean;
1993
+ meta: {
1994
+ count: number;
1995
+ request_id: string;
1996
+ next_cursor?: string | undefined;
1997
+ };
1998
+ }, {
1999
+ data: {
2000
+ coin: string;
2001
+ timestamp: string;
2002
+ bids: {
2003
+ px: string;
2004
+ sz: string;
2005
+ n: number;
2006
+ }[];
2007
+ asks: {
2008
+ px: string;
2009
+ sz: string;
2010
+ n: number;
2011
+ }[];
2012
+ mid_price?: string | undefined;
2013
+ spread?: string | undefined;
2014
+ spread_bps?: string | undefined;
2015
+ }[];
2016
+ success: boolean;
2017
+ meta: {
2018
+ count: number;
2019
+ request_id: string;
2020
+ next_cursor?: string | undefined;
2021
+ };
2022
+ }>;
2023
+ declare const TradeArrayResponseSchema: z.ZodObject<{
2024
+ success: z.ZodBoolean;
2025
+ data: z.ZodArray<z.ZodObject<{
2026
+ coin: z.ZodString;
2027
+ side: z.ZodEnum<["A", "B"]>;
2028
+ price: z.ZodString;
2029
+ size: z.ZodString;
2030
+ timestamp: z.ZodString;
2031
+ tx_hash: z.ZodOptional<z.ZodString>;
2032
+ trade_id: z.ZodOptional<z.ZodNumber>;
2033
+ order_id: z.ZodOptional<z.ZodNumber>;
2034
+ crossed: z.ZodOptional<z.ZodBoolean>;
2035
+ fee: z.ZodOptional<z.ZodString>;
2036
+ fee_token: z.ZodOptional<z.ZodString>;
2037
+ closed_pnl: z.ZodOptional<z.ZodString>;
2038
+ direction: z.ZodOptional<z.ZodEnum<["Open Long", "Open Short", "Close Long", "Close Short"]>>;
2039
+ start_position: z.ZodOptional<z.ZodString>;
2040
+ source: z.ZodOptional<z.ZodEnum<["s3", "ws", "api", "live"]>>;
2041
+ user_address: z.ZodOptional<z.ZodString>;
2042
+ maker_address: z.ZodOptional<z.ZodString>;
2043
+ taker_address: z.ZodOptional<z.ZodString>;
2044
+ }, "strip", z.ZodTypeAny, {
2045
+ coin: string;
2046
+ timestamp: string;
2047
+ side: "A" | "B";
2048
+ price: string;
2049
+ size: string;
2050
+ tx_hash?: string | undefined;
2051
+ trade_id?: number | undefined;
2052
+ order_id?: number | undefined;
2053
+ crossed?: boolean | undefined;
2054
+ fee?: string | undefined;
2055
+ fee_token?: string | undefined;
2056
+ closed_pnl?: string | undefined;
2057
+ direction?: "Open Long" | "Open Short" | "Close Long" | "Close Short" | undefined;
2058
+ start_position?: string | undefined;
2059
+ source?: "s3" | "ws" | "api" | "live" | undefined;
2060
+ user_address?: string | undefined;
2061
+ maker_address?: string | undefined;
2062
+ taker_address?: string | undefined;
2063
+ }, {
2064
+ coin: string;
2065
+ timestamp: string;
2066
+ side: "A" | "B";
2067
+ price: string;
2068
+ size: string;
2069
+ tx_hash?: string | undefined;
2070
+ trade_id?: number | undefined;
2071
+ order_id?: number | undefined;
2072
+ crossed?: boolean | undefined;
2073
+ fee?: string | undefined;
2074
+ fee_token?: string | undefined;
2075
+ closed_pnl?: string | undefined;
2076
+ direction?: "Open Long" | "Open Short" | "Close Long" | "Close Short" | undefined;
2077
+ start_position?: string | undefined;
2078
+ source?: "s3" | "ws" | "api" | "live" | undefined;
2079
+ user_address?: string | undefined;
2080
+ maker_address?: string | undefined;
2081
+ taker_address?: string | undefined;
2082
+ }>, "many">;
2083
+ meta: z.ZodObject<{
2084
+ count: z.ZodNumber;
2085
+ next_cursor: z.ZodOptional<z.ZodString>;
2086
+ request_id: z.ZodString;
2087
+ }, "strip", z.ZodTypeAny, {
2088
+ count: number;
2089
+ request_id: string;
2090
+ next_cursor?: string | undefined;
2091
+ }, {
2092
+ count: number;
2093
+ request_id: string;
2094
+ next_cursor?: string | undefined;
2095
+ }>;
2096
+ }, "strip", z.ZodTypeAny, {
2097
+ data: {
2098
+ coin: string;
2099
+ timestamp: string;
2100
+ side: "A" | "B";
2101
+ price: string;
2102
+ size: string;
2103
+ tx_hash?: string | undefined;
2104
+ trade_id?: number | undefined;
2105
+ order_id?: number | undefined;
2106
+ crossed?: boolean | undefined;
2107
+ fee?: string | undefined;
2108
+ fee_token?: string | undefined;
2109
+ closed_pnl?: string | undefined;
2110
+ direction?: "Open Long" | "Open Short" | "Close Long" | "Close Short" | undefined;
2111
+ start_position?: string | undefined;
2112
+ source?: "s3" | "ws" | "api" | "live" | undefined;
2113
+ user_address?: string | undefined;
2114
+ maker_address?: string | undefined;
2115
+ taker_address?: string | undefined;
2116
+ }[];
2117
+ success: boolean;
2118
+ meta: {
2119
+ count: number;
2120
+ request_id: string;
2121
+ next_cursor?: string | undefined;
2122
+ };
2123
+ }, {
2124
+ data: {
2125
+ coin: string;
2126
+ timestamp: string;
2127
+ side: "A" | "B";
2128
+ price: string;
2129
+ size: string;
2130
+ tx_hash?: string | undefined;
2131
+ trade_id?: number | undefined;
2132
+ order_id?: number | undefined;
2133
+ crossed?: boolean | undefined;
2134
+ fee?: string | undefined;
2135
+ fee_token?: string | undefined;
2136
+ closed_pnl?: string | undefined;
2137
+ direction?: "Open Long" | "Open Short" | "Close Long" | "Close Short" | undefined;
2138
+ start_position?: string | undefined;
2139
+ source?: "s3" | "ws" | "api" | "live" | undefined;
2140
+ user_address?: string | undefined;
2141
+ maker_address?: string | undefined;
2142
+ taker_address?: string | undefined;
2143
+ }[];
2144
+ success: boolean;
2145
+ meta: {
2146
+ count: number;
2147
+ request_id: string;
2148
+ next_cursor?: string | undefined;
2149
+ };
2150
+ }>;
2151
+ declare const InstrumentResponseSchema: z.ZodObject<{
2152
+ success: z.ZodBoolean;
2153
+ data: z.ZodObject<{
2154
+ name: z.ZodString;
2155
+ szDecimals: z.ZodNumber;
2156
+ maxLeverage: z.ZodOptional<z.ZodNumber>;
2157
+ onlyIsolated: z.ZodOptional<z.ZodBoolean>;
2158
+ instrumentType: z.ZodOptional<z.ZodEnum<["perp", "spot"]>>;
2159
+ isActive: z.ZodBoolean;
2160
+ }, "strip", z.ZodTypeAny, {
2161
+ name: string;
2162
+ szDecimals: number;
2163
+ isActive: boolean;
2164
+ maxLeverage?: number | undefined;
2165
+ onlyIsolated?: boolean | undefined;
2166
+ instrumentType?: "perp" | "spot" | undefined;
2167
+ }, {
2168
+ name: string;
2169
+ szDecimals: number;
2170
+ isActive: boolean;
2171
+ maxLeverage?: number | undefined;
2172
+ onlyIsolated?: boolean | undefined;
2173
+ instrumentType?: "perp" | "spot" | undefined;
2174
+ }>;
2175
+ meta: z.ZodObject<{
2176
+ count: z.ZodNumber;
2177
+ next_cursor: z.ZodOptional<z.ZodString>;
2178
+ request_id: z.ZodString;
2179
+ }, "strip", z.ZodTypeAny, {
2180
+ count: number;
2181
+ request_id: string;
2182
+ next_cursor?: string | undefined;
2183
+ }, {
2184
+ count: number;
2185
+ request_id: string;
2186
+ next_cursor?: string | undefined;
2187
+ }>;
2188
+ }, "strip", z.ZodTypeAny, {
2189
+ data: {
2190
+ name: string;
2191
+ szDecimals: number;
2192
+ isActive: boolean;
2193
+ maxLeverage?: number | undefined;
2194
+ onlyIsolated?: boolean | undefined;
2195
+ instrumentType?: "perp" | "spot" | undefined;
2196
+ };
2197
+ success: boolean;
2198
+ meta: {
2199
+ count: number;
2200
+ request_id: string;
2201
+ next_cursor?: string | undefined;
2202
+ };
2203
+ }, {
2204
+ data: {
2205
+ name: string;
2206
+ szDecimals: number;
2207
+ isActive: boolean;
2208
+ maxLeverage?: number | undefined;
2209
+ onlyIsolated?: boolean | undefined;
2210
+ instrumentType?: "perp" | "spot" | undefined;
2211
+ };
2212
+ success: boolean;
2213
+ meta: {
2214
+ count: number;
2215
+ request_id: string;
2216
+ next_cursor?: string | undefined;
2217
+ };
2218
+ }>;
2219
+ declare const InstrumentArrayResponseSchema: z.ZodObject<{
2220
+ success: z.ZodBoolean;
2221
+ data: z.ZodArray<z.ZodObject<{
2222
+ name: z.ZodString;
2223
+ szDecimals: z.ZodNumber;
2224
+ maxLeverage: z.ZodOptional<z.ZodNumber>;
2225
+ onlyIsolated: z.ZodOptional<z.ZodBoolean>;
2226
+ instrumentType: z.ZodOptional<z.ZodEnum<["perp", "spot"]>>;
2227
+ isActive: z.ZodBoolean;
2228
+ }, "strip", z.ZodTypeAny, {
2229
+ name: string;
2230
+ szDecimals: number;
2231
+ isActive: boolean;
2232
+ maxLeverage?: number | undefined;
2233
+ onlyIsolated?: boolean | undefined;
2234
+ instrumentType?: "perp" | "spot" | undefined;
2235
+ }, {
2236
+ name: string;
2237
+ szDecimals: number;
2238
+ isActive: boolean;
2239
+ maxLeverage?: number | undefined;
2240
+ onlyIsolated?: boolean | undefined;
2241
+ instrumentType?: "perp" | "spot" | undefined;
2242
+ }>, "many">;
2243
+ meta: z.ZodObject<{
2244
+ count: z.ZodNumber;
2245
+ next_cursor: z.ZodOptional<z.ZodString>;
2246
+ request_id: z.ZodString;
2247
+ }, "strip", z.ZodTypeAny, {
2248
+ count: number;
2249
+ request_id: string;
2250
+ next_cursor?: string | undefined;
2251
+ }, {
2252
+ count: number;
2253
+ request_id: string;
2254
+ next_cursor?: string | undefined;
2255
+ }>;
2256
+ }, "strip", z.ZodTypeAny, {
2257
+ data: {
2258
+ name: string;
2259
+ szDecimals: number;
2260
+ isActive: boolean;
2261
+ maxLeverage?: number | undefined;
2262
+ onlyIsolated?: boolean | undefined;
2263
+ instrumentType?: "perp" | "spot" | undefined;
2264
+ }[];
2265
+ success: boolean;
2266
+ meta: {
2267
+ count: number;
2268
+ request_id: string;
2269
+ next_cursor?: string | undefined;
2270
+ };
2271
+ }, {
2272
+ data: {
2273
+ name: string;
2274
+ szDecimals: number;
2275
+ isActive: boolean;
2276
+ maxLeverage?: number | undefined;
2277
+ onlyIsolated?: boolean | undefined;
2278
+ instrumentType?: "perp" | "spot" | undefined;
2279
+ }[];
2280
+ success: boolean;
2281
+ meta: {
2282
+ count: number;
2283
+ request_id: string;
2284
+ next_cursor?: string | undefined;
2285
+ };
2286
+ }>;
2287
+ declare const FundingRateResponseSchema: z.ZodObject<{
2288
+ success: z.ZodBoolean;
2289
+ data: z.ZodObject<{
2290
+ coin: z.ZodString;
2291
+ timestamp: z.ZodString;
2292
+ funding_rate: z.ZodString;
2293
+ premium: z.ZodOptional<z.ZodString>;
2294
+ }, "strip", z.ZodTypeAny, {
2295
+ coin: string;
2296
+ timestamp: string;
2297
+ funding_rate: string;
2298
+ premium?: string | undefined;
2299
+ }, {
2300
+ coin: string;
2301
+ timestamp: string;
2302
+ funding_rate: string;
2303
+ premium?: string | undefined;
2304
+ }>;
2305
+ meta: z.ZodObject<{
2306
+ count: z.ZodNumber;
2307
+ next_cursor: z.ZodOptional<z.ZodString>;
2308
+ request_id: z.ZodString;
2309
+ }, "strip", z.ZodTypeAny, {
2310
+ count: number;
2311
+ request_id: string;
2312
+ next_cursor?: string | undefined;
2313
+ }, {
2314
+ count: number;
2315
+ request_id: string;
2316
+ next_cursor?: string | undefined;
2317
+ }>;
2318
+ }, "strip", z.ZodTypeAny, {
2319
+ data: {
2320
+ coin: string;
2321
+ timestamp: string;
2322
+ funding_rate: string;
2323
+ premium?: string | undefined;
2324
+ };
2325
+ success: boolean;
2326
+ meta: {
2327
+ count: number;
2328
+ request_id: string;
2329
+ next_cursor?: string | undefined;
2330
+ };
2331
+ }, {
2332
+ data: {
2333
+ coin: string;
2334
+ timestamp: string;
2335
+ funding_rate: string;
2336
+ premium?: string | undefined;
2337
+ };
2338
+ success: boolean;
2339
+ meta: {
2340
+ count: number;
2341
+ request_id: string;
2342
+ next_cursor?: string | undefined;
2343
+ };
2344
+ }>;
2345
+ declare const FundingRateArrayResponseSchema: z.ZodObject<{
2346
+ success: z.ZodBoolean;
2347
+ data: z.ZodArray<z.ZodObject<{
2348
+ coin: z.ZodString;
2349
+ timestamp: z.ZodString;
2350
+ funding_rate: z.ZodString;
2351
+ premium: z.ZodOptional<z.ZodString>;
2352
+ }, "strip", z.ZodTypeAny, {
2353
+ coin: string;
2354
+ timestamp: string;
2355
+ funding_rate: string;
2356
+ premium?: string | undefined;
2357
+ }, {
2358
+ coin: string;
2359
+ timestamp: string;
2360
+ funding_rate: string;
2361
+ premium?: string | undefined;
2362
+ }>, "many">;
2363
+ meta: z.ZodObject<{
2364
+ count: z.ZodNumber;
2365
+ next_cursor: z.ZodOptional<z.ZodString>;
2366
+ request_id: z.ZodString;
2367
+ }, "strip", z.ZodTypeAny, {
2368
+ count: number;
2369
+ request_id: string;
2370
+ next_cursor?: string | undefined;
2371
+ }, {
2372
+ count: number;
2373
+ request_id: string;
2374
+ next_cursor?: string | undefined;
2375
+ }>;
2376
+ }, "strip", z.ZodTypeAny, {
2377
+ data: {
2378
+ coin: string;
2379
+ timestamp: string;
2380
+ funding_rate: string;
2381
+ premium?: string | undefined;
2382
+ }[];
2383
+ success: boolean;
2384
+ meta: {
2385
+ count: number;
2386
+ request_id: string;
2387
+ next_cursor?: string | undefined;
2388
+ };
2389
+ }, {
2390
+ data: {
2391
+ coin: string;
2392
+ timestamp: string;
2393
+ funding_rate: string;
2394
+ premium?: string | undefined;
2395
+ }[];
2396
+ success: boolean;
2397
+ meta: {
2398
+ count: number;
2399
+ request_id: string;
2400
+ next_cursor?: string | undefined;
2401
+ };
2402
+ }>;
2403
+ declare const OpenInterestResponseSchema: z.ZodObject<{
2404
+ success: z.ZodBoolean;
2405
+ data: z.ZodObject<{
2406
+ coin: z.ZodString;
2407
+ timestamp: z.ZodString;
2408
+ open_interest: z.ZodString;
2409
+ mark_price: z.ZodOptional<z.ZodString>;
2410
+ oracle_price: z.ZodOptional<z.ZodString>;
2411
+ day_ntl_volume: z.ZodOptional<z.ZodString>;
2412
+ prev_day_price: z.ZodOptional<z.ZodString>;
2413
+ mid_price: z.ZodOptional<z.ZodString>;
2414
+ impact_bid_price: z.ZodOptional<z.ZodString>;
2415
+ impact_ask_price: z.ZodOptional<z.ZodString>;
2416
+ }, "strip", z.ZodTypeAny, {
2417
+ coin: string;
2418
+ timestamp: string;
2419
+ open_interest: string;
2420
+ mid_price?: string | undefined;
2421
+ mark_price?: string | undefined;
2422
+ oracle_price?: string | undefined;
2423
+ day_ntl_volume?: string | undefined;
2424
+ prev_day_price?: string | undefined;
2425
+ impact_bid_price?: string | undefined;
2426
+ impact_ask_price?: string | undefined;
2427
+ }, {
2428
+ coin: string;
2429
+ timestamp: string;
2430
+ open_interest: string;
2431
+ mid_price?: string | undefined;
2432
+ mark_price?: string | undefined;
2433
+ oracle_price?: string | undefined;
2434
+ day_ntl_volume?: string | undefined;
2435
+ prev_day_price?: string | undefined;
2436
+ impact_bid_price?: string | undefined;
2437
+ impact_ask_price?: string | undefined;
2438
+ }>;
2439
+ meta: z.ZodObject<{
2440
+ count: z.ZodNumber;
2441
+ next_cursor: z.ZodOptional<z.ZodString>;
2442
+ request_id: z.ZodString;
2443
+ }, "strip", z.ZodTypeAny, {
2444
+ count: number;
2445
+ request_id: string;
2446
+ next_cursor?: string | undefined;
2447
+ }, {
2448
+ count: number;
2449
+ request_id: string;
2450
+ next_cursor?: string | undefined;
2451
+ }>;
2452
+ }, "strip", z.ZodTypeAny, {
2453
+ data: {
2454
+ coin: string;
2455
+ timestamp: string;
2456
+ open_interest: string;
2457
+ mid_price?: string | undefined;
2458
+ mark_price?: string | undefined;
2459
+ oracle_price?: string | undefined;
2460
+ day_ntl_volume?: string | undefined;
2461
+ prev_day_price?: string | undefined;
2462
+ impact_bid_price?: string | undefined;
2463
+ impact_ask_price?: string | undefined;
2464
+ };
2465
+ success: boolean;
2466
+ meta: {
2467
+ count: number;
2468
+ request_id: string;
2469
+ next_cursor?: string | undefined;
2470
+ };
2471
+ }, {
2472
+ data: {
2473
+ coin: string;
2474
+ timestamp: string;
2475
+ open_interest: string;
2476
+ mid_price?: string | undefined;
2477
+ mark_price?: string | undefined;
2478
+ oracle_price?: string | undefined;
2479
+ day_ntl_volume?: string | undefined;
2480
+ prev_day_price?: string | undefined;
2481
+ impact_bid_price?: string | undefined;
2482
+ impact_ask_price?: string | undefined;
2483
+ };
2484
+ success: boolean;
2485
+ meta: {
2486
+ count: number;
2487
+ request_id: string;
2488
+ next_cursor?: string | undefined;
2489
+ };
2490
+ }>;
2491
+ declare const OpenInterestArrayResponseSchema: z.ZodObject<{
2492
+ success: z.ZodBoolean;
2493
+ data: z.ZodArray<z.ZodObject<{
2494
+ coin: z.ZodString;
2495
+ timestamp: z.ZodString;
2496
+ open_interest: z.ZodString;
2497
+ mark_price: z.ZodOptional<z.ZodString>;
2498
+ oracle_price: z.ZodOptional<z.ZodString>;
2499
+ day_ntl_volume: z.ZodOptional<z.ZodString>;
2500
+ prev_day_price: z.ZodOptional<z.ZodString>;
2501
+ mid_price: z.ZodOptional<z.ZodString>;
2502
+ impact_bid_price: z.ZodOptional<z.ZodString>;
2503
+ impact_ask_price: z.ZodOptional<z.ZodString>;
2504
+ }, "strip", z.ZodTypeAny, {
2505
+ coin: string;
2506
+ timestamp: string;
2507
+ open_interest: string;
2508
+ mid_price?: string | undefined;
2509
+ mark_price?: string | undefined;
2510
+ oracle_price?: string | undefined;
2511
+ day_ntl_volume?: string | undefined;
2512
+ prev_day_price?: string | undefined;
2513
+ impact_bid_price?: string | undefined;
2514
+ impact_ask_price?: string | undefined;
2515
+ }, {
2516
+ coin: string;
2517
+ timestamp: string;
2518
+ open_interest: string;
2519
+ mid_price?: string | undefined;
2520
+ mark_price?: string | undefined;
2521
+ oracle_price?: string | undefined;
2522
+ day_ntl_volume?: string | undefined;
2523
+ prev_day_price?: string | undefined;
2524
+ impact_bid_price?: string | undefined;
2525
+ impact_ask_price?: string | undefined;
2526
+ }>, "many">;
2527
+ meta: z.ZodObject<{
2528
+ count: z.ZodNumber;
2529
+ next_cursor: z.ZodOptional<z.ZodString>;
2530
+ request_id: z.ZodString;
2531
+ }, "strip", z.ZodTypeAny, {
2532
+ count: number;
2533
+ request_id: string;
2534
+ next_cursor?: string | undefined;
2535
+ }, {
2536
+ count: number;
2537
+ request_id: string;
2538
+ next_cursor?: string | undefined;
2539
+ }>;
2540
+ }, "strip", z.ZodTypeAny, {
2541
+ data: {
2542
+ coin: string;
2543
+ timestamp: string;
2544
+ open_interest: string;
2545
+ mid_price?: string | undefined;
2546
+ mark_price?: string | undefined;
2547
+ oracle_price?: string | undefined;
2548
+ day_ntl_volume?: string | undefined;
2549
+ prev_day_price?: string | undefined;
2550
+ impact_bid_price?: string | undefined;
2551
+ impact_ask_price?: string | undefined;
2552
+ }[];
2553
+ success: boolean;
2554
+ meta: {
2555
+ count: number;
2556
+ request_id: string;
2557
+ next_cursor?: string | undefined;
2558
+ };
2559
+ }, {
2560
+ data: {
2561
+ coin: string;
2562
+ timestamp: string;
2563
+ open_interest: string;
2564
+ mid_price?: string | undefined;
2565
+ mark_price?: string | undefined;
2566
+ oracle_price?: string | undefined;
2567
+ day_ntl_volume?: string | undefined;
2568
+ prev_day_price?: string | undefined;
2569
+ impact_bid_price?: string | undefined;
2570
+ impact_ask_price?: string | undefined;
2571
+ }[];
2572
+ success: boolean;
2573
+ meta: {
2574
+ count: number;
2575
+ request_id: string;
2576
+ next_cursor?: string | undefined;
2577
+ };
2578
+ }>;
2579
+ type ValidatedApiMeta = z.infer<typeof ApiMetaSchema>;
2580
+ type ValidatedPriceLevel = z.infer<typeof PriceLevelSchema>;
2581
+ type ValidatedOrderBook = z.infer<typeof OrderBookSchema>;
2582
+ type ValidatedTrade = z.infer<typeof TradeSchema>;
2583
+ type ValidatedInstrument = z.infer<typeof InstrumentSchema>;
2584
+ type ValidatedFundingRate = z.infer<typeof FundingRateSchema>;
2585
+ type ValidatedOpenInterest = z.infer<typeof OpenInterestSchema>;
2586
+ type ValidatedWsServerMessage = z.infer<typeof WsServerMessageSchema>;
2587
+
2588
+ export { type ApiError, type ApiMeta, ApiMetaSchema, type ApiResponse, ApiResponseSchema, type ClientOptions, type DataSource, DataSourceSchema, type FundingRate, FundingRateArrayResponseSchema, FundingRateResponseSchema, FundingRateSchema, type GetOrderBookParams, type GetTradesParams, type Instrument, InstrumentArrayResponseSchema, InstrumentResponseSchema, InstrumentSchema, type InstrumentType, InstrumentTypeSchema, type OpenInterest, OpenInterestArrayResponseSchema, OpenInterestResponseSchema, OpenInterestSchema, type OrderBook, OrderBookArrayResponseSchema, type OrderBookHistoryParams, OrderBookResponseSchema, OrderBookSchema, OxArchive, OxArchiveError, OxArchiveWs, type PaginationParams, type PriceLevel, PriceLevelSchema, type TimeRangeParams, type Timestamp, type TimestampedRecord, TimestampedRecordSchema, type Trade, TradeArrayResponseSchema, type TradeDirection, TradeDirectionSchema, TradeSchema, type TradeSide, TradeSideSchema, type ValidatedApiMeta, type ValidatedFundingRate, type ValidatedInstrument, type ValidatedOpenInterest, type ValidatedOrderBook, type ValidatedPriceLevel, type ValidatedTrade, type ValidatedWsServerMessage, type WsChannel, WsChannelSchema, type WsClientMessage, type WsConnectionState, WsConnectionStateSchema, type WsData, WsDataSchema, type WsError, WsErrorSchema, type WsEventHandlers, type WsHistoricalBatch, WsHistoricalBatchSchema, type WsHistoricalData, WsHistoricalDataSchema, type WsOptions, type WsPing, type WsPong, WsPongSchema, type WsReplay, type WsReplayCompleted, WsReplayCompletedSchema, type WsReplayPause, type WsReplayPaused, WsReplayPausedSchema, type WsReplayResume, type WsReplayResumed, WsReplayResumedSchema, type WsReplaySeek, type WsReplayStarted, WsReplayStartedSchema, type WsReplayStop, type WsReplayStopped, WsReplayStoppedSchema, type WsServerMessage, WsServerMessageSchema, type WsStream, type WsStreamCompleted, WsStreamCompletedSchema, type WsStreamProgress, WsStreamProgressSchema, type WsStreamStarted, WsStreamStartedSchema, type WsStreamStop, type WsStreamStopped, WsStreamStoppedSchema, type WsSubscribe, type WsSubscribed, WsSubscribedSchema, type WsUnsubscribe, type WsUnsubscribed, WsUnsubscribedSchema, OxArchive as default };