@n1xyz/nord-ts 0.0.12 → 0.0.15

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 (188) hide show
  1. package/.prettierignore +1 -0
  2. package/README.md +9 -6
  3. package/dist/bridge/client.d.ts +8 -7
  4. package/dist/bridge/client.js +38 -37
  5. package/dist/bridge/index.d.ts +1 -2
  6. package/dist/bridge/index.js +2 -2
  7. package/dist/bridge/types.d.ts +5 -3
  8. package/dist/bridge/types.js +3 -1
  9. package/dist/gen/nord.d.ts +66 -5
  10. package/dist/gen/nord.js +449 -22
  11. package/dist/idl/bridge.json +1493 -0
  12. package/dist/idl/index.d.ts +585 -0
  13. package/dist/idl/index.js +8 -0
  14. package/dist/nord/api/core.d.ts +8 -8
  15. package/dist/nord/api/core.js +58 -15
  16. package/dist/nord/api/metrics.js +7 -4
  17. package/dist/nord/client/Nord.d.ts +57 -72
  18. package/dist/nord/client/Nord.js +134 -125
  19. package/dist/nord/client/NordUser.d.ts +0 -17
  20. package/dist/nord/client/NordUser.js +4 -35
  21. package/dist/types.d.ts +38 -15
  22. package/dist/types.js +2 -2
  23. package/dist/websocket/NordWebSocketClient.d.ts +0 -3
  24. package/dist/websocket/NordWebSocketClient.js +10 -13
  25. package/dist/websocket/events.d.ts +2 -2
  26. package/docs/assets/hierarchy.js +1 -1
  27. package/docs/assets/navigation.js +1 -1
  28. package/docs/assets/search.js +1 -1
  29. package/docs/classes/Nord.html +99 -100
  30. package/docs/classes/NordError.html +6 -6
  31. package/docs/classes/NordUser.html +48 -53
  32. package/docs/classes/NordWebSocketClient.html +6 -11
  33. package/docs/classes/SolanaBridgeClient.html +23 -23
  34. package/docs/classes/Subscriber.html +3 -3
  35. package/docs/enums/FillMode.html +2 -2
  36. package/docs/enums/KeyType.html +2 -2
  37. package/docs/enums/MetricPeriod.html +2 -2
  38. package/docs/enums/PdaSeedType.html +2 -2
  39. package/docs/enums/PeakTpsPeriodUnit.html +2 -2
  40. package/docs/enums/Side.html +2 -2
  41. package/docs/enums/WebSocketMessageType.html +3 -3
  42. package/docs/functions/actionQueryRollman.html +1 -1
  43. package/docs/functions/actionsQueryRollman.html +1 -1
  44. package/docs/functions/aggregateMetrics-1.html +1 -1
  45. package/docs/functions/assert.html +1 -1
  46. package/docs/functions/bigIntToProtoU128.html +1 -1
  47. package/docs/functions/bridgeToBN.html +1 -1
  48. package/docs/functions/bufferToHex.html +1 -1
  49. package/docs/functions/cancelOrder.html +1 -1
  50. package/docs/functions/checkPubKeyLength.html +1 -1
  51. package/docs/functions/checkedFetch.html +1 -1
  52. package/docs/functions/createSession.html +1 -1
  53. package/docs/functions/decodeLengthDelimited.html +1 -1
  54. package/docs/functions/encodeLengthDelimited.html +1 -1
  55. package/docs/functions/fillModeToProtoFillMode.html +1 -1
  56. package/docs/functions/findMarket.html +1 -1
  57. package/docs/functions/findPda.html +1 -1
  58. package/docs/functions/findToken.html +1 -1
  59. package/docs/functions/fromBN.html +1 -1
  60. package/docs/functions/getAccount.html +1 -1
  61. package/docs/functions/getActionNonce.html +1 -1
  62. package/docs/functions/getCurrentTps.html +1 -1
  63. package/docs/functions/getInfo.html +1 -1
  64. package/docs/functions/{queryLastNBlocks.html → getLastActionId.html} +3 -3
  65. package/docs/functions/getMedianLatency.html +1 -1
  66. package/docs/functions/getOrderbook.html +1 -1
  67. package/docs/functions/getPeakTps.html +1 -1
  68. package/docs/functions/getTimestamp.html +1 -1
  69. package/docs/functions/getTotalTransactions.html +1 -1
  70. package/docs/functions/getTrades.html +1 -1
  71. package/docs/functions/getUserAccountIds.html +1 -1
  72. package/docs/functions/hexToBuffer.html +1 -1
  73. package/docs/functions/initWebSocketClient.html +9 -9
  74. package/docs/functions/keypairFromPrivateKey.html +1 -1
  75. package/docs/functions/makeSigningFunction.html +1 -1
  76. package/docs/functions/makeWalletSignFn.html +1 -1
  77. package/docs/functions/marketsStats.html +1 -1
  78. package/docs/functions/optExpect.html +1 -1
  79. package/docs/functions/optMap.html +1 -1
  80. package/docs/functions/optUnwrap.html +1 -1
  81. package/docs/functions/panic.html +1 -1
  82. package/docs/functions/placeOrder.html +1 -1
  83. package/docs/functions/queryAction.html +1 -1
  84. package/docs/functions/queryPrometheus.html +1 -1
  85. package/docs/functions/queryRecentActions.html +4 -3
  86. package/docs/functions/revokeSession.html +1 -1
  87. package/docs/functions/shortenPublicKey.html +1 -1
  88. package/docs/functions/signAction.html +1 -1
  89. package/docs/functions/toBN.html +1 -1
  90. package/docs/functions/toScaledU128.html +1 -1
  91. package/docs/functions/toScaledU64.html +1 -1
  92. package/docs/functions/transfer.html +1 -1
  93. package/docs/functions/withdraw.html +1 -1
  94. package/docs/hierarchy.html +1 -1
  95. package/docs/index.html +2 -2
  96. package/docs/interfaces/Account.html +2 -2
  97. package/docs/interfaces/ActionInfo.html +2 -2
  98. package/docs/interfaces/ActionNonceResponse.html +2 -2
  99. package/docs/interfaces/ActionQuery.html +2 -2
  100. package/docs/interfaces/ActionResponse.html +2 -2
  101. package/docs/interfaces/ActionsExtendedInfo.html +2 -2
  102. package/docs/interfaces/ActionsQuery.html +2 -2
  103. package/docs/interfaces/ActionsResponse.html +2 -2
  104. package/docs/interfaces/AggregateMetrics.html +2 -2
  105. package/docs/interfaces/BlockFacts.html +5 -5
  106. package/docs/interfaces/BlockQuery.html +2 -2
  107. package/docs/interfaces/BlockResponse.html +2 -2
  108. package/docs/interfaces/BlockSummary.html +2 -2
  109. package/docs/interfaces/BlockSummaryResponse.html +2 -2
  110. package/docs/interfaces/DeltaEvent.html +2 -2
  111. package/docs/interfaces/DepositSplParams.html +5 -5
  112. package/docs/interfaces/Info.html +2 -2
  113. package/docs/interfaces/Market.html +2 -2
  114. package/docs/interfaces/MarketStats.html +2 -2
  115. package/docs/interfaces/MarketsStatsResponse.html +2 -2
  116. package/docs/interfaces/NordConfig.html +19 -9
  117. package/docs/interfaces/NordWebSocketClientEvents.html +2 -2
  118. package/docs/interfaces/NordWebSocketEvents.html +3 -3
  119. package/docs/interfaces/Order.html +2 -2
  120. package/docs/interfaces/OrderInfo.html +2 -2
  121. package/docs/interfaces/OrderbookEntry.html +2 -2
  122. package/docs/interfaces/OrderbookQuery.html +2 -2
  123. package/docs/interfaces/OrderbookResponse.html +2 -2
  124. package/docs/interfaces/OrderbookSubscription.html +5 -5
  125. package/docs/interfaces/PerpMarketStats.html +2 -2
  126. package/docs/interfaces/RollmanActionExtendedInfo.html +2 -2
  127. package/docs/interfaces/RollmanActionInfo.html +2 -2
  128. package/docs/interfaces/RollmanActionResponse.html +2 -2
  129. package/docs/interfaces/RollmanActionsResponse.html +2 -2
  130. package/docs/interfaces/RollmanBlockResponse.html +2 -2
  131. package/docs/interfaces/SPLTokenInfo.html +5 -5
  132. package/docs/interfaces/SolanaBridgeConfig.html +5 -5
  133. package/docs/interfaces/StateFacts.html +5 -5
  134. package/docs/interfaces/SubscriberConfig.html +2 -2
  135. package/docs/interfaces/TimestampResponse.html +2 -2
  136. package/docs/interfaces/Token.html +2 -2
  137. package/docs/interfaces/TokenInfo.html +3 -2
  138. package/docs/interfaces/Trade.html +2 -2
  139. package/docs/interfaces/TradeSubscription.html +5 -5
  140. package/docs/interfaces/Trades.html +2 -2
  141. package/docs/interfaces/TradesQuery.html +2 -2
  142. package/docs/interfaces/TradesResponse.html +2 -2
  143. package/docs/interfaces/TransferParams.html +4 -4
  144. package/docs/interfaces/UserAccountIdsQuery.html +2 -2
  145. package/docs/interfaces/UserAccountIdsResponse.html +2 -2
  146. package/docs/interfaces/WebSocketAccountUpdate.html +6 -0
  147. package/docs/interfaces/WebSocketDeltaUpdate.html +3 -3
  148. package/docs/interfaces/WebSocketSubscription.html +3 -3
  149. package/docs/interfaces/WebSocketTradeUpdate.html +3 -3
  150. package/docs/interfaces/WithdrawalClaim.html +7 -7
  151. package/docs/interfaces/WithdrawalParams.html +4 -4
  152. package/docs/modules.html +1 -1
  153. package/docs/types/BigIntValue.html +1 -1
  154. package/docs/types/SubscriptionPattern.html +4 -0
  155. package/docs/types/SubscriptionType.html +2 -0
  156. package/docs/types/WebSocketMessage.html +1 -1
  157. package/docs/variables/DEBUG_KEYS.html +1 -1
  158. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
  159. package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
  160. package/docs/variables/DEV_URL.html +1 -1
  161. package/docs/variables/MAX_BUFFER_LEN.html +1 -1
  162. package/docs/variables/SESSION_TTL.html +1 -1
  163. package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
  164. package/docs/variables/ZERO_DECIMAL.html +1 -1
  165. package/docs/variables/_private.html +1 -1
  166. package/idl-generate.sh +4 -0
  167. package/package.json +4 -3
  168. package/src/bridge/client.ts +54 -43
  169. package/src/bridge/index.ts +1 -2
  170. package/src/bridge/types.ts +5 -3
  171. package/src/gen/nord.ts +518 -19
  172. package/src/idl/bridge.json +1493 -0
  173. package/src/idl/index.ts +2 -0
  174. package/src/nord/api/core.ts +70 -20
  175. package/src/nord/api/metrics.ts +28 -20
  176. package/src/nord/api/queries.ts +7 -11
  177. package/src/nord/client/Nord.ts +174 -168
  178. package/src/nord/client/NordUser.ts +32 -98
  179. package/src/types.ts +40 -15
  180. package/src/websocket/NordWebSocketClient.ts +11 -14
  181. package/src/websocket/events.ts +2 -2
  182. package/docs/functions/blockQueryRollman.html +0 -6
  183. package/docs/functions/blockSummaryQueryRollman.html +0 -6
  184. package/docs/functions/queryBlock.html +0 -6
  185. package/docs/functions/queryRecentBlocks.html +0 -6
  186. package/docs/interfaces/WebSocketUserUpdate.html +0 -6
  187. package/src/idl/bridge.ts +0 -930
  188. package/test.ts +0 -107
