chia-agent 18.0.0 → 19.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,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [19.0.0]
4
+ Support for [`chia-blockchain@2.6.1`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.6.1)
5
+
6
+ ### Breaking change
7
+ - `ProofOfSpace` type was updated for v2 proof-of-space (follows `chia_rs@0.38.2`)
8
+ - Added `version`, `plot_index`, `meta_group` and `strength` fields (between `plot_public_key` and `size`)
9
+ - `size` now only carries the v1 k-size (0 for v2 proofs)
10
+ - This affects every RPC response embedding a `ProofOfSpace` (e.g. block records)
11
+ - `PartialProof`: `proof_fragments` was renamed to `fragments` (now 16 entries; follows `chia_rs@0.38.2`)
12
+
13
+ ### Added
14
+ - Structured RPC errors (added in chia-blockchain 2.6.1)
15
+ - RPC error responses now always include `structuredError: {code, message, data}`
16
+ (and `traceback` on the HTTP RPC path)
17
+ - `RpcError` now exposes a `structuredError` property
18
+ - Added `TStructuredError` and `TRpcErrorCode` types
19
+ - `create_signed_transaction`: new optional request parameters
20
+ `extra_delta`, `tail_reveal`, `tail_solution` (must be specified together) and `puzzle_decorator`
21
+ - [Harvester Protocol](./src/api/chia/protocols/harvester_protocol.ts)
22
+ - `PartialProofsData`: added `plot_index` and `meta_group`
23
+
24
+ ### Changed
25
+ - Synchronized `chia_rs` type definitions with `chia_rs@0.38.2`
26
+ - `nft_mint_nft`: upstream reverted the `royalty_amount` rename back to `royalty_percentage`
27
+ (chia-agent already used `royalty_percentage`; no type change)
28
+ - `take_offer`: the `sign` request parameter is now ignored by the wallet (signing is handled internally)
29
+ - `did_find_lost_did`: `latest_coin_id` now echoes the requested coin id
30
+
3
31
  ## [18.0.0]
4
32
  Support for [`chia-blockchain@2.6.0`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.6.0)
5
33
 
@@ -2042,6 +2070,7 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
2042
2070
  Initial release.
2043
2071
 
