chia-agent 9.1.0 → 10.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/README.md +12 -5
  3. package/api/chia/data_layer/data_layer_util.d.ts +8 -1
  4. package/api/chia/types/_python_types_.d.ts +1 -0
  5. package/api/chia/types/clvm_cost.d.ts +2 -0
  6. package/api/chia/types/clvm_cost.js +2 -0
  7. package/api/chia/types/mempool_item.d.ts +2 -4
  8. package/api/chia/util/keychain.d.ts +12 -0
  9. package/api/chia/util/keychain.js +2 -0
  10. package/api/chia/wallet/nft_wallet/nft_info.d.ts +3 -0
  11. package/api/chia/wallet/util/wallet_types.d.ts +0 -1
  12. package/api/chia/wallet/util/wallet_types.js +1 -1
  13. package/api/rpc/common/index.d.ts +19 -9
  14. package/api/rpc/crawler/index.d.ts +8 -2
  15. package/api/rpc/data_layer/index.d.ts +69 -27
  16. package/api/rpc/data_layer/index.js +8 -1
  17. package/api/rpc/farmer/index.d.ts +30 -13
  18. package/api/rpc/full_node/index.d.ts +76 -25
  19. package/api/rpc/full_node/index.js +8 -1
  20. package/api/rpc/harvester/index.d.ts +16 -6
  21. package/api/rpc/index.d.ts +11 -18
  22. package/api/rpc/index.js +14 -4
  23. package/api/rpc/wallet/index.d.ts +475 -95
  24. package/api/rpc/wallet/index.js +110 -4
  25. package/api/types.d.ts +3 -0
  26. package/api/ws/chia_plots_create/index.d.ts +4 -2
  27. package/api/ws/crawler/index.d.ts +5 -2
  28. package/api/ws/daemon/index.d.ts +165 -33
  29. package/api/ws/daemon/index.js +37 -2
  30. package/api/ws/farmer/index.d.ts +16 -8
  31. package/api/ws/full_node/index.d.ts +10 -5
  32. package/api/ws/harvester/index.d.ts +7 -3
  33. package/api/ws/index.d.ts +9 -18
  34. package/api/ws/index.js +15 -12
  35. package/api/ws/timelord/index.d.ts +9 -4
  36. package/api/ws/wallet/index.d.ts +11 -6
  37. package/daemon/index.d.ts +6 -7
  38. package/package.json +1 -1
  39. package/rpc/index.d.ts +1 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,192 @@
1
1
  # Changelog
2
2
 