@@ -0,0 +1,2 @@
1
+ import data from "./bridge.json";
2
+ export const BRIDGE_IDL = data;
@@ -1,4 +1,4 @@
1
- import { Account, Info } from "../../types";
1
+ import { Account, Info, SubscriptionPattern } from "../../types";
2
2
  import { checkedFetch } from "../../utils";
3
3
  import { NordWebSocketClient } from "../../websocket/index";
4
4
  import { NordError } from "../utils/NordError";
@@ -65,9 +65,7 @@ export async function getAccount(
65
65
  accountId: number,
66
66
  ): Promise<Account> {
67
67
  try {
68
- const response = await checkedFetch(
69
- `${webServerUrl}/account?account_id=${accountId}`,
70
- );
68
+ const response = await checkedFetch(`${webServerUrl}/account/${accountId}`);
71
69
  return await response.json();
72
70
  } catch (error) {
73
71
  throw new NordError(`Failed to get account ${accountId}`, { cause: error });
@@ -77,27 +75,55 @@ export async function getAccount(
77
75
  /**
78
76
  * Initialize a WebSocket client for Nord
79
77
  *
80
- * Connects to one of the specific Nord WebSocket endpoints:
81
- * - /ws/trades - For trade updates (default)
82
- * - /ws/deltas - For orderbook delta updates
83
- * - /ws/user - For user-specific updates
78
+ * Connects to the Nord WebSocket endpoint with support for multiple subscription types:
79
+ * - trades@SYMBOL - For trade updates
80
+ * - deltas@SYMBOL - For orderbook delta updates
81
+ * - account@ACCOUNT_ID - For user-specific updates
84
82
  *
85
83
  * @param webServerUrl - Base URL for the Nord web server
86
- * @param endpoint - Specific WebSocket endpoint to connect to (trades, deltas, or user)
87
- * @param initialSubscriptions - Optional array of initial subscriptions (e.g., ["trades@BTCUSDC"])
84
+ * @param subscriptions - Array of subscriptions (e.g., ["trades@BTCUSDC", "deltas@BTCUSDC", "account@42"])
88
85
  * @returns WebSocket client
86
+ * @throws {NordError} If initialization fails or invalid subscription is provided
89
87
  */
90
88
  export function initWebSocketClient(
91
89
  webServerUrl: string,
92
- endpoint?: "trades" | "deltas" | "user",
93
- initialSubscriptions?: string[],
90
+ subscriptions?: SubscriptionPattern[] | "trades" | "delta" | "account",
91
+ initialSubscriptions?: SubscriptionPattern[],
94
92
  ): NordWebSocketClient {
95
93
  try {
96
- // Convert HTTP URL to WebSocket URL with specific endpoint
97
- // If no specific endpoint is provided, we'll connect to trades by default
98
- const specificEndpoint = endpoint || "trades";
99
- const wsUrl =
100
- webServerUrl.replace(/^http/, "ws") + `/ws/${specificEndpoint}`;
94
+ // Determine URL and subscriptions based on parameters
95
+ let wsUrl = webServerUrl.replace(/^http/, "ws") + `/ws`;
96
+ let wsSubscriptions: SubscriptionPattern[] = [];
97
+
98
+ // Validate subscriptions parameter
99
+ if (typeof subscriptions === "string") {
100
+ // Legacy mode - handle endpoint string
101
+ if (
102
+ subscriptions === "trades" ||
103
+ subscriptions === "delta" ||
104
+ subscriptions === "account"
105
+ ) {
106
+ wsUrl += `/${subscriptions}`;
107
+ // If initialSubscriptions provided, use them
108
+ if (initialSubscriptions && initialSubscriptions.length > 0) {
109
+ // Validate initialSubscriptions
110
+ initialSubscriptions.forEach(validateSubscription);
111
+ wsSubscriptions = initialSubscriptions;
112
+ }
113
+ } else {
114
+ throw new NordError(
115
+ `Invalid endpoint: ${subscriptions}. Must be "trades", "deltas", or "account".`,
116
+ );
117
+ }
118
+ } else if (Array.isArray(subscriptions) && subscriptions.length > 0) {
119
+ // New mode - validate and combine subscriptions in URL
120
+ subscriptions.forEach(validateSubscription);
121
+ wsUrl += `/${subscriptions.join("&")}`;
122
+ } else {
123
+ // Default to trades endpoint if no subscriptions specified
124
+ wsUrl += `/trades`;
125
+ }
126
+
101
127
  console.log(`Initializing WebSocket client with URL: ${wsUrl}`);
102
128
 
103
129
  // Create and connect the WebSocket client
@@ -112,9 +138,10 @@ export function initWebSocketClient(
112
138
  ws.on("connected", () => {
113
139
  console.log("Nord WebSocket connected successfully");
114
140
 
115
- // Subscribe to initial subscriptions if provided
116
- if (initialSubscriptions && initialSubscriptions.length > 0) {
117
- ws.subscribe(initialSubscriptions);
141
+ // Subscribe to additional subscriptions if provided
142
+ // For new format, these are already part of the URL
143
+ if (wsSubscriptions.length > 0) {
144
+ ws.subscribe(wsSubscriptions);
118
145
  }
119
146
  });
120
147
 
@@ -128,3 +155,26 @@ export function initWebSocketClient(
128
155
  });
129
156
  }
130
157
  }
158
+
159
+ /**
160
+ * Validates a subscription string follows the correct format
161
+ *
162
+ * @param subscription - The subscription to validate
163
+ * @throws {NordError} If the subscription format is invalid
164
+ */
165
+ function validateSubscription(subscription: string): void {
166
+ const [type, param] = subscription.split("@");
167
+
168
+ if (!type || !param || !["trades", "deltas", "account"].includes(type)) {
169
+ throw new NordError(
170
+ `Invalid subscription format: ${subscription}. Expected format: "trades@SYMBOL", "deltas@SYMBOL", or "account@ID"`,
171
+ );
172
+ }
173
+
174
+ // Additional validation for account subscriptions
175
+ if (type === "account" && isNaN(Number(param))) {
176
+ throw new NordError(
177
+ `Invalid account ID in subscription: ${subscription}. Account ID must be a number.`,
178
+ );
179
+ }
180
+ }
@@ -33,19 +33,19 @@ export async function aggregateMetrics(
33
33
  const response = await checkedFetch(
34
34
  `${webServerUrl}/metrics?tx_peak_tps_period=${txPeakTpsPeriod}&tx_peak_tps_period_unit=${txPeakTpsPeriodUnit}`,
35
35
  );
36
-
36
+
37
37
  // Get the raw text response (Prometheus format)
38
38
  const text = await response.text();
39
-
39
+
40
40
  // Parse the Prometheus-formatted metrics text into an AggregateMetrics object
41
41
  const metrics: AggregateMetrics = {
42
42
  blocks_total: 0,
43
43
  tx_total: extractMetricValue(text, "nord_requests_ok_count"),
44
44
  tx_tps: calculateTps(text),
45
45
  tx_tps_peak: calculatePeakTps(text),
46
- request_latency_average: extractLatency(text)
46
+ request_latency_average: extractLatency(text),
47
47
  };
48
-
48
+
49
49
  return metrics;
50
50
  } catch (error) {
51
51
  throw new NordError("Failed to fetch aggregate metrics", { cause: error });
@@ -54,20 +54,20 @@ export async function aggregateMetrics(
54
54
 
55
55
  /**
56
56
  * Extract a metric value from Prometheus-formatted text
57
- *
57
+ *
58
58
  * @param text - Prometheus-formatted metrics text
59
59
  * @param metricName - Name of the metric to extract
60
60
  * @returns The metric value as a number, or 0 if not found
61
61
  */
62
62
  function extractMetricValue(text: string, metricName: string): number {
63
- const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, 'm');
63
+ const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, "m");
64
64
  const match = text.match(regex);
65
65
  return match ? parseFloat(match[1]) : 0;
66
66
  }
67
67
 
68
68
  /**
69
69
  * Calculate TPS from Prometheus metrics
70
- *
70
+ *
71
71
  * @param text - Prometheus-formatted metrics text
72
72
  * @returns Calculated TPS value
73
73
  */
@@ -75,52 +75,60 @@ function calculateTps(text: string): number {
75
75
  // Use the request count and latency to estimate TPS
76
76
  const requestCount = extractMetricValue(text, "nord_requests_ok_count");
77
77
  const latencySum = extractSummaryValue(text, "nord_requests_ok_latency_sum");
78
- const latencyCount = extractSummaryValue(text, "nord_requests_ok_latency_count");
79
-
78
+ const latencyCount = extractSummaryValue(
79
+ text,
80
+ "nord_requests_ok_latency_count",
81
+ );
82
+
80
83
  if (latencySum > 0 && latencyCount > 0) {
81
84
  // Average latency in seconds
82
85
  const avgLatency = latencySum / latencyCount;
83
86
  // If we have valid latency data, estimate TPS as requests per second
84
87
  return avgLatency > 0 ? requestCount / (latencyCount * avgLatency) : 0;
85
88
  }
86
-
89
+
87
90
  // Fallback: just return a small fraction of the total request count
88
91
  return requestCount > 0 ? requestCount / 100 : 0;
89
92
  }
90
93
 
91
94
  /**
92
95
  * Calculate peak TPS from Prometheus metrics
93
- *
96
+ *
94
97
  * @param text - Prometheus-formatted metrics text
95
98
  * @returns Calculated peak TPS value
96
99
  */
97
100
  function calculatePeakTps(text: string): number {
98
101
  // For peak TPS, we'll use a simple heuristic: 2x the current TPS estimate
102
+ // TODO: fix this
99
103
  return calculateTps(text) * 2;
100
104
  }
101
105
 
102
106
  /**
103
107
  * Extract latency from Prometheus metrics
104
- *
108
+ *
105
109
  * @param text - Prometheus-formatted metrics text
106
110
  * @returns Average latency in seconds
107
111
  */
108
112
  function extractLatency(text: string): number {
113
+ // TODO: fix - using average for latency is kinda wack. ok to merge for now but should change.
109
114
  const latencySum = extractSummaryValue(text, "nord_requests_ok_latency_sum");
110
- const latencyCount = extractSummaryValue(text, "nord_requests_ok_latency_count");
111
-
115
+ const latencyCount = extractSummaryValue(
116
+ text,
117
+ "nord_requests_ok_latency_count",
118
+ );
119
+
112
120
  return latencyCount > 0 ? latencySum / latencyCount : 0;
113
121
  }
114
122
 
115
123
  /**
116
124
  * Extract a summary value from Prometheus-formatted text
117
- *
125
+ *
118
126
  * @param text - Prometheus-formatted metrics text
119
127
  * @param metricName - Name of the metric to extract
120
128
  * @returns The metric value as a number, or 0 if not found
121
129
  */
122
130
  function extractSummaryValue(text: string, metricName: string): number {
123
- const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, 'm');
131
+ const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, "m");
124
132
  const match = text.match(regex);
125
133
  return match ? parseFloat(match[1]) : 0;
126
134
  }
@@ -235,21 +243,21 @@ export async function queryPrometheus(
235
243
  const response = await checkedFetch(
236
244
  `${webServerUrl}/prometheus?query=${encodeURIComponent(params)}`,
237
245
  );
238
-
246
+
239
247
  // Handle raw text response
240
248
  const text = await response.text();
241
249
  try {
242
250
  // Try to parse as JSON first
243
251
  const data = JSON.parse(text);
244
252
  return data.data.result[0]?.value[1] || 0;
245
- } catch (e) {
246
-
253
+ } catch (error) {
254
+ console.log("Prometheus query failed:", error);
247
255
  // Try to find a number in the response
248
256
  const numberMatch = text.match(/[\d.]+/);
249
257
  if (numberMatch) {
250
258
  return parseFloat(numberMatch[0]);
251
259
  }
252
-
260
+
253
261
  // Return 0 if no number is found
254
262
  return 0;
255
263
  }
@@ -2,17 +2,12 @@ import {
2
2
  ActionQuery,
3
3
  ActionResponse,
4
4
  ActionsResponse,
5
- BlockQuery,
6
- BlockResponse,
7
- BlockSummaryResponse,
8
5
  RollmanActionResponse,
9
6
  RollmanActionsResponse,
10
- RollmanBlockResponse,
11
7
  } from "../../types";
12
8
  import { checkedFetch } from "../../utils";
13
9
  import { NordError } from "../utils/NordError";
14
10
 
15
-
16
11
  /**
17
12
  * Query a specific action
18
13
  *
@@ -60,9 +55,12 @@ export async function queryRecentActions(
60
55
  );
61
56
  return await response.json();
62
57
  } catch (error) {
63
- throw new NordError(`Failed to query recent actions (from ${from} to ${to})`, {
64
- cause: error,
65
- });
58
+ throw new NordError(
59
+ `Failed to query recent actions (from ${from} to ${to})`,
60
+ {
61
+ cause: error,
62
+ },
63
+ );
66
64
  }
67
65
  }
68
66
 
@@ -73,9 +71,7 @@ export async function queryRecentActions(
73
71
  * @returns Last action ID
74
72
  * @throws {NordError} If the request fails
75
73
  */
76
- export async function getLastActionId(
77
- webServerUrl: string,
78
- ): Promise<number> {
74
+ export async function getLastActionId(webServerUrl: string): Promise<number> {
79
75
  try {
80
76
  const response = await checkedFetch(`${webServerUrl}/last_actionid`);
81
77
  const data = await response.json();