chia-agent 11.1.1 → 12.0.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 +16 -0
- 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,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [12.0.1]
|
|
4
|
+
### Changed
|
|
5
|
+
- Replace the npm module `json-bigint` to `@chiamine/json-bigint`.
|
|
6
|
+
### Fixed
|
|
7
|
+
- Fixed the type of `int64`, `uint64`, `uint128`, `uint512` to `number | bigint`.
|
|
8
|
+
|
|
9
|
+
## [12.0.0]
|
|
10
|
+
### Breaking change
|
|
11
|
+
Now the types of `int64`, `uint64`, `uint128`, `uint512` are `number | BigInt` (Originally it was `number`).
|
|
12
|
+
When the numeric value is larger than `Number.MAX_SAFE_INTEGER`, the value is parsed as a `BigInt`.
|
|
13
|
+
You need to check a numeric member of API responses whether it is a `number` or `BigInt`
|
|
14
|
+
if the type of it is either `int64`, `uint64`, `uint128` or `uint512`.
|
|
15
|
+
You may also use `BigInt` for API request inputs wherever the type is one of the above.
|
|
16
|
+
|
|
3
17
|
## [11.1.1]
|
|
4
18
|
Just updated documents.
|
|
5
19
|
You don't need to update `chia-agent` from `11.1.0` for `chia-blockchain@1.8.1` because there are no API changes.
|
|
@@ -1003,6 +1017,8 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
|
|
|
1003
1017
|
Initial release.
|
|
1004
1018
|
|
|
1005
1019
|
<!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
|
|
1020
|
+
[12.0.1]: https://github.com/Chia-Mine/chia-agent/compare/v12.0.0...v12.0.1
|
|
1021
|
+
[12.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v11.1.1...v12.0.0
|
|
1006
1022
|
[11.1.1]: https://github.com/Chia-Mine/chia-agent/compare/v11.1.0...v11.1.1
|
|
1007
1023
|
[11.1.0]: https://github.com/Chia-Mine/chia-agent/compare/v11.0.0...v11.1.0
|
|
1008
1024
|
[11.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v10.1.0...v11.0.0
|
|
@@ -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.1",
|
|
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
|
+
"@chiamine/json-bigint": "^1.0.3",
|
|
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("@chiamine/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
|