@n1xyz/nord-ts 0.0.14 → 0.0.16-29f6652

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 (186) 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 +39 -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 +7 -3
  8. package/dist/bridge/types.js +3 -1
  9. package/dist/gen/common.js +1 -1
  10. package/dist/gen/nord.d.ts +74 -25
  11. package/dist/gen/nord.js +498 -78
  12. package/dist/idl/bridge.json +1493 -0
  13. package/dist/idl/index.d.ts +585 -0
  14. package/dist/idl/index.js +8 -0
  15. package/dist/nord/api/core.js +7 -5
  16. package/dist/nord/api/metrics.js +7 -4
  17. package/dist/nord/client/Nord.d.ts +19 -5
  18. package/dist/nord/client/Nord.js +50 -23
  19. package/dist/nord/client/NordUser.d.ts +1 -1
  20. package/dist/nord/client/NordUser.js +19 -16
  21. package/dist/types.d.ts +3 -3
  22. package/dist/websocket/NordWebSocketClient.js +0 -2
  23. package/docs/assets/hierarchy.js +1 -1
  24. package/docs/assets/navigation.js +1 -1
  25. package/docs/assets/search.js +1 -1
  26. package/docs/classes/Nord.html +99 -100
  27. package/docs/classes/NordError.html +6 -6
  28. package/docs/classes/NordUser.html +49 -54
  29. package/docs/classes/NordWebSocketClient.html +6 -11
  30. package/docs/classes/SolanaBridgeClient.html +32 -27
  31. package/docs/classes/Subscriber.html +3 -3
  32. package/docs/enums/FillMode.html +2 -2
  33. package/docs/enums/KeyType.html +2 -2
  34. package/docs/enums/MetricPeriod.html +2 -2
  35. package/docs/enums/PdaSeedType.html +5 -3
  36. package/docs/enums/PeakTpsPeriodUnit.html +2 -2
  37. package/docs/enums/Side.html +2 -2
  38. package/docs/enums/WebSocketMessageType.html +3 -3
  39. package/docs/functions/actionQueryRollman.html +1 -1
  40. package/docs/functions/actionsQueryRollman.html +1 -1
  41. package/docs/functions/aggregateMetrics-1.html +1 -1
  42. package/docs/functions/assert.html +1 -1
  43. package/docs/functions/bigIntToProtoU128.html +1 -1
  44. package/docs/functions/bridgeToBN.html +1 -1
  45. package/docs/functions/bufferToHex.html +1 -1
  46. package/docs/functions/cancelOrder.html +1 -1
  47. package/docs/functions/checkPubKeyLength.html +1 -1
  48. package/docs/functions/checkedFetch.html +1 -1
  49. package/docs/functions/createSession.html +1 -1
  50. package/docs/functions/decodeLengthDelimited.html +1 -1
  51. package/docs/functions/encodeLengthDelimited.html +1 -1
  52. package/docs/functions/fillModeToProtoFillMode.html +1 -1
  53. package/docs/functions/findMarket.html +1 -1
  54. package/docs/functions/findPda.html +1 -1
  55. package/docs/functions/findToken.html +1 -1
  56. package/docs/functions/fromBN.html +1 -1
  57. package/docs/functions/getAccount.html +1 -1
  58. package/docs/functions/getActionNonce.html +1 -1
  59. package/docs/functions/getCurrentTps.html +1 -1
  60. package/docs/functions/getInfo.html +1 -1
  61. package/docs/functions/{queryLastNBlocks.html → getLastActionId.html} +3 -3
  62. package/docs/functions/getMedianLatency.html +1 -1
  63. package/docs/functions/getOrderbook.html +1 -1
  64. package/docs/functions/getPeakTps.html +1 -1
  65. package/docs/functions/getTimestamp.html +1 -1
  66. package/docs/functions/getTotalTransactions.html +1 -1
  67. package/docs/functions/getTrades.html +1 -1
  68. package/docs/functions/getUserAccountIds.html +1 -1
  69. package/docs/functions/hexToBuffer.html +1 -1
  70. package/docs/functions/initWebSocketClient.html +9 -9
  71. package/docs/functions/keypairFromPrivateKey.html +1 -1
  72. package/docs/functions/makeSigningFunction.html +1 -1
  73. package/docs/functions/makeWalletSignFn.html +1 -1
  74. package/docs/functions/marketsStats.html +1 -1
  75. package/docs/functions/optExpect.html +1 -1
  76. package/docs/functions/optMap.html +1 -1
  77. package/docs/functions/optUnwrap.html +1 -1
  78. package/docs/functions/panic.html +1 -1
  79. package/docs/functions/placeOrder.html +1 -1
  80. package/docs/functions/queryAction.html +1 -1
  81. package/docs/functions/queryPrometheus.html +1 -1
  82. package/docs/functions/queryRecentActions.html +4 -3
  83. package/docs/functions/revokeSession.html +1 -1
  84. package/docs/functions/shortenPublicKey.html +1 -1
  85. package/docs/functions/signAction.html +1 -1
  86. package/docs/functions/toBN.html +1 -1
  87. package/docs/functions/toScaledU128.html +1 -1
  88. package/docs/functions/toScaledU64.html +1 -1
  89. package/docs/functions/transfer.html +1 -1
  90. package/docs/functions/withdraw.html +1 -1
  91. package/docs/hierarchy.html +1 -1
  92. package/docs/index.html +2 -2
  93. package/docs/interfaces/Account.html +2 -2
  94. package/docs/interfaces/ActionInfo.html +2 -2
  95. package/docs/interfaces/ActionNonceResponse.html +2 -2
  96. package/docs/interfaces/ActionQuery.html +2 -2
  97. package/docs/interfaces/ActionResponse.html +2 -2
  98. package/docs/interfaces/ActionsExtendedInfo.html +2 -2
  99. package/docs/interfaces/ActionsQuery.html +2 -2
  100. package/docs/interfaces/ActionsResponse.html +2 -2
  101. package/docs/interfaces/AggregateMetrics.html +2 -2
  102. package/docs/interfaces/BlockFacts.html +5 -5
  103. package/docs/interfaces/BlockQuery.html +2 -2
  104. package/docs/interfaces/BlockResponse.html +2 -2
  105. package/docs/interfaces/BlockSummary.html +2 -2
  106. package/docs/interfaces/BlockSummaryResponse.html +2 -2
  107. package/docs/interfaces/DeltaEvent.html +2 -2
  108. package/docs/interfaces/DepositSplParams.html +6 -6
  109. package/docs/interfaces/Info.html +2 -2
  110. package/docs/interfaces/Market.html +2 -2
  111. package/docs/interfaces/MarketStats.html +2 -2
  112. package/docs/interfaces/MarketsStatsResponse.html +2 -2
  113. package/docs/interfaces/NordConfig.html +19 -9
  114. package/docs/interfaces/NordWebSocketClientEvents.html +2 -2
  115. package/docs/interfaces/NordWebSocketEvents.html +3 -3
  116. package/docs/interfaces/Order.html +2 -2
  117. package/docs/interfaces/OrderInfo.html +2 -2
  118. package/docs/interfaces/OrderbookEntry.html +2 -2
  119. package/docs/interfaces/OrderbookQuery.html +2 -2
  120. package/docs/interfaces/OrderbookResponse.html +2 -2
  121. package/docs/interfaces/OrderbookSubscription.html +5 -5
  122. package/docs/interfaces/PerpMarketStats.html +2 -2
  123. package/docs/interfaces/RollmanActionExtendedInfo.html +2 -2
  124. package/docs/interfaces/RollmanActionInfo.html +2 -2
  125. package/docs/interfaces/RollmanActionResponse.html +2 -2
  126. package/docs/interfaces/RollmanActionsResponse.html +2 -2
  127. package/docs/interfaces/RollmanBlockResponse.html +2 -2
  128. package/docs/interfaces/SPLTokenInfo.html +5 -5
  129. package/docs/interfaces/SolanaBridgeConfig.html +8 -6
  130. package/docs/interfaces/StateFacts.html +5 -5
  131. package/docs/interfaces/SubscriberConfig.html +2 -2
  132. package/docs/interfaces/TimestampResponse.html +2 -2
  133. package/docs/interfaces/Token.html +2 -2
  134. package/docs/interfaces/TokenInfo.html +3 -2
  135. package/docs/interfaces/Trade.html +2 -2
  136. package/docs/interfaces/TradeSubscription.html +5 -5
  137. package/docs/interfaces/Trades.html +2 -2
  138. package/docs/interfaces/TradesQuery.html +2 -2
  139. package/docs/interfaces/TradesResponse.html +2 -2
  140. package/docs/interfaces/TransferParams.html +4 -4
  141. package/docs/interfaces/UserAccountIdsQuery.html +2 -2
  142. package/docs/interfaces/UserAccountIdsResponse.html +2 -2
  143. package/docs/interfaces/WebSocketAccountUpdate.html +6 -0
  144. package/docs/interfaces/WebSocketDeltaUpdate.html +3 -3
  145. package/docs/interfaces/WebSocketSubscription.html +3 -3
  146. package/docs/interfaces/WebSocketTradeUpdate.html +3 -3
  147. package/docs/interfaces/WithdrawalClaim.html +7 -7
  148. package/docs/interfaces/WithdrawalParams.html +4 -4
  149. package/docs/modules.html +1 -1
  150. package/docs/types/BigIntValue.html +1 -1
  151. package/docs/types/SubscriptionPattern.html +4 -0
  152. package/docs/types/SubscriptionType.html +2 -0
  153. package/docs/types/WebSocketMessage.html +1 -1
  154. package/docs/variables/DEBUG_KEYS.html +1 -1
  155. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
  156. package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
  157. package/docs/variables/DEV_URL.html +1 -1
  158. package/docs/variables/MAX_BUFFER_LEN.html +1 -1
  159. package/docs/variables/SESSION_TTL.html +1 -1
  160. package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
  161. package/docs/variables/ZERO_DECIMAL.html +1 -1
  162. package/docs/variables/_private.html +1 -1
  163. package/idl-generate.sh +4 -0
  164. package/package.json +6 -3
  165. package/src/bridge/client.ts +55 -43
  166. package/src/bridge/index.ts +1 -2
  167. package/src/bridge/types.ts +7 -3
  168. package/src/gen/common.ts +1 -1
  169. package/src/gen/nord.ts +567 -75
  170. package/src/idl/bridge.json +1493 -0
  171. package/src/idl/index.ts +2 -0
  172. package/src/nord/api/core.ts +1 -3
  173. package/src/nord/api/metrics.ts +2 -0
  174. package/src/nord/client/Nord.ts +49 -13
  175. package/src/nord/client/NordUser.ts +52 -59
  176. package/src/types.ts +2 -2
  177. package/src/websocket/NordWebSocketClient.ts +0 -2
  178. package/tsconfig.json +1 -1
  179. package/dist/idl/bridge.d.ts +0 -2
  180. package/dist/idl/bridge.js +0 -930
  181. package/docs/functions/blockQueryRollman.html +0 -6
  182. package/docs/functions/blockSummaryQueryRollman.html +0 -6
  183. package/docs/functions/queryBlock.html +0 -6
  184. package/docs/functions/queryRecentBlocks.html +0 -6
  185. package/docs/interfaces/WebSocketUserUpdate.html +0 -6
  186. package/src/idl/bridge.ts +0 -929