2044
2072
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
2073
+ [19.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v18.0.0...v19.0.0
2045
2074
  [18.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v17.0.0...v18.0.0
2046
2075
  [17.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.6...v17.0.0
2047
2076
  [16.1.6]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.5...v16.1.6
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.6.0` of [`chia-blockchain`](https://github.com/Chia-Network/chia-blockchain/).
5
+ Supports all RPC/Websocket API available at `2.6.1` 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
- - [`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)
25
+ - [`204fe59bd82984ec7c70794891a669a949e3edc3`](https://github.com/Chia-Network/chia-blockchain/tree/204fe59bd82984ec7c70794891a669a949e3edc3) of [chia-blockchain 2.6.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/204fe59bd82984ec7c70794891a669a949e3edc3...main)
27
+ - [`da47ae281f1f8801542a743263db84fff3612de1`](https://github.com/Chia-Network/chia_rs/tree/da47ae281f1f8801542a743263db84fff3612de1) of [chia_rs 0.38.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/da47ae281f1f8801542a743263db84fff3612de1...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,6 +1,6 @@
1
1
  import { Optional, str } from "../types/_python_types_";
2
2
  import { G1Element } from "../../chia_rs/chia-bls/lib";
3
- import { uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
3
+ import { uint16, uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
4
4
  import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
5
5
  import { PartialProof } from "../../chia_rs/chia-protocol/partial_proof";
6
6
  export type PartialProofsData = {
@@ -10,6 +10,8 @@ export type PartialProofsData = {
10
10
  partial_proofs: PartialProof[];
11
11
  signage_point_index: uint8;
12
12
  plot_size: uint8;
13
+ plot_index: uint16;
14
+ meta_group: uint8;
13
15
  strength: uint8;
14
16
  plot_id: bytes32;
15
17
  pool_public_key: Optional<G1Element>;
@@ -1,4 +1,4 @@
1
1
  import { uint64 } from "../wheel/python/sized_ints";
2
2
  export type PartialProof = {
3
- proof_fragments: uint64[];
3
+ fragments: uint64[];
4
4
  };
@@ -1,12 +1,16 @@
1
1
  import { bytes32 } from "../wheel/python/sized_bytes";
2
2
  import { bytes, Optional } from "../../chia/types/_python_types_";
3
3
  import { G1Element } from "../chia-bls/lib";
4
- import { uint8 } from "../wheel/python/sized_ints";
4
+ import { uint16, uint8 } from "../wheel/python/sized_ints";
5
5
  export type ProofOfSpace = {
6
6
  challenge: bytes32;
7
7
  pool_public_key: Optional<G1Element>;
8
8
  pool_contract_puzzle_hash: Optional<bytes32>;
9
9
  plot_public_key: G1Element;
10
+ version: uint8;
11
+ plot_index: uint16;
12
+ meta_group: uint8;
13
+ strength: uint8;
10
14
  size: uint8;
11
15
  proof: bytes;
12
16
  };
@@ -434,6 +434,10 @@ export type TCreateSignedTransactionRequest = {
434
434
  coin_announcements?: TCoinAnnouncement[];
435
435
  puzzle_announcements?: TPuzzleAnnouncement[];
436
436
  morph_bytes?: str;
437
+ extra_delta?: str;
438
+ tail_reveal?: str;
439
+ tail_solution?: str;
440
+ puzzle_decorator?: ClawbackPuzzleDecoratorOverride[];
437
441
  } & TXEndpointRequest;
438
442
  export type TCreateSignedTransactionResponse = {
439
443
  signed_txs: TransactionRecordConvenience[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chia-agent",
3
- "version": "18.0.0",
3
+ "version": "19.0.0",
4
4
  "author": "ChiaMineJP <admin@chiamine.jp>",
5
5
  "description": "chia rpc/websocket client library",
6
6
  "license": "MIT",
package/rpc/index.d.ts CHANGED
@@ -2,8 +2,15 @@ import { Agent as HttpsAgent } from "https";
2
2
  import { Agent as HttpAgent } from "http";
3
3
  import { TConfig } from "../config/index";
4
4
  import { APIAgent } from "../agent/index";
5
+ export type TRpcErrorCode = "API_ERROR" | "BLOCK_DOES_NOT_EXIST" | "BLOCK_HASH_NOT_FOUND" | "BLOCK_HEIGHT_NOT_FOUND" | "BLOCK_IN_FORK" | "BLOCK_NOT_FOUND" | "COIN_RECORD_NOT_FOUND" | "CONSENSUS_ERROR" | "EOS_NOT_IN_CACHE" | "HEADER_HASH_NOT_IN_REQUEST" | "HEIGHT_NOT_IN_BLOCKCHAIN" | "HINT_NOT_IN_REQUEST" | "INTERNAL_ERROR" | "INVALID_BLOCK_OR_GENERATOR" | "INVALID_COST" | "INVALID_HEIGHT_FOR_COIN" | "INVALID_NETWORK_SPACE_REQUEST" | "NAME_NOT_IN_REQUEST" | "NAMES_NOT_IN_REQUEST" | "NEW_AND_OLD_MUST_DIFFER" | "NEWER_BLOCK_NOT_FOUND" | "NO_BLOCKS_IN_CHAIN" | "NO_COIN_NAME_IN_REQUEST" | "NO_END_IN_REQUEST" | "NO_HEADER_HASH_IN_REQUEST" | "NO_HEIGHT_IN_REQUEST" | "NO_START_IN_REQUEST" | "NO_TX_ID_IN_REQUEST" | "OLDER_BLOCK_NOT_FOUND" | "PARENT_IDS_NOT_IN_REQUEST" | "PEAK_IS_NONE" | "PROTOCOL_ERROR" | "PUZZLE_HASH_NOT_IN_REQUEST" | "PUZZLE_HASHES_NOT_IN_REQUEST" | "PUZZLE_SOLUTION_FAILED" | "REQUEST_MUST_CONTAIN_EXACTLY_ONE" | "SP_NOT_IN_CACHE" | "SPEND_BUNDLE_NOT_IN_REQUEST" | "TARGET_TIMES_NON_NEGATIVE" | "TARGET_TIMES_REQUIRED" | "TIMESTAMP_ERROR" | "TRANSACTION_FAILED" | "TX_NOT_IN_MEMPOOL" | "UNKNOWN" | "VALIDATION_ERROR";
6
+ export type TStructuredError = {
7
+ code: TRpcErrorCode | string;
8
+ message: string;
9
+ data: Record<string, unknown>;
10
+ };
5
11
  export declare class RpcError extends Error {
6
12
  response: unknown;
13
+ structuredError?: TStructuredError;
7
14
  constructor(message: string, response: unknown);
8
15
  }
9
16
  type TDestination = "farmer" | "harvester" | "full_node" | "wallet" | "data_layer" | "solver" | "daemon" | "pool";
package/rpc/index.js CHANGED
@@ -19,6 +19,11 @@ class RpcError extends Error {
19
19
  super(message);
20
20
  this.name = "RpcError";
21
21
  this.response = response;
22
+ if (response &&
23
+ typeof response === "object" &&
24
+ "structuredError" in response) {
25
+ this.structuredError = response.structuredError;
26
+ }
22
27
  }
23
28
  }
24
29
  exports.RpcError = RpcError;