@n1xyz/nord-ts 0.0.4 → 0.0.5

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 (306) hide show
  1. package/dist/bridge/client.d.ts +4 -4
  2. package/dist/bridge/client.js +4 -4
  3. package/dist/bridge/const.d.ts +2 -2
  4. package/dist/bridge/const.js +22 -22
  5. package/dist/bridge/index.d.ts +4 -4
  6. package/dist/bridge/types.d.ts +3 -3
  7. package/dist/bridge/utils.d.ts +4 -4
  8. package/dist/bridge/utils.js +10 -10
  9. package/dist/const.d.ts +1 -1
  10. package/dist/const.js +17 -17
  11. package/dist/gen/nord.d.ts +1 -4
  12. package/dist/idl/bridge.d.ts +1 -1
  13. package/dist/idl/bridge.js +185 -185
  14. package/dist/index.d.ts +8 -8
  15. package/dist/nord/api/actions.d.ts +3 -3
  16. package/dist/nord/api/actions.js +21 -21
  17. package/dist/nord/api/core.d.ts +3 -3
  18. package/dist/nord/api/core.js +12 -12
  19. package/dist/nord/api/market.d.ts +1 -1
  20. package/dist/nord/api/market.js +12 -12
  21. package/dist/nord/api/metrics.d.ts +1 -1
  22. package/dist/nord/api/metrics.js +6 -6
  23. package/dist/nord/api/queries.d.ts +1 -1
  24. package/dist/nord/api/queries.js +9 -9
  25. package/dist/nord/client/Nord.d.ts +4 -4
  26. package/dist/nord/client/Nord.js +18 -18
  27. package/dist/nord/client/NordUser.d.ts +7 -7
  28. package/dist/nord/client/NordUser.js +45 -49
  29. package/dist/nord/index.d.ts +9 -9
  30. package/dist/nord/models/Subscriber.d.ts +6 -6
  31. package/dist/nord/models/Subscriber.js +1 -5
  32. package/dist/nord/utils/NordError.js +2 -2
  33. package/dist/types.d.ts +1 -1
  34. package/dist/types.js +1 -1
  35. package/dist/utils.d.ts +6 -6
  36. package/dist/utils.js +8 -8
  37. package/dist/websocket/NordWebSocketClient.d.ts +2 -2
  38. package/dist/websocket/NordWebSocketClient.js +38 -38
  39. package/dist/websocket/events.d.ts +1 -1
  40. package/dist/websocket/index.d.ts +2 -2
  41. package/docs/assets/hierarchy.js +1 -0
  42. package/docs/assets/highlight.css +16 -16
  43. package/docs/assets/icons.js +17 -14
  44. package/docs/assets/icons.svg +1 -1
  45. package/docs/assets/main.js +5 -4
  46. package/docs/assets/navigation.js +1 -1
  47. package/docs/assets/search.js +1 -1
  48. package/docs/assets/style.css +1423 -1227
  49. package/docs/classes/Nord.html +190 -31
  50. package/docs/classes/NordError.html +24 -0
  51. package/docs/classes/NordUser.html +120 -35
  52. package/docs/classes/NordWebSocketClient.html +335 -0
  53. package/docs/classes/SolanaBridgeClient.html +86 -0
  54. package/docs/classes/Subscriber.html +10 -0
  55. package/docs/enums/FillMode.html +5 -5
  56. package/docs/enums/KeyType.html +4 -4
  57. package/docs/enums/MetricPeriod.html +9 -0
  58. package/docs/enums/PdaSeedType.html +9 -0
  59. package/docs/enums/PeakTpsPeriodUnit.html +7 -7
  60. package/docs/enums/Side.html +3 -3
  61. package/docs/enums/WebSocketMessageType.html +7 -0
  62. package/docs/functions/actionQueryRollman.html +6 -0
  63. package/docs/functions/actionsQueryRollman.html +6 -0
  64. package/docs/functions/aggregateMetrics-1.html +7 -0
  65. package/docs/functions/assert.html +1 -1
  66. package/docs/functions/bigIntToProtoU128.html +3 -3
  67. package/docs/functions/blockQueryRollman.html +6 -0
  68. package/docs/functions/blockSummaryQueryRollman.html +6 -0
  69. package/docs/functions/bridgeToBN.html +5 -0
  70. package/docs/functions/bufferToHex.html +4 -0
  71. package/docs/functions/cancelOrder.html +1 -0
  72. package/docs/functions/checkPubKeyLength.html +1 -1
  73. package/docs/functions/checkedFetch.html +4 -4
  74. package/docs/functions/createSession.html +1 -0
  75. package/docs/functions/decodeLengthDelimited.html +7 -6
  76. package/docs/functions/encodeLengthDelimited.html +4 -4
  77. package/docs/functions/fillModeToProtoFillMode.html +4 -4
  78. package/docs/functions/findMarket.html +1 -1
  79. package/docs/functions/findPda.html +6 -0
  80. package/docs/functions/findToken.html +1 -1
  81. package/docs/functions/fromBN.html +5 -0
  82. package/docs/functions/getAccount.html +6 -0
  83. package/docs/functions/getActionNonce.html +5 -0
  84. package/docs/functions/getCurrentTps.html +6 -0
  85. package/docs/functions/getInfo.html +5 -0
  86. package/docs/functions/getMedianLatency.html +6 -0
  87. package/docs/functions/getOrderbook.html +6 -0
  88. package/docs/functions/getPeakTps.html +6 -0
  89. package/docs/functions/getTimestamp.html +5 -0
  90. package/docs/functions/getTotalTransactions.html +5 -0
  91. package/docs/functions/getTrades.html +6 -0
  92. package/docs/functions/getUserAccountIds.html +6 -0
  93. package/docs/functions/hexToBuffer.html +4 -0
  94. package/docs/functions/initWebSocketClient.html +12 -0
  95. package/docs/functions/keypairFromPrivateKey.html +4 -0
  96. package/docs/functions/makeSigningFunction.html +4 -0
  97. package/docs/functions/makeWalletSignFn.html +5 -5
  98. package/docs/functions/marketsStats.html +5 -0
  99. package/docs/functions/optExpect.html +4 -4
  100. package/docs/functions/optMap.html +5 -5
  101. package/docs/functions/optUnwrap.html +2 -2
  102. package/docs/functions/panic.html +1 -1
  103. package/docs/functions/placeOrder.html +1 -0
  104. package/docs/functions/queryAction.html +6 -0
  105. package/docs/functions/queryBlock.html +6 -0
  106. package/docs/functions/queryLastNBlocks.html +5 -0
  107. package/docs/functions/queryPrometheus.html +6 -0
  108. package/docs/functions/queryRecentActions.html +6 -0
  109. package/docs/functions/queryRecentBlocks.html +6 -0
  110. package/docs/functions/revokeSession.html +1 -0
  111. package/docs/functions/shortenPublicKey.html +5 -0
  112. package/docs/functions/signAction.html +2 -2
  113. package/docs/functions/toBN.html +5 -0
  114. package/docs/functions/toScaledU128.html +5 -5
  115. package/docs/functions/toScaledU64.html +5 -5
  116. package/docs/functions/transfer.html +1 -0
  117. package/docs/functions/withdraw.html +1 -0
  118. package/docs/hierarchy.html +1 -0
  119. package/docs/index.html +39 -20
  120. package/docs/interfaces/Account.html +8 -8
  121. package/docs/interfaces/ActionInfo.html +8 -8
  122. package/docs/interfaces/ActionNonceResponse.html +3 -0
  123. package/docs/interfaces/ActionQuery.html +4 -4
  124. package/docs/interfaces/ActionResponse.html +8 -8
  125. package/docs/interfaces/ActionsExtendedInfo.html +10 -10
  126. package/docs/interfaces/ActionsQuery.html +5 -5
  127. package/docs/interfaces/ActionsResponse.html +6 -6
  128. package/docs/interfaces/AggregateMetrics.html +12 -12
  129. package/docs/interfaces/BlockFacts.html +10 -0
  130. package/docs/interfaces/BlockQuery.html +6 -6
  131. package/docs/interfaces/BlockResponse.html +6 -6
  132. package/docs/interfaces/BlockSummary.html +8 -8
  133. package/docs/interfaces/BlockSummaryResponse.html +6 -6
  134. package/docs/interfaces/DeltaEvent.html +6 -6
  135. package/docs/interfaces/DepositSplParams.html +10 -0
  136. package/docs/interfaces/Info.html +3 -3
  137. package/docs/interfaces/Market.html +8 -6
  138. package/docs/interfaces/MarketStats.html +7 -7
  139. package/docs/interfaces/MarketsStatsResponse.html +2 -2
  140. package/docs/interfaces/NordConfig.html +14 -5
  141. package/docs/interfaces/NordWebSocketClientEvents.html +4 -0
  142. package/docs/interfaces/NordWebSocketEvents.html +8 -0
  143. package/docs/interfaces/Order.html +6 -6
  144. package/docs/interfaces/OrderInfo.html +6 -6
  145. package/docs/interfaces/OrderbookEntry.html +4 -0
  146. package/docs/interfaces/OrderbookQuery.html +6 -0
  147. package/docs/interfaces/OrderbookResponse.html +6 -0
  148. package/docs/interfaces/OrderbookSubscription.html +159 -0
  149. package/docs/interfaces/PerpMarketStats.html +5 -5
  150. package/docs/interfaces/RollmanActionExtendedInfo.html +4 -4
  151. package/docs/interfaces/RollmanActionInfo.html +4 -4
  152. package/docs/interfaces/RollmanActionResponse.html +4 -4
  153. package/docs/interfaces/RollmanActionsResponse.html +2 -2
  154. package/docs/interfaces/RollmanBlockResponse.html +3 -3
  155. package/docs/interfaces/SPLTokenInfo.html +10 -0
  156. package/docs/interfaces/SolanaBridgeConfig.html +10 -0
  157. package/docs/interfaces/StateFacts.html +10 -0
  158. package/docs/interfaces/SubscriberConfig.html +3 -3
  159. package/docs/interfaces/TimestampResponse.html +3 -0
  160. package/docs/interfaces/Token.html +5 -5
  161. package/docs/interfaces/TokenInfo.html +5 -0
  162. package/docs/interfaces/Trade.html +5 -5
  163. package/docs/interfaces/TradeSubscription.html +159 -0
  164. package/docs/interfaces/Trades.html +5 -5
  165. package/docs/interfaces/TradesQuery.html +6 -0
  166. package/docs/interfaces/TradesResponse.html +7 -0
  167. package/docs/interfaces/TransferParams.html +8 -0
  168. package/docs/interfaces/UserAccountIdsQuery.html +3 -0
  169. package/docs/interfaces/UserAccountIdsResponse.html +3 -0
  170. package/docs/interfaces/WebSocketDeltaUpdate.html +9 -0
  171. package/docs/interfaces/WebSocketSubscription.html +4 -0
  172. package/docs/interfaces/WebSocketTradeUpdate.html +6 -0
  173. package/docs/interfaces/WebSocketUserUpdate.html +6 -0
  174. package/docs/interfaces/WithdrawalClaim.html +14 -0
  175. package/docs/interfaces/WithdrawalParams.html +8 -0
  176. package/docs/modules.html +1 -70
  177. package/docs/types/BigIntValue.html +2 -2
  178. package/docs/types/WebSocketMessage.html +1 -0
  179. package/docs/variables/DEBUG_KEYS.html +1 -1
  180. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
  181. package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
  182. package/docs/variables/DEV_URL.html +1 -1
  183. package/docs/variables/MAX_BUFFER_LEN.html +1 -1
  184. package/docs/variables/SESSION_TTL.html +1 -1
  185. package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
  186. package/docs/variables/ZERO_DECIMAL.html +1 -1
  187. package/docs/variables/_private.html +2 -0
  188. package/eslint.config.mjs +66 -0
  189. package/package.json +12 -13
  190. package/src/bridge/client.ts +10 -10
  191. package/src/bridge/const.ts +24 -24
  192. package/src/bridge/index.ts +4 -4
  193. package/src/bridge/types.ts +10 -10
  194. package/src/bridge/utils.ts +14 -14
  195. package/src/const.ts +18 -18
  196. package/src/gen/nord.ts +1 -4
  197. package/src/idl/bridge.ts +186 -186
  198. package/src/index.ts +8 -8
  199. package/src/nord/api/actions.ts +25 -25
  200. package/src/nord/api/core.ts +16 -16
  201. package/src/nord/api/market.ts +15 -15
  202. package/src/nord/api/metrics.ts +16 -16
  203. package/src/nord/api/queries.ts +12 -12
  204. package/src/nord/client/Nord.ts +27 -27
  205. package/src/nord/client/NordUser.ts +59 -63
  206. package/src/nord/index.ts +9 -9
  207. package/src/nord/models/Subscriber.ts +11 -12
  208. package/src/nord/utils/NordError.ts +2 -2
  209. package/src/types.ts +12 -12
  210. package/src/utils.ts +20 -20
  211. package/src/websocket/NordWebSocketClient.ts +42 -42
  212. package/src/websocket/events.ts +1 -1
  213. package/src/websocket/index.ts +2 -2
  214. package/tests/utils.spec.ts +24 -24
  215. package/tsconfig.eslint.json +12 -0
  216. package/.eslintignore +0 -1
  217. package/.eslintrc.js +0 -31
  218. package/dist/abis/ERC20_ABI.d.ts +0 -39
  219. package/dist/abis/ERC20_ABI.js +0 -313
  220. package/dist/abis/NORD_GETTERS_FACET_ABI.d.ts +0 -34
  221. package/dist/abis/NORD_GETTERS_FACET_ABI.js +0 -195
  222. package/dist/abis/NORD_RAMP_FACET_ABI.d.ts +0 -35
  223. package/dist/abis/NORD_RAMP_FACET_ABI.js +0 -144
  224. package/dist/abis/index.d.ts +0 -3
  225. package/dist/abis/index.js +0 -9
  226. package/dist/bridge/NordUser.d.ts +0 -78
  227. package/dist/bridge/NordUser.js +0 -196
  228. package/dist/client.d.ts +0 -70
  229. package/dist/client.js +0 -129
  230. package/dist/constants/endpoints.d.ts +0 -65
  231. package/dist/constants/endpoints.js +0 -68
  232. package/dist/models/account.d.ts +0 -58
  233. package/dist/models/account.js +0 -6
  234. package/dist/models/index.d.ts +0 -8
  235. package/dist/models/index.js +0 -28
  236. package/dist/models/market.d.ts +0 -137
  237. package/dist/models/market.js +0 -6
  238. package/dist/models/order.d.ts +0 -211
  239. package/dist/models/order.js +0 -6
  240. package/dist/models/token.d.ts +0 -50
  241. package/dist/models/token.js +0 -6
  242. package/dist/nord/Nord.d.ts +0 -249
  243. package/dist/nord/Nord.js +0 -388
  244. package/dist/nord/NordError.d.ts +0 -23
  245. package/dist/nord/NordError.js +0 -48
  246. package/dist/nord/NordImpl.d.ts +0 -11
  247. package/dist/nord/NordImpl.js +0 -26
  248. package/dist/nord/NordUser.d.ts +0 -243
  249. package/dist/nord/NordUser.js +0 -481
  250. package/dist/nord/Subscriber.d.ts +0 -37
  251. package/dist/nord/Subscriber.js +0 -29
  252. package/dist/nord/actions.d.ts +0 -101
  253. package/dist/nord/actions.js +0 -254
  254. package/dist/nord/api/index.d.ts +0 -1
  255. package/dist/nord/api/index.js +0 -17
  256. package/dist/nord/api/orderFunctions.d.ts +0 -168
  257. package/dist/nord/api/orderFunctions.js +0 -133
  258. package/dist/nord/core.d.ts +0 -48
  259. package/dist/nord/core.js +0 -97
  260. package/dist/nord/market.d.ts +0 -36
  261. package/dist/nord/market.js +0 -90
  262. package/dist/nord/metrics.d.ts +0 -67
  263. package/dist/nord/metrics.js +0 -124
  264. package/dist/nord/queries.d.ts +0 -81
  265. package/dist/nord/queries.js +0 -181
  266. package/dist/nord/types.d.ts +0 -88
  267. package/dist/nord/types.js +0 -2
  268. package/dist/nord/websocket.d.ts +0 -49
  269. package/dist/nord/websocket.js +0 -107
  270. package/dist/operations/account.d.ts +0 -58
  271. package/dist/operations/account.js +0 -112
  272. package/dist/operations/market.d.ts +0 -65
  273. package/dist/operations/market.js +0 -131
  274. package/dist/operations/orders.d.ts +0 -57
  275. package/dist/operations/orders.js +0 -129
  276. package/dist/solana/NordUser.d.ts +0 -78
  277. package/dist/solana/NordUser.js +0 -196
  278. package/dist/solana/client.d.ts +0 -139
  279. package/dist/solana/client.js +0 -360
  280. package/dist/solana/const.d.ts +0 -23
  281. package/dist/solana/const.js +0 -47
  282. package/dist/solana/index.d.ts +0 -5
  283. package/dist/solana/index.js +0 -23
  284. package/dist/solana/types.d.ts +0 -118
  285. package/dist/solana/types.js +0 -16
  286. package/dist/solana/utils.d.ts +0 -64
  287. package/dist/solana/utils.js +0 -131
  288. package/dist/types/api.d.ts +0 -152
  289. package/dist/types/api.js +0 -6
  290. package/dist/types/config.d.ts +0 -34
  291. package/dist/types/config.js +0 -6
  292. package/dist/utils/errors.d.ts +0 -96
  293. package/dist/utils/errors.js +0 -132
  294. package/dist/utils/http.d.ts +0 -35
  295. package/dist/utils/http.js +0 -105
  296. package/dist/websocket/client.d.ts +0 -93
  297. package/dist/websocket/client.js +0 -222
  298. package/dist/websocket.d.ts +0 -55
  299. package/dist/websocket.js +0 -211
  300. package/docs/interfaces/ERC20TokenInfo.html +0 -5
  301. package/docs/variables/DEV_CONTRACT_ADDRESS.html +0 -1
  302. package/docs/variables/ERC20_ABI.html +0 -1
  303. package/docs/variables/EVM_DEV_URL.html +0 -1
  304. package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +0 -1
  305. package/docs/variables/NORD_GETTERS_FACET_ABI.html +0 -1
  306. package/docs/variables/NORD_RAMP_FACET_ABI.html +0 -1
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from './types';
2
- export * from './utils';
3
- export * from './const';
4
- export * from './nord';
5
- export * from './websocket/index';
6
- export * from './bridge/client';
7
- export * from './bridge/types';
8
- export { bridgeToBN, fromBN, keypairFromPrivateKey, makeSigningFunction, findPda, bufferToHex, hexToBuffer, shortenPublicKey, } from './bridge/utils';
1
+ export * from "./types";
2
+ export * from "./utils";
3
+ export * from "./const";
4
+ export * from "./nord";
5
+ export * from "./websocket/index";
6
+ export * from "./bridge/client";
7
+ export * from "./bridge/types";
8
+ export { bridgeToBN, fromBN, keypairFromPrivateKey, makeSigningFunction, findPda, bufferToHex, hexToBuffer, shortenPublicKey, } from "./bridge/utils";
@@ -1,6 +1,6 @@
1
- import Decimal from 'decimal.js';
2
- import { FillMode, Side } from '../../types';
3
- import { BigIntValue } from '../../utils';
1
+ import Decimal from "decimal.js";
2
+ import { FillMode, Side } from "../../types";
3
+ import { BigIntValue } from "../../utils";
4
4
  declare function createSessionImpl(sendFn: (encoded: Uint8Array) => Promise<Uint8Array>, walletSignFn: (message: string | Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
5
5
  userPubkey: Uint8Array;
6
6
  sessionPubkey: Uint8Array;
@@ -54,9 +54,9 @@ async function walletSign(walletSignFn, message) {
54
54
  function makeSendHttp(serverUrl) {
55
55
  return async (body) => {
56
56
  const response = await (0, utils_1.checkedFetch)(`${serverUrl}/action`, {
57
- method: 'POST',
57
+ method: "POST",
58
58
  headers: {
59
- 'Content-Type': 'application/json',
59
+ "Content-Type": "application/json",
60
60
  },
61
61
  body,
62
62
  });
@@ -68,7 +68,7 @@ async function sendAction(sendFn, makeSignedMessage, action, actionErrorDesc) {
68
68
  const body = await makeSignedMessage(encoded);
69
69
  const rawResp = await sendFn(body);
70
70
  const resp = (0, utils_1.decodeLengthDelimited)(rawResp, proto.Receipt);
71
- if (resp.kind?.$case === 'err') {
71
+ if (resp.kind?.$case === "err") {
72
72
  throw new Error(`Could not ${actionErrorDesc}, reason: ${proto.errorToJSON(resp.kind.value)}`);
73
73
  }
74
74
  return resp;
@@ -79,7 +79,7 @@ async function createSessionImpl(sendFn, walletSignFn, currentTimestamp, nonce,
79
79
  let expiry = 0n;
80
80
  if (params.expiryTimestamp !== undefined) {
81
81
  expiry = params.expiryTimestamp;
82
- (0, utils_1.assert)(expiry > currentTimestamp, 'Cannot set expiry timestamp in the past');
82
+ (0, utils_1.assert)(expiry > currentTimestamp, "Cannot set expiry timestamp in the past");
83
83
  }
84
84
  else {
85
85
  expiry = currentTimestamp + utils_1.SESSION_TTL;
@@ -88,7 +88,7 @@ async function createSessionImpl(sendFn, walletSignFn, currentTimestamp, nonce,
88
88
  currentTimestamp,
89
89
  nonce,
90
90
  kind: {
91
- $case: 'createSession',
91
+ $case: "createSession",
92
92
  value: {
93
93
  userPubkey: params.userPubkey,
94
94
  blstPubkey: params.sessionPubkey,
@@ -96,8 +96,8 @@ async function createSessionImpl(sendFn, walletSignFn, currentTimestamp, nonce,
96
96
  },
97
97
  },
98
98
  };
99
- const resp = await sendAction(sendFn, (m) => walletSign(walletSignFn, m), action, 'create a new session');
100
- if (resp.kind?.$case === 'createSessionResult') {
99
+ const resp = await sendAction(sendFn, (m) => walletSign(walletSignFn, m), action, "create a new session");
100
+ if (resp.kind?.$case === "createSessionResult") {
101
101
  return resp.kind.value.sessionId;
102
102
  }
103
103
  else {
@@ -112,13 +112,13 @@ async function revokeSessionImpl(sendFn, walletSignFn, currentTimestamp, nonce,
112
112
  currentTimestamp,
113
113
  nonce,
114
114
  kind: {
115
- $case: 'revokeSession',
115
+ $case: "revokeSession",
116
116
  value: {
117
117
  sessionId: BigInt(params.sessionId),
118
118
  },
119
119
  },
120
120
  };
121
- await sendAction(sendFn, (m) => walletSign(walletSignFn, m), action, 'create a new session');
121
+ await sendAction(sendFn, (m) => walletSign(walletSignFn, m), action, "create a new session");
122
122
  }
123
123
  async function revokeSession(serverUrl, walletSignFn, currentTimestamp, nonce, params) {
124
124
  return revokeSessionImpl(makeSendHttp(serverUrl), walletSignFn, currentTimestamp, nonce, params);
@@ -126,13 +126,13 @@ async function revokeSession(serverUrl, walletSignFn, currentTimestamp, nonce, p
126
126
  async function withdrawImpl(sendFn, signFn, currentTimestamp, nonce, params) {
127
127
  const amount = (0, utils_1.toScaledU64)(params.amount, params.sizeDecimals);
128
128
  if (amount <= 0) {
129
- throw new Error('Withdraw amount must be positive');
129
+ throw new Error("Withdraw amount must be positive");
130
130
  }
131
131
  const action = {
132
132
  currentTimestamp,
133
133
  nonce,
134
134
  kind: {
135
- $case: 'withdraw',
135
+ $case: "withdraw",
136
136
  value: {
137
137
  sessionId: BigInt(params.sessionId),
138
138
  tokenId: params.tokenId,
@@ -140,7 +140,7 @@ async function withdrawImpl(sendFn, signFn, currentTimestamp, nonce, params) {
140
140
  },
141
141
  },
142
142
  };
143
- await sendAction(sendFn, (m) => sessionSign(signFn, m), action, 'withdraw');
143
+ await sendAction(sendFn, (m) => sessionSign(signFn, m), action, "withdraw");
144
144
  }
145
145
  async function withdraw(serverUrl, signFn, currentTimestamp, nonce, params) {
146
146
  return withdrawImpl(makeSendHttp(serverUrl), signFn, currentTimestamp, nonce, params);
@@ -154,7 +154,7 @@ async function placeOrderImpl(sendFn, signFn, currentTimestamp, nonce, params) {
154
154
  currentTimestamp,
155
155
  nonce,
156
156
  kind: {
157
- $case: 'placeOrder',
157
+ $case: "placeOrder",
158
158
  value: {
159
159
  sessionId: BigInt(params.sessionId),
160
160
  senderAccountId: params.senderId,
@@ -170,8 +170,8 @@ async function placeOrderImpl(sendFn, signFn, currentTimestamp, nonce, params) {
170
170
  },
171
171
  },
172
172
  };
173
- const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, 'place the order');
174
- if (resp.kind?.$case === 'placeOrderResult') {
173
+ const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, "place the order");
174
+ if (resp.kind?.$case === "placeOrderResult") {
175
175
  return resp.kind.value.posted?.orderId;
176
176
  }
177
177
  else {
@@ -186,7 +186,7 @@ async function cancelOrderImpl(sendFn, signFn, currentTimestamp, nonce, params)
186
186
  currentTimestamp,
187
187
  nonce: nonce,
188
188
  kind: {
189
- $case: 'cancelOrderById',
189
+ $case: "cancelOrderById",
190
190
  value: {
191
191
  orderId: BigInt(params.orderId),
192
192
  sessionId: BigInt(params.sessionId),
@@ -195,8 +195,8 @@ async function cancelOrderImpl(sendFn, signFn, currentTimestamp, nonce, params)
195
195
  },
196
196
  },
197
197
  };
198
- const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, 'cancel the order');
199
- if (resp.kind?.$case === 'cancelOrderResult') {
198
+ const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, "cancel the order");
199
+ if (resp.kind?.$case === "cancelOrderResult") {
200
200
  return resp.kind.value.orderId;
201
201
  }
202
202
  else {
@@ -211,7 +211,7 @@ async function transferImpl(sendFn, signFn, currentTimestamp, nonce, params) {
211
211
  currentTimestamp,
212
212
  nonce: nonce,
213
213
  kind: {
214
- $case: 'transfer',
214
+ $case: "transfer",
215
215
  value: {
216
216
  sessionId: BigInt(params.sessionId),
217
217
  fromAccountId: params.fromAccountId,
@@ -221,8 +221,8 @@ async function transferImpl(sendFn, signFn, currentTimestamp, nonce, params) {
221
221
  },
222
222
  },
223
223
  };
224
- const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, 'transfer asset to other account');
225
- if (resp.kind?.$case === 'transferred') {
224
+ const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, "transfer asset to other account");
225
+ if (resp.kind?.$case === "transferred") {
226
226
  if (resp.kind.value.accountCreated) {
227
227
  return resp.kind.value.toUserAccount;
228
228
  }
@@ -1,5 +1,5 @@
1
- import { Account, Info } from '../../types';
2
- import { NordWebSocketClient } from '../../websocket/index';
1
+ import { Account, Info } from "../../types";
2
+ import { NordWebSocketClient } from "../../websocket/index";
3
3
  /**
4
4
  * Get the current timestamp from the Nord server
5
5
  *
@@ -46,4 +46,4 @@ export declare function getAccount(webServerUrl: string, accountId: number): Pro
46
46
  * @param initialSubscriptions - Optional array of initial subscriptions (e.g., ["trades@BTCUSDC"])
47
47
  * @returns WebSocket client
48
48
  */
49
- export declare function initWebSocketClient(webServerUrl: string, endpoint?: 'trades' | 'deltas' | 'user', initialSubscriptions?: string[]): NordWebSocketClient;
49
+ export declare function initWebSocketClient(webServerUrl: string, endpoint?: "trades" | "deltas" | "user", initialSubscriptions?: string[]): NordWebSocketClient;
@@ -6,8 +6,8 @@ exports.getInfo = getInfo;
6
6
  exports.getAccount = getAccount;
7
7
  exports.initWebSocketClient = initWebSocketClient;
8
8
  const utils_1 = require("../../utils");
9
- const NordError_1 = require("../utils/NordError");
10
9
  const index_1 = require("../../websocket/index");
10
+ const NordError_1 = require("../utils/NordError");
11
11
  /**
12
12
  * Get the current timestamp from the Nord server
13
13
  *
@@ -21,7 +21,7 @@ async function getTimestamp(webServerUrl) {
21
21
  return BigInt(await response.json());
22
22
  }
23
23
  catch (error) {
24
- throw new NordError_1.NordError('Failed to get timestamp', { cause: error });
24
+ throw new NordError_1.NordError("Failed to get timestamp", { cause: error });
25
25
  }
26
26
  }
27
27
  /**
@@ -38,7 +38,7 @@ async function getActionNonce(webServerUrl) {
38
38
  return data.nonce;
39
39
  }
40
40
  catch (error) {
41
- throw new NordError_1.NordError('Failed to get action nonce', { cause: error });
41
+ throw new NordError_1.NordError("Failed to get action nonce", { cause: error });
42
42
  }
43
43
  }
44
44
  /**
@@ -54,7 +54,7 @@ async function getInfo(webServerUrl) {
54
54
  return await response.json();
55
55
  }
56
56
  catch (error) {
57
- throw new NordError_1.NordError('Failed to get info', { cause: error });
57
+ throw new NordError_1.NordError("Failed to get info", { cause: error });
58
58
  }
59
59
  }
60
60
  /**
@@ -91,18 +91,18 @@ function initWebSocketClient(webServerUrl, endpoint, initialSubscriptions) {
91
91
  try {
92
92
  // Convert HTTP URL to WebSocket URL with specific endpoint
93
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}`;
94
+ const specificEndpoint = endpoint || "trades";
95
+ const wsUrl = webServerUrl.replace(/^http/, "ws") + `/ws/${specificEndpoint}`;
96
96
  console.log(`Initializing WebSocket client with URL: ${wsUrl}`);
97
97
  // Create and connect the WebSocket client
98
98
  const ws = new index_1.NordWebSocketClient(wsUrl);
99
99
  // Add error handler
100
- ws.on('error', (error) => {
101
- console.error('Nord WebSocket error:', error);
100
+ ws.on("error", (error) => {
101
+ console.error("Nord WebSocket error:", error);
102
102
  });
103
103
  // Add connected handler for debugging
104
- ws.on('connected', () => {
105
- console.log('Nord WebSocket connected successfully');
104
+ ws.on("connected", () => {
105
+ console.log("Nord WebSocket connected successfully");
106
106
  // Subscribe to initial subscriptions if provided
107
107
  if (initialSubscriptions && initialSubscriptions.length > 0) {
108
108
  ws.subscribe(initialSubscriptions);
@@ -113,8 +113,8 @@ function initWebSocketClient(webServerUrl, endpoint, initialSubscriptions) {
113
113
  return ws;
114
114
  }
115
115
  catch (error) {
116
- console.error('Failed to initialize WebSocket client:', error);
117
- throw new NordError_1.NordError('Failed to initialize WebSocket client', {
116
+ console.error("Failed to initialize WebSocket client:", error);
117
+ throw new NordError_1.NordError("Failed to initialize WebSocket client", {
118
118
  cause: error,
119
119
  });
120
120
  }
@@ -1,4 +1,4 @@
1
- import { MarketsStatsResponse, OrderbookQuery, OrderbookResponse, TradesQuery, TradesResponse, UserAccountIdsQuery, UserAccountIdsResponse } from '../../types';
1
+ import { MarketsStatsResponse, OrderbookQuery, OrderbookResponse, TradesQuery, TradesResponse, UserAccountIdsQuery, UserAccountIdsResponse } from "../../types";
2
2
  /**
3
3
  * Get market statistics
4
4
  *
@@ -19,7 +19,7 @@ async function marketsStats(webServerUrl) {
19
19
  return await response.json();
20
20
  }
21
21
  catch (error) {
22
- throw new NordError_1.NordError('Failed to fetch markets stats', { cause: error });
22
+ throw new NordError_1.NordError("Failed to fetch markets stats", { cause: error });
23
23
  }
24
24
  }
25
25
  /**
@@ -33,21 +33,21 @@ async function marketsStats(webServerUrl) {
33
33
  async function getTrades(webServerUrl, query) {
34
34
  try {
35
35
  const params = new URLSearchParams();
36
- params.append('accountId', query.accountId.toString());
36
+ params.append("accountId", query.accountId.toString());
37
37
  if (query.since) {
38
- params.append('since', query.since);
38
+ params.append("since", query.since);
39
39
  }
40
40
  if (query.until) {
41
- params.append('until', query.until);
41
+ params.append("until", query.until);
42
42
  }
43
43
  if (query.pageId) {
44
- params.append('pageId', query.pageId);
44
+ params.append("pageId", query.pageId);
45
45
  }
46
46
  const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/trades?${params.toString()}`);
47
47
  return await response.json();
48
48
  }
49
49
  catch (error) {
50
- throw new NordError_1.NordError('Failed to get trades', { cause: error });
50
+ throw new NordError_1.NordError("Failed to get trades", { cause: error });
51
51
  }
52
52
  }
53
53
  /**
@@ -61,12 +61,12 @@ async function getTrades(webServerUrl, query) {
61
61
  async function getUserAccountIds(webServerUrl, query) {
62
62
  try {
63
63
  const params = new URLSearchParams();
64
- params.append('pubkey', query.pubkey);
64
+ params.append("pubkey", query.pubkey);
65
65
  const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/user?${params.toString()}`);
66
66
  return await response.json();
67
67
  }
68
68
  catch (error) {
69
- throw new NordError_1.NordError('Failed to get user account IDs', { cause: error });
69
+ throw new NordError_1.NordError("Failed to get user account IDs", { cause: error });
70
70
  }
71
71
  }
72
72
  /**
@@ -81,18 +81,18 @@ async function getOrderbook(webServerUrl, query) {
81
81
  try {
82
82
  const params = new URLSearchParams();
83
83
  if (query.symbol) {
84
- params.append('symbol', query.symbol);
84
+ params.append("symbol", query.symbol);
85
85
  }
86
86
  else if (query.market_id !== undefined) {
87
- params.append('market_id', query.market_id.toString());
87
+ params.append("market_id", query.market_id.toString());
88
88
  }
89
89
  else {
90
- throw new NordError_1.NordError('Either symbol or market_id must be provided for orderbook query');
90
+ throw new NordError_1.NordError("Either symbol or market_id must be provided for orderbook query");
91
91
  }
92
92
  const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/orderbook?${params.toString()}`);
93
93
  return await response.json();
94
94
  }
95
95
  catch (error) {
96
- throw new NordError_1.NordError('Failed to get orderbook', { cause: error });
96
+ throw new NordError_1.NordError("Failed to get orderbook", { cause: error });
97
97
  }
98
98
  }
@@ -1,4 +1,4 @@
1
- import { AggregateMetrics, PeakTpsPeriodUnit } from '../../types';
1
+ import { AggregateMetrics, PeakTpsPeriodUnit } from "../../types";
2
2
  /**
3
3
  * Time periods for metrics queries
4
4
  */
@@ -38,7 +38,7 @@ async function aggregateMetrics(webServerUrl, txPeakTpsPeriod = 1, txPeakTpsPeri
38
38
  return await response.json();
39
39
  }
40
40
  catch (error) {
41
- throw new NordError_1.NordError('Failed to fetch aggregate metrics', { cause: error });
41
+ throw new NordError_1.NordError("Failed to fetch aggregate metrics", { cause: error });
42
42
  }
43
43
  }
44
44
  /**
@@ -49,7 +49,7 @@ async function aggregateMetrics(webServerUrl, txPeakTpsPeriod = 1, txPeakTpsPeri
49
49
  * @returns Current TPS value
50
50
  * @throws {NordError} If the request fails
51
51
  */
52
- async function getCurrentTps(webServerUrl, period = '1m') {
52
+ async function getCurrentTps(webServerUrl, period = "1m") {
53
53
  try {
54
54
  return await queryPrometheus(webServerUrl, `sum(rate(nord_tx_count[${period}]))`);
55
55
  }
@@ -67,7 +67,7 @@ async function getCurrentTps(webServerUrl, period = '1m') {
67
67
  * @returns Peak TPS value
68
68
  * @throws {NordError} If the request fails
69
69
  */
70
- async function getPeakTps(webServerUrl, period = '24h') {
70
+ async function getPeakTps(webServerUrl, period = "24h") {
71
71
  try {
72
72
  return await queryPrometheus(webServerUrl, `max_over_time(sum(rate(nord_tx_count[1m]))[${period}:])`);
73
73
  }
@@ -85,7 +85,7 @@ async function getPeakTps(webServerUrl, period = '24h') {
85
85
  * @returns Median latency in milliseconds
86
86
  * @throws {NordError} If the request fails
87
87
  */
88
- async function getMedianLatency(webServerUrl, period = '1m') {
88
+ async function getMedianLatency(webServerUrl, period = "1m") {
89
89
  try {
90
90
  return await queryPrometheus(webServerUrl, `quantile_over_time(0.5, nord_tx_latency_ms[${period}])`);
91
91
  }
@@ -104,10 +104,10 @@ async function getMedianLatency(webServerUrl, period = '1m') {
104
104
  */
105
105
  async function getTotalTransactions(webServerUrl) {
106
106
  try {
107
- return await queryPrometheus(webServerUrl, 'sum(nord_tx_count)');
107
+ return await queryPrometheus(webServerUrl, "sum(nord_tx_count)");
108
108
  }
109
109
  catch (error) {
110
- throw new NordError_1.NordError('Failed to get total transactions', { cause: error });
110
+ throw new NordError_1.NordError("Failed to get total transactions", { cause: error });
111
111
  }
112
112
  }
113
113
  /**
@@ -1,4 +1,4 @@
1
- import { ActionQuery, ActionResponse, ActionsResponse, BlockQuery, BlockResponse, BlockSummaryResponse, RollmanActionResponse, RollmanActionsResponse, RollmanBlockResponse } from '../../types';
1
+ import { ActionQuery, ActionResponse, ActionsResponse, BlockQuery, BlockResponse, BlockSummaryResponse, RollmanActionResponse, RollmanActionsResponse, RollmanBlockResponse } from "../../types";
2
2
  /**
3
3
  * Query a specific block
4
4
  *
@@ -23,13 +23,13 @@ async function queryBlock(webServerUrl, query) {
23
23
  try {
24
24
  const params = new URLSearchParams();
25
25
  if (query.block_number !== undefined) {
26
- params.append('block_height', query.block_number.toString());
26
+ params.append("block_height", query.block_number.toString());
27
27
  }
28
28
  const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/block?${params.toString()}`);
29
29
  return await response.json();
30
30
  }
31
31
  catch (error) {
32
- throw new NordError_1.NordError('Failed to query block', { cause: error });
32
+ throw new NordError_1.NordError("Failed to query block", { cause: error });
33
33
  }
34
34
  }
35
35
  /**
@@ -45,7 +45,7 @@ async function queryLastNBlocks(webServerUrl) {
45
45
  return await response.json();
46
46
  }
47
47
  catch (error) {
48
- throw new NordError_1.NordError('Failed to query last N blocks', { cause: error });
48
+ throw new NordError_1.NordError("Failed to query last N blocks", { cause: error });
49
49
  }
50
50
  }
51
51
  /**
@@ -79,13 +79,13 @@ async function queryAction(webServerUrl, query) {
79
79
  try {
80
80
  const params = new URLSearchParams();
81
81
  if (query.action_id !== undefined) {
82
- params.append('action_id', query.action_id.toString());
82
+ params.append("action_id", query.action_id.toString());
83
83
  }
84
84
  const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/action?${params.toString()}`);
85
85
  return await response.json();
86
86
  }
87
87
  catch (error) {
88
- throw new NordError_1.NordError('Failed to query action', { cause: error });
88
+ throw new NordError_1.NordError("Failed to query action", { cause: error });
89
89
  }
90
90
  }
91
91
  /**
@@ -119,13 +119,13 @@ async function blockQueryRollman(webServerUrl, query) {
119
119
  try {
120
120
  const params = new URLSearchParams();
121
121
  if (query.block_number !== undefined) {
122
- params.append('block_height', query.block_number.toString());
122
+ params.append("block_height", query.block_number.toString());
123
123
  }
124
124
  const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/rollman/block?${params.toString()}`);
125
125
  return await response.json();
126
126
  }
127
127
  catch (error) {
128
- throw new NordError_1.NordError('Failed to query Rollman block', { cause: error });
128
+ throw new NordError_1.NordError("Failed to query Rollman block", { cause: error });
129
129
  }
130
130
  }
131
131
  /**
@@ -157,13 +157,13 @@ async function actionQueryRollman(webServerUrl, query) {
157
157
  try {
158
158
  const params = new URLSearchParams();
159
159
  if (query.action_id !== undefined) {
160
- params.append('action_id', query.action_id.toString());
160
+ params.append("action_id", query.action_id.toString());
161
161
  }
162
162
  const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/rollman/action?${params.toString()}`);
163
163
  return await response.json();
164
164
  }
165
165
  catch (error) {
166
- throw new NordError_1.NordError('Failed to query Rollman action', { cause: error });
166
+ throw new NordError_1.NordError("Failed to query Rollman action", { cause: error });
167
167
  }
168
168
  }
169
169
  /**
@@ -1,7 +1,7 @@
1
- import { EventEmitter } from 'events';
2
- import { Account, ActionQuery, ActionResponse, ActionsResponse, AggregateMetrics, BlockQuery, BlockResponse, BlockSummaryResponse, Info, Market, MarketsStatsResponse, NordConfig, OrderbookQuery, OrderbookResponse, PeakTpsPeriodUnit, RollmanActionResponse, RollmanActionsResponse, RollmanBlockResponse, Token, TradesQuery, TradesResponse, UserAccountIdsQuery, UserAccountIdsResponse } from '../../types';
3
- import { NordWebSocketClient } from '../../websocket/index';
4
- import { OrderbookSubscription, TradeSubscription } from '../models/Subscriber';
1
+ import { EventEmitter } from "events";
2
+ import { Account, ActionQuery, ActionResponse, ActionsResponse, AggregateMetrics, BlockQuery, BlockResponse, BlockSummaryResponse, Info, Market, MarketsStatsResponse, NordConfig, OrderbookQuery, OrderbookResponse, PeakTpsPeriodUnit, RollmanActionResponse, RollmanActionsResponse, RollmanBlockResponse, Token, TradesQuery, TradesResponse, UserAccountIdsQuery, UserAccountIdsResponse } from "../../types";
3
+ import { NordWebSocketClient } from "../../websocket/index";
4
+ import { OrderbookSubscription, TradeSubscription } from "../models/Subscriber";
5
5
  /**
6
6
  * User subscription interface
7
7
  */
@@ -80,13 +80,13 @@ class Nord {
80
80
  */
81
81
  this.userWs = null;
82
82
  if (!webServerUrl) {
83
- throw new NordError_1.NordError('webServerUrl is required');
83
+ throw new NordError_1.NordError("webServerUrl is required");
84
84
  }
85
85
  if (!solanaProgramId) {
86
- throw new NordError_1.NordError('solanaProgramId is required');
86
+ throw new NordError_1.NordError("solanaProgramId is required");
87
87
  }
88
88
  if (!solanaUrl) {
89
- throw new NordError_1.NordError('solanaUrl is required');
89
+ throw new NordError_1.NordError("solanaUrl is required");
90
90
  }
91
91
  this.webServerUrl = webServerUrl;
92
92
  this.solanaProgramId = solanaProgramId;
@@ -116,8 +116,8 @@ class Nord {
116
116
  const trades = tradesSubscriptions || this.tradesSubscriptions;
117
117
  const deltas = deltasSubscriptions || this.deltasSubscriptions;
118
118
  // Initialize WebSocket clients for each endpoint with subscriptions
119
- this.tradesWs = core.initWebSocketClient(this.webServerUrl, 'trades', trades);
120
- this.deltasWs = core.initWebSocketClient(this.webServerUrl, 'deltas', deltas);
119
+ this.tradesWs = core.initWebSocketClient(this.webServerUrl, "trades", trades);
120
+ this.deltasWs = core.initWebSocketClient(this.webServerUrl, "deltas", deltas);
121
121
  }
122
122
  /**
123
123
  * Get the current timestamp from the Nord server
@@ -154,7 +154,7 @@ class Nord {
154
154
  });
155
155
  }
156
156
  catch (error) {
157
- throw new NordError_1.NordError('Failed to fetch Nord info', { cause: error });
157
+ throw new NordError_1.NordError("Failed to fetch Nord info", { cause: error });
158
158
  }
159
159
  }
160
160
  /**
@@ -251,7 +251,7 @@ class Nord {
251
251
  * @returns Current TPS value
252
252
  * @throws {NordError} If the request fails
253
253
  */
254
- async getCurrentTps(period = '1m') {
254
+ async getCurrentTps(period = "1m") {
255
255
  return metrics.getCurrentTps(this.webServerUrl, period);
256
256
  }
257
257
  /**
@@ -261,7 +261,7 @@ class Nord {
261
261
  * @returns Peak TPS value
262
262
  * @throws {NordError} If the request fails
263
263
  */
264
- async getPeakTps(period = '24h') {
264
+ async getPeakTps(period = "24h") {
265
265
  return metrics.getPeakTps(this.webServerUrl, period);
266
266
  }
267
267
  /**
@@ -271,7 +271,7 @@ class Nord {
271
271
  * @returns Median latency in milliseconds
272
272
  * @throws {NordError} If the request fails
273
273
  */
274
- async getMedianLatency(period = '1m') {
274
+ async getMedianLatency(period = "1m") {
275
275
  return metrics.getMedianLatency(this.webServerUrl, period);
276
276
  }
277
277
  /**
@@ -378,7 +378,7 @@ class Nord {
378
378
  getUserWebSocketClient() {
379
379
  if (!this.userWs) {
380
380
  // Initialize user WebSocket client on demand
381
- this.userWs = core.initWebSocketClient(this.webServerUrl, 'user');
381
+ this.userWs = core.initWebSocketClient(this.webServerUrl, "user");
382
382
  return this.userWs;
383
383
  }
384
384
  return this.userWs;
@@ -395,17 +395,17 @@ class Nord {
395
395
  if (update.symbol !== symbol) {
396
396
  return;
397
397
  }
398
- subscription.emit('message', update);
398
+ subscription.emit("message", update);
399
399
  };
400
400
  // Initialize deltas websocket if it doesn't exist
401
401
  if (!this.deltasWs) {
402
402
  this.initializeWebSockets();
403
403
  }
404
- this.deltasWs.on('delta', handleDelta);
404
+ this.deltasWs.on("delta", handleDelta);
405
405
  this.deltasWs.subscribe([`deltas@${symbol}`]);
406
406
  subscription.close = () => {
407
407
  this.deltasWs.unsubscribe([`deltas@${symbol}`]);
408
- this.deltasWs.removeListener('delta', handleDelta);
408
+ this.deltasWs.removeListener("delta", handleDelta);
409
409
  subscription.removeAllListeners();
410
410
  };
411
411
  return subscription;
@@ -422,17 +422,17 @@ class Nord {
422
422
  if (update.symbol !== symbol) {
423
423
  return;
424
424
  }
425
- subscription.emit('message', update);
425
+ subscription.emit("message", update);
426
426
  };
427
427
  // Initialize trades websocket if it doesn't exist
428
428
  if (!this.tradesWs) {
429
429
  this.initializeWebSockets();
430
430
  }
431
- this.tradesWs.on('trade', handleTrade);
431
+ this.tradesWs.on("trade", handleTrade);
432
432
  this.tradesWs.subscribe([`trades@${symbol}`]);
433
433
  subscription.close = () => {
434
434
  this.tradesWs.unsubscribe([`trades@${symbol}`]);
435
- this.tradesWs.removeListener('trade', handleTrade);
435
+ this.tradesWs.removeListener("trade", handleTrade);
436
436
  subscription.removeAllListeners();
437
437
  };
438
438
  return subscription;
@@ -481,7 +481,7 @@ class Nord {
481
481
  }
482
482
  // Ensure market_id is provided
483
483
  if (query.market_id === undefined) {
484
- throw new NordError_1.NordError('market_id is required for orderbook query');
484
+ throw new NordError_1.NordError("market_id is required for orderbook query");
485
485
  }
486
486
  return market.getOrderbook(this.webServerUrl, query);
487
487
  }
@@ -524,7 +524,7 @@ class Nord {
524
524
  await market.getUserAccountIds(this.webServerUrl, { pubkey: address });
525
525
  return true;
526
526
  }
527
- catch (error) {
527
+ catch {
528
528
  return false;
529
529
  }
530
530
  }
@@ -1,10 +1,10 @@
1
- import { Connection, PublicKey } from '@solana/web3.js';
2
- import Decimal from 'decimal.js';
3
- import { SolanaBridgeClient } from '../../bridge/client';
4
- import { SPLTokenInfo } from '../../bridge/types';
5
- import { FillMode, Order, Side } from '../../types';
6
- import { BigIntValue } from '../../utils';
7
- import { Nord } from './Nord';
1
+ import { Connection, PublicKey } from "@solana/web3.js";
2
+ import Decimal from "decimal.js";
3
+ import { SolanaBridgeClient } from "../../bridge/client";
4
+ import { SPLTokenInfo } from "../../bridge/types";
5
+ import { FillMode, Order, Side } from "../../types";
6
+ import { BigIntValue } from "../../utils";
7
+ import { Nord } from "./Nord";
8
8
  /**
9
9
  * Parameters for creating a NordUser instance
10
10
  */