3
+ ## [10.0.0]
4
+ ### Breaking change
5
+ In `chia/types/mempool_items.py`, `removals` of `MempoolItem` is now flagged as `@property`.
6
+ As a result of this, `removals` of `MempoolItem` is removed from 2 RPC API responses listed below.
7
+ - [FullNode RPC API](./src/api/rpc/full_node)
8
+ - [`get_all_mempool_items`](./src/api/rpc/full_node/README.md#getallmempoolitemsagent)
9
+ - [`get_mempool_item_by_tx_id`](./src/api/rpc/full_node/README.md#getmempoolitembytxidagent-params)
10
+ ### Minor breaking change
11
+ - Response params of`keyring_status` daemon WebSocket API below are deprecated
12
+ - `needs_migration`
13
+ - `can_remove_legacy_keys`
14
+ ### Removed
15
+ - [Daemon WebSocket API](./src/api/ws/daemon)
16
+ (Code will remain awhile on chia-agent for backward compatibility. Only document is removed for now.)
17
+ - Removed `migrate_keyring`
18
+ - Removed `notify_keyring_migration_completed`
19
+ ### Added
20
+ - [New DataLayer RPC API](./src/api/rpc/data_layer)
21
+ - [`get_sync_status`](./src/api/rpc/data_layer/README.md#getsyncstatusagent-params)
22
+ - [New Wallet RPC API](./src/api/rpc/wallet)
23
+ - [`get_spendable_coins`](./src/api/rpc/wallet/README.md#getspendablecoinsagent-params)
24
+ - [`get_coin_records_by_names`](./src/api/rpc/wallet/README.md#getcoinrecordsbynamesagent-params)
25
+ - [`verify_signature`](./src/api/rpc/wallet/README.md#verifysignatureagent-params)
26
+ - [`did_message_spend`](./src/api/rpc/wallet/README.md#didmessagespendagent-params)
27
+ - [`did_get_info`](./src/api/rpc/wallet/README.md#didgetinfoagent-params)
28
+ - [`did_find_lost_did`](./src/api/rpc/wallet/README.md#didfindlostdidagent-params)
29
+ - [`nft_set_did_bulk`](./src/api/rpc/wallet/README.md#nftsetdidbulkagent-params)
30
+ ### Changed
31
+ - [Daemon WebSocket API](./src/api/ws/daemon)
32
+ - [`keyring_status`](./src/api/ws/daemon/README.md#keyringstatusdaemon)
33
+ - Removed `needs_migration` from response
34
+ - Removed `can_remove_legacy_keys` from response
35
+ - [FullNode RPC API](./src/api/rpc/full_node)
36
+ - [`get_mempool_item_by_tx_id`](./src/api/rpc/full_node/README.md#getmempoolitembytxidagent-params)
37
+ - Added `include_pending` to request parameter
38
+ - [Wallet RPC API](./src/api/rpc/wallet)
39
+ - [`send_transaction`](./src/api/rpc/wallet/README.md#sendtransactionagent-params)
40
+ - Added `max_coin_amount` to request parameter
41
+ - Added `exclude_coin_amounts` to request parameter
42
+ - Added `exclude_coin_ids` to request parameter
43
+ - [`send_transaction_multi`](./src/api/rpc/wallet/README.md#sendtransactionmultiagent-params)
44
+ - Added `max_coin_amount` to request parameter
45
+ - Added `exclude_coin_amounts` to request parameter
46
+ - Added parameters for cat spends.
47
+ - [`select_coins`](./src/api/rpc/wallet/README.md#selectcoinsagent-params)
48
+ - Added `max_coin_amount` to request parameter
49
+ - Added `exclude_coin_amounts` to request parameter
50
+ - [`cat_spend`](./src/api/rpc/wallet/README.md#catspendagent-params)
51
+ - Added `additions` to request parameter
52
+ - Added `max_coin_amount` to request parameter
53
+ - Added `exclude_coin_amounts` to request parameter
54
+ - Added `exclude_coin_ids` to request parameter
55
+ - [`sign_message_by_id`](./src/api/rpc/wallet/README.md#signmessagebyidagent-params)
56
+ - Added `latest_coin_id` to request parameter
57
+ - [`create_offer_for_ids`](./src/api/rpc/wallet/README.md#createofferforidsagent-params)
58
+ - Added `max_coin_amount` to request parameter
59
+ - [`take_offer`](./src/api/rpc/wallet/README.md#takeofferagent-params)
60
+ - Added `max_coin_amount` to request parameter
61
+ - [`nft_mint_nft`](./src/api/rpc/wallet/README.md#nftmintnftagent-params)
62
+ - Added `nft_id` to return parameter
63
+ - [`nft_mint_bulk`](./src/api/rpc/wallet/README.md#nftmintbulkagent-params)
64
+ - Added `nft_id_list` to return parameter
65
+ - [`create_signed_transaction`](./src/api/rpc/wallet/README.md#createsignedtransactionagent-params)
66
+ - Added `max_coin_amount` to return parameter
67
+ - Added `exclude_coin_amounts` to return parameter
68
+ - [Wallet WebSocket API](./src/api/ws/wallet)
69
+ - [`state_changed`](./src/api/ws/wallet/README.md#onstatechangedofwallet)
70
+ - Added `new_on_chain_notification` state.
71
+ - `TBladeBitParams` has been renamed to `TBladeBitRamParams`
72
+ - `plot_type: "ramplot"` has been added
73
+ - `TBladeBit2Params` has been renamed to `TBladeBitDiskParams`
74
+ - `plot_type: "diskplot"` has been added
75
+ - `plotter` type has been converted to `"bladebit"` from `"bladebit2"`
76
+ - Eased type requirement of `daemon.sendMessage()` and `agent.sendMessage()`
77
+ You can request **RPC** API on Daemon WebSocket channel like this:
78
+ ```typescript
79
+ const {getDaemon} = require("chia-agent");
80
+ const {get_harvesters_summary} = require("chia-agent/api/rpc/farmer");
81
+ const daemon = getDaemon();
82
+ await daemon.connect();
83
+ res = await get_harvesters_summary(daemon);
84
+ // or specify service name and API command
85
+ res = await daemon.sendMessage("chia_farmer", "get_harvesters_summary");
86
+ /*
87
+ {
88
+ ack: true,
89
+ command: 'get_harvesters_summary',
90
+ data: { harvesters: [ [Object] ], success: true },
91
+ destination: 'chia_agent',
92
+ origin: 'chia_farmer',
93
+ request_id: '4e31c04df234538901d9270932d04301b5b3a1a895d762144400852b8167973f'
94
+ }
95
+ */
96
+ ```
97
+ Please note that when you use RPC API, you can directly request to the RPC endpoint of the service(full_node/farmer/...).
98
+ However, when you request RPC API on Daemon WebSocket channel, you get a response from the service
99
+ which the daemon is connecting to.
100
+ In other word, you can choose the exact ip:port of a service if you use RPC API,
101
+ while it is the daemon which chooses the services it connects to if you use Daemon WebSocket channel.
102
+ ### Fixed
103
+ - [FullNode RPC API](./src/api/rpc/full_node)
104
+ - [`get_blockchain_state`](./src/api/rpc/full_node/README.md#getblockchainstateagent)
105
+ - Made `sync_tip_height` as `uint32`(previously `Optional<uint32>`) because `None` value would never be set
106
+ - [Wallet RPC API](./src/api/rpc/wallet)
107
+ - [`send_transaction_multi`](./src/api/rpc/wallet/README.md#sendtransactionmultiagent-params)
108
+ - Added missing `min_coin_amount` to request parameter
109
+ - Added missing `exclude_coins` to request parameter
110
+ - [`create_offer_for_ids`](./src/api/rpc/wallet/README.md#createofferforidsagent-params)
111
+ - Added missing `solver` to request parameter
112
+ - [`create_signed_transaction`](./src/api/rpc/wallet/README.md#createsignedtransactionagent-params)
113
+ - Added missing `wallet_id` to return parameter in README
114
+ - Added missing `exclude_coins` to return parameter in README
115
+
116
+ ## [9.2.0]
117
+ ### Minor breaking change
118
+ - `add_private_key` daemon WebSocket API now deprecated `passphrase` request param
119
+ and added `label` param.
120
+ - `program` property was removed from `MempoolItem` class.
121
+ See [MempoolItem](./src/api/chia/types/mempool_item.ts) for more detail.
122
+ This impacts on API response below:
123
+ - [`get_all_mempool_items`](./src/api/rpc/full_node/README.md#get_all_mempool_itemsagent)
124
+ of FullNode RPC API
125
+ - [`get_mempool_item_by_tx_id`](./src/api/rpc/full_node/README.md#get_mempool_item_by_tx_idagent-params)
126
+ of FullNode RPC API
127
+ ### Removed
128
+ - [Wallet RPC API](./src/api/rpc/wallet)
129
+ (Code will remain awhile on chia-agent for backward compatibility. Only document is removed for now.)
130
+ - Removed `rl_set_user_info`
131
+ - Removed `send_clawback_transaction`
132
+ - Removed `add_rate_limited_funds`
133
+ - Removed RL Wallet type from `create_new_wallet` API
134
+ - Removed `RATE_LIMITED` from [`WalletType`](./src/api/chia/wallet/util/wallet_types.ts)
135
+ ### Added
136
+ - [New Daemon WebSocket API](./src/api/ws/daemon)
137
+ - [`get_key`](./src/api/ws/daemon/README.md#get_keydaemon-params)
138
+ - [`get_keys`](./src/api/ws/daemon/README.md#get_keysdaemon-params)
139
+ - [`set_label`](./src/api/ws/daemon/README.md#set_labeldaemon-params)
140
+ - [`delete_label`](./src/api/ws/daemon/README.md#delete_labeldaemon-params)
141
+ - [`running_services`](./src/api/ws/daemon/README.md#running_servicesdaemon)
142
+ - Added support for Bladebit2 plotting option
143
+ - [New FullNode RPC API](./src/api/rpc/full_node)
144
+ - [`get_fee_estimate`](./src/api/rpc/full_node/README.md#get_fee_estimateagent-params)
145
+ - [New Wallet RPC API](./src/api/rpc/wallet)
146
+ - [`push_transactions`](./src/api/rpc/wallet/README.md#push_transactionsagent-params)
147
+ - [`get_notifications`](./src/api/rpc/wallet/README.md#get_notificationsagent-params)
148
+ - [`delete_notifications`](./src/api/rpc/wallet/README.md#delete_notificationsagent-params)
149
+ - [`send_notification`](./src/api/rpc/wallet/README.md#send_notificationagent-params)
150
+ - [`sign_message_by_address`](./src/api/rpc/wallet/README.md#sign_message_by_addressagent-params)
151
+ - [`sign_message_by_id`](./src/api/rpc/wallet/README.md#sign_message_by_idagent-params)
152
+ - [`nft_calculate_royalties`](./src/api/rpc/wallet/README.md#nft_calculate_royaltiesagent-params)
153
+ - [`nft_mint_bulk`](./src/api/rpc/wallet/README.md#nft_mint_bulkagent-params)
154
+ ### Changed
155
+ - [Daemon WebSocket API](./src/api/ws/daemon)
156
+ - [`add_private_key`](./src/api/ws/daemon/README.md#add_private_keydaemon-params)
157
+ - Removed `passphrase` request parameter
158
+ - Added `label` request parameter
159
+ - [DataLayer RPC API](./src/api/rpc/data_layer)
160
+ - [`get_value`](./src/api/rpc/data_layer/README.md#get_valueagent-params)
161
+ - Added `root_hash` request parameter
162
+ - [FullNode RPC API](./src/api/rpc/full_node)
163
+ - `program` property was removed from `MempoolItem` class.
164
+ See [MempoolItem](./src/api/chia/types/mempool_item.ts) for more detail.
165
+ - [Wallet RPC API](./src/api/rpc/wallet)
166
+ - [`nft_get_nfts`](./src/api/rpc/wallet/README.md#nft_get_nftsagent-params)
167
+ - Made `wallet_id` optional request parameter
168
+ - Added `start_index`, `num`, `ignore_size_limit` request parameters
169
+ - [`nft_get_info`](./src/api/rpc/wallet/README.md#nft_get_infoagent-params)
170
+ - Added `ignore_size_limit` request parameters
171
+ - [`nft_add_uri`](./src/api/rpc/wallet/README.md#nft_add_uriagent-params)
172
+ - Removed error response
173
+ - [`create_signed_transaction`](./src/api/rpc/wallet/README.md#create_signed_transactionagent-params)
174
+ - Added `signed_txs` to response
175
+ - [Common RPC API](./src/api/rpc/common)
176
+ - [`healthz`](./src/api/rpc/common/README.md#healthzagent)
177
+ - Changed `success` type to `True` from `"true"`
178
+ - `p2_address`, `minter_did`, `off_chain_metadata` were added to `NFTInfo` class.
179
+ This impacts on API response below:
180
+ - [`nft_get_nfts`](./src/api/rpc/wallet/README.md#nft_get_nftsagent-params)
181
+ - [`nft_get_info`](./src/api/rpc/wallet/README.md#nft_get_infoagent-params)
182
+ ### Fixed
183
+ - [Wallet RPC API](./src/api/rpc/wallet)
184
+ - [`nft_set_nft_did`](./src/api/rpc/wallet/README.md#nft_set_nft_didagent-params)
185
+ - Fixed an issue where `did_id` request param was described to be required
186
+ - [Common RPC API](./src/api/rpc/common)
187
+ - [`get_routes`](./src/api/rpc/common/README.md#get_routesagent)
188
+ - Added missing `success` response parameter.
189
+
3
190
  ## [9.1.0]
4
191
  ### Added
5
192
  - Added Common RPC API Error format description and type
@@ -632,6 +819,8 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
632
819
  Initial release.
633
820
 
634
821
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
822
+ [10.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v9.2.0...v10.0.0
823
+ [9.2.0]: https://github.com/Chia-Mine/chia-agent/compare/v9.1.0...v9.2.0
635
824
  [9.1.0]: https://github.com/Chia-Mine/chia-agent/compare/v9.0.1...v9.1.0
636
825
  [9.0.1]: https://github.com/Chia-Mine/chia-agent/compare/v9.0.0...v9.0.1
637
826
  [9.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v8.0.0...v9.0.0
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 `chia 1.6.0`.
5
+ Supports all RPC/Websocket API available at `chia 1.6.2`.
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
- - [`bf4759be503bf46c997b41e39a3c22a53316e404`](https://github.com/Chia-Network/chia-blockchain/tree/bf4759be503bf46c997b41e39a3c22a53316e404) of [chia-blockchain 1.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/bf4759be503bf46c997b41e39a3c22a53316e404...main)
27
- - [`495f71e3acc93b18f10cfa9aac6a5b68cc7064c2`](https://github.com/Chia-Network/pool-reference/tree/495f71e3acc93b18f10cfa9aac6a5b68cc7064c2) of [pool-reference](https://github.com/Chia-Network/pool-reference)
28
- - [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/495f71e3acc93b18f10cfa9aac6a5b68cc7064c2...main)
25
+ - [`ba1ff12b31f8fea600e8ee2058bf472e211f1f7a`](https://github.com/Chia-Network/chia-blockchain/tree/ba1ff12b31f8fea600e8ee2058bf472e211f1f7a) of [chia-blockchain 1.6.2](https://github.com/Chia-Network/chia-blockchain)
26
+ - [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/ba1ff12b31f8fea600e8ee2058bf472e211f1f7a...main)
27
+ - [`41a16695db4c6e032aeb18e0af5ab9f01db864cf`](https://github.com/Chia-Network/pool-reference/tree/41a16695db4c6e032aeb18e0af5ab9f01db864cf) of [pool-reference](https://github.com/Chia-Network/pool-reference)
28
+ - [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/41a16695db4c6e032aeb18e0af5ab9f01db864cf...main)
29
29
 
30
30
  ## API
31
31
  There are 2 kinds of APIs in chia.
@@ -61,6 +61,13 @@ console.log(res.plots[0]);
61
61
  time_modified: 1619540745
62
62
  }
63
63
  */
64
+
65
+ // Or you can request RPC API via daemon websocket like this
66
+ const {getDaemon, setLogLevel} = require("chia-agent");
67
+ const {get_plots} = require("chia-agent/api/rpc");
68
+ const daemon = getDaemon();
69
+ await daemon.connect(); // connect to local daemon using config file.
70
+ const res = await get_plots(daemon);
64
71
  ```
65
72
 
66
73
  ### Websocket API
@@ -1,4 +1,5 @@
1
- import { str } from "../types/_python_types_";
1
+ import { int, str } from "../types/_python_types_";
2
+ import { bytes32 } from "../types/blockchain_format/sized_bytes";
2
3
  export declare type KeyValueMarshalled = {
3
4
  key: str;
4
5
  value: str;
@@ -28,3 +29,9 @@ export declare type OfferMarshalled = {
28
29
  taker: OfferStoreMarshalled[];
29
30
  maker: StoreProofsMarshalled[];
30
31
  };
32
+ export declare type SyncStatus = {
33
+ root_hash: bytes32;
34
+ generation: int;
35
+ target_root_hash: bytes32;
36
+ target_generation: int;
37
+ };
@@ -1,5 +1,6 @@
1
1
  export declare type G1Element = string;
2
2
  export declare type G2Element = string;
3
+ export declare type PrivateKey = string;
3
4
  export declare type bytes = string;
4
5
  export declare type int = number;
5
6
  export declare type int8 = number;
@@ -0,0 +1,2 @@
1
+ import { uint64 } from "./_python_types_";
2
+ export declare type CLVMCost = uint64;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +1,8 @@
1
1
  import { SpendBundle } from "./spend_bundle";
2
- import { SerializedProgram } from "./blockchain_format/program";
3
2
  import { Coin } from "./blockchain_format/coin";
4
3
  import { bytes32 } from "./blockchain_format/sized_bytes";
5
4
  import { NPCResult } from "../consensus/cost_calculator";
6
- import { uint64 } from "./_python_types_";
5
+ import { uint32, uint64 } from "./_python_types_";
7
6
  export declare type MempoolItem = {
8
7
  spend_bundle: SpendBundle;
9
8
  fee: uint64;
@@ -11,6 +10,5 @@ export declare type MempoolItem = {
11
10
  cost: uint64;
12
11
  spend_bundle_name: bytes32;
13
12
  additions: Coin[];
14
- removals: Coin[];
15
- program: SerializedProgram;
13
+ height_added_to_mempool: uint32;
16
14
  };
@@ -0,0 +1,12 @@
1
+ import { bytes, G1Element, PrivateKey, Optional, str, uint32 } from "../types/_python_types_";
2
+ export declare type KeyDataSecrets = {
3
+ mnemonic: str[];
4
+ entropy: bytes;
5
+ private_key: PrivateKey;
6
+ };
7
+ export declare type KeyData = {
8
+ fingerprint: uint32;
9
+ public_key: G1Element;
10
+ label: Optional<str>;
11
+ secrets: Optional<KeyDataSecrets>;
12
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -18,6 +18,9 @@ export declare type NFTInfo = {
18
18
  chain_info: str;
19
19
  mint_height: uint32;
20
20
  supports_did: bool;
21
+ p2_address: bytes32;
21
22
  pending_transaction: bool;
23
+ minter_did: Optional<bytes32>;
22
24
  launcher_puzhash: bytes32;
25
+ off_chain_metadata: Optional<str>;
23
26
  };
@@ -1,6 +1,5 @@
1
1
  export declare const WalletType: {
2
2
  STANDARD_WALLET: number;
3
- RATE_LIMITED: number;
4
3
  ATOMIC_SWAP: number;
5
4
  AUTHORIZED_PAYEE: number;
6
5
  MULTI_SIG: number;
@@ -4,7 +4,7 @@ exports.WalletType = void 0;
4
4
  exports.WalletType = {
5
5
  // # Wallet Types
6
6
  STANDARD_WALLET: 0,
7
- RATE_LIMITED: 1,
7
+ // RATE_LIMITED: 1, // Deprecated at chia-blockchain@1.6.1
8
8
  ATOMIC_SWAP: 2,
9
9
  AUTHORIZED_PAYEE: 3,
10
10
  MULTI_SIG: 4,
@@ -1,7 +1,8 @@
1
- import { str, uint16 } from "../../chia/types/_python_types_";
1
+ import { str, True, uint16 } from "../../chia/types/_python_types_";
2
2
  import { TRPCAgent } from "../../../rpc/index";
3
- import { TConnectionGeneral } from "../../types";
3
+ import { GetMessageType, ResType, TConnectionGeneral } from "../../types";
4
4
  import { TConnectionFullNode } from "../../ws/full_node/index";
5
+ import { TDaemon } from "../../../daemon/index";
5
6
  export declare const chia_common_service = "";
6
7
  export declare type chia_common_service = typeof chia_common_service;
7
8
  export declare const get_connections_command = "get_connections";
@@ -12,7 +13,8 @@ export declare type TGetConnectionsRequest = {
12
13
  export declare type TGetConnectionsResponse = {
13
14
  connections: TConnectionGeneral[] | TConnectionFullNode[];
14
15
  };
15
- export declare function get_connections(agent: TRPCAgent, params: TGetConnectionsRequest): Promise<TGetConnectionsResponse | import("../../../rpc/index").ErrorResponse>;
16
+ export declare type WsGetConnectionsMessage = GetMessageType<chia_common_service, get_connections_command, TGetConnectionsResponse>;
17
+ export declare function get_connections<T extends TRPCAgent | TDaemon>(agent: T, params: TGetConnectionsRequest): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, TGetConnectionsResponse, WsGetConnectionsMessage>>;
16
18
  export declare const open_connection_command = "open_connection";
17
19
  export declare type open_connection_command = typeof open_connection_command;
18
20
  export declare type TOpenConnectionRequest = {
@@ -20,27 +22,35 @@ export declare type TOpenConnectionRequest = {
20
22
  port: uint16;
21
23
  };
22
24
  export declare type TOpenConnectionResponse = {};
23
- export declare function open_connection(agent: TRPCAgent, params: TOpenConnectionRequest): Promise<TOpenConnectionResponse | import("../../../rpc/index").ErrorResponse>;
25
+ export declare type WsOpenConnectionMessage = GetMessageType<chia_common_service, open_connection_command, TOpenConnectionResponse>;
26
+ export declare function open_connection<T extends TRPCAgent | TDaemon>(agent: T, params: TOpenConnectionRequest): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, TOpenConnectionResponse, WsOpenConnectionMessage>>;
24
27
  export declare const close_connection_command = "close_connection";
25
28
  export declare type close_connection_command = typeof close_connection_command;
26
29
  export declare type TCloseConnectionRequest = {
27
30
  node_id: str;
28
31
  };
29
32
  export declare type TCloseConnectionResponse = {};
30
- export declare function close_connection(agent: TRPCAgent, params: TCloseConnectionRequest): Promise<TCloseConnectionResponse | import("../../../rpc/index").ErrorResponse>;
33
+ export declare type WsCloseConnectionMessage = GetMessageType<chia_common_service, close_connection_command, TCloseConnectionResponse>;
34
+ export declare function close_connection<T extends TRPCAgent | TDaemon>(agent: T, params: TCloseConnectionRequest): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, TCloseConnectionResponse, WsCloseConnectionMessage>>;
31
35
  export declare const stop_node_command = "stop_node";
32
36
  export declare type stop_node_command = typeof stop_node_command;
33
37
  export declare type TStopNodeResponse = {};
34
- export declare function stop_node(agent: TRPCAgent): Promise<TStopNodeResponse | import("../../../rpc/index").ErrorResponse>;
38
+ export declare type WsStopNodeMessage = GetMessageType<chia_common_service, stop_node_command, TStopNodeResponse>;
39
+ export declare function stop_node<T extends TRPCAgent | TDaemon>(agent: T): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, TStopNodeResponse, WsStopNodeMessage>>;
35
40
  export declare const get_routes_command = "get_routes";
36
41
  export declare type get_routes_command = typeof get_routes_command;
37
42
  export declare type TGetRoutesResponse = {
43
+ success: True;
38
44
  routes: str[];
39
45
  };
40
- export declare function get_routes(agent: TRPCAgent): Promise<TGetRoutesResponse | import("../../../rpc/index").ErrorResponse>;
46
+ export declare type WsGetRoutesMessage = GetMessageType<chia_common_service, get_routes_command, TGetRoutesResponse>;
47
+ export declare function get_routes<T extends TRPCAgent | TDaemon>(agent: T): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, TGetRoutesResponse, WsGetRoutesMessage>>;
41
48
  export declare const healthz_command = "healthz";
42
49
  export declare type healthz_command = typeof healthz_command;
43
50
  export declare type THealthzResponse = {
44
- success: "true";
51
+ success: True;
45
52
  };
46
- export declare function healthz(agent: TRPCAgent): Promise<THealthzResponse | import("../../../rpc/index").ErrorResponse>;
53
+ export declare type WsHealthzMessage = GetMessageType<chia_common_service, healthz_command, THealthzResponse>;
54
+ export declare function healthz<T extends TRPCAgent | TDaemon>(agent: T): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, THealthzResponse, WsHealthzMessage>>;
55
+ export declare type RpcCommonMessage = TGetConnectionsResponse | TOpenConnectionResponse | TCloseConnectionResponse | TStopNodeResponse | TGetRoutesResponse | THealthzResponse;
56
+ export declare type RpcCommonMessageOnWs = WsGetConnectionsMessage | WsOpenConnectionMessage | WsCloseConnectionMessage | WsStopNodeMessage | WsGetRoutesMessage | WsHealthzMessage;
@@ -1,6 +1,8 @@
1
1
  import { int, str, uint64 } from "../../chia/types/_python_types_";
2
2
  import { bytes32 } from "../../chia/types/blockchain_format/sized_bytes";
3
3
  import { TRPCAgent } from "../../../rpc/index";
4
+ import { TDaemon } from "../../../daemon/index";
5
+ import { GetMessageType, ResType } from "../../types";
4
6
  export declare const chia_crawler_service = "chia_crawler";
5
7
  export declare type chia_crawler_service = typeof chia_crawler_service;
6
8
  export declare const get_peer_counts_command = "get_peer_counts";
@@ -14,7 +16,8 @@ export declare type TGetPeerCountsResponse = {
14
16
  versions: Record<str, int>;
15
17
  };
16
18
  };
17
- export declare function get_peer_counts(agent: TRPCAgent): Promise<TGetPeerCountsResponse | import("../../../rpc/index").ErrorResponse>;
19
+ export declare type WsGetPeerCountsMessage = GetMessageType<chia_crawler_service, get_peer_counts_command, TGetPeerCountsResponse>;
20
+ export declare function get_peer_counts<T extends TRPCAgent | TDaemon>(agent: T): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, TGetPeerCountsResponse, WsGetPeerCountsMessage>>;
18
21
  export declare const get_ips_after_timestamp_command = "get_ips_after_timestamp";
19
22
  export declare type get_ips_after_timestamp_command = typeof get_ips_after_timestamp_command;
20
23
  export declare type TGetIpsAfterTimestampRequest = {
@@ -26,4 +29,7 @@ export declare type TGetIpsAfterTimestampResponse = {
26
29
  ips: str[];
27
30
  total: int;
28
31
  };
29
- export declare function get_ips_after_timestamp(agent: TRPCAgent, params: TGetIpsAfterTimestampRequest): Promise<TGetIpsAfterTimestampResponse | import("../../../rpc/index").ErrorResponse>;
32
+ export declare type WsGetIpsAfterTimestampMessage = GetMessageType<chia_crawler_service, get_ips_after_timestamp_command, TGetIpsAfterTimestampResponse>;
33
+ export declare function get_ips_after_timestamp<T extends TRPCAgent | TDaemon>(agent: T, params: TGetIpsAfterTimestampRequest): Promise<import("../../../rpc/index").ErrorResponse | ResType<T, TGetIpsAfterTimestampResponse, WsGetIpsAfterTimestampMessage>>;
34
+ export declare type RpcCrawlerMessage = TGetIpsAfterTimestampResponse | TGetPeerCountsResponse;
35
+ export declare type RpcCrawlerMessageOnWs = WsGetIpsAfterTimestampMessage | WsGetPeerCountsMessage;