chia-agent 19.2.0 → 20.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [20.0.0]
4
+ ### Breaking change
5
+ - Fixed unsound `int` typing on numeric fields that can exceed `Number.MAX_SAFE_INTEGER` (`2^53 - 1`)
6
+ - The RPC JSON parser (`@chiamine/json-bigint`, `alwaysParseAsBig: false`) returns a `BigInt` for any
7
+ integer above `2^53 - 1` (≈ 9,007 XCH expressed in mojos). Fields that are `uint64` upstream had been
8
+ typed `int` (= `number`), which hid that a `BigInt` can be returned and could mistype values at runtime.
9
+ - Retyped these fields from `int` to `uint64` (= `number | bigint`), matching upstream and the parser's
10
+ actual behavior. To read one as a `bigint`, just wrap it with the built-in `BigInt(x)` — it accepts
11
+ both `number` and `bigint`, so no `typeof` branching is needed (`alwaysParseAsBig` stays `false`, so
12
+ small fields like heights/ids/counts remain plain `number`).
13
+ - Response fields affected:
14
+ - `get_farmed_amount`: `farmed_amount`, `pool_reward_amount`, `farmer_reward_amount`, `fee_amount`
15
+ - `get_offer_summary`: `fees`; `TradeRecord`: `fees`, `pending` (`Record<str, uint64>`)
16
+ - `get_blockchain_state`: `mempool_fees`, `mempool_max_total_cost`, `block_max_cost`, `node_time_utc`, `last_block_cost`
17
+ - Full Node WS mempool broadcast: `mempool_cost`, `mempool_max_total_cost`, `block_max_cost`, `transaction_generator_size_bytes`
18
+ - Data Layer: `total_bytes`
19
+ - Harvester `Plot`: `file_size`, `time_modified`; plot-sync: `total_plot_size`, `total_effective_plot_size`
20
+ - Connection info: `bytes_read`, `bytes_written`
21
+ - Request fields affected (now accept `number | bigint`):
22
+ - `send_transaction` `amount`, `create_new_wallet` (DID) `amount`, `fee`, and `create_offer_for_ids` `offer` values (`Record<str, str | uint64>`)
23
+ - Corrected `TradeRecord` `summary.offered` / `summary.requested` from `Record<str, int>` to `Record<str, str>`
24
+ - These offer amounts are serialized as **strings** on the wire (since chia-blockchain 2.6.0, like
25
+ `get_offer_summary`); they had been mistyped as numbers. (Not a `BigInt` issue — a string-vs-number fix.)
26
+
3
27
  ## [19.2.0]
4
28
  Support for [`chia-blockchain@2.7.1`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.7.1)
5
29
 
@@ -2115,6 +2139,7 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
2115
2139
  Initial release.
2116
2140
 
