chia-agent 14.2.0 → 14.2.1
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/CHANGELOG.md +6 -1
- package/README.md +3 -3
- package/daemon/connection.js +1 -0
- package/daemon/index.d.ts +2 -1
- package/daemon/index.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [14.2.1]
|
|
4
|
+
### Changed
|
|
5
|
+
- [`daemon.connect()`](./src/daemon/README.md#daemonconnecturl-string-timeoutms-number) now returns a rejected promise on failure to connect instead of throwing an uncaught exception
|
|
6
|
+
- [`daemon.connect()`](./src/daemon/README.md#daemonconnecturl-string-timeoutms-number) now accepts connection timeout in milliseconds.
|
|
7
|
+
|
|
3
8
|
## [14.2.0]
|
|
4
9
|
### Note
|
|
5
10
|
- [`add_private_key`](./src/api/ws/daemon/README.md#add_private_keydaemon-params)
|
|
6
11
|
- The request parameters `kc_user` and `kc_service` is temporarily not working with `2.4.0` and `2.4.1` of
|
|
7
|
-
`chia-blockchain`.
|
|
12
|
+
`chia-blockchain`. (`2.4.2` fixed this issue)
|
|
8
13
|
This is a bug and not spec change so `chia-agent` stays to be able to set those params for now.
|
|
9
14
|
### Changed
|
|
10
15
|
- Reorganized directory structure under `src/api/` in order to make it clear the dependencies from `chia_rs`/`pool_reference`
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://badge.fury.io/js/chia-agent) [](https://opensource.org/licenses/MIT)
|
|
3
3
|
|
|
4
4
|
chia rpc/websocket client library for NodeJS.
|
|
5
|
-
Supports all RPC/Websocket API available at `2.4.0` and `2.4.
|
|
5
|
+
Supports all RPC/Websocket API available at `2.4.0`, `2.4.1` and `2.4.2` of [`chia-blockchain`](https://github.com/Chia-Network/chia-blockchain/).
|
|
6
6
|
\(If you need previous version, search for the corresponding release [here](https://github.com/Chia-Mine/chia-agent/releases)\)
|
|
7
7
|
|
|
8
8
|
you can develop your own nodejs script with `chia-agent` to:
|
|
@@ -22,8 +22,8 @@ yarn add chia-agent
|
|
|
22
22
|
|
|
23
23
|
## Compatibility
|
|
24
24
|
This code is compatible with:
|
|
25
|
-
- [`
|
|
26
|
-
- [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/
|
|
25
|
+
- [`6ae45b70369eae3ab23391867846bb84d010a30b`](https://github.com/Chia-Network/chia-blockchain/tree/6ae45b70369eae3ab23391867846bb84d010a30b) of [chia-blockchain 2.4.2](https://github.com/Chia-Network/chia-blockchain)
|
|
26
|
+
- [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/6ae45b70369eae3ab23391867846bb84d010a30b...main)
|
|
27
27
|
- [`284dfdffe0397413bfec2376da0c2f038b7ebe4d`](https://github.com/Chia-Network/pool-reference/tree/284dfdffe0397413bfec2376da0c2f038b7ebe4d) of [pool-reference](https://github.com/Chia-Network/pool-reference)
|
|
28
28
|
- [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/284dfdffe0397413bfec2376da0c2f038b7ebe4d...main)
|
|
29
29
|
- [`3f8a42b9d81e513dfc6c151d952a1c3f17030a8d`](https://github.com/Chia-Network/chia_rs/tree/3f8a42b9d81e513dfc6c151d952a1c3f17030a8d) of [chia_rs](https://github.com/Chia-Network/chia_rs)
|
package/daemon/connection.js
CHANGED
package/daemon/index.d.ts
CHANGED
|
@@ -28,8 +28,9 @@ declare class Daemon {
|
|
|
28
28
|
/**
|
|
29
29
|
* Connect to local daemon via websocket.
|
|
30
30
|
* @param daemonServerURL
|
|
31
|
+
* @param timeoutMs
|
|
31
32
|
*/
|
|
32
|
-
connect(daemonServerURL?: string): Promise<boolean>;
|
|
33
|
+
connect(daemonServerURL?: string, timeoutMs?: number): Promise<boolean>;
|
|
33
34
|
close(): Promise<unknown>;
|
|
34
35
|
sendMessage<M = unknown>(destination: string, command: string, data?: Record<string, unknown>): Promise<M>;
|
|
35
36
|
createMessageTemplate(command: string, destination: string, data: Record<string, unknown>): {
|
package/daemon/index.js
CHANGED
|
@@ -72,8 +72,9 @@ class Daemon {
|
|
|
72
72
|
/**
|
|
73
73
|
* Connect to local daemon via websocket.
|
|
74
74
|
* @param daemonServerURL
|
|
75
|
+
* @param timeoutMs
|
|
75
76
|
*/
|
|
76
|
-
connect(daemonServerURL) {
|
|
77
|
+
connect(daemonServerURL, timeoutMs) {
|
|
77
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
79
|
if (!daemonServerURL) {
|
|
79
80
|
const config = (0, index_1.getConfig)();
|
|
@@ -89,7 +90,7 @@ class Daemon {
|
|
|
89
90
|
return false;
|
|
90
91
|
}
|
|
91
92
|
(0, logger_1.getLogger)().debug(`Opening websocket connection to ${daemonServerURL}`);
|
|
92
|
-
const result = yield (0, connection_1.open)(daemonServerURL);
|
|
93
|
+
const result = yield (0, connection_1.open)(daemonServerURL, timeoutMs);
|
|
93
94
|
this._socket = result.ws;
|
|
94
95
|
this._socket.onerror = this.onError;
|
|
95
96
|
this._socket.onmessage = this.onMessage;
|