Skip to content

Commit

Permalink
Merge pull request #57 from Chia-Mine/v14.2.0
Browse files Browse the repository at this point in the history
V14.2.0
  • Loading branch information
ChiaMineJP authored Jul 4, 2024
2 parents 748302d + 0caa23b commit e50e267
Show file tree
Hide file tree
Showing 62 changed files with 1,378 additions and 529 deletions.
122 changes: 121 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,124 @@
# Changelog

## [14.2.0]
### Note
- [`add_private_key`](./src/api/ws/daemon/README.md#add_private_keydaemon-params)
- The request parameters `kc_user` and `kc_service` is temporarily not working with `2.4.0` and `2.4.1` of
`chia-blockchain`.
This is a bug and not spec change so `chia-agent` stays to be able to set those params for now.
### Changed
- Reorganized directory structure under `src/api/` in order to make it clear the dependencies from `chia_rs`/`pool_reference`
- [Daemon WebSocket API](./src/api/ws/daemon)
- [`get_key_for_fingerprint`](./src/api/ws/daemon/README.md#get_key_for_fingerprintdaemon-params)
- Added a `private` request parameter
- [Common RPC API](./src/api/rpc/common)
- [`get_network_info`](./src/api/rpc/common/README.md#get_network_infoagent)
- Added a `genesis_challenge` response parameter
- [`Mirror`](./src/api/chia/data_layer/data_layer_wallet.ts) now has new `confirmed_at_height` property.
As a result of this addition, [`dl_get_mirrors`](./src/api/rpc/wallet/README.md#dl_get_mirrorsagent-params) is affected.
- [`PoolWalletInfo`](./src/api/chia/pools/pool_wallet_info.ts)'s `current_inner` property was removed.
As a result of this removal, the following [Wallet RPC API](./src/api/rpc/wallet)s are affected.
- [`pw_absorb_rewards`](./src/api/rpc/wallet/README.md#pw_absorb_rewardsagent-params)
- [`pw_status`](./src/api/rpc/wallet/README.md#pw_statusagent-params)
- `CHIP-0029` and `sign` request params were added to [`TXEndpointRequest`](./src/api/chia/rpc/util.ts).
Plus, `unsigned_transactions` and `signing_responses` were added to responses of TxEndpoint APIs.
As a result of these additions, the following [Wallet RPC API](./src/api/rpc/wallet)s are affected.
- [`create_new_wallet`](./src/api/rpc/wallet/README.md#create_new_walletagent-params)
- [`send_transaction`](./src/api/rpc/wallet/README.md#send_transactionagent-params)
- [`spend_clawback_coins`](./src/api/rpc/wallet/README.md#spend_clawback_coinsagent-params)
- [`create_signed_transaction`](./src/api/rpc/wallet/README.md#create_signed_transactionagent-params)
- [`send_notification`](./src/api/rpc/wallet/README.md#send_notificationagent-params)
- [`cat_spend`](./src/api/rpc/wallet/README.md#cat_spendagent-params)
- [`create_offer_for_ids`](./src/api/rpc/wallet/README.md#create_offer_for_idsagent-params)
- [`take_offer`](./src/api/rpc/wallet/README.md#take_offeragent-params)
- [`cancel_offer`](./src/api/rpc/wallet/README.md#cancel_offeragent-params)
- [`cancel_offers`](./src/api/rpc/wallet/README.md#cancel_offersagent-params)
- [`did_update_recovery_ids`](./src/api/rpc/wallet/README.md#did_update_recovery_idsagent-params)
- [`did_update_metadata`](./src/api/rpc/wallet/README.md#did_update_metadataagent-params)
- [`did_create_attest`](./src/api/rpc/wallet/README.md#did_create_attestagent-params)
- [`did_message_spend`](./src/api/rpc/wallet/README.md#did_message_spendagent-params)
- [`did_transfer_did`](./src/api/rpc/wallet/README.md#did_transfer_didagent-params)
- [`dao_add_funds_to_treasury`](./src/api/rpc/wallet/README.md#dao_add_funds_to_treasuryagent-params)
- [`dao_send_to_lockup`](./src/api/rpc/wallet/README.md#dao_send_to_lockupagent-params)
- [`dao_exit_lockup`](./src/api/rpc/wallet/README.md#dao_exit_lockupagent-params)
- [`dao_create_proposal`](./src/api/rpc/wallet/README.md#dao_create_proposalagent-params)
- [`dao_vote_on_proposal`](./src/api/rpc/wallet/README.md#dao_vote_on_proposalagent-params)
- [`dao_close_proposal`](./src/api/rpc/wallet/README.md#dao_close_proposalagent-params)
- [`dao_free_coins_from_finished_proposals`](./src/api/rpc/wallet/README.md#dao_free_coins_from_finished_proposalsagent-params)
- [`nft_mint_nft`](./src/api/rpc/wallet/README.md#nft_mint_nftagent-params)
- [`nft_set_nft_did`](./src/api/rpc/wallet/README.md#nft_set_nft_didagent-params)
- [`nft_set_did_bulk`](./src/api/rpc/wallet/README.md#nft_set_did_bulkagent-params)
- [`nft_transfer_bulk`](./src/api/rpc/wallet/README.md#nft_transfer_bulkagent-params)
- [`nft_transfer_nft`](./src/api/rpc/wallet/README.md#nft_transfer_nftagent-params)
- [`nft_add_uri`](./src/api/rpc/wallet/README.md#nft_add_uriagent-params)
- [`nft_mint_bulk`](./src/api/rpc/wallet/README.md#nft_mint_bulkagent-params)
- [`pw_join_pool`](./src/api/rpc/wallet/README.md#pw_join_poolagent-params)
- [`pw_self_pool`](./src/api/rpc/wallet/README.md#pw_self_poolagent-params)
- [`pw_absorb_rewards`](./src/api/rpc/wallet/README.md#pw_absorb_rewardsagent-params)
- [`create_new_dl`](./src/api/rpc/wallet/README.md#create_new_dlagent-params)
- [`dl_update_root`](./src/api/rpc/wallet/README.md#dl_update_rootagent-params)
- [`dl_update_multiple`](./src/api/rpc/wallet/README.md#dl_update_multipleagent-params)
- [`dl_new_mirror`](./src/api/rpc/wallet/README.md#dl_new_mirroragent-params)
- [`dl_delete_mirror`](./src/api/rpc/wallet/README.md#dl_delete_mirroragent-params)
- [`vc_mint`](./src/api/rpc/wallet/README.md#vc_mintagent-params)
- [`vc_spend`](./src/api/rpc/wallet/README.md#vc_spendagent-params)
- [`vc_revoke`](./src/api/rpc/wallet/README.md#vc_revokeagent-params)
- [`crcat_approve_pending`](./src/api/rpc/wallet/README.md#crcat_approve_pendingagent-params)
- [FullNode RPC API](./src/api/rpc/full_node)
- `TFarmBlockFullNodeRequest`, `TFarmBlockFullNodeResponse` and `farm_block_fullnode` are now
`TFarmBlockRequest`, `TFarmBlockResponse` and `farm_block`
- [Wallet RPC API](./src/api/rpc/wallet)
- [`push_transactions`](./src/api/rpc/wallet/README.md#push_transactionsagent-params)
- Added `sign` request parameter
- [`dl_update_multiple`](./src/api/rpc/wallet/README.md#dl_update_multipleagent-params)
- Added `fee` optional request parameter
- Removed `tx_records` from response
### Added
- [New Daemon WebSocket API](./src/api/ws/daemon)
- [`add_key`](./src/api/ws/daemon/README.md#add_keydaemon-params)
- [New DataLayer RPC API](./src/api/rpc/data_layer)
- [`multistore_batch_update`](./src/api/rpc/data_layer/README.md#multistore_batch_updateagent-params)
- [`submit_all_pending_roots`](./src/api/rpc/data_layer/README.md#submit_all_pending_rootsagent-params)
- [New FullNode WebSocket API](./src/api/ws/full_node)
- [`unfinished_block`](./src/api/ws/full_node/README.md#on_unfinished_block)
- [New Wallet RPC API](./src/api/rpc/wallet)
- [`gather_signing_info`](./src/api/rpc/wallet/README.md#gather_signing_infoagent-params)
- [`apply_signatures`](./src/api/rpc/wallet/README.md#apply_signaturesagent-params)
- [`submit_transactions`](./src/api/rpc/wallet/README.md#submit_transactionsagent-params)
### Removed
- [Wallet RPC API](./src/api/rpc/wallet)
- `farm_block`
### Fixed
- [Daemon WebSocket API](./src/api/ws/daemon)
- [`add_private_key`](./src/api/ws/daemon/README.md#add_private_keydaemon-params)
- Added missing `fingerprint` response property
- [`add_private_key`](./src/api/ws/daemon/README.md#add_private_keydaemon-params)
- [`check_keys`](./src/api/ws/daemon/README.md#check_keysdaemon-params)
- [`delete_all_keys`](./src/api/ws/daemon/README.md#delete_all_keysdaemon-params)
- [`delete_key_by_fingerprint`](./src/api/ws/daemon/README.md#delete_key_by_fingerprintdaemon-params)
- [`get_all_private_keys`](./src/api/ws/daemon/README.md#get_all_private_keysdaemon-params)
- [`get_first_private_key`](./src/api/ws/daemon/README.md#get_first_private_keydaemon-params)
- [`get_key_for_fingerprint`](./src/api/ws/daemon/README.md#get_key_for_fingerprintdaemon-params)
- [`get_key`](./src/api/ws/daemon/README.md#get_keydaemon-params)
- [`get_keys`](./src/api/ws/daemon/README.md#get_keysdaemon-params)
- [`get_public_key`](./src/api/ws/daemon/README.md#get_public_keydaemon-params)
- [`get_public_keys`](./src/api/ws/daemon/README.md#get_public_keysdaemon-params)
- [`set_label`](./src/api/ws/daemon/README.md#set_labeldaemon-params)
- [`delete_label`](./src/api/ws/daemon/README.md#delete_labeldaemon-params)
- Added a missing `kc_service` request parameter
- Removed `kc_test` request parameter
- [`get_key_for_fingerprint`](./src/api/ws/daemon/README.md#get_key_for_fingerprintdaemon-params)
- Made `error` response parameter non-optional when `success == False`
- [Common RPC API](./src/api/rpc/common)
- [`get_network_info`](./src/api/rpc/common/README.md#get_network_infoagent)
- Added a missing `success` response parameter
- [Wallet RPC API](./src/api/rpc/wallet)
- [`create_new_wallet`](./src/api/rpc/wallet/README.md#create_new_walletagent-params)
- Fixed CAT request/response documentation incorrectness
- [`dao_close_proposal`](./src/api/rpc/wallet/README.md#dao_close_proposalagent-params)
- Fixed response documentation incorrectness
- Fixed an issue where `Spend` and `SpendBundleCondition` were too old and missed several properties in the types.

## [14.1.0]
### Changed
-`get_network_info` RPC API is now commonized and available in addition to `full_node` and `wallet`.
Expand Down Expand Up @@ -108,7 +227,7 @@
- `dao_get_proposals` of Wallet RPC API
- `dao_adjust_filter_level` of Wallet RPC API
- Upgraded dependencies and replaced `yarn.lock` with `pnpm-lock.yaml`
- Moved `FarmerRecord` to [src/chia/pool/record.ts](./src/api/chia/pool/record.ts) (
- Moved `FarmerRecord` to [src/chia/pool/record.ts](src/api/pool-reference/pool/record.ts) (
Previously `src/chia/pool/store.ts`)
### Added
- [Daemon WebSocket API](./src/api/ws/daemon)
Expand Down Expand Up @@ -1514,6 +1633,7 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
Initial release.
<!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
[14.2.0]: https://github.com/Chia-Mine/chia-agent/compare/v14.1.0...v14.2.0
[14.1.0]: https://github.com/Chia-Mine/chia-agent/compare/v14.0.0...v14.1.0
[14.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v13.2.0...v14.0.0
[13.2.0]: https://github.com/Chia-Mine/chia-agent/compare/v13.1.0...v13.2.0
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![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)

chia rpc/websocket client library for NodeJS.
Supports all RPC/Websocket API available at `chia 2.3.0` and `chia 2.3.1`.
Supports all RPC/Websocket API available at `2.4.0` and `2.4.1` of [`chia-blockchain`](https://github.com/Chia-Network/chia-blockchain/).
\(If you need previous version, search for the corresponding release [here](https://github.com/Chia-Mine/chia-agent/releases)\)

you can develop your own nodejs script with `chia-agent` to:
Expand All @@ -22,10 +22,12 @@ yarn add chia-agent

## Compatibility
This code is compatible with:
- [`b29ae6367486a874dae45d685a565ff8e7640b00`](https://github.com/Chia-Network/chia-blockchain/tree/b29ae6367486a874dae45d685a565ff8e7640b00) of [chia-blockchain 2.3.0](https://github.com/Chia-Network/chia-blockchain)
- [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/b29ae6367486a874dae45d685a565ff8e7640b00...main)
- [`b7b02da0953f0790376d29f4cbaad3f71702ba62`](https://github.com/Chia-Network/pool-reference/tree/b7b02da0953f0790376d29f4cbaad3f71702ba62) of [pool-reference](https://github.com/Chia-Network/pool-reference)
- [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/b7b02da0953f0790376d29f4cbaad3f71702ba62...main)
- [`4572390f40fce50ba186f13ae30b171887e3a104`](https://github.com/Chia-Network/chia-blockchain/tree/4572390f40fce50ba186f13ae30b171887e3a104) of [chia-blockchain 2.4.1](https://github.com/Chia-Network/chia-blockchain)
- [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/4572390f40fce50ba186f13ae30b171887e3a104...main)
- [`284dfdffe0397413bfec2376da0c2f038b7ebe4d`](https://github.com/Chia-Network/pool-reference/tree/284dfdffe0397413bfec2376da0c2f038b7ebe4d) of [pool-reference](https://github.com/Chia-Network/pool-reference)
- [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/284dfdffe0397413bfec2376da0c2f038b7ebe4d...main)
- [`3f8a42b9d81e513dfc6c151d952a1c3f17030a8d`](https://github.com/Chia-Network/chia_rs/tree/3f8a42b9d81e513dfc6c151d952a1c3f17030a8d) of [chia_rs](https://github.com/Chia-Network/chia_rs)
- [Diff to the main branch of chia_rs](https://github.com/Chia-Network/chia_rs/compare/3f8a42b9d81e513dfc6c151d952a1c3f17030a8d...main)

## API
There are 2 kinds of APIs in chia.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chia-agent",
"version": "14.1.0",
"version": "14.2.0",
"author": "ChiaMineJP <[email protected]>",
"description": "chia rpc/websocket client library",
"license": "MIT",
Expand Down
8 changes: 7 additions & 1 deletion src/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ In order to keep description simple, the above error response is omitted in RPC
- [`get_height_info`](./rpc/wallet/README.md#get_height_infoagent)
- [`push_tx`](./rpc/wallet/README.md#push_txagent-params)
- [`push_transactions`](./rpc/wallet/README.md#push_transactionsagent-params)
- [`farm_block`](./rpc/wallet/README.md#farm_blockagent-params)
- [`get_timestamp_for_height`](./rpc/wallet/README.md#gettimestampforheightagent)
- [`set_auto_claim`](./rpc/wallet/README.md#set_auto_claimagent-params)
- [`get_auto_claim`](./rpc/wallet/README.md#get_auto_claimagent-params)
Expand Down Expand Up @@ -216,6 +215,9 @@ In order to keep description simple, the above error response is omitted in RPC
- [`vc_get_proofs_for_root`](./rpc/wallet/README.md#vc_get_proofs_for_rootagent-params)
- [`vc_revoke`](./rpc/wallet/README.md#vc_revokeagent-params)
- [`crcat_approve_pending`](./rpc/wallet/README.md#crcat_approve_pendingagent-params)
- [`gather_signing_info`](./rpc/wallet/README.md#gather_signing_infoagent-params)
- [`apply_signatures`](./rpc/wallet/README.md#apply_signaturesagent-params)
- [`submit_transactions`](./rpc/wallet/README.md#submit_transactionsagent-params)

#### [Pool API](./rpc/pool/README.md#usage)
- [`pool_info`](./rpc/pool/README.md#pool_infoagent)
Expand All @@ -230,7 +232,9 @@ In order to keep description simple, the above error response is omitted in RPC
- [`create_data_store`](./rpc/data_layer/README.md#create_data_storeagent-params)
- [`get_owned_stores`](./rpc/data_layer/README.md#get_owned_storesagent)
- [`batch_update`](./rpc/data_layer/README.md#batch_updateagent-params)
- [`multistore_batch_update`](./rpc/data_layer/README.md#multistore_batch_updateagent-params)
- [`submit_pending_root`](./rpc/data_layer/README.md#submit_pending_rootagent-params)
- [`submit_all_pending_roots`](./rpc/data_layer/README.md#submit_all_pending_rootsagent-params)
- [`get_value`](./rpc/data_layer/README.md#get_valueagent-params)
- [`get_keys`](./rpc/data_layer/README.md#get_keysagent-params)
- [`get_keys_values`](./rpc/data_layer/README.md#get_keys_valuesagent-params)
Expand Down Expand Up @@ -286,6 +290,7 @@ See how to get Daemon instance before requesting Websocket API [**>>here**](../d

#### [daemon](./ws/daemon/README.md#usage)
- [`add_private_key`](./ws/daemon/README.md#add_private_keydaemon-params)
- [`add_key`](./ws/daemon/README.md#add_keydaemon-params)
- [`check_keys`](./ws/daemon/README.md#check_keysdaemon-params)
- [`delete_all_keys`](./ws/daemon/README.md#delete_all_keysdaemon-params)
- [`delete_key_by_fingerprint`](./ws/daemon/README.md#delete_key_by_fingerprintdaemon-params)
Expand Down Expand Up @@ -350,6 +355,7 @@ you need to wait messages in the channel are arrived to your message listener.
- [`get_blockchain_state`](./ws/full_node/README.md#on_get_blockchain_state)
- [`block`](./ws/full_node/README.md#on_block)
- [`signage_point`](./ws/full_node/README.md#on_signage_point)
- [`unfinished_block`](./ws/full_node/README.md#on_unfinished_block)

#### [harvester](./ws/harvester/README.md#usage)
- [`get_connections`](./ws/harvester/README.md#on_get_connections)
Expand Down
42 changes: 1 addition & 41 deletions src/api/chia/consensus/block_record.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1 @@
import {bytes32} from "../types/blockchain_format/sized_bytes";
import {ClassgroupElement} from "../types/blockchain_format/classgroup";
import {Coin} from "../types/blockchain_format/coin";
import {SubEpochSummary} from "../types/blockchain_format/sub_epoch_summary";
import {bool, Optional, uint128, uint32, uint64, uint8} from "../types/_python_types_";

// The reference code was moved to https://github.com/Chia-Network/chia_rs/blob/main/crates/chia-protocol/src/block_record.rs

export type BlockRecord = {
header_hash: bytes32; // bytes32
prev_hash: bytes32; // bytes32 # Header hash of the previous block
height: uint32; // uint32
weight: uint128; // uint128 # Total cumulative difficulty of all ancestor blocks since genesis
total_iters: uint128; // uint128 # Total number of VDF iterations since genesis, including this block
signage_point_index: uint8; // uint8
challenge_vdf_output: ClassgroupElement; // ClassgroupElement # This is the intermediary VDF output at ip_iters in challenge chain
infused_challenge_vdf_output: Optional<ClassgroupElement>; // Optional[ClassgroupElement] # This is the intermediary VDF output at ip_iters in infused cc, iff deficit <= 3
reward_infusion_new_challenge: bytes32; // bytes32 # The reward chain infusion output, input to next VDF
challenge_block_info_hash: bytes32; // bytes32 # Hash of challenge chain data, used to validate end of slots in the future
sub_slot_iters: uint64; // uint64 # Current network sub_slot_iters parameter
pool_puzzle_hash: bytes32; // bytes32 # Need to keep track of these because Coins are created in a future block
farmer_puzzle_hash: bytes32; // bytes32
required_iters: uint64; // uint64 # The number of iters required for this proof of space
deficit: uint8; // uint8 # A deficit of 16 is an overflow block after an infusion. Deficit of 15 is a challenge block
overflow: bool; // bool
prev_transaction_block_height: uint32; // uint32

// # Transaction block (present iff is_transaction_block)
timestamp: Optional<uint64>; // Optional[uint64]
prev_transaction_block_hash: Optional<bytes32>; // Optional[bytes32] # Header hash of the previous transaction block
fees: Optional<uint64>; // Optional[uint64]
reward_claims_incorporated: Optional<Coin[]>; // Optional[List[Coin]]

// # Slot (present iff this is the first SB in sub slot)
finished_challenge_slot_hashes: Optional<bytes32[]>; // Optional[List[bytes32]]
finished_infused_challenge_slot_hashes: Optional<bytes32[]>; // Optional[List[bytes32]]
finished_reward_slot_hashes: Optional<bytes32[]>; // Optional[List[bytes32]]

// # Sub-epoch (present iff this is the first SB after sub-epoch)
sub_epoch_summary_included: Optional<SubEpochSummary>; // Optional[SubEpochSummary]
};
export type {BlockRecord} from "../../chia_rs/chia-protocol/block_record";
3 changes: 2 additions & 1 deletion src/api/chia/data_layer/data_layer_wallet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {bytes32} from "../types/blockchain_format/sized_bytes";
import {bool, str, uint32, uint64} from "../types/_python_types_";
import {bool, Optional, str, uint32, uint64} from "../types/_python_types_";
import {LineageProof} from "../wallet/lineage_proof";

export type SingletonRecord = {
Expand All @@ -20,4 +20,5 @@ export type Mirror = {
amount: uint64;
urls: str[];
ours: bool;
confirmed_at_height: Optional<uint32>;
};
2 changes: 0 additions & 2 deletions src/api/chia/pools/pool_wallet_info.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {G1Element, Optional, str, uint32, uint8} from "../types/_python_types_";
import {bytes32} from "../types/blockchain_format/sized_bytes";
import {Coin} from "../types/blockchain_format/coin";
import {Program} from "../types/blockchain_format/program";

export type PoolState = {
version: uint8;
Expand All @@ -18,7 +17,6 @@ export type PoolWalletInfo = {
launcher_coin: Coin;
launcher_id: bytes32;
p2_singleton_puzzle_hash: bytes32;
current_inner: Program; // # Inner puzzle in current singleton, not revealed yet
tip_singleton_coin_id: bytes32;
singleton_block_height: uint32; // # Block height that current PoolState is from
};
Expand Down
2 changes: 2 additions & 0 deletions src/api/chia/rpc/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export type TXEndpointRequest = {
wallet_type: str;
extra_conditions?: ExtraCondition[];
push?: bool;
"CHIP-0029"?: bool;
sign?: bool;
}
& TXConfigLoader
& TXEndpointForCompat
Expand Down
Loading

0 comments on commit e50e267

Please sign in to comment.