@n1xyz/nord-ts 0.0.18-8121ed05.0 → 0.0.19

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.
Files changed (77) hide show
  1. package/.claude/settings.local.json +11 -0
  2. package/.local/qa.ts +77 -0
  3. package/.local/test-atomic.ts +112 -0
  4. package/check.sh +4 -0
  5. package/default.nix +47 -0
  6. package/package.json +20 -27
  7. package/src/index.ts +0 -16
  8. package/src/nord/api/actions.ts +131 -9
  9. package/src/nord/api/core.ts +0 -71
  10. package/src/nord/client/Nord.ts +142 -76
  11. package/src/nord/client/NordUser.ts +171 -50
  12. package/src/nord/index.ts +0 -2
  13. package/src/nord/models/Subscriber.ts +2 -2
  14. package/src/types.ts +55 -216
  15. package/src/utils.ts +6 -42
  16. package/src/websocket/NordWebSocketClient.ts +23 -15
  17. package/src/websocket/index.ts +1 -1
  18. package/tests/utils.spec.ts +1 -34
  19. package/dist/bridge/client.d.ts +0 -151
  20. package/dist/bridge/client.js +0 -434
  21. package/dist/bridge/const.d.ts +0 -23
  22. package/dist/bridge/const.js +0 -47
  23. package/dist/bridge/index.d.ts +0 -4
  24. package/dist/bridge/index.js +0 -23
  25. package/dist/bridge/types.d.ts +0 -120
  26. package/dist/bridge/types.js +0 -18
  27. package/dist/bridge/utils.d.ts +0 -64
  28. package/dist/bridge/utils.js +0 -131
  29. package/dist/const.d.ts +0 -8
  30. package/dist/const.js +0 -30
  31. package/dist/gen/common.d.ts +0 -68
  32. package/dist/gen/common.js +0 -215
  33. package/dist/gen/nord.d.ts +0 -853
  34. package/dist/gen/nord.js +0 -6368
  35. package/dist/idl/bridge.d.ts +0 -569
  36. package/dist/idl/bridge.js +0 -8
  37. package/dist/idl/bridge.json +0 -1506
  38. package/dist/idl/index.d.ts +0 -607
  39. package/dist/idl/index.js +0 -8
  40. package/dist/index.d.ts +0 -6
  41. package/dist/index.js +0 -30
  42. package/dist/nord/api/actions.d.ts +0 -106
  43. package/dist/nord/api/actions.js +0 -256
  44. package/dist/nord/api/core.d.ts +0 -49
  45. package/dist/nord/api/core.js +0 -164
  46. package/dist/nord/api/market.d.ts +0 -36
  47. package/dist/nord/api/market.js +0 -96
  48. package/dist/nord/api/metrics.d.ts +0 -67
  49. package/dist/nord/api/metrics.js +0 -229
  50. package/dist/nord/api/queries.d.ts +0 -46
  51. package/dist/nord/api/queries.js +0 -109
  52. package/dist/nord/client/Nord.d.ts +0 -284
  53. package/dist/nord/client/Nord.js +0 -491
  54. package/dist/nord/client/NordUser.d.ts +0 -287
  55. package/dist/nord/client/NordUser.js +0 -595
  56. package/dist/nord/index.d.ts +0 -9
  57. package/dist/nord/index.js +0 -33
  58. package/dist/nord/models/Subscriber.d.ts +0 -37
  59. package/dist/nord/models/Subscriber.js +0 -25
  60. package/dist/nord/utils/NordError.d.ts +0 -35
  61. package/dist/nord/utils/NordError.js +0 -49
  62. package/dist/types.d.ts +0 -407
  63. package/dist/types.js +0 -103
  64. package/dist/utils.d.ts +0 -116
  65. package/dist/utils.js +0 -271
  66. package/dist/websocket/NordWebSocketClient.d.ts +0 -68
  67. package/dist/websocket/NordWebSocketClient.js +0 -338
  68. package/dist/websocket/events.d.ts +0 -19
  69. package/dist/websocket/events.js +0 -2
  70. package/dist/websocket/index.d.ts +0 -2
  71. package/dist/websocket/index.js +0 -5
  72. package/jest.config.ts +0 -9
  73. package/nodemon.json +0 -4
  74. package/protoc-generate.sh +0 -23
  75. package/src/idl/bridge.json +0 -1506
  76. package/src/nord/api/market.ts +0 -122
  77. package/src/nord/api/queries.ts +0 -135
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Subscriber = void 0;
4
- const utils_1 = require("../../utils");
5
- /**
6
- * Subscriber class for handling WebSocket subscriptions
7
- */
8
- class Subscriber {
9
- /**
10
- * Create a new Subscriber instance
11
- * @param config Subscriber configuration
12
- */
13
- constructor(config) {
14
- this.streamURL = config.streamURL;
15
- this.buffer = [];
16
- this.maxBufferLen = config.maxBufferLen ?? utils_1.MAX_BUFFER_LEN;
17
- }
18
- /**
19
- * Subscribe to WebSocket events
20
- */
21
- subscribe() {
22
- // TODO: Implement subscription logic
23
- }
24
- }
25
- exports.Subscriber = Subscriber;
@@ -1,35 +0,0 @@
1
- /**
2
- * Options for creating a NordError
3
- */
4
- export interface NordErrorOptions {
5
- /** The original error that caused this error */
6
- cause?: unknown;
7
- /** HTTP status code (if applicable) */
8
- statusCode?: number;
9
- /** Additional error details */
10
- details?: Record<string, unknown>;
11
- }
12
- /**
13
- * Custom error class for Nord-related errors
14
- */
15
- export declare class NordError extends Error {
16
- /** The original error that caused this error */
17
- readonly cause?: unknown;
18
- /** HTTP status code (if applicable) */
19
- readonly statusCode?: number;
20
- /** Additional error details */
21
- readonly details?: Record<string, unknown>;
22
- /**
23
- * Create a new NordError
24
- *
25
- * @param message - Error message
26
- * @param options - Error options
27
- */
28
- constructor(message: string, options?: NordErrorOptions);
29
- /**
30
- * Convert the error to a string representation
31
- *
32
- * @returns String representation of the error
33
- */
34
- toString(): string;
35
- }
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NordError = void 0;
4
- /**
5
- * Custom error class for Nord-related errors
6
- */
7
- class NordError extends Error {
8
- /**
9
- * Create a new NordError
10
- *
11
- * @param message - Error message
12
- * @param options - Error options
13
- */
14
- constructor(message, options = {}) {
15
- super(message);
16
- this.name = "NordError";
17
- this.cause = options.cause;
18
- this.statusCode = options.statusCode;
19
- this.details = options.details;
20
- // Capture stack trace
21
- if (Error.captureStackTrace) {
22
- Error.captureStackTrace(this, NordError);
23
- }
24
- // Handle nested errors
25
- if (this.cause instanceof Error) {
26
- this.stack =
27
- this.stack + "\nCaused by: " + (this.cause.stack || this.cause.message);
28
- }
29
- }
30
- /**
31
- * Convert the error to a string representation
32
- *
33
- * @returns String representation of the error
34
- */
35
- toString() {
36
- let result = `${this.name}: ${this.message}`;
37
- if (this.statusCode) {
38
- result += ` \nstatus: ${this.statusCode}`;
39
- }
40
- if (this.details && Object.keys(this.details).length > 0) {
41
- result += ` \ndetails: ${JSON.stringify(this.details, null, 2)}`;
42
- }
43
- if (this.cause) {
44
- result += ` \ncause: ${this.cause.toString()}`;
45
- }
46
- return result;
47
- }
48
- }
49
- exports.NordError = NordError;
package/dist/types.d.ts DELETED
@@ -1,407 +0,0 @@
1
- import * as proto from "./gen/nord";
2
- /**
3
- * The peak TPS rate is queried over the specified period.
4
- * The period is specified in units of: {hour, day, week, month, year}.
5
- * Example inputs:
6
- * 1. AggregateMetrics.txPeakTpsPeriod = 3,
7
- * AggregateMetrics.txPeakTpsPeriodUnit = "d" => Peak TPS over last 3 days.
8
- * 1. AggregateMetrics.txPeakTpsPeriod = 1,
9
- * AggregateMetrics.txPeakTpsPeriodUnit = "w" => Peak TPS over last week.
10
- */
11
- export declare enum PeakTpsPeriodUnit {
12
- Hour = "h",
13
- Day = "d",
14
- Week = "w",
15
- Month = "m",
16
- Year = "y"
17
- }
18
- /**
19
- * Nord subscription type for trades or deltas
20
- */
21
- export type SubscriptionType = "trades" | "deltas" | "account";
22
- /**
23
- * Pattern for a valid Nord subscription
24
- * Format should be: "<type>@<parameter>"
25
- * Examples: "trades@BTCUSDC", "deltas@ETHUSDC", "account@42"
26
- */
27
- export type SubscriptionPattern = `${SubscriptionType}@${string}` | string;
28
- /**
29
- * Configuration options for the Nord client
30
- */
31
- export interface NordConfig {
32
- /** Base URL for the Nord web server */
33
- webServerUrl: string;
34
- /** Bridge verification key */
35
- bridgeVk: string;
36
- /** Solana cluster URL */
37
- solanaUrl: string;
38
- /**
39
- * Whether to initialize WebSockets on creation, defaults to true
40
- * @deprecated this is a funky api we're gonna be removing it
41
- */
42
- initWebSockets?: boolean;
43
- }
44
- /**
45
- * Configuration options for the Nord client
46
- */
47
- export interface TokenInfo {
48
- address: string;
49
- precision: number;
50
- tokenId: number;
51
- name: string;
52
- }
53
- export interface Order {
54
- orderId: number;
55
- isLong: boolean;
56
- size: number;
57
- price: number;
58
- marketId: number;
59
- }
60
- export declare enum KeyType {
61
- Ed25519 = 0,
62
- Secp256k1 = 1,
63
- Bls12_381 = 2
64
- }
65
- export declare enum Side {
66
- Ask = 0,
67
- Bid = 1
68
- }
69
- export declare enum FillMode {
70
- Limit = 0,
71
- PostOnly = 1,
72
- ImmediateOrCancel = 2,
73
- FillOrKill = 3
74
- }
75
- export interface SubscriberConfig {
76
- streamURL: string;
77
- maxBufferLen?: number;
78
- }
79
- export interface Market {
80
- marketId: number;
81
- symbol: string;
82
- priceDecimals: number;
83
- sizeDecimals: number;
84
- baseTokenId: number;
85
- quoteTokenId: number;
86
- frozen: boolean;
87
- }
88
- export interface Token {
89
- tokenId: number;
90
- symbol: string;
91
- decimals: number;
92
- mintAddr: string;
93
- }
94
- export interface Info {
95
- markets: Market[];
96
- tokens: Token[];
97
- }
98
- export interface DeltaEvent {
99
- last_update_id: number;
100
- update_id: number;
101
- market_symbol: string;
102
- asks: OrderbookEntry[];
103
- bids: OrderbookEntry[];
104
- }
105
- export interface Trade {
106
- side: Side;
107
- price: number;
108
- size: number;
109
- order_id: number;
110
- }
111
- export interface Trades {
112
- last_update_id: number;
113
- update_id: number;
114
- market_symbol: string;
115
- trades: Trade[];
116
- }
117
- export interface OrderInfo {
118
- id: number;
119
- reduce_only: boolean;
120
- limit_price: number;
121
- size: number;
122
- account_id: number;
123
- }
124
- export interface HashMap<T> {
125
- [key: number]: T;
126
- }
127
- export interface Account {
128
- last_update_id: number;
129
- update_id: number;
130
- account_id: number;
131
- fills: HashMap<number>;
132
- places: HashMap<OrderInfo>;
133
- cancels: HashMap<OrderInfo>;
134
- balances: HashMap<number>;
135
- }
136
- /**
137
- * Query the transactions in the specified L2 block.
138
- * block_number specifies the block number to query.
139
- * If not specified, transactions from latest block are returned.
140
- */
141
- export interface BlockQuery {
142
- block_number?: number;
143
- }
144
- /**
145
- * Response for BlockQuery.
146
- * block_number specifies the block number being returned.
147
- * actions are the list of transactions from the block.
148
- */
149
- export interface BlockResponse {
150
- block_number: number;
151
- actions: ActionInfo[];
152
- }
153
- /**
154
- * Response for BlockSummaryQuery.
155
- * block_summary is the summary of upto the last N blocks.
156
- * The server can return fewer than last_n block summary if
157
- * fewer blocks are available or if it exceeds a max cap.
158
- */
159
- export interface BlockSummaryResponse {
160
- block_summary: BlockSummary[];
161
- }
162
- /**
163
- * Query the action for the specified action id.
164
- * action_id specifies the action to query.
165
- */
166
- export interface ActionQuery {
167
- action_id: number;
168
- }
169
- /**
170
- * Response for ActionQuery.
171
- * block_number the block the action is part of.
172
- * If the action is not yet included in any block, null is returned.
173
- * action the transaction.
174
- */
175
- export interface ActionResponse {
176
- block_number?: number;
177
- action: proto.Action;
178
- }
179
- /**
180
- * Query the recent actions
181
- * last_n requests last N actions.
182
- */
183
- export interface ActionsQuery {
184
- last_n: number;
185
- }
186
- /**
187
- * Response for ActionsQuery.
188
- * actions returns upto the last N actions.
189
- * The server can return fewer than last_n actions if
190
- * fewer actions are available or if it exceeds a max cap.
191
- */
192
- export interface ActionsResponse {
193
- actions: ActionsExtendedInfo[];
194
- }
195
- /**
196
- * Block summary.
197
- * block_number Block number.
198
- * from_action_id First action_id in the block.
199
- * to_action_id Last action_id in the block.
200
- */
201
- export interface BlockSummary {
202
- block_number: number;
203
- from_action_id: number;
204
- to_action_id: number;
205
- }
206
- /**
207
- * Info about the block transaction.
208
- * action_id is the action identifier.
209
- * action in protobuf format.
210
- * exec_timestamp is the execution timestamp.
211
- */
212
- export interface ActionInfo {
213
- action_id: number;
214
- action: proto.Action;
215
- exec_timestamp: number;
216
- }
217
- /**
218
- * Extended info about the block transaction.
219
- * block_number the block the action is part of.
220
- * If the action is not yet included in any block, null is returned.
221
- * action_id of the action.
222
- * action the transaction.
223
- */
224
- export interface ActionsExtendedInfo {
225
- block_number?: number;
226
- action_id: number;
227
- action: proto.Action;
228
- }
229
- /**
230
- * Aggregate metrics
231
- * blocks_total: Total number of L2 blocks.
232
- * tx_total: Total number of transactions.
233
- * tx_tps: Transaction throughput.
234
- * tx_tps_peak: Peak transaction throughput.
235
- * request_latency_average: Average request latency.
236
- */
237
- export interface AggregateMetrics {
238
- blocks_total: number;
239
- tx_total: number;
240
- tx_tps: number;
241
- tx_tps_peak: number;
242
- request_latency_average: number;
243
- }
244
- export interface RollmanBlockResponse {
245
- block_number: number;
246
- actions: RollmanActionInfo[];
247
- }
248
- export interface RollmanActionResponse {
249
- block_number?: number;
250
- action_pb: Uint8Array;
251
- exec_timestamp: number;
252
- }
253
- export interface RollmanActionsResponse {
254
- actions: RollmanActionExtendedInfo[];
255
- }
256
- export interface RollmanActionInfo {
257
- action_id: number;
258
- action_pb: Uint8Array;
259
- exec_timestamp: number;
260
- }
261
- export interface RollmanActionExtendedInfo {
262
- block_number?: number;
263
- action_id: number;
264
- action_pb: Uint8Array;
265
- }
266
- export interface MarketsStatsResponse {
267
- markets: MarketStats[];
268
- }
269
- export interface MarketStats {
270
- market_id: number;
271
- index_price: [number, number];
272
- volume_24h: number;
273
- high_24h: number;
274
- low_24h: number;
275
- perp_stats?: PerpMarketStats;
276
- }
277
- export interface PerpMarketStats {
278
- mark_price?: number;
279
- funding_rate?: number;
280
- next_funding_time?: Date;
281
- open_interest?: number;
282
- }
283
- /**
284
- * Converts a `FillMode` enum to its corresponding protobuf representation.
285
- *
286
- * @param x - The fill mode to convert.
287
- * @returns The corresponding protobuf fill mode.
288
- * @throws Will throw an error if provided with an invalid fill mode.
289
- */
290
- export declare function fillModeToProtoFillMode(x: FillMode): proto.FillMode;
291
- /**
292
- * Response for trades query with pagination support
293
- */
294
- export interface TradesResponse {
295
- trades: Trade[];
296
- accountId: number;
297
- since?: string;
298
- until?: string;
299
- nextPageId?: string;
300
- }
301
- /**
302
- * Query parameters for trades endpoint
303
- */
304
- export interface TradesQuery {
305
- accountId: number;
306
- since?: string;
307
- until?: string;
308
- pageId?: string;
309
- }
310
- /**
311
- * Response for user account IDs query
312
- */
313
- export interface UserAccountIdsResponse {
314
- accountIds: number[];
315
- }
316
- /**
317
- * Query parameters for user account IDs
318
- */
319
- export interface UserAccountIdsQuery {
320
- pubkey: string;
321
- }
322
- /**
323
- * Orderbook entry representing price and size
324
- */
325
- export interface OrderbookEntry {
326
- price: number;
327
- size: number;
328
- }
329
- /**
330
- * Response for orderbook query
331
- */
332
- export interface OrderbookResponse {
333
- symbol: string;
334
- asks: OrderbookEntry[];
335
- bids: OrderbookEntry[];
336
- timestamp: number;
337
- }
338
- /**
339
- * Query parameters for orderbook
340
- *
341
- * Note: While you can provide either symbol or market_id, the API endpoint only accepts market_id.
342
- * If you provide a symbol, it will be converted to a market_id internally.
343
- */
344
- export interface OrderbookQuery {
345
- symbol?: string;
346
- market_id?: number;
347
- }
348
- /**
349
- * Response for timestamp query
350
- */
351
- export interface TimestampResponse {
352
- timestamp: number;
353
- }
354
- /**
355
- * Response for action nonce query
356
- */
357
- export interface ActionNonceResponse {
358
- nonce: number;
359
- }
360
- /**
361
- * WebSocket message types
362
- */
363
- export declare enum WebSocketMessageType {
364
- Subscribe = "subscribe",
365
- Unsubscribe = "unsubscribe",
366
- TradeUpdate = "trades",
367
- DeltaUpdate = "delta",
368
- AccountUpdate = "account"
369
- }
370
- /**
371
- * WebSocket subscription request
372
- */
373
- export interface WebSocketSubscription {
374
- e: WebSocketMessageType;
375
- streams: string[];
376
- }
377
- /**
378
- * WebSocket trade update message
379
- */
380
- export interface WebSocketTradeUpdate {
381
- e: WebSocketMessageType.TradeUpdate;
382
- symbol: string;
383
- trades: Trade[];
384
- timestamp: number;
385
- }
386
- /**
387
- * WebSocket delta update message
388
- */
389
- export interface WebSocketDeltaUpdate {
390
- e: WebSocketMessageType.DeltaUpdate;
391
- last_update_id: number;
392
- update_id: number;
393
- market_symbol: string;
394
- asks: OrderbookEntry[];
395
- bids: OrderbookEntry[];
396
- timestamp: number;
397
- }
398
- /**
399
- * WebSocket user update message
400
- */
401
- export interface WebSocketAccountUpdate {
402
- e: WebSocketMessageType.AccountUpdate;
403
- accountId: number;
404
- account: Account;
405
- timestamp: number;
406
- }
407
- export type WebSocketMessage = WebSocketSubscription | WebSocketTradeUpdate | WebSocketDeltaUpdate | WebSocketAccountUpdate;
package/dist/types.js DELETED
@@ -1,103 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.WebSocketMessageType = exports.FillMode = exports.Side = exports.KeyType = exports.PeakTpsPeriodUnit = void 0;
37
- exports.fillModeToProtoFillMode = fillModeToProtoFillMode;
38
- const proto = __importStar(require("./gen/nord"));
39
- /**
40
- * The peak TPS rate is queried over the specified period.
41
- * The period is specified in units of: {hour, day, week, month, year}.
42
- * Example inputs:
43
- * 1. AggregateMetrics.txPeakTpsPeriod = 3,
44
- * AggregateMetrics.txPeakTpsPeriodUnit = "d" => Peak TPS over last 3 days.
45
- * 1. AggregateMetrics.txPeakTpsPeriod = 1,
46
- * AggregateMetrics.txPeakTpsPeriodUnit = "w" => Peak TPS over last week.
47
- */
48
- var PeakTpsPeriodUnit;
49
- (function (PeakTpsPeriodUnit) {
50
- PeakTpsPeriodUnit["Hour"] = "h";
51
- PeakTpsPeriodUnit["Day"] = "d";
52
- PeakTpsPeriodUnit["Week"] = "w";
53
- PeakTpsPeriodUnit["Month"] = "m";
54
- PeakTpsPeriodUnit["Year"] = "y";
55
- })(PeakTpsPeriodUnit || (exports.PeakTpsPeriodUnit = PeakTpsPeriodUnit = {}));
56
- var KeyType;
57
- (function (KeyType) {
58
- KeyType[KeyType["Ed25519"] = 0] = "Ed25519";
59
- KeyType[KeyType["Secp256k1"] = 1] = "Secp256k1";
60
- KeyType[KeyType["Bls12_381"] = 2] = "Bls12_381";
61
- })(KeyType || (exports.KeyType = KeyType = {}));
62
- var Side;
63
- (function (Side) {
64
- Side[Side["Ask"] = 0] = "Ask";
65
- Side[Side["Bid"] = 1] = "Bid";
66
- })(Side || (exports.Side = Side = {}));
67
- var FillMode;
68
- (function (FillMode) {
69
- FillMode[FillMode["Limit"] = 0] = "Limit";
70
- FillMode[FillMode["PostOnly"] = 1] = "PostOnly";
71
- FillMode[FillMode["ImmediateOrCancel"] = 2] = "ImmediateOrCancel";
72
- FillMode[FillMode["FillOrKill"] = 3] = "FillOrKill";
73
- })(FillMode || (exports.FillMode = FillMode = {}));
74
- /**
75
- * Converts a `FillMode` enum to its corresponding protobuf representation.
76
- *
77
- * @param x - The fill mode to convert.
78
- * @returns The corresponding protobuf fill mode.
79
- * @throws Will throw an error if provided with an invalid fill mode.
80
- */
81
- function fillModeToProtoFillMode(x) {
82
- if (x === FillMode.Limit)
83
- return proto.FillMode.LIMIT;
84
- if (x === FillMode.PostOnly)
85
- return proto.FillMode.POST_ONLY;
86
- if (x === FillMode.ImmediateOrCancel) {
87
- return proto.FillMode.IMMEDIATE_OR_CANCEL;
88
- }
89
- if (x === FillMode.FillOrKill)
90
- return proto.FillMode.FILL_OR_KILL;
91
- throw new Error("Invalid fill mode");
92
- }
93
- /**
94
- * WebSocket message types
95
- */
96
- var WebSocketMessageType;
97
- (function (WebSocketMessageType) {
98
- WebSocketMessageType["Subscribe"] = "subscribe";
99
- WebSocketMessageType["Unsubscribe"] = "unsubscribe";
100
- WebSocketMessageType["TradeUpdate"] = "trades";
101
- WebSocketMessageType["DeltaUpdate"] = "delta";
102
- WebSocketMessageType["AccountUpdate"] = "account";
103
- })(WebSocketMessageType || (exports.WebSocketMessageType = WebSocketMessageType = {}));