chia-agent 17.0.0 → 18.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,45 @@
1
1
  # Changelog
2
2
 
3
+ ## [18.0.0]
4
+ Support for [`chia-blockchain@2.6.0`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.6.0)
5
+
6
+ ### Breaking change
7
+ - `create_new_wallet`
8
+ - The response `type` is now the `WalletType` name string (`"CAT"`, `"DECENTRALIZED_ID"`, `"NFT"`, `"POOLING_WALLET"`)
9
+ instead of the integer enum value
10
+ - Pool wallet `mode: "recovery"` was removed
11
+ - Pool wallet response now includes `type`
12
+ - `asset_id`, `coin_name`, `newpuzhash`, `pubkey`, `launcher_id` and `p2_singleton_puzzle_hash` in responses
13
+ are now `0x`-prefixed hex
14
+ - The `{success: false, error: "invalid request"}` success-path variant was removed
15
+ (invalid requests now produce a standard RPC error response)
16
+ - `get_offer_summary`
17
+ - `summary.offered` / `summary.requested` amounts are now JSON strings (were numbers)
18
+ - `additions` / `removals` are now `0x`-prefixed hex
19
+ - DataLayer offer summaries are now typed as `TDataLayerOfferSummary`
20
+ - `create_signed_transaction` / `send_transaction_multi`
21
+ - Per-announcement `morph_bytes` was removed; only the top-level `morph_bytes` is applied
22
+ - All transaction endpoints now require a fully synced wallet
23
+ (may fail with `"Wallet needs to be fully synced before making transactions."`)
24
+ - `split_coins` with `number_of_coins == 0` and `combine_coins` with `number_of_coins < 2` now error
25
+
26
+ ### Added
27
+ - [Harvester Protocol](./src/api/chia/protocols/harvester_protocol.ts)
28
+ - `PartialProofsData`: `partial_proofs` is now `PartialProof[]`; added `strength` and `plot_id`
29
+ - `Plot`: added `compression_level`; for v2 plots `size` now encodes `0x80 | strength`
30
+ - [Solver Protocol](./src/api/chia/protocols/solver_protocol.ts)
31
+ - `SolverInfo` is now `{partial_proof: PartialProof, plot_id, strength, size}`
32
+ - `SolverResponse.partial_proof` is now `PartialProof`
33
+ - Added `PartialProof` type (mirrors `chia_rs`)
34
+
35
+ ### Changed
36
+ - Synchronized `chia_rs` type definitions with `chia_rs@0.35.2`
37
+ - `SubEpochSummary`: added `challenge_merkle_root`
38
+ - `RewardChainBlock`: added `header_mmr_root`
39
+ - `create_offer_for_ids`: `offer` dictionary values are canonically strings now (`Record<str, str | int>`)
40
+ - `get_transactions`: `start` / `end` widened to `uint32`
41
+ - `get_all_offers`: `start` / `end` are now bounded to `uint16`
42
+
3
43
  ## [17.0.0]
4
44
  Support for [`chia-blockchain@2.5.7`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.5.7)
5
45
 
@@ -2002,6 +2042,7 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
2002
2042
  Initial release.
2003
2043
 
