@n1xyz/nord-ts 0.0.21 → 0.0.22

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 (45) hide show
  1. package/dist/api/client.d.ts +14 -0
  2. package/dist/api/client.js +45 -0
  3. package/dist/bridge/client.d.ts +151 -0
  4. package/dist/bridge/client.js +434 -0
  5. package/dist/bridge/const.d.ts +23 -0
  6. package/dist/bridge/const.js +47 -0
  7. package/dist/bridge/index.d.ts +4 -0
  8. package/dist/bridge/index.js +23 -0
  9. package/dist/bridge/types.d.ts +120 -0
  10. package/dist/bridge/types.js +18 -0
  11. package/dist/bridge/utils.d.ts +64 -0
  12. package/dist/bridge/utils.js +131 -0
  13. package/dist/gen/common.d.ts +68 -0
  14. package/dist/gen/common.js +215 -0
  15. package/dist/gen/nord_pb.d.ts +3651 -0
  16. package/dist/gen/nord_pb.js +892 -0
  17. package/dist/gen/openapi.d.ts +241 -2
  18. package/dist/idl/bridge.d.ts +569 -0
  19. package/dist/idl/bridge.js +8 -0
  20. package/dist/idl/bridge.json +1506 -0
  21. package/dist/idl/index.d.ts +607 -0
  22. package/dist/idl/index.js +8 -0
  23. package/dist/nord/api/actions.d.ts +30 -72
  24. package/dist/nord/api/actions.js +179 -200
  25. package/dist/nord/api/market.d.ts +36 -0
  26. package/dist/nord/api/market.js +96 -0
  27. package/dist/nord/api/queries.d.ts +46 -0
  28. package/dist/nord/api/queries.js +109 -0
  29. package/dist/nord/client/Nord.js +3 -3
  30. package/dist/nord/client/NordUser.d.ts +26 -13
  31. package/dist/nord/client/NordUser.js +13 -10
  32. package/dist/types.d.ts +12 -1
  33. package/dist/types.js +29 -2
  34. package/dist/utils.d.ts +6 -20
  35. package/dist/utils.js +17 -35
  36. package/dist/websocket/NordWebSocketClient.js +2 -6
  37. package/package.json +26 -23
  38. package/src/gen/nord_pb.ts +4172 -0
  39. package/src/gen/openapi.ts +241 -2
  40. package/src/nord/api/actions.ts +249 -370
  41. package/src/nord/client/Nord.ts +3 -3
  42. package/src/nord/client/NordUser.ts +40 -19
  43. package/src/types.ts +32 -1
  44. package/src/utils.ts +24 -43
  45. package/src/websocket/NordWebSocketClient.ts +2 -8
@@ -408,6 +408,14 @@ export interface paths {
408
408
  "application/json": components["schemas"]["MarketStats"];
409
409
  };
410
410
  };
411
+ 404: {
412
+ headers: {
413
+ [name: string]: unknown;
414
+ };
415
+ content: {
416
+ "application/json": components["schemas"]["MarketNotFound"];
417
+ };
418
+ };
411
419
  };
412
420
  };
413
421
  put?: never;
@@ -636,6 +644,138 @@ export interface paths {
636
644
  patch?: never;
637
645
  trace?: never;
638
646
  };
