@n1xyz/nord-ts 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +14 -0
- package/dist/api/client.js +45 -0
- package/dist/bridge/client.d.ts +151 -0
- package/dist/bridge/client.js +434 -0
- package/dist/bridge/const.d.ts +23 -0
- package/dist/bridge/const.js +47 -0
- package/dist/bridge/index.d.ts +4 -0
- package/dist/bridge/index.js +23 -0
- package/dist/bridge/types.d.ts +120 -0
- package/dist/bridge/types.js +18 -0
- package/dist/bridge/utils.d.ts +64 -0
- package/dist/bridge/utils.js +131 -0
- package/dist/gen/common.d.ts +68 -0
- package/dist/gen/common.js +215 -0
- package/dist/gen/nord_pb.d.ts +3651 -0
- package/dist/gen/nord_pb.js +892 -0
- package/dist/gen/openapi.d.ts +241 -2
- package/dist/idl/bridge.d.ts +569 -0
- package/dist/idl/bridge.js +8 -0
- package/dist/idl/bridge.json +1506 -0
- package/dist/idl/index.d.ts +607 -0
- package/dist/idl/index.js +8 -0
- package/dist/nord/api/actions.d.ts +30 -72
- package/dist/nord/api/actions.js +179 -200
- package/dist/nord/api/market.d.ts +36 -0
- package/dist/nord/api/market.js +96 -0
- package/dist/nord/api/queries.d.ts +46 -0
- package/dist/nord/api/queries.js +109 -0
- package/dist/nord/client/Nord.js +3 -3
- package/dist/nord/client/NordUser.d.ts +26 -13
- package/dist/nord/client/NordUser.js +13 -10
- package/dist/types.d.ts +12 -1
- package/dist/types.js +29 -2
- package/dist/utils.d.ts +6 -20
- package/dist/utils.js +17 -35
- package/dist/websocket/NordWebSocketClient.js +2 -6
- package/package.json +26 -23
- package/src/gen/nord_pb.ts +4172 -0
- package/src/gen/openapi.ts +241 -2
- package/src/nord/api/actions.ts +249 -370
- package/src/nord/client/Nord.ts +3 -3
- package/src/nord/client/NordUser.ts +40 -19
- package/src/types.ts +32 -1
- package/src/utils.ts +24 -43
- package/src/websocket/NordWebSocketClient.ts +2 -8
|
@@ -7,8 +7,6 @@ exports.NordWebSocketClient = void 0;
|
|
|
7
7
|
const events_1 = require("events");
|
|
8
8
|
const ws_1 = __importDefault(require("ws"));
|
|
9
9
|
const VALID_STREAM_TYPES = ["trades", "delta", "account"];
|
|
10
|
-
// Constants for WebSocket readyState
|
|
11
|
-
const WS_OPEN = 1;
|
|
12
10
|
/**
|
|
13
11
|
* WebSocket client for Nord exchange
|
|
14
12
|
*
|
|
@@ -132,9 +130,7 @@ class NordWebSocketClient extends events_1.EventEmitter {
|
|
|
132
130
|
this.emit("error", new Error(`Failed to parse message: ${error instanceof Error ? error.message : String(error)}`));
|
|
133
131
|
}
|
|
134
132
|
};
|
|
135
|
-
this.ws.onclose = (
|
|
136
|
-
const reason = event && event.reason ? ` Reason: ${event.reason}` : "";
|
|
137
|
-
const code = event && event.code ? ` Code: ${event.code}` : "";
|
|
133
|
+
this.ws.onclose = (_event) => {
|
|
138
134
|
this.emit("disconnected");
|
|
139
135
|
this.reconnect();
|
|
140
136
|
};
|
|
@@ -162,7 +158,7 @@ class NordWebSocketClient extends events_1.EventEmitter {
|
|
|
162
158
|
this.emit("error", new Error(`Failed to parse message: ${error instanceof Error ? error.message : String(error)}`));
|
|
163
159
|
}
|
|
164
160
|
});
|
|
165
|
-
nodeWs.on("close", (
|
|
161
|
+
nodeWs.on("close", (_code, _reason) => {
|
|
166
162
|
this.emit("disconnected");
|
|
167
163
|
if (this.pingInterval) {
|
|
168
164
|
clearInterval(this.pingInterval);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n1xyz/nord-ts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "Typescript for Nord",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -14,46 +14,49 @@
|
|
|
14
14
|
"README.md"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"gen:proto": "
|
|
18
|
-
"gen:api": "nix run ..#
|
|
17
|
+
"gen:proto": "bunx @bufbuild/buf generate ../engine",
|
|
18
|
+
"gen:api": "nix run ..#openapi | bunx openapi-typescript > src/gen/openapi.ts",
|
|
19
19
|
"gen": "bun run gen:proto && bun run gen:api",
|
|
20
20
|
"build": "bun run gen && bunx tsc && bun run docs",
|
|
21
21
|
"docs": "bunx typedoc --out ./docs ./src",
|
|
22
22
|
"compile": "tsc",
|
|
23
23
|
"clean": "rm -rf ./src/gen ./dist ./docs",
|
|
24
24
|
"fmt": "prettier --write src tests",
|
|
25
|
-
"ci": "bunx eslint && prettier --check src tests"
|
|
25
|
+
"ci": "bunx eslint && prettier --check src tests",
|
|
26
|
+
"all": "bun install && bun run build && bun run ci && bun fmt"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
29
|
+
"@bufbuild/protoc-gen-es": "^2.6.3",
|
|
30
|
+
"@bufbuild/protoplugin": "^2.6.3",
|
|
28
31
|
"@types/bun": "latest",
|
|
29
|
-
"@types/google-protobuf": "^3.15.
|
|
30
|
-
"@types/node": "^22.
|
|
31
|
-
"@types/node-fetch": "^2.6.
|
|
32
|
-
"@types/ws": "^8.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
34
|
-
"@typescript-eslint/parser": "^8.
|
|
35
|
-
"eslint": "^9.
|
|
36
|
-
"globals": "^16.
|
|
37
|
-
"openapi-typescript": "^7.
|
|
38
|
-
"prettier": "^3.
|
|
32
|
+
"@types/google-protobuf": "^3.15.12",
|
|
33
|
+
"@types/node": "^22.17.1",
|
|
34
|
+
"@types/node-fetch": "^2.6.13",
|
|
35
|
+
"@types/ws": "^8.18.1",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^8.39.1",
|
|
37
|
+
"@typescript-eslint/parser": "^8.39.1",
|
|
38
|
+
"eslint": "^9.33.0",
|
|
39
|
+
"globals": "^16.3.0",
|
|
40
|
+
"openapi-typescript": "^7.9.1",
|
|
41
|
+
"prettier": "^3.6.2",
|
|
39
42
|
"ts-node": "^10.9.2",
|
|
40
43
|
"typedoc": "^0.27.9",
|
|
41
|
-
"typescript": "
|
|
44
|
+
"typescript": "^5.9.2"
|
|
42
45
|
},
|
|
43
46
|
"dependencies": {
|
|
44
|
-
"@bufbuild/protobuf": "^2.
|
|
47
|
+
"@bufbuild/protobuf": "^2.6.3",
|
|
45
48
|
"@n1xyz/proton": "0.0.2",
|
|
46
|
-
"@noble/curves": "^1.
|
|
47
|
-
"@noble/ed25519": "^2.
|
|
48
|
-
"@noble/hashes": "^1.
|
|
49
|
+
"@noble/curves": "^1.9.6",
|
|
50
|
+
"@noble/ed25519": "^2.3.0",
|
|
51
|
+
"@noble/hashes": "^1.8.0",
|
|
49
52
|
"@solana/spl-token": "^0.4.13",
|
|
50
|
-
"@solana/web3.js": "^1.98.
|
|
53
|
+
"@solana/web3.js": "^1.98.4",
|
|
51
54
|
"bs58": "^6.0.0",
|
|
52
|
-
"decimal.js": "^10.
|
|
53
|
-
"ethers": "^6.
|
|
55
|
+
"decimal.js": "^10.6.0",
|
|
56
|
+
"ethers": "^6.15.0",
|
|
54
57
|
"node-fetch": "2.6.13",
|
|
55
58
|
"openapi-fetch": "^0.14.0",
|
|
56
59
|
"tweetnacl": "^1.0.3",
|
|
57
|
-
"ws": "^8.
|
|
60
|
+
"ws": "^8.18.3"
|
|
58
61
|
}
|
|
59
62
|
}
|