chia-agent 11.1.0 → 12.0.0
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 +14 -1
- package/README.md +3 -3
- package/api/chia/types/_python_types_.d.ts +4 -4
- package/bin/cli.js +1 -1
- package/package.json +2 -1
- package/rpc/index.js +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [12.0.0]
|
|
4
|
+
### Breaking change
|
|
5
|
+
Now the types of `int64`, `uint64`, `uint128`, `uint512` are `number | BigInt` (Originally it was `number`).
|
|
6
|
+
When the numeric value is larger than `Number.MAX_SAFE_INTEGER`, the value is parsed as a `BigInt`.
|
|
7
|
+
You need to check a numeric member of API responses whether it is a `number` or `BigInt`
|
|
8
|
+
if the type of it is either `int64`, `uint64`, `uint128` or `uint512`.
|
|
9
|
+
You may also use `BigInt` for API request inputs wherever the type is one of the above.
|
|
10
|
+
|
|
11
|
+
## [11.1.1]
|
|
12
|
+
Just updated documents.
|
|
13
|
+
You don't need to update `chia-agent` from `11.1.0` for `chia-blockchain@1.8.1` because there are no API changes.
|
|
14
|
+
|
|
3
15
|
## [11.1.0]
|
|
4
16
|
### Changed
|
|
5
17
|
- [Wallet RPC API](./src/api/rpc/wallet)
|
|
@@ -999,7 +1011,8 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
|
|
|
999
1011
|
Initial release.
|
|
1000
1012
|
|
|
1001
1013
|
<!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
|
|
1002
|
-
|
|
1014
|
+
[12.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v11.1.1...v12.0.0
|
|
1015
|
+
[11.1.1]: https://github.com/Chia-Mine/chia-agent/compare/v11.1.0...v11.1.1
|
|
1003
1016
|
[11.1.0]: https://github.com/Chia-Mine/chia-agent/compare/v11.0.0...v11.1.0
|
|
1004
1017
|
[11.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v10.1.0...v11.0.0
|
|
1005
1018
|
[10.1.0]: https://github.com/Chia-Mine/chia-agent/compare/v10.0.0...v10.1.0
|
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 `chia 1.8.
|
|
5
|
+
Supports all RPC/Websocket API available at `chia 1.8.1`.
|
|
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
|
+
- [`c61129d3b10abd4128cd6f99bdcf8dd08ff116d0`](https://github.com/Chia-Network/chia-blockchain/tree/c61129d3b10abd4128cd6f99bdcf8dd08ff116d0) of [chia-blockchain 1.8.1](https://github.com/Chia-Network/chia-blockchain)
|
|
26
|
+
- [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/c61129d3b10abd4128cd6f99bdcf8dd08ff116d0...main)
|
|
27
27
|
- [`6c1c7ecd2ed7307760d1673dc2b1057f22e08fd5`](https://github.com/Chia-Network/pool-reference/tree/6c1c7ecd2ed7307760d1673dc2b1057f22e08fd5) 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/6c1c7ecd2ed7307760d1673dc2b1057f22e08fd5...main)
|
|
29
29
|
|
|
@@ -9,10 +9,10 @@ export declare type int16 = number;
|
|
|
9
9
|
export declare type uint16 = number;
|
|
10
10
|
export declare type int32 = number;
|
|
11
11
|
export declare type uint32 = number;
|
|
12
|
-
export declare type int64 = number;
|
|
13
|
-
export declare type uint64 = number;
|
|
14
|
-
export declare type uint128 = number;
|
|
15
|
-
export declare type int512 = number;
|
|
12
|
+
export declare type int64 = number | BigInt;
|
|
13
|
+
export declare type uint64 = number | BigInt;
|
|
14
|
+
export declare type uint128 = number | BigInt;
|
|
15
|
+
export declare type int512 = number | BigInt;
|
|
16
16
|
export declare type float = number;
|
|
17
17
|
export declare type str = string;
|
|
18
18
|
export declare type bool = boolean;
|
package/bin/cli.js
CHANGED
|
@@ -39,7 +39,7 @@ if (command === "farm") {
|
|
|
39
39
|
if (e.command === "new_farming_info") {
|
|
40
40
|
const { farming_info } = e.data;
|
|
41
41
|
const { challenge_hash, passed_filter, proofs, total_plots, timestamp } = farming_info;
|
|
42
|
-
const date = new Date(timestamp * 1000);
|
|
42
|
+
const date = new Date(Number(timestamp) * 1000);
|
|
43
43
|
console.log(`${challenge_hash.substr(0, 32)}... ${passed_filter}/${total_plots} ${proofs} ${date.toLocaleTimeString()}`);
|
|
44
44
|
sumPassedFilter += passed_filter;
|
|
45
45
|
sumTotalPlot += total_plots;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chia-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"author": "ChiaMineJP <admin@chiamine.jp>",
|
|
5
5
|
"description": "chia rpc/websocket client library",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"node": ">=12.13.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"json-bigint": "Chia-Mine/json-bigint#v1.0.1",
|
|
29
30
|
"ws": "^8.5.0",
|
|
30
31
|
"yaml": "^2.2.2"
|
|
31
32
|
}
|
package/rpc/index.js
CHANGED
|
@@ -13,8 +13,13 @@ exports.RPCAgent = exports.getConnectionInfoFromConfig = void 0;
|
|
|
13
13
|
const https_1 = require("https");
|
|
14
14
|
const http_1 = require("http");
|
|
15
15
|
const fs_1 = require("fs");
|
|
16
|
+
const JSONbigBuilder = require("json-bigint");
|
|
16
17
|
const logger_1 = require("../logger");
|
|
17
18
|
const index_1 = require("../config/index");
|
|
19
|
+
const JSONbig = JSONbigBuilder({
|
|
20
|
+
useNativeBigInt: true,
|
|
21
|
+
alwaysParseAsBig: false,
|
|
22
|
+
});
|
|
18
23
|
function getConnectionInfoFromConfig(destination, config) {
|
|
19
24
|
let hostname = "localhost";
|
|
20
25
|
let port = -1;
|
|
@@ -153,7 +158,7 @@ class RPCAgent {
|
|
|
153
158
|
request(method, path, data) {
|
|
154
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
155
160
|
return new Promise((resolve, reject) => {
|
|
156
|
-
const body = data ?
|
|
161
|
+
const body = data ? JSONbig.stringify(data) : "{}";
|
|
157
162
|
const pathname = `/${path.replace(/^\/+/, "")}`;
|
|
158
163
|
const METHOD = method.toUpperCase();
|
|
159
164
|
const options = {
|
|
@@ -216,7 +221,7 @@ class RPCAgent {
|
|
|
216
221
|
res.on("end", () => {
|
|
217
222
|
try {
|
|
218
223
|
if (chunks.length > 0) {
|
|
219
|
-
const data =
|
|
224
|
+
const data = JSONbig.parse(Buffer.concat(chunks).toString());
|
|
220
225
|
return resolve(data);
|
|
221
226
|
}
|
|
222
227
|
// RPC Server should return response like
|