@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
@@ -67,7 +67,7 @@ async function getInfo(webServerUrl) {
67
67
  */
68
68
  async function getAccount(webServerUrl, accountId) {
69
69
  try {
70
- const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/account?account_id=${accountId}`);
70
+ const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/account/${accountId}`);
71
71
  return await response.json();
72
72
  }
73
73
  catch (error) {
@@ -77,22 +77,48 @@ async function getAccount(webServerUrl, accountId) {
77
77
  /**
78
78
  * Initialize a WebSocket client for Nord
79
79
  *
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
80
+ * Connects to the Nord WebSocket endpoint with support for multiple subscription types:
81
+ * - trades@SYMBOL - For trade updates
82
+ * - deltas@SYMBOL - For orderbook delta updates
83
+ * - account@ACCOUNT_ID - For user-specific updates
84
84
  *
85
85
  * @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"])
86
+ * @param subscriptions - Array of subscriptions (e.g., ["trades@BTCUSDC", "deltas@BTCUSDC", "account@42"])
88
87
  * @returns WebSocket client
88
+ * @throws {NordError} If initialization fails or invalid subscription is provided
89
89
  */
90
- function initWebSocketClient(webServerUrl, endpoint, initialSubscriptions) {
90
+ function initWebSocketClient(webServerUrl, subscriptions, initialSubscriptions) {
91
91
  try {
92
- // Convert HTTP URL to WebSocket URL with specific endpoint
93
- // If no specific endpoint is provided, we'll connect to trades by default
94
- const specificEndpoint = endpoint || "trades";
95
- const wsUrl = webServerUrl.replace(/^http/, "ws") + `/ws/${specificEndpoint}`;
92
+ // Determine URL and subscriptions based on parameters
93
+ let wsUrl = webServerUrl.replace(/^http/, "ws") + `/ws`;
94
+ let wsSubscriptions = [];
95
+ // Validate subscriptions parameter
96
+ if (typeof subscriptions === "string") {
97
+ // Legacy mode - handle endpoint string
98
+ if (subscriptions === "trades" ||
99
+ subscriptions === "delta" ||
100
+ subscriptions === "account") {
101
+ wsUrl += `/${subscriptions}`;
102
+ // If initialSubscriptions provided, use them
103
+ if (initialSubscriptions && initialSubscriptions.length > 0) {
104
+ // Validate initialSubscriptions
105
+ initialSubscriptions.forEach(validateSubscription);
106
+ wsSubscriptions = initialSubscriptions;
107
+ }
108
+ }
109
+ else {
110
+ throw new NordError_1.NordError(`Invalid endpoint: ${subscriptions}. Must be "trades", "deltas", or "account".`);
111
+ }
112
+ }
113
+ else if (Array.isArray(subscriptions) && subscriptions.length > 0) {
114
+ // New mode - validate and combine subscriptions in URL
115
+ subscriptions.forEach(validateSubscription);
116
+ wsUrl += `/${subscriptions.join("&")}`;
117
+ }
118
+ else {
119
+ // Default to trades endpoint if no subscriptions specified
120
+ wsUrl += `/trades`;
121
+ }
96
122
  console.log(`Initializing WebSocket client with URL: ${wsUrl}`);
97
123
  // Create and connect the WebSocket client
98
124
  const ws = new index_1.NordWebSocketClient(wsUrl);
@@ -103,9 +129,10 @@ function initWebSocketClient(webServerUrl, endpoint, initialSubscriptions) {
103
129
  // Add connected handler for debugging
104
130
  ws.on("connected", () => {
105
131
  console.log("Nord WebSocket connected successfully");
106
- // Subscribe to initial subscriptions if provided
107
- if (initialSubscriptions && initialSubscriptions.length > 0) {
108
- ws.subscribe(initialSubscriptions);
132
+ // Subscribe to additional subscriptions if provided
133
+ // For new format, these are already part of the URL
134
+ if (wsSubscriptions.length > 0) {
135
+ ws.subscribe(wsSubscriptions);
109
136
  }
110
137
  });
111
138
  // Connect the WebSocket
@@ -119,3 +146,19 @@ function initWebSocketClient(webServerUrl, endpoint, initialSubscriptions) {
119
146
  });
120
147
  }
121
148
  }
149
+ /**
150
+ * Validates a subscription string follows the correct format
151
+ *
152
+ * @param subscription - The subscription to validate
153
+ * @throws {NordError} If the subscription format is invalid
154
+ */
155
+ function validateSubscription(subscription) {
156
+ const [type, param] = subscription.split("@");
157
+ if (!type || !param || !["trades", "deltas", "account"].includes(type)) {
158
+ throw new NordError_1.NordError(`Invalid subscription format: ${subscription}. Expected format: "trades@SYMBOL", "deltas@SYMBOL", or "account@ID"`);
159
+ }
160
+ // Additional validation for account subscriptions
161
+ if (type === "account" && isNaN(Number(param))) {
162
+ throw new NordError_1.NordError(`Invalid account ID in subscription: ${subscription}. Account ID must be a number.`);
163
+ }
164
+ }
@@ -43,7 +43,7 @@ async function aggregateMetrics(webServerUrl, txPeakTpsPeriod = 1, txPeakTpsPeri
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
  return metrics;
49
49
  }
@@ -59,7 +59,7 @@ async function aggregateMetrics(webServerUrl, txPeakTpsPeriod = 1, txPeakTpsPeri
59
59
  * @returns The metric value as a number, or 0 if not found
60
60
  */
61
61
  function extractMetricValue(text, metricName) {
62
- const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, 'm');
62
+ const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, "m");
63
63
  const match = text.match(regex);
64
64
  return match ? parseFloat(match[1]) : 0;
65
65
  }
@@ -91,6 +91,7 @@ function calculateTps(text) {
91
91
  */
92
92
  function calculatePeakTps(text) {
93
93
  // For peak TPS, we'll use a simple heuristic: 2x the current TPS estimate
94
+ // TODO: fix this
94
95
  return calculateTps(text) * 2;
95
96
  }
96
97
  /**
@@ -100,6 +101,7 @@ function calculatePeakTps(text) {
100
101
  * @returns Average latency in seconds
101
102
  */
102
103
  function extractLatency(text) {
104
+ // TODO: fix - using average for latency is kinda wack. ok to merge for now but should change.
103
105
  const latencySum = extractSummaryValue(text, "nord_requests_ok_latency_sum");
104
106
  const latencyCount = extractSummaryValue(text, "nord_requests_ok_latency_count");
105
107
  return latencyCount > 0 ? latencySum / latencyCount : 0;
@@ -112,7 +114,7 @@ function extractLatency(text) {
112
114
  * @returns The metric value as a number, or 0 if not found
113
115
  */
114
116
  function extractSummaryValue(text, metricName) {
115
- const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, 'm');
117
+ const regex = new RegExp(`^${metricName}\\s+([\\d.]+)`, "m");
116
118
  const match = text.match(regex);
117
119
  return match ? parseFloat(match[1]) : 0;
118
120
  }
@@ -208,7 +210,8 @@ async function queryPrometheus(webServerUrl, params) {
208
210
  const data = JSON.parse(text);
209
211
  return data.data.result[0]?.value[1] || 0;
210
212
  }
211
- catch (e) {
213
+ catch (error) {
214
+ console.log("Prometheus query failed:", error);
212
215
  // Try to find a number in the response
213
216
  const numberMatch = text.match(/[\d.]+/);
214
217
  if (numberMatch) {
@@ -8,14 +8,27 @@ import { OrderbookSubscription, TradeSubscription } from "../models/Subscriber";
8
8
  export interface UserSubscription extends EventEmitter {
9
9
  close: () => void;
10
10
  }
11
+ /**
12
+ * WebSocket subscription options interface
13
+ */
14
+ export interface WebSocketSubscriptionOptions {
15
+ /** Market symbols to subscribe to for trade updates */
16
+ trades?: string[];
17
+ /** Market symbols to subscribe to for orderbook delta updates */
18
+ deltas?: string[];
19
+ /** Account IDs to subscribe to for account updates */
20
+ accounts?: number[];
21
+ }
11
22
  /**
12
23
  * Main Nord client class for interacting with the Nord API
13
24
  */
14
25
  export declare class Nord {
15
26
  /** Base URL for the Nord web server */
16
27
  readonly webServerUrl: string;
17
- /** Solana program ID */
18
- readonly solanaProgramId: string;
28
+ /** Bridge verification key */
29
+ readonly bridgeVk: string;
30
+ /** Optional Solana program ID (will be derived from bridgeVk) */
31
+ private _solanaProgramId;
19
32
  /** Solana RPC URL */
20
33
  readonly solanaUrl: string;
21
34
  /** Available markets */
@@ -24,57 +37,38 @@ export declare class Nord {
24
37
  tokens: Token[];
25
38
  /** Map of symbol to market_id */
26
39
  private symbolToMarketId;
27
- /**
28
- * WebSocket client for trades
29
- * @private
30
- */
31
- private tradesWs;
32
- /**
33
- * WebSocket client for orderbook deltas
34
- * @private
35
- */
36
- private deltasWs;
37
- /**
38
- * WebSocket client for user updates
39
- * @private
40
- */
41
- private userWs;
42
- /**
43
- * Initial subscriptions for the trades WebSocket
44
- * @private
45
- */
46
- private tradesSubscriptions?;
47
- /**
48
- * Initial subscriptions for the deltas WebSocket
49
- * @private
50
- */
51
- private deltasSubscriptions?;
52
40
  /**
53
41
  * Create a new Nord client
54
42
  *
55
43
  * @param config - Configuration options for the Nord client
56
44
  * @param config.webServerUrl - Base URL for the Nord web server
57
- * @param config.solanaProgramId - Solana program ID
45
+ * @param config.bridgeVk - Bridge verification key
58
46
  * @param config.solanaUrl - Solana cluster URL
59
- * @param config.initWebSockets - Whether to initialize WebSockets on creation, defaults to true
60
- * @param config.tradesSubscriptions - Optional array of trades subscriptions to initialize with (e.g., ["trades@BTCUSDC"])
61
- * @param config.deltasSubscriptions - Optional array of deltas subscriptions to initialize with (e.g., ["deltas@BTCUSDC"])
62
47
  * @throws {Error} If required configuration is missing
63
48
  */
64
- constructor({ webServerUrl, solanaProgramId, solanaUrl, initWebSockets, tradesSubscriptions, deltasSubscriptions, }: NordConfig);
49
+ constructor(config: NordConfig);
65
50
  /**
66
- * Initialize WebSocket clients for trades and deltas
51
+ * Create a WebSocket client with specific subscriptions
67
52
  *
68
- * This method can be called manually if websockets were not initialized during construction
69
- * (i.e., if initWebSockets was set to false in the constructor).
53
+ * @param options - Subscription options that specify which data streams to subscribe to
54
+ * @returns A new WebSocket client with the requested subscriptions
55
+ * @throws {NordError} If invalid subscription options are provided
70
56
  *
71
- * It initializes the trades and deltas WebSocket clients. The user WebSocket client
72
- * is initialized on demand when needed.
57
+ * @example
58
+ * // Create a client for trades and deltas from one market and an account
59
+ * const wsClient = nord.createWebSocketClient({
60
+ * trades: ["BTCUSDC"],
61
+ * deltas: ["BTCUSDC"],
62
+ * accounts: [123]
63
+ * });
73
64
  *
74
- * @param tradesSubscriptions - Optional array of trades subscriptions to initialize with
75
- * @param deltasSubscriptions - Optional array of deltas subscriptions to initialize with
65
+ * @example
66
+ * // Create a client for trades from multiple markets
67
+ * const tradesClient = nord.createWebSocketClient({
68
+ * trades: ["BTCUSDC", "ETHUSDC"]
69
+ * });
76
70
  */
77
- initializeWebSockets(tradesSubscriptions?: string[], deltasSubscriptions?: string[]): void;
71
+ createWebSocketClient(options: WebSocketSubscriptionOptions): NordWebSocketClient;
78
72
  /**
79
73
  * Get the current timestamp from the Nord server
80
74
  *
@@ -100,15 +94,24 @@ export declare class Nord {
100
94
  *
101
95
  * @param nordConfig - Configuration options for the Nord client
102
96
  * @param nordConfig.webServerUrl - Base URL for the Nord web server
103
- * @param nordConfig.solanaProgramId - Solana program ID
97
+ * @param nordConfig.bridgeVk - Bridge verification key
104
98
  * @param nordConfig.solanaUrl - Solana cluster URL
105
- * @param nordConfig.initWebSockets - Whether to initialize WebSockets on creation, defaults to true
106
- * @param nordConfig.tradesSubscriptions - Optional array of trades subscriptions (e.g., ["trades@BTCUSDC"])
107
- * @param nordConfig.deltasSubscriptions - Optional array of deltas subscriptions (e.g., ["deltas@BTCUSDC"])
108
99
  * @returns Initialized Nord client
109
100
  * @throws {NordError} If initialization fails
110
101
  */
111
102
  static initNord(nordConfig: NordConfig): Promise<Nord>;
103
+ /**
104
+ * Initialize the Nord client by deriving program ID and fetching info
105
+ * @private
106
+ */
107
+ private init;
108
+ /**
109
+ * Get the Solana program ID derived from bridge VK
110
+ *
111
+ * @returns Program ID string
112
+ * @throws {NordError} If program ID hasn't been initialized
113
+ */
114
+ getSolanaProgramId(): string;
112
115
  /**
113
116
  * Get market statistics
114
117
  *
@@ -204,39 +207,12 @@ export declare class Nord {
204
207
  * @throws {NordError} If the request fails
205
208
  */
206
209
  queryPrometheus(params: string): Promise<number>;
207
- /**
208
- * Get the trades WebSocket client (default)
209
- * If not already initialized, it will be created
210
- *
211
- * @returns WebSocket client for trades
212
- */
213
- getWebSocketClient(): NordWebSocketClient;
214
- /**
215
- * Get the trades WebSocket client
216
- * If not already initialized, it will be created
217
- *
218
- * @returns WebSocket client for trades
219
- */
220
- getTradesWebSocketClient(): NordWebSocketClient;
221
- /**
222
- * Get the deltas WebSocket client
223
- * If not already initialized, it will be created
224
- *
225
- * @returns WebSocket client for orderbook deltas
226
- */
227
- getDeltasWebSocketClient(): NordWebSocketClient;
228
- /**
229
- * Get the user WebSocket client
230
- * If not already initialized, it will be created
231
- *
232
- * @returns WebSocket client for user updates
233
- */
234
- getUserWebSocketClient(): NordWebSocketClient;
235
210
  /**
236
211
  * Subscribe to orderbook updates for a market
237
212
  *
238
213
  * @param symbol - Market symbol
239
214
  * @returns Orderbook subscription
215
+ * @throws {NordError} If symbol is invalid
240
216
  */
241
217
  subscribeOrderbook(symbol: string): OrderbookSubscription;
242
218
  /**
@@ -244,8 +220,17 @@ export declare class Nord {
244
220
  *
245
221
  * @param symbol - Market symbol
246
222
  * @returns Trade subscription
223
+ * @throws {NordError} If symbol is invalid
247
224
  */
248
225
  subscribeTrades(symbol: string): TradeSubscription;
226
+ /**
227
+ * Subscribe to account updates
228
+ *
229
+ * @param accountId - Account ID to subscribe to
230
+ * @returns User subscription
231
+ * @throws {NordError} If accountId is invalid
232
+ */
233
+ subscribeAccount(accountId: number): UserSubscription;
249
234
  /**
250
235
  * Get trades for a market
251
236
  *