@n1xyz/nord-ts 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.
Files changed (47) hide show
  1. package/dist/client/Nord.d.ts +9 -3
  2. package/dist/gen/openapi.d.ts +366 -4
  3. package/dist/index.browser.js +96626 -0
  4. package/dist/index.common.js +115002 -0
  5. package/dist/types.d.ts +13 -2
  6. package/dist/websocket/NordWebSocketClient.d.ts +1 -0
  7. package/dist/websocket/Subscriber.d.ts +7 -1
  8. package/dist/websocket/events.d.ts +2 -1
  9. package/dist/websocket/index.d.ts +1 -1
  10. package/package.json +7 -4
  11. package/dist/actions.js +0 -184
  12. package/dist/client/Nord.js +0 -759
  13. package/dist/client/NordAdmin.js +0 -362
  14. package/dist/client/NordUser.js +0 -752
  15. package/dist/const.js +0 -27
  16. package/dist/error.js +0 -51
  17. package/dist/gen/nord_pb.js +0 -1068
  18. package/dist/gen/openapi.js +0 -5
  19. package/dist/index.js +0 -10
  20. package/dist/nord/api/actions.d.ts +0 -128
  21. package/dist/nord/api/actions.js +0 -396
  22. package/dist/nord/api/core.d.ts +0 -16
  23. package/dist/nord/api/core.js +0 -81
  24. package/dist/nord/api/metrics.d.ts +0 -67
  25. package/dist/nord/api/metrics.js +0 -229
  26. package/dist/nord/api/triggers.d.ts +0 -7
  27. package/dist/nord/api/triggers.js +0 -38
  28. package/dist/nord/client/Nord.d.ts +0 -387
  29. package/dist/nord/client/Nord.js +0 -747
  30. package/dist/nord/client/NordAdmin.d.ts +0 -226
  31. package/dist/nord/client/NordAdmin.js +0 -410
  32. package/dist/nord/client/NordClient.d.ts +0 -16
  33. package/dist/nord/client/NordClient.js +0 -28
  34. package/dist/nord/client/NordUser.d.ts +0 -379
  35. package/dist/nord/client/NordUser.js +0 -787
  36. package/dist/nord/index.d.ts +0 -8
  37. package/dist/nord/index.js +0 -34
  38. package/dist/nord/models/Subscriber.d.ts +0 -37
  39. package/dist/nord/models/Subscriber.js +0 -25
  40. package/dist/nord/utils/NordError.d.ts +0 -35
  41. package/dist/nord/utils/NordError.js +0 -49
  42. package/dist/types.js +0 -92
  43. package/dist/utils.js +0 -193
  44. package/dist/websocket/NordWebSocketClient.js +0 -242
  45. package/dist/websocket/Subscriber.js +0 -24
  46. package/dist/websocket/events.js +0 -1
  47. package/dist/websocket/index.js +0 -80
@@ -3,9 +3,9 @@ import { Connection, PublicKey } from "@solana/web3.js";
3
3
  import { EventEmitter } from "events";
4
4
  import { Client } from "openapi-fetch";
5
5
  import type { paths } from "../gen/openapi.ts";
6
- import { Account, AccountPnlInfoPage, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, TriggerHistoryPage, WithdrawalHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery, PreviousMarketPrice } from "../types";
6
+ import { Account, AccountPnlInfoPage, PagedQuery, ActionResponse, MarketsInfo, Market, MarketStats, NordConfig, OrderbookQuery, OrderbookResponse, FeeTierConfig, Token, TradesResponse, User, AccountTriggerInfo, TriggerHistoryPage, WithdrawalHistoryPage, FeeTierId, AccountFeeTierPage, PageResultStringOrderInfo, PageResultStringTrade, OrderInfoFromApi, TokenStats, FillRole, AdminInfo, AccountVolumeInfo, GetAccountVolumeQuery, PreviousMarketPrice, CandleResolution } from "../types";
7
7
  import { NordWebSocketClient } from "../websocket/index";
8
- import { OrderbookSubscription, TradeSubscription } from "../websocket/Subscriber";
8
+ import { OrderbookSubscription, TradeSubscription, CandleSubscription } from "../websocket/Subscriber";
9
9
  /**
10
10
  * User subscription interface
11
11
  */
@@ -45,6 +45,7 @@ export declare class Nord {
45
45
  * @param trades - Market symbols to subscribe to for trade updates
46
46
  * @param deltas - Market symbols to subscribe to for orderbook delta updates
47
47
  * @param accounts - Account IDs to subscribe to for account updates
48
+ * @param candles - Candle subscriptions with symbol and resolution
48
49
  * @returns A new WebSocket client with the requested subscriptions
49
50
  * @throws {NordError} If invalid subscription options are provided
50
51
  *
@@ -62,10 +63,14 @@ export declare class Nord {
62
63
  * trades: ["BTCUSDC", "ETHUSDC"]
63
64
  * });