@@ -0,0 +1,585 @@
1
+ export declare const BRIDGE_IDL: {
2
+ address: string;
3
+ metadata: {
4
+ name: string;
5
+ version: string;
6
+ spec: string;
7
+ description: string;
8
+ };
9
+ instructions: ({
10
+ name: string;
11
+ discriminator: number[];
12
+ accounts: ({
13
+ name: string;
14
+ writable: boolean;
15
+ signer: boolean;
16
+ optional?: undefined;
17
+ pda?: undefined;
18
+ address?: undefined;
19
+ } | {
20
+ name: string;
21
+ writable: boolean;
22
+ signer?: undefined;
23
+ optional?: undefined;
24
+ pda?: undefined;
25
+ address?: undefined;
26
+ } | {
27
+ name: string;
28
+ optional: boolean;
29
+ pda: {
30
+ seeds: ({
31
+ kind: string;
32
+ value: number[];
33
+ path?: undefined;
34
+ account?: undefined;
35
+ } | {
36
+ kind: string;
37
+ path: string;
38
+ value?: undefined;
39
+ account?: undefined;
40
+ } | {
41
+ kind: string;
42
+ path: string;
43
+ account: string;
44
+ value?: undefined;
45
+ })[];
46
+ program?: undefined;
47
+ };
48
+ writable?: undefined;
49
+ signer?: undefined;
50
+ address?: undefined;
51
+ } | {
52
+ name: string;
53
+ pda: {
54
+ seeds: ({
55
+ kind: string;
56
+ value: number[];
57
+ path?: undefined;
58
+ } | {
59
+ kind: string;
60
+ path: string;
61
+ value?: undefined;
62
+ })[];
63
+ program?: undefined;
64
+ };
65
+ writable?: undefined;
66
+ signer?: undefined;
67
+ optional?: undefined;
68
+ address?: undefined;
69
+ } | {
70
+ name: string;
71
+ writable: boolean;
72
+ pda: {
73
+ seeds: {
74
+ kind: string;
75
+ path: string;
76
+ }[];
77
+ program: {
78
+ kind: string;
79
+ value: number[];
80
+ };
81
+ };
82
+ signer?: undefined;
83
+ optional?: undefined;
84
+ address?: undefined;
85
+ } | {
86
+ name: string;
87
+ writable?: undefined;
88
+ signer?: undefined;
89
+ optional?: undefined;
90
+ pda?: undefined;
91
+ address?: undefined;
92
+ } | {
93
+ name: string;
94
+ address: string;
95
+ writable?: undefined;
96
+ signer?: undefined;
97
+ optional?: undefined;
98
+ pda?: undefined;
99
+ })[];
100
+ args: {
101
+ name: string;
102
+ type: string;
103
+ }[];
104
+ } | {
105
+ name: string;
106
+ discriminator: number[];
107
+ accounts: ({
108
+ name: string;
109
+ docs?: undefined;
110
+ signer?: undefined;
111
+ pda?: undefined;
112
+ } | {
113
+ name: string;
114
+ docs: string[];
115
+ signer: boolean;
116
+ pda: {
117
+ seeds: ({
118
+ kind: string;
119
+ value: number[];
120
+ path?: undefined;
121
+ } | {
122
+ kind: string;
123
+ path: string;
124
+ value?: undefined;
125
+ })[];
126
+ };
127
+ })[];
128
+ args: never[];
129
+ } | {
130
+ name: string;
131
+ discriminator: number[];
132
+ accounts: ({
133
+ name: string;
134
+ writable: boolean;
135
+ signer: boolean;
136
+ pda?: undefined;
137
+ address?: undefined;
138
+ } | {
139
+ name: string;
140
+ writable: boolean;
141
+ signer?: undefined;
142
+ pda?: undefined;
143
+ address?: undefined;
144
+ } | {
145
+ name: string;
146
+ writable: boolean;
147
+ pda: {
148
+ seeds: ({
149
+ kind: string;
150
+ value: number[];
151
+ path?: undefined;
152
+ } | {
153
+ kind: string;
154
+ path: string;
155
+ value?: undefined;
156
+ })[];
157
+ };
158
+ signer?: undefined;
159
+ address?: undefined;
160
+ } | {
161
+ name: string;
162
+ pda: {
163
+ seeds: ({
164
+ kind: string;
165
+ value: number[];
166
+ path?: undefined;
167
+ } | {
168
+ kind: string;
169
+ path: string;
170
+ value?: undefined;
171
+ })[];
172
+ };
173
+ writable?: undefined;
174
+ signer?: undefined;
175
+ address?: undefined;
176
+ } | {
177
+ name: string;
178
+ writable?: undefined;
179
+ signer?: undefined;
180
+ pda?: undefined;
181
+ address?: undefined;
182
+ } | {
183
+ name: string;
184
+ address: string;
185
+ writable?: undefined;
186
+ signer?: undefined;
187
+ pda?: undefined;
188
+ })[];
189
+ args: {
190
+ name: string;
191
+ type: string;
192
+ }[];
193
+ } | {
194
+ name: string;
195
+ discriminator: number[];
196
+ accounts: ({
197
+ name: string;
198
+ writable: boolean;
199
+ signer: boolean;
200
+ pda?: undefined;
201
+ address?: undefined;
202
+ } | {
203
+ name: string;
204
+ writable?: undefined;
205
+ signer?: undefined;
206
+ pda?: undefined;
207
+ address?: undefined;
208
+ } | {
209
+ name: string;
210
+ writable: boolean;
211
+ pda: {
212
+ seeds: ({
213
+ kind: string;
214
+ value: number[];
215
+ path?: undefined;
216
+ } | {
217
+ kind: string;
218
+ path: string;
219
+ value?: undefined;
220
+ })[];
221
+ };
222
+ signer?: undefined;
223
+ address?: undefined;
224
+ } | {
225
+ name: string;
226
+ pda: {
227
+ seeds: ({
228
+ kind: string;
229
+ value: number[];
230
+ path?: undefined;
231
+ } | {
232
+ kind: string;
233
+ path: string;
234
+ value?: undefined;
235
+ })[];
236
+ };
237
+ writable?: undefined;
238
+ signer?: undefined;
239
+ address?: undefined;
240
+ } | {
241
+ name: string;
242
+ address: string;
243
+ writable?: undefined;
244
+ signer?: undefined;
245
+ pda?: undefined;
246
+ })[];
247
+ args: {
248
+ name: string;
249
+ type: {
250
+ array: (string | number)[];
251
+ };
252
+ }[];
253
+ } | {
254
+ name: string;
255
+ discriminator: number[];
256
+ accounts: ({
257
+ name: string;
258
+ writable: boolean;
259
+ signer: boolean;
260
+ address?: undefined;
261
+ } | {
262
+ name: string;
263
+ signer: boolean;
264
+ writable?: undefined;
265
+ address?: undefined;
266
+ } | {
267
+ name: string;
268
+ address: string;
269
+ writable?: undefined;
270
+ signer?: undefined;
271
+ })[];
272
+ args: ({
273
+ name: string;
274
+ type: string;
275
+ } | {
276
+ name: string;
277
+ type: {
278
+ array: (string | number)[];
279
+ };
280
+ })[];
281
+ } | {
282
+ name: string;
283
+ discriminator: number[];
284
+ accounts: ({
285
+ name: string;
286
+ writable: boolean;
287
+ signer: boolean;
288
+ optional?: undefined;
289
+ pda?: undefined;
290
+ address?: undefined;
291
+ } | {
292
+ name: string;
293
+ writable: boolean;
294
+ signer?: undefined;
295
+ optional?: undefined;
296
+ pda?: undefined;
297
+ address?: undefined;
298
+ } | {
299
+ name: string;
300
+ signer: boolean;
301
+ writable?: undefined;
302
+ optional?: undefined;
303
+ pda?: undefined;
304
+ address?: undefined;
305
+ } | {
306
+ name: string;
307
+ optional: boolean;
308
+ pda: {
309
+ seeds: ({
310
+ kind: string;
311
+ value: number[];
312
+ path?: undefined;
313
+ } | {
314
+ kind: string;
315
+ path: string;
316
+ value?: undefined;
317
+ })[];
318
+ };
319
+ writable?: undefined;
320
+ signer?: undefined;
321
+ address?: undefined;
322
+ } | {
323
+ name: string;
324
+ writable?: undefined;
325
+ signer?: undefined;
326
+ optional?: undefined;
327
+ pda?: undefined;
328
+ address?: undefined;
329
+ } | {
330
+ name: string;
331
+ pda: {
332
+ seeds: ({
333
+ kind: string;
334
+ value: number[];
335
+ path?: undefined;
336
+ } | {
337
+ kind: string;
338
+ path: string;
339
+ value?: undefined;
340
+ })[];
341
+ };
342
+ writable?: undefined;
343
+ signer?: undefined;
344
+ optional?: undefined;
345
+ address?: undefined;
346
+ } | {
347
+ name: string;
348
+ address: string;
349
+ writable?: undefined;
350
+ signer?: undefined;
351
+ optional?: undefined;
352
+ pda?: undefined;
353
+ })[];
354
+ args: {
355
+ name: string;
356
+ type: {
357
+ defined: {
358
+ name: string;
359
+ };
360
+ };
361
+ }[];
362
+ } | {
363
+ name: string;
364
+ discriminator: number[];
365
+ accounts: ({
366
+ name: string;
367
+ writable: boolean;
368
+ signer: boolean;
369
+ pda?: undefined;
370
+ } | {
371
+ name: string;
372
+ writable?: undefined;
373
+ signer?: undefined;
374
+ pda?: undefined;
375
+ } | {
376
+ name: string;
377
+ signer: boolean;
378
+ writable?: undefined;
379
+ pda?: undefined;
380
+ } | {
381
+ name: string;
382
+ writable: boolean;
383
+ pda: {
384
+ seeds: ({
385
+ kind: string;
386
+ value: number[];
387
+ path?: undefined;
388
+ } | {
389
+ kind: string;
390
+ path: string;
391
+ value?: undefined;
392
+ })[];
393
+ };
394
+ signer?: undefined;
395
+ } | {
396
+ name: string;
397
+ pda: {
398
+ seeds: ({
399
+ kind: string;
400
+ value: number[];
401
+ path?: undefined;
402
+ } | {
403
+ kind: string;
404
+ path: string;
405
+ value?: undefined;
406
+ })[];
407
+ };
408
+ writable?: undefined;
409
+ signer?: undefined;
410
+ })[];
411
+ args: {
412
+ name: string;
413
+ type: string;
414
+ }[];
415
+ } | {
416
+ name: string;
417
+ discriminator: number[];
418
+ accounts: ({
419
+ name: string;
420
+ writable: boolean;
421
+ signer: boolean;
422
+ pda?: undefined;
423
+ address?: undefined;
424
+ } | {
425
+ name: string;
426
+ writable?: undefined;
427
+ signer?: undefined;
428
+ pda?: undefined;
429
+ address?: undefined;
430
+ } | {
431
+ name: string;
432
+ pda: {
433
+ seeds: ({
434
+ kind: string;
435
+ value: number[];
436
+ path?: undefined;
437
+ } | {
438
+ kind: string;
439
+ path: string;
440
+ value?: undefined;
441
+ })[];
442
+ program?: undefined;
443
+ };
444
+ writable?: undefined;
445
+ signer?: undefined;
446
+ address?: undefined;
447
+ } | {
448
+ name: string;
449
+ writable: boolean;
450
+ pda: {
451
+ seeds: ({
452
+ kind: string;
453
+ value: number[];
454
+ path?: undefined;
455
+ } | {
456
+ kind: string;
457
+ path: string;
458
+ value?: undefined;
459
+ })[];
460
+ program?: undefined;
461
+ };
462
+ signer?: undefined;
463
+ address?: undefined;
464
+ } | {
465
+ name: string;
466
+ writable: boolean;
467
+ pda: {
468
+ seeds: {
469
+ kind: string;
470
+ path: string;
471
+ }[];
472
+ program: {
473
+ kind: string;
474
+ value: number[];
475
+ };
476
+ };
477
+ signer?: undefined;
478
+ address?: undefined;
479
+ } | {
480
+ name: string;
481
+ writable: boolean;
482
+ signer?: undefined;
483
+ pda?: undefined;
484
+ address?: undefined;
485
+ } | {
486
+ name: string;
487
+ address: string;
488
+ writable?: undefined;
489
+ signer?: undefined;
490
+ pda?: undefined;
491
+ })[];
492
+ args: {
493
+ name: string;
494
+ type: {
495
+ defined: {
496
+ name: string;
497
+ };
498
+ };
499
+ }[];
500
+ })[];
501
+ accounts: {
502
+ name: string;
503
+ discriminator: number[];
504
+ }[];
505
+ types: ({
506
+ name: string;
507
+ type: {
508
+ kind: string;
509
+ fields: ({
510
+ name: string;
511
+ type: {
512
+ defined: {
513
+ name: string;
514
+ };
515
+ };
516
+ } | {
517
+ name: string;
518
+ type: string;
519
+ })[];
520
+ variants?: undefined;
521
+ };
522
+ } | {
523
+ name: string;
524
+ type: {
525
+ kind: string;
526
+ fields: ({
527
+ name: string;
528
+ type: {
529
+ defined: {
530
+ name: string;
531
+ };
532
+ array?: undefined;
533
+ };
534
+ } | {
535
+ name: string;
536
+ type: {
537
+ array: (string | number)[];
538
+ defined?: undefined;
539
+ };
540
+ })[];
541
+ variants?: undefined;
542
+ };
543
+ } | {
544
+ name: string;
545
+ type: {
546
+ kind: string;
547
+ variants: {
548
+ name: string;
549
+ }[];
550
+ fields?: undefined;
551
+ };
552
+ } | {
553
+ name: string;
554
+ type: {
555
+ kind: string;
556
+ fields: ({
557
+ name: string;
558
+ type: {
559
+ array: (string | number)[];
560
+ };
561
+ } | {
562
+ name: string;
563
+ type: string;
564
+ })[];
565
+ variants?: undefined;
566
+ };
567
+ } | {
568
+ name: string;
569
+ type: {
570
+ kind: string;
571
+ fields: ({
572
+ name: string;
573
+ type: string;
574
+ } | {
575
+ name: string;
576
+ type: {
577
+ vec: {
578
+ array: (string | number)[];
579
+ };
580
+ };
581
+ })[];
582
+ variants?: undefined;
583
+ };
584
+ })[];
585
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BRIDGE_IDL = void 0;
7
+ const bridge_json_1 = __importDefault(require("./bridge.json"));
8
+ exports.BRIDGE_IDL = bridge_json_1.default;
@@ -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) {
@@ -95,7 +95,9 @@ function initWebSocketClient(webServerUrl, subscriptions, initialSubscriptions)
95
95
  // Validate subscriptions parameter
96
96
  if (typeof subscriptions === "string") {
97
97
  // Legacy mode - handle endpoint string
98
- if (subscriptions === "trades" || subscriptions === "delta" || subscriptions === "account") {
98
+ if (subscriptions === "trades" ||
99
+ subscriptions === "delta" ||
100
+ subscriptions === "account") {
99
101
  wsUrl += `/${subscriptions}`;
100
102
  // If initialSubscriptions provided, use them
101
103
  if (initialSubscriptions && initialSubscriptions.length > 0) {
@@ -151,12 +153,12 @@ function initWebSocketClient(webServerUrl, subscriptions, initialSubscriptions)
151
153
  * @throws {NordError} If the subscription format is invalid
152
154
  */
153
155
  function validateSubscription(subscription) {
154
- const [type, param] = subscription.split('@');
155
- if (!type || !param || !['trades', 'deltas', 'account'].includes(type)) {
156
+ const [type, param] = subscription.split("@");
157
+ if (!type || !param || !["trades", "deltas", "account"].includes(type)) {
156
158
  throw new NordError_1.NordError(`Invalid subscription format: ${subscription}. Expected format: "trades@SYMBOL", "deltas@SYMBOL", or "account@ID"`);
157
159
  }
158
160
  // Additional validation for account subscriptions
159
- if (type === 'account' && isNaN(Number(param))) {
161
+ if (type === "account" && isNaN(Number(param))) {
160
162
  throw new NordError_1.NordError(`Invalid account ID in subscription: ${subscription}. Account ID must be a number.`);
161
163
  }
162
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 (_) {
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) {