2004
2044
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
2045
+ [18.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v17.0.0...v18.0.0
2005
2046
  [17.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.6...v17.0.0
2006
2047
  [16.1.6]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.5...v16.1.6
2007
2048
  [16.1.5]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.4...v16.1.5
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  [![npm version](https://badge.fury.io/js/chia-agent.svg)](https://badge.fury.io/js/chia-agent) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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.5.7` of [`chia-blockchain`](https://github.com/Chia-Network/chia-blockchain/).
5
+ Supports all RPC/Websocket API available at `2.6.0` 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,10 +22,10 @@ yarn add chia-agent
22
22
 
23
23
  ## Compatibility
24
24
  This code is compatible with:
25
- - [`54bdf378c7a2a60b45b8d8523dd7b10920f029b8`](https://github.com/Chia-Network/chia-blockchain/tree/54bdf378c7a2a60b45b8d8523dd7b10920f029b8) of [chia-blockchain 2.5.7](https://github.com/Chia-Network/chia-blockchain)
26
- - [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/54bdf378c7a2a60b45b8d8523dd7b10920f029b8...main)
27
- - [`aea3188b55305aed9ecea7b09a77d063f9f0ace7`](https://github.com/Chia-Network/chia_rs/tree/aea3188b55305aed9ecea7b09a77d063f9f0ace7) of [chia_rs 0.30.0](https://github.com/Chia-Network/chia_rs)
28
- - [Diff to the main branch of chia_rs](https://github.com/Chia-Network/chia_rs/compare/aea3188b55305aed9ecea7b09a77d063f9f0ace7...main)
25
+ - [`a73171a119f27d3e94409f1a523207fd151b4b69`](https://github.com/Chia-Network/chia-blockchain/tree/a73171a119f27d3e94409f1a523207fd151b4b69) of [chia-blockchain 2.6.0](https://github.com/Chia-Network/chia-blockchain)
26
+ - [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/a73171a119f27d3e94409f1a523207fd151b4b69...main)
27
+ - [`a1d5fbcb15a12e3b5bde96d633e2e5419d7632f0`](https://github.com/Chia-Network/chia_rs/tree/a1d5fbcb15a12e3b5bde96d633e2e5419d7632f0) of [chia_rs 0.35.2](https://github.com/Chia-Network/chia_rs)
28
+ - [Diff to the main branch of chia_rs](https://github.com/Chia-Network/chia_rs/compare/a1d5fbcb15a12e3b5bde96d633e2e5419d7632f0...main)
29
29
  - [`ef49150171cc243b09c0e5d5cb27f2249ffa3793`](https://github.com/Chia-Network/pool-reference/tree/ef49150171cc243b09c0e5d5cb27f2249ffa3793) of [pool-reference](https://github.com/Chia-Network/pool-reference)
30
30
  - [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/ef49150171cc243b09c0e5d5cb27f2249ffa3793...main)
31
31
 
@@ -1,14 +1,17 @@
1
- import { bytes, Optional, str } from "../types/_python_types_";
1
+ import { Optional, str } from "../types/_python_types_";
2
2
  import { G1Element } from "../../chia_rs/chia-bls/lib";
3
3
  import { uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
4
4
  import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
5
+ import { PartialProof } from "../../chia_rs/chia-protocol/partial_proof";
5
6
  export type PartialProofsData = {
6
7
  challenge_hash: bytes32;
7
8
  sp_hash: bytes32;
8
9
  plot_identifier: str;
9
- partial_proofs: bytes[];
10
+ partial_proofs: PartialProof[];
10
11
  signage_point_index: uint8;
11
12
  plot_size: uint8;
13
+ strength: uint8;
14
+ plot_id: bytes32;
12
15
  pool_public_key: Optional<G1Element>;
13
16
  pool_contract_puzzle_hash: Optional<bytes32>;
14
17
  plot_public_key: G1Element;
@@ -22,4 +25,5 @@ export type Plot = {
22
25
  plot_public_key: G1Element;
23
26
  file_size: uint64;
24
27
  time_modified: uint64;
28
+ compression_level: Optional<uint8>;
25
29
  };
@@ -1,8 +1,14 @@
1
1
  import { bytes } from "../types/_python_types_";
2
+ import { uint8 } from "../../chia_rs/wheel/python/sized_ints";
3
+ import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
4
+ import { PartialProof } from "../../chia_rs/chia-protocol/partial_proof";
2
5
  export type SolverInfo = {
3
- partial_proof: bytes;
6
+ partial_proof: PartialProof;
7
+ plot_id: bytes32;
8
+ strength: uint8;
9
+ size: uint8;
4
10
  };
5
11
  export type SolverResponse = {
6
- partial_proof: bytes;
12
+ partial_proof: PartialProof;
7
13
  proof: bytes;
8
14
  };
@@ -0,0 +1,4 @@
1
+ import { uint64 } from "../wheel/python/sized_ints";
2
+ export type PartialProof = {
3
+ proof_fragments: uint64[];
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -28,5 +28,6 @@ export type RewardChainBlock = {
28
28
  reward_chain_sp_signature: G2Element;
29
29
  reward_chain_ip_vdf: VDFInfo;
30
30
  infused_challenge_chain_ip_vdf: Optional<VDFInfo>;
31
+ header_mmr_root: Optional<bytes32>;
31
32
  is_transaction_block: bool;
32
33
  };
@@ -7,4 +7,5 @@ export type SubEpochSummary = {
7
7
  num_blocks_overflow: uint8;
8
8
  new_difficulty: Optional<uint64>;
9
9
  new_sub_slot_iters: Optional<uint64>;
10
+ challenge_merkle_root: Optional<bytes32>;
10
11
  };
@@ -1,7 +1,7 @@
1
1
  import { WalletInfo } from "../../chia/wallet/wallet_info";
2
2
  import { Coin } from "../../chia/types/blockchain_format/coin";
3
3
  import { bool, bytes, False, None, Optional, str, True } from "../../chia/types/_python_types_";
4
- import { int, uint16, uint32, uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
4
+ import { int, uint16, uint32, uint64 } from "../../chia_rs/wheel/python/sized_ints";
5
5
  import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
6
6
  import { TransactionRecord, TransactionRecordConvenience, TransactionRecordConvenienceWithMetadata } from "../../chia/wallet/transaction_record";
7
7
  import { TRPCAgent } from "../../../rpc";
@@ -169,7 +169,7 @@ export type TCreate_New_CAT_WalletRequest = {
169
169
  asset_id: str;
170
170
  };
171
171
  export type TCreate_New_CAT_WalletResponse = {
172
- type: uint8;
172
+ type: "CAT";
173
173
  asset_id: str;
174
174
  wallet_id: uint32;
175
175
  transactions: TransactionRecordConvenience[];
@@ -192,13 +192,15 @@ export type TCreateNewDidWalletRequestRecovery = {
192
192
  export type TCreate_New_DID_WalletRequest = TCreateNewDidWalletRequestNew | TCreateNewDidWalletRequestRecovery;
193
193
  export type TCreateNewDidWalletResponseNew = {
194
194
  success: True;
195
- type: uint8;
195
+ type: "DECENTRALIZED_ID";
196
196
  my_did: str;
197
197
  wallet_id: uint32;
198
+ transactions: TransactionRecordConvenience[];
199
+ signing_responses?: str[];
198
200
  };
199
201
  export type TCreateNewDidWalletResponseRecovery = {
200
202
  success: True;
201
- type: uint8;
203
+ type: "DECENTRALIZED_ID";
202
204
  my_did: str;
203
205
  wallet_id: uint32;
204
206
  coin_name: str;
@@ -217,7 +219,7 @@ export type TCreate_New_NFT_WalletRequest = {
217
219
  };
218
220
  export type TCreate_New_NFT_WalletResponse = {
219
221
  success: True;
220
- type: uint8;
222
+ type: "NFT";
221
223
  wallet_id: uint32;
222
224
  };
223
225
  export type TCreate_New_Pool_WalletRequest = {
@@ -234,12 +236,9 @@ export type TCreate_New_Pool_WalletRequest = {
234
236
  };
235
237
  p2_singleton_delayed_ph?: str;
236
238
  p2_singleton_delay_time?: uint64;
237
- } | {
238
- fee?: uint64;
239
- wallet_type: "pool_wallet";
240
- mode: "recovery";
241
239
  };
242
240
  export type TCreate_New_Pool_WalletResponse = {
241
+ type: "POOLING_WALLET";
243
242
  total_fee: uint64;
244
243
  transaction: TransactionRecord;
245
244
  transactions: TransactionRecordConvenience[];
@@ -247,16 +246,12 @@ export type TCreate_New_Pool_WalletResponse = {
247
246
  launcher_id: str;
248
247
  p2_singleton_puzzle_hash: str;
249
248
  };
250
- export type TCreateWalletErrorResponse = {
251
- success: False;
252
- error: str;
253
- };
254
249
  export declare const create_new_wallet_command = "create_new_wallet";
255
250
  export type create_new_wallet_command = typeof create_new_wallet_command;
256
251
  export type TCreateNewWalletRequestWithTx = TCreate_New_CAT_WalletRequest | TCreate_New_Pool_WalletRequest;
257
252
  export type TCreateNewWalletRequestWithoutTx = TCreate_New_DID_WalletRequest | TCreate_New_NFT_WalletRequest;
258
253
  export type TCreateNewWalletRequest = (TCreateNewWalletRequestWithTx | TCreateNewWalletRequestWithoutTx) & TXEndpointRequest;
259
- export type TCreateNewWalletResponse = TCreate_New_CAT_WalletResponse | TCreate_New_DID_WalletResponse | TCreate_New_NFT_WalletResponse | TCreate_New_Pool_WalletResponse | TCreateWalletErrorResponse;
254
+ export type TCreateNewWalletResponse = TCreate_New_CAT_WalletResponse | TCreate_New_DID_WalletResponse | TCreate_New_NFT_WalletResponse | TCreate_New_Pool_WalletResponse;
260
255
  export type GetCreateNewWalletResponse<REQ extends TCreateNewWalletRequest> = REQ extends TCreate_New_CAT_WalletRequest ? TCreate_New_CAT_WalletResponse : REQ extends TCreate_New_DID_WalletRequest ? REQ extends TCreateNewDidWalletRequestNew ? TCreateNewDidWalletResponseNew : TCreateNewDidWalletResponseRecovery : REQ extends TCreate_New_NFT_WalletRequest ? TCreate_New_NFT_WalletResponse : TCreate_New_Pool_WalletResponse;
261
256
  export type WsCreateNewWalletMessage<R> = GetMessageType<chia_wallet_service, create_new_wallet_command, R>;
262
257
  export declare function create_new_wallet<T extends TRPCAgent | TDaemon, D extends TCreateNewWalletRequest>(agent: T, data: D): Promise<ResType<T, D extends TCreateNewWalletRequestWithTx ? TxeResp<D, GetCreateNewWalletResponse<D>> : GetCreateNewWalletResponse<D>, WsCreateNewWalletMessage<D extends TCreateNewWalletRequestWithTx ? TxeResp<D, GetCreateNewWalletResponse<D>> : GetCreateNewWalletResponse<D>>>>;
@@ -302,8 +297,8 @@ export declare const get_transactions_command = "get_transactions";
302
297
  export type get_transactions_command = typeof get_transactions_command;
303
298
  export type TGetTransactionsRequest = {
304
299
  wallet_id: int;
305
- start?: uint16;
306
- end?: uint16;
300
+ start?: uint32;
301
+ end?: uint32;
307
302
  sort_key?: str;
308
303
  reverse?: bool;
309
304
  to_address?: str;
@@ -424,12 +419,10 @@ export type TAdditions = {
424
419
  export type TCoinAnnouncement = {
425
420
  coin_id: str;
426
421
  message: str;
427
- morph_bytes?: str;
428
422
  };
429
423
  export type TPuzzleAnnouncement = {
430
424
  puzzle_hash: str;
431
425
  message: str;
432
- morph_bytes?: str;
433
426
  };
434
427
  export declare const create_signed_transaction_command = "create_signed_transaction";
435
428
  export type create_signed_transaction_command = typeof create_signed_transaction_command;
@@ -440,7 +433,7 @@ export type TCreateSignedTransactionRequest = {
440
433
  coins?: Coin[];
441
434
  coin_announcements?: TCoinAnnouncement[];
442
435
  puzzle_announcements?: TPuzzleAnnouncement[];
443
- morph_bytes?: True;
436
+ morph_bytes?: str;
444
437
  } & TXEndpointRequest;
445
438
  export type TCreateSignedTransactionResponse = {
446
439
  signed_txs: TransactionRecordConvenience[];
@@ -723,7 +716,7 @@ export declare function cat_get_asset_id<T extends TRPCAgent | TDaemon>(agent: T
723
716
  export declare const create_offer_for_ids_command = "create_offer_for_ids";
724
717
  export type create_offer_for_ids_command = typeof create_offer_for_ids_command;
725
718
  export type TCreateOfferForIdsRequest = {
726
- offer: Record<int, int>;
719
+ offer: Record<str, str | int>;
727
720
  fee?: uint64;
728
721
  validate_only?: bool;
729
722
  driver_dict?: TDriverDict;
@@ -743,16 +736,27 @@ export type TGetOfferSummaryRequest = {
743
736
  offer: str;
744
737
  advanced?: bool;
745
738
  };
739
+ export type TOfferSummary = {
740
+ offered: Record<str, str>;
741
+ requested: Record<str, str>;
742
+ fees: int;
743
+ infos: TDriverDict;
744
+ additions: str[];
745
+ removals: str[];
746
+ valid_times: Omit<ConditionValidTimes, "max_secs_after_created" | "min_secs_since_created" | "max_blocks_after_created" | "min_blocks_since_created">;
747
+ };
748
+ export type TDataLayerOfferSummary = {
749
+ offered: Array<{
750
+ launcher_id: str;
751
+ new_root: str;
752
+ dependencies: Array<{
753
+ launcher_id: str;
754
+ values_to_prove: str[];
755
+ }>;
756
+ }>;
757
+ };
746
758
  export type TGetOfferSummaryResponse = {
747
- summary: {
748
- offered: Record<str, int>;
749
- requested: Record<str, int>;
750
- fees: int;
751
- infos: TDriverDict;
752
- additions: str[];
753
- removals: str[];
754
- valid_times: Omit<ConditionValidTimes, "max_secs_after_created" | "min_secs_since_created" | "max_blocks_after_created" | "min_blocks_since_created">;
755
- };
759
+ summary: TOfferSummary | TDataLayerOfferSummary;
756
760
  id: bytes32;
757
761
  };
758
762
  export type WsGetOfferSummaryMessage = GetMessageType<chia_wallet_service, get_offer_summary_command, TGetOfferSummaryResponse>;
@@ -798,8 +802,8 @@ export declare function get_offer<T extends TRPCAgent | TDaemon>(agent: T, data:
798
802
  export declare const get_all_offers_command = "get_all_offers";
799
803
  export type get_all_offers_command = typeof get_all_offers_command;
800
804
  export type TGetAllOffersRequest = {
801
- start?: int;
802
- end?: int;
805
+ start?: uint16;
806
+ end?: uint16;
803
807
  exclude_my_offers?: bool;
804
808
  exclude_taken_offers?: bool;
805
809
  include_completed?: bool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chia-agent",
3
- "version": "17.0.0",
3
+ "version": "18.0.0",
4
4
  "author": "ChiaMineJP <admin@chiamine.jp>",
5
5
  "description": "chia rpc/websocket client library",
6
6
  "license": "MIT",