647
+ "/account/{account_id}/pnl": {
648
+ parameters: {
649
+ query?: never;
650
+ header?: never;
651
+ path?: never;
652
+ cookie?: never;
653
+ };
654
+ /** @description Get account's PnL (Profit and Loss) history, ordered from most recent to oldest.
655
+ *
656
+ * Pagination Results include account PnL records with timestamp, account_id, action_id, and pnl value. Use query parameters `since` and `until` for time-based filtering, and `startInclusive` for pagination.
657
+ *
658
+ * To fetch more data, use the same `since` and `until` parameters and set `startInclusive` to the `nextStartInclusive` value from the previous response. If `nextStartInclusive` is absent, it means there's no more data to fetch, even if the max number of entries were returned. */
659
+ get: {
660
+ parameters: {
661
+ query?: {
662
+ /** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
663
+ since?: string;
664
+ /** @description end with this timestamp (RFC3339); defaults to current date-time */
665
+ until?: string;
666
+ /** @description fetch results starting with this page; query starts with first entry if page isn't specified */
667
+ startInclusive?: number | null;
668
+ /** @description Query returns up to 50 trades in one go. */
669
+ pageSize?: number | null;
670
+ };
671
+ header?: never;
672
+ path: {
673
+ /** @description Account for which to retrieve PnL history */
674
+ account_id: number;
675
+ };
676
+ cookie?: never;
677
+ };
678
+ requestBody?: never;
679
+ responses: {
680
+ 200: {
681
+ headers: {
682
+ [name: string]: unknown;
683
+ };
684
+ content: {
685
+ "application/json": components["schemas"]["PageResult_for_uint64_and_AccountPnl"];
686
+ };
687
+ };
688
+ };
689
+ };
690
+ put?: never;
691
+ post?: never;
692
+ delete?: never;
693
+ options?: never;
694
+ head?: never;
695
+ patch?: never;
696
+ trace?: never;
697
+ };
698
+ "/account/{account_id}/triggers/history": {
699
+ parameters: {
700
+ query?: never;
701
+ header?: never;
702
+ path?: never;
703
+ cookie?: never;
704
+ };
705
+ get: {
706
+ parameters: {
707
+ query?: {
708
+ /** @description start with this timestamp (RFC3339); defaults to UNIX epoch start */
709
+ since?: string;
710
+ /** @description end with this timestamp (RFC3339); defaults to current date-time */
711
+ until?: string;
712
+ /** @description fetch results starting with this page; query starts with first entry if page isn't specified */
713
+ startInclusive?: number | null;
714
+ /** @description Query returns up to 50 trades in one go. */
715
+ pageSize?: number | null;
716
+ };
717
+ header?: never;
718
+ path: {
719
+ account_id: number;
720
+ };
721
+ cookie?: never;
722
+ };
723
+ requestBody?: never;
724
+ responses: {
725
+ 200: {
726
+ headers: {
727
+ [name: string]: unknown;
728
+ };
729
+ content: {
730
+ "application/json": components["schemas"]["PageResult_for_uint64_and_HistoryTriggerInfo"];
731
+ };
732
+ };
733
+ };
734
+ };
735
+ put?: never;
736
+ post?: never;
737
+ delete?: never;
738
+ options?: never;
739
+ head?: never;
740
+ patch?: never;
741
+ trace?: never;
742
+ };
743
+ "/account/{account_id}/triggers": {
744
+ parameters: {
745
+ query?: never;
746
+ header?: never;
747
+ path?: never;
748
+ cookie?: never;
749
+ };
750
+ get: {
751
+ parameters: {
752
+ query?: never;
753
+ header?: never;
754
+ path: {
755
+ account_id: number;
756
+ };
757
+ cookie?: never;
758
+ };
759
+ requestBody?: never;
760
+ responses: {
761
+ 200: {
762
+ headers: {
763
+ [name: string]: unknown;
764
+ };
765
+ content: {
766
+ "application/json": components["schemas"]["TriggerInfo"][] | null;
767
+ };
768
+ };
769
+ };
770
+ };
771
+ put?: never;
772
+ post?: never;
773
+ delete?: never;
774
+ options?: never;
775
+ head?: never;
776
+ patch?: never;
777
+ trace?: never;
778
+ };
639
779
  "/account/{account_id}/pubkey": {
640
780
  parameters: {
641
781
  query?: never;
@@ -1761,8 +1901,7 @@ export interface components {
1761
1901
  ActionsItem: {
1762
1902
  /** Format: uint64 */
1763
1903
  actionId: number;
1764
- /** Format: int64 */
1765
- physicalTime: number;
1904
+ physicalTime: string;
1766
1905
  payload: string;
1767
1906
  };
1768
1907
  RangeTooLarge: {
@@ -2008,6 +2147,106 @@ export interface components {
2008
2147
  /** @description See `bankruptcy` in MARKETS.md. In general happens if account does not have enough weighted tokens to covert his debt and negative PnL. */
2009
2148
  bankruptcy: boolean;
2010
2149
  };
2150
+ AccountPnlQuery: {
2151
+ /**
2152
+ * @description start with this timestamp (RFC3339); defaults to UNIX epoch start
2153
+ * @default null
2154
+ */
2155
+ since: string;
2156
+ /**
2157
+ * @description end with this timestamp (RFC3339); defaults to current date-time
2158
+ * @default null
2159
+ */
2160
+ until: string;
2161
+ /**
2162
+ * Format: uint64
2163
+ * @description fetch results starting with this page; query starts with first entry if page isn't specified
2164
+ */
2165
+ startInclusive?: number | null;
2166
+ /**
2167
+ * Format: uint8
2168
+ * @description Query returns up to 50 trades in one go.
2169
+ * @default null
2170
+ */
2171
+ pageSize: number | null;
2172
+ };
2173
+ PageResult_for_uint64_and_AccountPnl: {
2174
+ /** @description Set of items for requested by query. */
2175
+ items: components["schemas"]["AccountPnl"][];
2176
+ /**
2177
+ * Format: uint64
2178
+ * @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.
2179
+ */
2180
+ nextStartInclusive?: number | null;
2181
+ };
2182
+ AccountPnl: {
2183
+ time: string;
2184
+ /** Format: uint64 */
2185
+ actionId: number;
2186
+ /** Format: uint32 */
2187
+ accountId: number;
2188
+ /** Format: double */
2189
+ pnl: number;
2190
+ };
2191
+ AccountTriggersQuery: {
2192
+ /**
2193
+ * @description start with this timestamp (RFC3339); defaults to UNIX epoch start
2194
+ * @default null
2195
+ */
2196
+ since: string;
2197
+ /**
2198
+ * @description end with this timestamp (RFC3339); defaults to current date-time
2199
+ * @default null
2200
+ */
2201
+ until: string;
2202
+ /**
2203
+ * Format: uint64
2204
+ * @description fetch results starting with this page; query starts with first entry if page isn't specified
2205
+ */
2206
+ startInclusive?: number | null;
2207
+ /**
2208
+ * Format: uint8
2209
+ * @description Query returns up to 50 trades in one go.
2210
+ * @default null
2211
+ */
2212
+ pageSize: number | null;
2213
+ };
2214
+ PageResult_for_uint64_and_HistoryTriggerInfo: {
2215
+ /** @description Set of items for requested by query. */
2216
+ items: components["schemas"]["HistoryTriggerInfo"][];
2217
+ /**
2218
+ * Format: uint64
2219
+ * @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.
2220
+ */
2221
+ nextStartInclusive?: number | null;
2222
+ };
2223
+ HistoryTriggerInfo: {
2224
+ /** Format: uint32 */
2225
+ accountId: number;
2226
+ /** Format: uint64 */
2227
+ actionId: number;
2228
+ /** Format: uint32 */
2229
+ marketId: number;
2230
+ /** Format: uint64 */
2231
+ price: number;
2232
+ side: components["schemas"]["Side"];
2233
+ kind: components["schemas"]["TriggerKind"];
2234
+ status: components["schemas"]["TriggerStatus"];
2235
+ createdAt: string;
2236
+ updatedAt: string;
2237
+ };
2238
+ /** @enum {string} */
2239
+ TriggerKind: "stopLoss" | "takeProfit";
2240
+ /** @enum {string} */
2241
+ TriggerStatus: "added" | "succeeded" | "failed" | "removed";
2242
+ TriggerInfo: {
2243
+ /** Format: uint32 */
2244
+ marketId: number;
2245
+ /** Format: uint64 */
2246
+ price: number;
2247
+ side: components["schemas"]["Side"];
2248
+ kind: components["schemas"]["TriggerKind"];
2249
+ };
2011
2250
  OrderNotFound: null;
2012
2251
  PageResult_for_String_and_Trade: {
2013
2252
  /** @description Set of items for requested by query. */