2117
2141
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
2142
+ [20.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v19.2.0...v20.0.0
2118
2143
  [19.2.0]: https://github.com/Chia-Mine/chia-agent/compare/v19.1.0...v19.2.0
2119
2144
  [19.1.0]: https://github.com/Chia-Mine/chia-agent/compare/v19.0.0...v19.1.0
2120
2145
  [19.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v18.0.0...v19.0.0
@@ -1,6 +1,6 @@
1
1
  import { bytes, Optional, str } from "../types/_python_types_";
2
2
  import { G1Element } from "../../chia_rs/chia-bls/lib";
3
- import { int } from "../../chia_rs/wheel/python/sized_ints";
3
+ import { int, uint64 } from "../../chia_rs/wheel/python/sized_ints";
4
4
  import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
5
5
  export type Plot = {
6
6
  filename: str;
@@ -9,7 +9,7 @@ export type Plot = {
9
9
  pool_public_key: Optional<G1Element>;
10
10
  pool_contract_puzzle_hash: Optional<bytes32>;
11
11
  plot_public_key: G1Element;
12
- file_size: int;
13
- time_modified: int;
12
+ file_size: uint64;
13
+ time_modified: uint64;
14
14
  compression_level: int;
15
15
  };
@@ -1,6 +1,6 @@
1
1
  import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
2
2
  import { bool, float, None, Optional, str } from "../types/_python_types_";
3
- import { int, uint32 } from "../../chia_rs/wheel/python/sized_ints";
3
+ import { int, uint32, uint64 } from "../../chia_rs/wheel/python/sized_ints";
4
4
  import { Plot } from "../protocols/harvester_protocol";
5
5
  import { HarvestingMode } from "../plotting/util";
6
6
  export type MayBeSummary<S, O> = S extends true ? int : O;
@@ -14,8 +14,8 @@ export type Receiver<SUMMARY extends boolean = false> = {
14
14
  failed_to_open_filenames: MayBeSummary<SUMMARY, str[]>;
15
15
  no_key_filenames: MayBeSummary<SUMMARY, str[]>;
16
16
  duplicates: MayBeSummary<SUMMARY, str[]>;
17
- total_plot_size: int;
18
- total_effective_plot_size: int;
17
+ total_plot_size: uint64;
18
+ total_effective_plot_size: uint64;
19
19
  syncing: {
20
20
  initial: bool;
21
21
  plot_files_processed: uint32;
@@ -1,5 +1,5 @@
1
1
  import { bool, bytes, Optional, str } from "../types/_python_types_";
2
- import { int, uint32, uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
2
+ import { uint32, uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
3
3
  import { Coin } from "../types/blockchain_format/coin";
4
4
  import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
5
5
  import { TDriverDict } from "./puzzle_drivers";
@@ -23,10 +23,10 @@ export type TradeRecord = TradeRecordOld & {
23
23
  export type TradeRecordConvenience = {
24
24
  status: str;
25
25
  summary: {
26
- offered: Record<str, int>;
27
- requested: Record<str, int>;
26
+ offered: Record<str, str>;
27
+ requested: Record<str, str>;
28
28
  infos: TDriverDict;
29
- fees: int;
29
+ fees: uint64;
30
30
  };
31
- pending: Record<str, int>;
31
+ pending: Record<str, uint64>;
32
32
  } & Omit<TradeRecord, "offer">;
@@ -123,7 +123,7 @@ export type TGetKeysResponse = {
123
123
  } | {
124
124
  keys: str[];
125
125
  total_pages: int;
126
- total_bytes: int;
126
+ total_bytes: uint64;
127
127
  root_hash: Optional<bytes32>;
128
128
  };
129
129
  export type WsGetKeysMessage = GetMessageType<chia_data_layer_service, get_keys_command, TGetKeysResponse>;
@@ -149,7 +149,7 @@ export type TGetKeysValuesResponse = {
149
149
  value: str;
150
150
  }>;
151
151
  total_pages: int;
152
- total_bytes: int;
152
+ total_bytes: uint64;
153
153
  root_hash: Optional<bytes32>;
154
154
  };
155
155
  export type WsGetKeysValuesMessage = GetMessageType<chia_data_layer_service, get_keys_values_command, TGetKeysValuesResponse>;
@@ -323,7 +323,7 @@ export type TGetKvDiffResponse = {
323
323
  value: str;
324
324
  }>;
325
325
  total_pages: int;
326
- total_bytes: int;
326
+ total_bytes: uint64;
327
327
  };
328
328
  export type WsGetKvDiffMessage = GetMessageType<chia_data_layer_service, get_kv_diff_command, TGetKvDiffResponse>;
329
329
  export declare function get_kv_diff<T extends TRPCAgent | TDaemon>(agent: T, params: TGetKvDiffRequest): Promise<ResType<T, TGetKvDiffResponse, WsGetKvDiffMessage>>;
@@ -38,12 +38,12 @@ export type TGetBlockchainStateResponse = {
38
38
  average_block_time: Optional<uint32>;
39
39
  mempool_size: int;
40
40
  mempool_cost: CLVMCost;
41
- mempool_fees: int;
41
+ mempool_fees: uint64;
42
42
  mempool_min_fees: {
43
43
  cost_5000000: float;
44
44
  };
45
- mempool_max_total_cost: int;
46
- block_max_cost: int;
45
+ mempool_max_total_cost: uint64;
46
+ block_max_cost: uint64;
47
47
  node_id: str;
48
48
  };
49
49
  };
@@ -354,14 +354,14 @@ export type TGetFeeEstimateResponse = {
354
354
  target_times: int[];
355
355
  current_fee_rate: uint64;
356
356
  mempool_size: CLVMCost;
357
- mempool_fees: int;
357
+ mempool_fees: uint64;
358
358
  num_spends: int;
359
359
  mempool_max_size: CLVMCost;
360
360
  full_node_synced: bool;
361
361
  peak_height: uint32;
362
362
  last_peak_timestamp: uint64;
363
- node_time_utc: int;
364
- last_block_cost: int;
363
+ node_time_utc: uint64;
364
+ last_block_cost: uint64;
365
365
  fees_last_block: uint64;
366
366
  fee_rate_last_block: float;
367
367
  last_tx_block_height: int;
@@ -179,7 +179,7 @@ export type TCreateNewDidWalletRequestNew = {
179
179
  fee?: uint64;
180
180
  wallet_type: "did_wallet";
181
181
  did_type: "new";
182
- amount: int;
182
+ amount: uint64;
183
183
  metadata?: Record<str, str>;
184
184
  wallet_name?: str;
185
185
  };
@@ -342,7 +342,7 @@ export type ClawbackPuzzleDecoratorOverride = {
342
342
  };
343
343
  export type TSendTransactionRequest = {
344
344
  wallet_id: uint32;
345
- amount: int;
345
+ amount: uint64;
346
346
  fee?: uint64;
347
347
  address: str;
348
348
  memos?: str[];
@@ -409,10 +409,10 @@ export declare function get_transaction_count<T extends TRPCAgent | TDaemon>(age
409
409
  export declare const get_farmed_amount_command = "get_farmed_amount";
410
410
  export type get_farmed_amount_command = typeof get_farmed_amount_command;
411
411
  export type TGetFarmedAmountResponse = {
412
- farmed_amount: int;
413
- pool_reward_amount: int;
414
- farmer_reward_amount: int;
415
- fee_amount: int;
412
+ farmed_amount: uint64;
413
+ pool_reward_amount: uint64;
414
+ farmer_reward_amount: uint64;
415
+ fee_amount: uint64;
416
416
  last_height_farmed: int;
417
417
  last_time_farmed: uint32;
418
418
  blocks_won: uint32;
@@ -736,7 +736,7 @@ export declare function cat_get_asset_id<T extends TRPCAgent | TDaemon>(agent: T
736
736
  export declare const create_offer_for_ids_command = "create_offer_for_ids";
737
737
  export type create_offer_for_ids_command = typeof create_offer_for_ids_command;
738
738
  export type TCreateOfferForIdsRequest = {
739
- offer: Record<str, str | int>;
739
+ offer: Record<str, str | uint64>;
740
740
  fee?: uint64;
741
741
  validate_only?: bool;
742
742
  driver_dict?: TDriverDict;
@@ -759,7 +759,7 @@ export type TGetOfferSummaryRequest = {
759
759
  export type TOfferSummary = {
760
760
  offered: Record<str, str>;
761
761
  requested: Record<str, str>;
762
- fees: int;
762
+ fees: uint64;
763
763
  infos: TDriverDict;
764
764
  additions: str[];
765
765
  removals: str[];
@@ -1375,7 +1375,7 @@ export declare const send_clawback_transaction_command = "send_clawback_transact
1375
1375
  export type send_clawback_transaction_command = typeof send_clawback_transaction_command;
1376
1376
  export type TSendClawbackTransactionRequest = {
1377
1377
  wallet_id: uint32;
1378
- fee: int;
1378
+ fee: uint64;
1379
1379
  };
1380
1380
  export type TSendClawbackTransactionResponse = {
1381
1381
  transaction: TransactionRecord;
package/api/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NodeType } from "./chia/protocols/outbound_message";
2
2
  import { float, str } from "./chia/types/_python_types_";
3
- import { int, uint16 } from "./chia_rs/wheel/python/sized_ints";
3
+ import { int, uint16, uint64 } from "./chia_rs/wheel/python/sized_ints";
4
4
  import { bytes32 } from "./chia_rs/wheel/python/sized_bytes";
5
5
  import { TRPCAgent } from "../rpc/index";
6
6
  import { TDaemon } from "../daemon/index";
@@ -24,7 +24,7 @@ export type TConnectionGeneral = {
24
24
  peer_server_port?: uint16;
25
25
  node_id: bytes32;
26
26
  creation_time: float;
27
- bytes_read: int;
28
- bytes_written: int;
27
+ bytes_read: uint64;
28
+ bytes_written: uint64;
29
29
  last_message_time: float;
30
30
  };
@@ -41,12 +41,12 @@ export type TGetBlockchainStateBroadCast = {
41
41
  sub_slot_iters: uint64;
42
42
  space: uint128;
43
43
  mempool_size: int;
44
- mempool_cost: int;
44
+ mempool_cost: uint64;
45
45
  mempool_min_fees: {
46
46
  cost_5000000: float;
47
47
  };
48
- mempool_max_total_cost: int;
49
- block_max_cost: int;
48
+ mempool_max_total_cost: uint64;
49
+ block_max_cost: uint64;
50
50
  node_id: str;
51
51
  };
52
52
  };
@@ -62,7 +62,7 @@ export type TBlockBroadCast = Record<string, never> | {
62
62
  block_cost?: uint64;
63
63
  block_fees?: uint64;
64
64
  timestamp?: uint64;
65
- transaction_generator_size_bytes?: int;
65
+ transaction_generator_size_bytes?: uint64;
66
66
  transaction_generator_ref_list: uint32[];
67
67
  receive_block_result?: AddBlockResult;
68
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chia-agent",
3
- "version": "19.2.0",
3
+ "version": "20.0.0",
4
4
  "author": "ChiaMineJP <admin@chiamine.jp>",
5
5
  "description": "chia rpc/websocket client library",
6
6
  "license": "MIT",