64
65
  */
65
- createWebSocketClient({ trades, deltas, accounts, }: Readonly<{
66
+ createWebSocketClient({ trades, deltas, accounts, candles, }: Readonly<{
66
67
  trades?: string[];
67
68
  deltas?: string[];
68
69
  accounts?: number[];
70
+ candles?: Array<{
71
+ symbol: string;
72
+ resolution: CandleResolution;
73
+ }>;
69
74
  }>): NordWebSocketClient;
70
75
  private GET;
71
76
  /**
@@ -161,6 +166,7 @@ export declare class Nord {
161
166
  * @throws {NordError} If symbol is invalid
162
167
  */
163
168
  subscribeOrderbook(symbol: string): OrderbookSubscription;
169
+ subscribeBars(symbol: string, resolution: CandleResolution): CandleSubscription;
164
170
  /**
165
171
  * Subscribe to trade updates for a market
166
172
  *
@@ -303,7 +303,7 @@ export interface paths {
303
303
  query?: never;
304
304
  header?: never;
305
305
  path: {
306
- /** @description where `streams` is `trades@{symbol} | deltas@{symbol} | account@{account id} [&, ...]` e.g. `/ws/trades@BTCUSDC&deltas@BTCUSDC&account@42` */
306
+ /** @description where `streams` is `trades@{symbol} | deltas@{symbol} | account@{account id} | candle@{symbol}:{resolution} [&, ...]` e.g. `/ws/trades@BTCUSDC&deltas@BTCUSDC&account@42&candle@BTCUSDC:60` */
307
307
  streams: string;
308
308
  };
309
309
  cookie?: never;
@@ -752,7 +752,13 @@ export interface paths {
752
752
  * For exact applied PnL use more per trade PnL. */
753
753
  get: {
754
754
  parameters: {
755
- query?: never;
755
+ query?: {
756
+ /** @description Optional market filter by market id or symbol. */
757
+ marketId?: number | null;
758
+ /** @description Optional limit on number of returned entries summary items per `market_id`. */
759
+ count?: number;
760
+ since?: string;
761
+ };
756
762
  header?: never;
757
763
  path: {
758
764
  /** @description Account for which to retrieve PnL history */
@@ -770,6 +776,22 @@ export interface paths {
770
776
  "application/json": components["schemas"]["AccountPnlHistInfo"][];
771
777
  };
772
778
  };
779
+ 400: {
780
+ headers: {
781
+ [name: string]: unknown;
782
+ };
783
+ content: {
784
+ "application/json": components["schemas"]["BadRequest"];
785
+ };
786
+ };
787
+ 404: {
788
+ headers: {
789
+ [name: string]: unknown;
790
+ };
791
+ content: {
792
+ "application/json": components["schemas"]["UserNotFound"];
793
+ };
794
+ };
773
795
  };
774
796
  };
775
797
  put?: never;
@@ -861,6 +883,79 @@ export interface paths {
861
883
  patch?: never;
862
884
  trace?: never;
863
885
  };
886
+ "/triggers/active": {
887
+ parameters: {
888
+ query?: never;
889
+ header?: never;
890
+ path?: never;
891
+ cookie?: never;
892
+ };
893
+ get: {
894
+ parameters: {
895
+ query?: {
896
+ /** @description fetch results starting with this page; query starts with first entry if page isn't specified */
897
+ startInclusive?: string | null;
898
+ /** @description Query returns up to 50 trades in one go. */
899
+ pageSize?: number | null;
900
+ };
901
+ header?: never;
902
+ path?: never;
903
+ cookie?: never;
904
+ };
905
+ requestBody?: never;
906
+ responses: {
907
+ 200: {
908
+ headers: {
909
+ [name: string]: unknown;
910
+ };
911
+ content: {
912
+ "application/json": components["schemas"]["PageResult_for_String_and_TriggerInfo"];
913
+ };
914
+ };
915
+ };
916
+ };
917
+ put?: never;
918
+ post?: never;
919
+ delete?: never;
920
+ options?: never;
921
+ head?: never;
922
+ patch?: never;
923
+ trace?: never;
924
+ };
925
+ "/accounts/count": {
926
+ parameters: {
927
+ query?: never;
928
+ header?: never;
929
+ path?: never;
930
+ cookie?: never;
931
+ };
932
+ get: {
933
+ parameters: {
934
+ query?: never;
935
+ header?: never;
936
+ path?: never;
937
+ cookie?: never;
938
+ };
939
+ requestBody?: never;
940
+ responses: {
941
+ 200: {
942
+ headers: {
943
+ [name: string]: unknown;
944
+ };
945
+ content: {
946
+ "application/json": number;
947
+ };
948
+ };
949
+ };
950
+ };
951
+ put?: never;
952
+ post?: never;
953
+ delete?: never;
954
+ options?: never;
955
+ head?: never;
956
+ patch?: never;
957
+ trace?: never;
958
+ };
864
959
  "/account/{account_id}/pubkey": {
865
960
  parameters: {
866
961
  query?: never;
@@ -1152,6 +1247,40 @@ export interface paths {
1152
1247
  patch?: never;
1153
1248
  trace?: never;
1154
1249
  };
1250
+ "/state/info/hist": {
1251
+ parameters: {
1252
+ query?: never;
1253
+ header?: never;
1254
+ path?: never;
1255
+ cookie?: never;
1256
+ };
1257
+ get: {
1258
+ parameters: {
1259
+ query?: never;
1260
+ header?: never;
1261
+ path?: never;
1262
+ cookie?: never;
1263
+ };
1264
+ requestBody?: never;
1265
+ responses: {
1266
+ 200: {
1267
+ headers: {
1268
+ [name: string]: unknown;
1269
+ };
1270
+ content: {
1271
+ "application/json": components["schemas"]["StateHistInfo"];
1272
+ };
1273
+ };
1274
+ };
1275
+ };
1276
+ put?: never;
1277
+ post?: never;
1278
+ delete?: never;
1279
+ options?: never;
1280
+ head?: never;
1281
+ patch?: never;
1282
+ trace?: never;
1283
+ };
1155
1284
  "/fee/brackets/info": {
1156
1285
  parameters: {
1157
1286
  query?: never;
@@ -1464,6 +1593,116 @@ export interface paths {
1464
1593
  patch?: never;
1465
1594
  trace?: never;
1466
1595
  };
1596
+ "/account/{account_id}/history/deposit": {
1597
+ parameters: {
1598
+ query?: never;
1599
+ header?: never;
1600
+ path?: never;
1601
+ cookie?: never;
1602
+ };
1603
+ /** @description Fetch full history of deposits for an account. */
1604
+ get: {
1605
+ parameters: {
1606
+ query?: {
1607
+ /** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
1608
+ since?: string;
1609
+ /** @description end with this timestamp (RFC3339); defaults to current date-time */
1610
+ until?: string;
1611
+ /** @description fetch results starting with this page; query starts with first entry if page isn't specified */
1612
+ startInclusive?: string | null;
1613
+ /** @description Query returns up to 50 trades in one go. */
1614
+ pageSize?: number | null;
1615
+ };
1616
+ header?: never;
1617
+ path: {
1618
+ /** @description Account ID for which to fetch deposit history. */
1619
+ account_id: number;
1620
+ };
1621
+ cookie?: never;
1622
+ };
1623
+ requestBody?: never;
1624
+ responses: {
1625
+ 200: {
1626
+ headers: {
1627
+ [name: string]: unknown;
1628
+ };
1629
+ content: {
1630
+ "application/json": components["schemas"]["PageResult_for_String_and_DepositInfo"];
1631
+ };
1632
+ };
1633
+ 404: {
1634
+ headers: {
1635
+ [name: string]: unknown;
1636
+ };
1637
+ content: {
1638
+ "application/json": components["schemas"]["UserNotFound"];
1639
+ };
1640
+ };
1641
+ };
1642
+ };
1643
+ put?: never;
1644
+ post?: never;
1645
+ delete?: never;
1646
+ options?: never;
1647
+ head?: never;
1648
+ patch?: never;
1649
+ trace?: never;
1650
+ };
1651
+ "/account/{account_id}/history/liquidation": {
1652
+ parameters: {
1653
+ query?: never;
1654
+ header?: never;
1655
+ path?: never;
1656
+ cookie?: never;
1657
+ };
1658
+ /** @description Fetch full history of liquidations for an account. */
1659
+ get: {
1660
+ parameters: {
1661
+ query?: {
1662
+ /** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
1663
+ since?: string;
1664
+ /** @description end with this timestamp (RFC3339); defaults to current date-time */
1665
+ until?: string;
1666
+ /** @description fetch results starting with this page; query starts with first entry if page isn't specified */
1667
+ startInclusive?: string | null;
1668
+ /** @description Query returns up to 50 trades in one go. */
1669
+ pageSize?: number | null;
1670
+ };
1671
+ header?: never;
1672
+ path: {
1673
+ /** @description Account ID for which to fetch liquidation history. */
1674
+ account_id: number;
1675
+ };
1676
+ cookie?: never;
1677
+ };
1678
+ requestBody?: never;
1679
+ responses: {
1680
+ 200: {
1681
+ headers: {
1682
+ [name: string]: unknown;
1683
+ };
1684
+ content: {
1685
+ "application/json": components["schemas"]["PageResult_for_String_and_LiquidationInfo"];
1686
+ };
1687
+ };
1688
+ 404: {
1689
+ headers: {
1690
+ [name: string]: unknown;
1691
+ };
1692
+ content: {
1693
+ "application/json": components["schemas"]["UserNotFound"];
1694
+ };
1695
+ };
1696
+ };
1697
+ };
1698
+ put?: never;
1699
+ post?: never;
1700
+ delete?: never;
1701
+ options?: never;
1702
+ head?: never;
1703
+ patch?: never;
1704
+ trace?: never;
1705
+ };
1467
1706
  "/tv": {
1468
1707
  parameters: {
1469
1708
  query?: never;
@@ -1510,7 +1749,9 @@ export interface paths {
1510
1749
  /** @description Gets market updates history for some period of time. Default is hourly for last 24 hours */
1511
1750
  get: {
1512
1751
  parameters: {
1513
- query?: never;
1752
+ query?: {
1753
+ pageSize?: number;
1754
+ };
1514
1755
  header?: never;
1515
1756
  path: {
1516
1757
  market_id: number;
@@ -2754,6 +2995,23 @@ export interface components {
2754
2995
  */
2755
2996
  pnl: number;
2756
2997
  };
2998
+ /** @description Non paginating, just goes to some past extent. */
2999
+ GetAccountPnlFundingHistQuery: {
3000
+ /**
3001
+ * Format: uint32
3002
+ * @description Optional market filter by market id or symbol.
3003
+ * @default null
3004
+ */
3005
+ marketId: number | null;
3006
+ /**
3007
+ * Format: uint8
3008
+ * @description Optional limit on number of returned entries summary items per `market_id`.
3009
+ * @default 24
3010
+ */
3011
+ count: number;
3012
+ /** @default null */
3013
+ since: string;
3014
+ };
2757
3015
  AccountPnlHistInfo: {
2758
3016
  /** @description Same time when funding is applied */
2759
3017
  time: string;
@@ -2786,6 +3044,7 @@ export interface components {
2786
3044
  market_id: number;
2787
3045
  market_symbol: string;
2788
3046
  };
3047
+ BadRequest: null;
2789
3048
  PageResult_for_String_and_Trigger: {
2790
3049
  /** @description Set of items for requested by query. */
2791
3050
  items: components["schemas"]["Trigger"][];
@@ -2831,6 +3090,12 @@ export interface components {
2831
3090
  actionId: string;
2832
3091
  createdAt: string;
2833
3092
  };
3093
+ PageResult_for_String_and_TriggerInfo: {
3094
+ /** @description Set of items for requested by query. */
3095
+ items: components["schemas"]["TriggerInfo"][];
3096
+ /** @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined. */
3097
+ nextStartInclusive?: string | null;
3098
+ };
2834
3099
  OrderNotFound: null;
2835
3100
  PageResult_for_String_and_Trade: {
2836
3101
  /** @description Set of items for requested by query. */
@@ -2934,6 +3199,12 @@ export interface components {
2934
3199
  timestamp: number;
2935
3200
  paused: boolean;
2936
3201
  };
3202
+ StateHistInfo: {
3203
+ versions: [
3204
+ number,
3205
+ components["schemas"]["ExecutableVersion"]
3206
+ ][];
3207
+ };
2937
3208
  /** Format: uint32 */
2938
3209
  FeeTierId: number;
2939
3210
  FeeTierConfig: {
@@ -3026,6 +3297,83 @@ export interface components {
3026
3297
  /** Format: int64 */
3027
3298
  fee: number;
3028
3299
  };
3300
+ PageResult_for_String_and_DepositInfo: {
3301
+ /** @description Set of items for requested by query. */
3302
+ items: components["schemas"]["DepositInfo"][];
3303
+ /** @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined. */
3304
+ nextStartInclusive?: string | null;
3305
+ };
3306
+ DepositInfo: {
3307
+ time: string;
3308
+ actionId: string;
3309
+ /** Format: uint32 */
3310
+ accountId: number;
3311
+ /** Format: uint32 */
3312
+ tokenId: number;
3313
+ /** Format: double */
3314
+ amount: number;
3315
+ /** Format: double */
3316
+ balance: number;
3317
+ /** Format: uint64 */
3318
+ eventIndex: number;
3319
+ };
3320
+ PageResult_for_String_and_LiquidationInfo: {
3321
+ /** @description Set of items for requested by query. */
3322
+ items: components["schemas"]["LiquidationInfo"][];
3323
+ /** @description If request contains more data, this is the id is set with which next request should be performed to get next page. If no more data, then it is undefined. */
3324
+ nextStartInclusive?: string | null;
3325
+ };
3326
+ LiquidationInfo: {
3327
+ time: string;
3328
+ actionId: string;
3329
+ /** Format: uint32 */
3330
+ liquidatorId: number;
3331
+ /** Format: uint32 */
3332
+ liquidateeId: number;
3333
+ /** Format: double */
3334
+ fee: number;
3335
+ liquidationKind: components["schemas"]["LiquidationKind"];
3336
+ /** Format: uint32 */
3337
+ marketId?: number | null;
3338
+ /** Format: uint32 */
3339
+ tokenId?: number | null;
3340
+ orderId?: string | null;
3341
+ /** Format: double */
3342
+ orderPrice?: number | null;
3343
+ /** Format: double */
3344
+ orderSize?: number | null;
3345
+ /** Format: double */
3346
+ orderQuote?: number | null;
3347
+ /** Format: double */
3348
+ preOmf: number;
3349
+ /** Format: double */
3350
+ preMmf: number;
3351
+ /** Format: double */
3352
+ preImf: number;
3353
+ /** Format: double */
3354
+ preCmf: number;
3355
+ /** Format: double */
3356
+ prePon: number;
3357
+ /** Format: double */
3358
+ preMf: number;
3359
+ /** Format: double */
3360
+ prePn: number;
3361
+ /** Format: double */
3362
+ postOmf: number;
3363
+ /** Format: double */
3364
+ postMmf: number;
3365
+ /** Format: double */
3366
+ postImf: number;
3367
+ /** Format: double */
3368
+ postCmf: number;
3369
+ /** Format: double */
3370
+ postPon: number;
3371
+ /** Format: double */
3372
+ postMf: number;
3373
+ /** Format: double */
3374
+ postPn: number;
3375
+ };
3376
+ LiquidationKind: "place_order" | "cancel_order" | "bankruptcy";
3029
3377
  /** @description TV config query response https://www.tradingview.com/charting-library-docs/latest/connecting_data/UDF/#data-feed-configuration-data */
3030
3378
  TvConfigResponse: {
3031
3379
  supported_resolutions: components["schemas"]["Resolution"][];
@@ -3038,7 +3386,7 @@ export interface components {
3038
3386
  * @description More limited resolution than history one, used in some HTTP queries
3039
3387
  * @enum {string}
3040
3388
  */
3041
- Resolution: "1" | "5" | "15" | "30" | "60" | "1D" | "1W" | "1M";
3389
+ Resolution: "OneMinute" | "FiveMinutes" | "FifteenMinutes" | "ThirtyMinutes" | "SixtyMinutes" | "OneDay" | "OneWeek" | "OneMonth";
3042
3390
  /** @description TV symbols query */
3043
3391
  TvSymbolsQuery: {
3044
3392
  symbol: string;
@@ -3190,6 +3538,13 @@ export interface components {
3190
3538
  };
3191
3539
  /** @description Empty object, to make quotes item conform to API error spec */
3192
3540
  TvQuotesErrorValues: Record<string, never>;
3541
+ GetMarketHistoryQuery: {
3542
+ /**
3543
+ * Format: uint8
3544
+ * @default 24
3545
+ */
3546
+ pageSize: number;
3547
+ };
3193
3548
  PageResult_for_String_and_MarketHistoryInfo: {
3194
3549
  /** @description Set of items for requested by query. */
3195
3550
  items: components["schemas"]["MarketHistoryInfo"][];
@@ -3204,6 +3559,13 @@ export interface components {
3204
3559
  fundingIndex: components["schemas"]["FundingIndexMantissa"];
3205
3560
  /** Format: double */
3206
3561
  fundingRate: number;
3562
+ /**
3563
+ * Format: double
3564
+ * @description Scaled in market price decimals
3565
+ */
3566
+ indexPrice: number;
3567
+ /** Format: double */
3568
+ markPrice: number;
3207
3569
  };
3208
3570
  /**
3209
3571
  * Format: int128