chia-agent 2.0.6 → 3.0.1

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,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.0.1]
4
+ ### Added
5
+ - Added `skip_hostname_verification` option for `RPCAgent`
6
+ ### Fixed
7
+ - Fixed an issue where wallet WebSocket message from daemon was not captured.
8
+ Thank you! @joshpainter
9
+
10
+ ## [3.0.0]
11
+ ### Minor Breaking Change
12
+ - Service name of plotter was changed:
13
+ `chia plots create` => `chia_plotter`.
14
+ If you have a code which starts plotting via daemon websocket API, you might write like this:
15
+ ```typescript
16
+ const {getDaemon} = require("chia-agent");
17
+ const {start_plotting} = require("chia-agent/api/ws");
18
+ const daemon = getDaemon(); // This is the websocket connection handler
19
+ await daemon.connect(); // connect to local daemon using config file.
20
+ const response = await start_plotting(daemon, {service: "chia plots create", ...});
21
+ ```
22
+ On and after chia-blockchain@1.2.11, you must rewrite the last line of the above code like this:
23
+ ```typescript
24
+ const response = await start_plotting(daemon, {service: "chia_plotter", ...});
25
+ ```
26
+ Please note you need to also update other code lines which refers to old service name(`chia plots create`).
27
+ ### Changed
28
+ - Updated [`start_plotting`](./src/api/ws/daemon/README.md#start_plottingdaemon-params) of Daemon Websocket API
29
+ - Updated [`create_new_wallet`](./src/api/rpc/wallet/README.md#create_new_walletagent-params) of Wallet RPC API
30
+ - Updated [`get_trade`](./src/api/rpc/wallet/README.md#get_tradeagent-params) of Wallet RPC API
31
+ - Updated [`pw_join_pool`](./src/api/rpc/wallet/README.md#pw_join_poolagent-params) of Wallet RPC API
32
+ - Updated [`pw_self_pool`](./src/api/rpc/wallet/README.md#pw_self_poolagent-params) of Wallet RPC API
33
+ - Updated [`pw_absorb_rewards`](./src/api/rpc/wallet/README.md#pw_absorb_rewardsagent-params) of Wallet RPC API
34
+ - Updated [`pw_status`](./src/api/rpc/wallet/README.md#pw_statusagent-params) of Wallet RPC API
35
+ ### Added
36
+ - [New daemon api](./src/api/ws/daemon)
37
+ - [`get_plotters`](./src/api/ws/daemon/README.md#get_plottersdaemon)
38
+
3
39
  ## [2.0.6]
4
40
  ### Changed
5
41
  - Updated [`keyring_status`](./src/api/ws/daemon/README.md#keyring_statusdaemon) of Daemon Websocket API
@@ -174,6 +210,8 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
174
210
  Initial release.
175
211
 
176
212
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
213
+ [3.0.1]: https://github.com/Chia-Mine/chia-agent/compare/v3.0.0...v3.0.1
214
+ [3.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.6...v3.0.0
177
215
  [2.0.6]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.5...v2.0.6
178
216
  [2.0.5]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.4...v2.0.5
179
217
  [2.0.4]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.3...v2.0.4
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![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)
7
7
 
8
8
  chia rpc/websocket client library for NodeJS.
9
- Supports all RPC/Websocket API available at `chia 1.2.10`.
9
+ Supports all RPC/Websocket API available at `chia 1.2.11`.
10
10
  \(If you need previous version, search for the corresponding release [here](https://github.com/Chia-Mine/chia-agent/releases)\)
11
11
 
12
12
  you can develop your own nodejs script with `chia-agent` to:
@@ -26,8 +26,8 @@ yarn add chia-agent
26
26
 
27
27
  ## Compatibility
28
28
  This code is compatible with:
29
- - [`00382222d96fdafe429f6aa77682d91e3beffc3b`](https://github.com/Chia-Network/chia-blockchain/tree/00382222d96fdafe429f6aa77682d91e3beffc3b) of [chia-blockchain@1.2.10](https://github.com/Chia-Network/chia-blockchain)
30
- - [Diff to the latest chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/00382222d96fdafe429f6aa77682d91e3beffc3b...main)
29
+ - [`b74a3f3849cadeece2fac3efa3cb55d7d3a0647f`](https://github.com/Chia-Network/chia-blockchain/tree/b74a3f3849cadeece2fac3efa3cb55d7d3a0647f) of [chia-blockchain@1.2.11](https://github.com/Chia-Network/chia-blockchain)
30
+ - [Diff to the latest chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/b74a3f3849cadeece2fac3efa3cb55d7d3a0647f...main)
31
31
  - [`d6d1d0ea41b81e1c6b23688206c6ab3ba6418a95`](https://github.com/Chia-Network/pool-reference/tree/d6d1d0ea41b81e1c6b23688206c6ab3ba6418a95) of [pool-reference](https://github.com/Chia-Network/pool-reference)
32
32
  - [Diff to the latest pool-reference](https://github.com/Chia-Network/pool-reference/compare/d6d1d0ea41b81e1c6b23688206c6ab3ba6418a95...main)
33
33
 
@@ -0,0 +1,9 @@
1
+ import { bool, str } from "../types/_python_types_";
2
+ export declare const display_name = "BladeBit Plotter";
3
+ export declare type bladebit_install_info = {
4
+ display_name: typeof display_name;
5
+ version?: str;
6
+ installed: bool;
7
+ can_install?: bool;
8
+ bladebit_memory_warning?: str;
9
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.display_name = void 0;
4
+ exports.display_name = "BladeBit Plotter";
@@ -0,0 +1,7 @@
1
+ import { bool, str } from "../types/_python_types_";
2
+ export declare const display_name = "Chia Proof of Space";
3
+ export declare type chiapos_install_info = {
4
+ display_name: typeof display_name;
5
+ version: str;
6
+ installed: bool;
7
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.display_name = void 0;
4
+ exports.display_name = "Chia Proof of Space";
@@ -0,0 +1,8 @@
1
+ import { bool, str } from "../types/_python_types_";
2
+ export declare const display_name = "madMAx Plotter";
3
+ export declare type madmax_install_info = {
4
+ display_name: typeof display_name;
5
+ version?: str;
6
+ installed: bool;
7
+ can_install?: bool;
8
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.display_name = void 0;
4
+ exports.display_name = "madMAx Plotter";
@@ -259,6 +259,7 @@ export declare type TCreate_New_Pool_WalletRequest = {
259
259
  mode: "recovery";
260
260
  };
261
261
  export declare type TCreate_New_Pool_WalletResponse = {
262
+ total_fee: uint64;
262
263
  transaction: TransactionRecord;
263
264
  launcher_id: str;
264
265
  p2_singleton_puzzle_hash: str;
@@ -467,7 +468,7 @@ export declare function respond_to_offer(agent: TRPCAgent, data: TResponseToOffe
467
468
  export declare const get_trade_command = "get_trade";
468
469
  export declare type get_trade_command = typeof get_trade_command;
469
470
  export declare type TGetTradeRequest = {
470
- trade_id: bytes;
471
+ trade_id: str;
471
472
  };
472
473
  export declare type TGetTradeResponse = {
473
474
  trade: TradeRecordInJson;
@@ -637,33 +638,46 @@ export declare function add_rate_limited_funds(agent: TRPCAgent, data: TAddRateL
637
638
  export declare const pw_join_pool_command = "pw_join_pool";
638
639
  export declare type pw_join_pool_command = typeof pw_join_pool_command;
639
640
  export declare type TPwJoinPoolRequest = {
641
+ fee?: uint64;
640
642
  wallet_id: uint32;
641
643
  target_puzzlehash?: string;
642
644
  pool_url?: str;
643
645
  relative_lock_height: uint32;
644
646
  };
645
647
  export declare type TPwJoinPoolResponse = {
648
+ total_fee: uint64;
646
649
  transaction: TransactionRecord;
650
+ } | {
651
+ success: False;
652
+ error: "not_initialized";
647
653
  };
648
654
  export declare function pw_join_pool(agent: TRPCAgent, data: TPwJoinPoolRequest): Promise<TPwJoinPoolResponse>;
649
655
  export declare const pw_self_pool_command = "pw_self_pool";
650
656
  export declare type pw_self_pool_command = typeof pw_self_pool_command;
651
657
  export declare type TPwSelfPoolRequest = {
652
658
  wallet_id: uint32;
659
+ fee?: uint64;
653
660
  };
654
661
  export declare type TPwSelfPoolResponse = {
662
+ total_fee: uint64;
655
663
  transaction: TransactionRecord;
664
+ } | {
665
+ success: False;
666
+ error: "not_initialized";
656
667
  };
657
668
  export declare function pw_self_pool(agent: TRPCAgent, data: TPwSelfPoolRequest): Promise<TPwSelfPoolResponse>;
658
669
  export declare const pw_absorb_rewards_command = "pw_absorb_rewards";
659
670
  export declare type pw_absorb_rewards_command = typeof pw_absorb_rewards_command;
660
671
  export declare type TPwAbsorbRewardsRequest = {
661
672
  wallet_id: uint32;
662
- fee: uint64;
673
+ fee?: uint64;
663
674
  };
664
675
  export declare type TPwAbsorbRewardsResponse = {
665
676
  state: PoolWalletInfo;
666
677
  transaction: TransactionRecord;
678
+ } | {
679
+ success: False;
680
+ error: "not_initialized";
667
681
  };
668
682
  export declare function pw_absorb_rewards(agent: TRPCAgent, data: TPwAbsorbRewardsRequest): Promise<TPwAbsorbRewardsResponse>;
669
683
  export declare const pw_status_command = "pw_status";
@@ -674,5 +688,8 @@ export declare type TPwStatusRequest = {
674
688
  export declare type TPwStatusResponse = {
675
689
  state: PoolWalletInfo;
676
690
  unconfirmed_transactions: TransactionRecord[];
691
+ } | {
692
+ success: False;
693
+ error: "not_initialized";
677
694
  };
678
695
  export declare function pw_status(agent: TRPCAgent, data: TPwStatusRequest): Promise<TPwStatusResponse>;
@@ -1,15 +1,15 @@
1
1
  import { TPlotQueue } from "../daemon/index";
2
2
  import { TDaemon } from "../../../daemon/index";
3
3
  import { GetMessageType } from "../../types";
4
- export declare const chia_plots_create_service = "chia plots create";
5
- export declare type chia_plots_create_service = typeof chia_plots_create_service;
4
+ export declare const chia_plotter_service = "chia_plotter";
5
+ export declare type chia_plotter_service = typeof chia_plotter_service;
6
6
  export declare const state_changed_command_of_plots = "state_changed";
7
7
  export declare type state_changed_command_of_plots = typeof state_changed_command_of_plots;
8
8
  export declare type TStateChangedBroadCastOfPlots = {
9
9
  state: "log_changed" | "state_changed";
10
10
  queue: TPlotQueue[];
11
11
  };
12
- export declare function on_state_changed_of_plots(daemon: TDaemon, callback: (e: GetMessageType<chia_plots_create_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots>) => unknown): Promise<() => void>;
12
+ export declare function on_state_changed_of_plots(daemon: TDaemon, callback: (e: GetMessageType<chia_plotter_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots>) => unknown): Promise<() => void>;
13
13
  export declare type chia_plots_create_commands = state_changed_command_of_plots;
14
14
  export declare type TChiaPlotsCreateBroadcast = TStateChangedBroadCastOfPlots;
15
- export declare function on_message_from_chia_plots_create(daemon: TDaemon, callback: (e: GetMessageType<chia_plots_create_service, chia_plots_create_commands, TChiaPlotsCreateBroadcast>) => unknown): Promise<() => void>;
15
+ export declare function on_message_from_chia_plots_create(daemon: TDaemon, callback: (e: GetMessageType<chia_plotter_service, chia_plots_create_commands, TChiaPlotsCreateBroadcast>) => unknown): Promise<() => void>;
@@ -9,30 +9,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.on_message_from_chia_plots_create = exports.on_state_changed_of_plots = exports.state_changed_command_of_plots = exports.chia_plots_create_service = void 0;
13
- exports.chia_plots_create_service = "chia plots create";
12
+ exports.on_message_from_chia_plots_create = exports.on_state_changed_of_plots = exports.state_changed_command_of_plots = exports.chia_plotter_service = void 0;
13
+ exports.chia_plotter_service = "chia_plotter";
14
14
  exports.state_changed_command_of_plots = "state_changed";
15
15
  function on_state_changed_of_plots(daemon, callback) {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
- yield daemon.subscribe(exports.chia_plots_create_service);
17
+ yield daemon.subscribe(exports.chia_plotter_service);
18
18
  const messageListener = (e) => {
19
- if (e.origin === exports.chia_plots_create_service && e.command === exports.state_changed_command_of_plots) {
19
+ if (e.origin === exports.chia_plotter_service && e.command === exports.state_changed_command_of_plots) {
20
20
  callback(e);
21
21
  }
22
22
  };
23
- return daemon.addMessageListener(exports.chia_plots_create_service, messageListener);
23
+ return daemon.addMessageListener(exports.chia_plotter_service, messageListener);
24
24
  });
25
25
  }
26
26
  exports.on_state_changed_of_plots = on_state_changed_of_plots;
27
27
  function on_message_from_chia_plots_create(daemon, callback) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
- yield daemon.subscribe(exports.chia_plots_create_service);
29
+ yield daemon.subscribe(exports.chia_plotter_service);
30
30
  const messageListener = (e) => {
31
- if (e.origin === exports.chia_plots_create_service) {
31
+ if (e.origin === exports.chia_plotter_service) {
32
32
  callback(e);
33
33
  }
34
34
  };
35
- return daemon.addMessageListener(exports.chia_plots_create_service, messageListener);
35
+ return daemon.addMessageListener(exports.chia_plotter_service, messageListener);
36
36
  });
37
37
  }
38
38
  exports.on_message_from_chia_plots_create = on_message_from_chia_plots_create;
@@ -1,6 +1,9 @@
1
1
  import { GetMessageType } from "../../types";
2
2
  import { TDaemon } from "../../../daemon/index";
3
3
  import { bool, int, None, Optional, str, True } from "../../chia/types/_python_types_";
4
+ import { chiapos_install_info } from "../../chia/plotters/chiapos";
5
+ import { bladebit_install_info } from "../../chia/plotters/bladebit";
6
+ import { madmax_install_info } from "../../chia/plotters/maxmax";
4
7
  export declare const daemon_service = "daemon";
5
8
  export declare type daemon_service = typeof daemon_service;
6
9
  export declare const ping_command = "ping";
@@ -26,27 +29,45 @@ export declare type TStartServiceResponse = {
26
29
  export declare function start_service(daemon: TDaemon, data: TStartServiceRequest): Promise<GetMessageType<"daemon", "start_service", TStartServiceResponse>>;
27
30
  export declare const start_plotting_command = "start_plotting";
28
31
  export declare type start_plotting_command = typeof start_plotting_command;
29
- export declare type TStartPlottingRequest = {
30
- service: "chia plots create";
32
+ export declare type TCommonPlottingParams = {
33
+ service: "chia_plotter";
31
34
  delay?: int;
32
35
  parallel?: bool;
33
36
  k: int;
34
- n?: int;
35
- queue?: str;
36
37
  t: str;
37
- t2: str;
38
38
  d: str;
39
- b: int;
40
- u: int;
39
+ x?: bool;
40
+ n?: int;
41
+ queue?: str;
41
42
  r: int;
42
- a?: int;
43
43
  f?: str;
44
44
  p?: str;
45
45
  c?: str;
46
+ };
47
+ export declare type TChiaPosParams = {
48
+ plotter: "chiapos";
49
+ t2: str;
50
+ b: int;
51
+ u: int;
52
+ a?: int;
46
53
  e: bool;
47
- x: bool;
48
54
  overrideK: bool;
49
55
  };
56
+ export declare type TBladeBitParams = {
57
+ plotter: "bladebit";
58
+ w?: bool;
59
+ m?: bool;
60
+ };
61
+ export declare type TMadMaxParams = {
62
+ plotter: "madmax";
63
+ t2: str;
64
+ b: int;
65
+ u: int;
66
+ v: int;
67
+ K?: int;
68
+ G?: bool;
69
+ };
70
+ export declare type TStartPlottingRequest = TCommonPlottingParams & (TChiaPosParams | TBladeBitParams | TMadMaxParams);
50
71
  export declare type TStartPlottingResponse = {
51
72
  success: bool;
52
73
  ids: str[];
@@ -318,6 +339,18 @@ export declare type TGetStatusResponse = {
318
339
  genesis_initialized: True;
319
340
  };
320
341
  export declare function get_status(daemon: TDaemon): Promise<GetMessageType<"daemon", "get_status", TGetStatusResponse>>;
342
+ export declare const get_plotters_command = "get_plotters";
343
+ export declare type get_plotters_command = typeof get_plotters_command;
344
+ export declare type TGetPlottersRequest = {};
345
+ export declare type TGetPlottersResponse = {
346
+ success: True;
347
+ plotters: {
348
+ chiapos?: chiapos_install_info;
349
+ bladebit?: bladebit_install_info;
350
+ madmax?: madmax_install_info;
351
+ };
352
+ };
353
+ export declare function get_plotters(daemon: TDaemon): Promise<GetMessageType<"daemon", "get_plotters", TGetPlottersResponse>>;
321
354
  export declare const keyring_status_changed_command = "keyring_status_changed";
322
355
  export declare type keyring_status_changed_command = typeof keyring_status_changed_command;
323
356
  export declare type TKeyringStatusChangedBroadCast = {
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.keyring_status_changed_command = exports.get_status = exports.get_status_command = exports.register_service = exports.register_service_command = exports.exit = exports.exit_command = exports.notify_keyring_migration_completed = exports.notify_keyring_migration_completed_command = exports.remove_keyring_passphrase = exports.remove_keyring_passphrase_command = exports.set_keyring_passphrase = exports.set_keyring_passphrase_command = exports.migrate_keyring = exports.migrate_keyring_command = exports.validate_keyring_passphrase = exports.validate_keyring_passphrase_command = exports.unlock_keyring = exports.unlock_keyring_command = exports.keyring_status = exports.keyring_status_command = exports.is_keyring_locked = exports.is_keyring_locked_command = exports.get_key_for_fingerprint = exports.get_key_for_fingerprint_command = exports.get_first_private_key = exports.get_first_private_key_command = exports.get_all_private_keys = exports.get_all_private_keys_command = exports.delete_key_by_fingerprint = exports.delete_key_by_fingerprint_command = exports.delete_all_keys = exports.delete_all_keys_command = exports.check_keys = exports.check_keys_command = exports.add_private_key = exports.add_private_key_command = exports.is_running = exports.is_running_command = exports.stop_service = exports.stop_service_command = exports.stop_plotting = exports.stop_plotting_command = exports.start_plotting = exports.start_plotting_command = exports.start_service = exports.start_service_command = exports.ping = exports.ping_command = exports.daemon_service = void 0;
13
- exports.on_keyring_status_changed = void 0;
12
+ exports.get_plotters_command = exports.get_status = exports.get_status_command = exports.register_service = exports.register_service_command = exports.exit = exports.exit_command = exports.notify_keyring_migration_completed = exports.notify_keyring_migration_completed_command = exports.remove_keyring_passphrase = exports.remove_keyring_passphrase_command = exports.set_keyring_passphrase = exports.set_keyring_passphrase_command = exports.migrate_keyring = exports.migrate_keyring_command = exports.validate_keyring_passphrase = exports.validate_keyring_passphrase_command = exports.unlock_keyring = exports.unlock_keyring_command = exports.keyring_status = exports.keyring_status_command = exports.is_keyring_locked = exports.is_keyring_locked_command = exports.get_key_for_fingerprint = exports.get_key_for_fingerprint_command = exports.get_first_private_key = exports.get_first_private_key_command = exports.get_all_private_keys = exports.get_all_private_keys_command = exports.delete_key_by_fingerprint = exports.delete_key_by_fingerprint_command = exports.delete_all_keys = exports.delete_all_keys_command = exports.check_keys = exports.check_keys_command = exports.add_private_key = exports.add_private_key_command = exports.is_running = exports.is_running_command = exports.stop_service = exports.stop_service_command = exports.stop_plotting = exports.stop_plotting_command = exports.start_plotting = exports.start_plotting_command = exports.start_service = exports.start_service_command = exports.ping = exports.ping_command = exports.daemon_service = void 0;
13
+ exports.on_keyring_status_changed = exports.keyring_status_changed_command = exports.get_plotters = void 0;
14
14
  // The daemon service currently does not provide state_change event as of v1.1.5.
15
15
  const types_1 = require("../../types");
16
16
  exports.daemon_service = "daemon";
@@ -182,6 +182,13 @@ function get_status(daemon) {
182
182
  });
183
183
  }
184
184
  exports.get_status = get_status;
185
+ exports.get_plotters_command = "get_plotters";
186
+ function get_plotters(daemon) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ return daemon.sendMessage(exports.daemon_service, exports.get_plotters_command);
189
+ });
190
+ }
191
+ exports.get_plotters = get_plotters;
185
192
  //// From here subscribe/listen style APIs ////
186
193
  exports.keyring_status_changed_command = "keyring_status_changed";
187
194
  function on_keyring_status_changed(daemon, callback) {
package/api/ws/index.d.ts CHANGED
@@ -7,14 +7,14 @@ import type { chia_harvester_service, get_plots_command, TGetPlotsBroadCast } fr
7
7
  export { chia_harvester_service, TChiaHarvesterBroadcast, TGetPlotsBroadCast, on_message_from_harvester, on_get_plots, } from "./harvester/index";
8
8
  import type { chia_wallet_service, state_changed_command_of_wallet, TStateChangedBroadCastOfWallet } from "./wallet/index";
9
9
  export { chia_wallet_service, TChiaWalletBroadcast, TStateChangedBroadCastOfWallet, on_message_from_wallet, on_state_changed_of_wallet, } from "./wallet/index";
10
- import type { chia_plots_create_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots } from "./chia_plots_create/index";
11
- export { chia_plots_create_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots, on_state_changed_of_plots, } from "./chia_plots_create/index";
12
- import type { daemon_service, exit_command, get_status_command, is_running_command, add_private_key_command, check_keys_command, delete_all_keys_command, delete_key_by_fingerprint_command, get_all_private_keys_command, get_first_private_key_command, get_key_for_fingerprint_command, is_keyring_locked_command, keyring_status_command, unlock_keyring_command, set_keyring_passphrase_command, remove_keyring_passphrase_command, ping_command, register_service_command, start_plotting_command, start_service_command, stop_plotting_command, stop_service_command, migrate_keyring_command, notify_keyring_migration_completed_command, keyring_status_changed_command, validate_keyring_passphrase_command, TExitResponse, TGetStatusResponse, TIsRunningResponse, TAddPrivateKeyResponse, TCheckKeysResponse, TDeleteAllKeysResponse, TDeleteKeyByFingerprintResponse, TGetAllPrivateKeysResponse, TGetFirstPrivateKeyResponse, TGetKeyForFingerprintResponse, TIsKeyringLockedResponse, TKeyringStatusResponse, TUnlockKeyringResponse, TSetKeyringPassphraseResponse, TRemoveKeyringPassphraseResponse, TPingResponse, TRegisterServiceResponse, TStartPlottingResponse, TStartServiceResponse, TStopPlottingResponse, TStopServiceResponse, TMigrateKeyringResponse, TNotifyKeyringMigrationCompletedResponse, TKeyringStatusChangedBroadCast, TValidateKeyringPassphraseResponse } from "./daemon/index";
13
- export { daemon_service, TRegisterServiceResponse, TStartPlottingResponse, TStartServiceResponse, TStopPlottingResponse, TStopServiceResponse, TExitResponse, TGetStatusResponse, TIsRunningResponse, TAddPrivateKeyResponse, TCheckKeysResponse, TDeleteAllKeysResponse, TDeleteKeyByFingerprintResponse, TGetAllPrivateKeysResponse, TGetFirstPrivateKeyResponse, TGetKeyForFingerprintResponse, TIsKeyringLockedResponse, TKeyringStatusResponse, TUnlockKeyringResponse, TMigrateKeyringResponse, TSetKeyringPassphraseResponse, TRemoveKeyringPassphraseResponse, TNotifyKeyringMigrationCompletedResponse, TPingResponse, TKeyringStatusChangedBroadCast, TValidateKeyringPassphraseResponse, TStopPlottingRequest, TRegisterServiceRequest, TPlotQueue, TPingRequest, TGetStatusRequest, TStartServiceRequest, TStartPlottingRequest, TStopServiceRequest, TIsRunningRequest, TAddPrivateKeyRequest, TCheckKeysRequest, TDeleteAllKeysRequest, TDeleteKeyByFingerprintRequest, TGetAllPrivateKeysRequest, TGetFirstPrivateKeyRequest, TGetKeyForFingerprintRequest, TUnlockKeyringRequest, TMigrateKeyringRequest, TSetKeyringPassphraseRequest, TRemoveKeyringPassphraseRequest, TNotifyKeyringMigrationCompletedRequest, TExitRequest, TValidateKeyringPassphraseRequest, get_status, ping_command, stop_service, stop_plotting, start_service, exit_command, start_plotting, register_service, ping, is_running, add_private_key, check_keys, delete_all_keys, delete_key_by_fingerprint, get_all_private_keys, get_first_private_key, get_key_for_fingerprint, is_keyring_locked, keyring_status, unlock_keyring, migrate_keyring, set_keyring_passphrase, remove_keyring_passphrase, notify_keyring_migration_completed, exit, on_keyring_status_changed, validate_keyring_passphrase, } from "./daemon/index";
10
+ import type { chia_plotter_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots } from "./chia_plots_create/index";
11
+ export { chia_plotter_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots, on_state_changed_of_plots, } from "./chia_plots_create/index";
12
+ import type { daemon_service, exit_command, get_status_command, get_plotters_command, is_running_command, add_private_key_command, check_keys_command, delete_all_keys_command, delete_key_by_fingerprint_command, get_all_private_keys_command, get_first_private_key_command, get_key_for_fingerprint_command, is_keyring_locked_command, keyring_status_command, unlock_keyring_command, set_keyring_passphrase_command, remove_keyring_passphrase_command, ping_command, register_service_command, start_plotting_command, start_service_command, stop_plotting_command, stop_service_command, migrate_keyring_command, notify_keyring_migration_completed_command, keyring_status_changed_command, validate_keyring_passphrase_command, TExitResponse, TGetStatusResponse, TGetPlottersResponse, TIsRunningResponse, TAddPrivateKeyResponse, TCheckKeysResponse, TDeleteAllKeysResponse, TDeleteKeyByFingerprintResponse, TGetAllPrivateKeysResponse, TGetFirstPrivateKeyResponse, TGetKeyForFingerprintResponse, TIsKeyringLockedResponse, TKeyringStatusResponse, TUnlockKeyringResponse, TSetKeyringPassphraseResponse, TRemoveKeyringPassphraseResponse, TPingResponse, TRegisterServiceResponse, TStartPlottingResponse, TStartServiceResponse, TStopPlottingResponse, TStopServiceResponse, TMigrateKeyringResponse, TNotifyKeyringMigrationCompletedResponse, TKeyringStatusChangedBroadCast, TValidateKeyringPassphraseResponse } from "./daemon/index";
13
+ export { daemon_service, TRegisterServiceResponse, TStartPlottingResponse, TStartServiceResponse, TStopPlottingResponse, TStopServiceResponse, TExitResponse, TGetStatusResponse, TGetPlottersResponse, TIsRunningResponse, TAddPrivateKeyResponse, TCheckKeysResponse, TDeleteAllKeysResponse, TDeleteKeyByFingerprintResponse, TGetAllPrivateKeysResponse, TGetFirstPrivateKeyResponse, TGetKeyForFingerprintResponse, TIsKeyringLockedResponse, TKeyringStatusResponse, TUnlockKeyringResponse, TMigrateKeyringResponse, TSetKeyringPassphraseResponse, TRemoveKeyringPassphraseResponse, TNotifyKeyringMigrationCompletedResponse, TPingResponse, TKeyringStatusChangedBroadCast, TValidateKeyringPassphraseResponse, TStopPlottingRequest, TRegisterServiceRequest, TPlotQueue, TPingRequest, TGetStatusRequest, TGetPlottersRequest, TStartServiceRequest, TStartPlottingRequest, TStopServiceRequest, TIsRunningRequest, TAddPrivateKeyRequest, TCheckKeysRequest, TDeleteAllKeysRequest, TDeleteKeyByFingerprintRequest, TGetAllPrivateKeysRequest, TGetFirstPrivateKeyRequest, TGetKeyForFingerprintRequest, TUnlockKeyringRequest, TMigrateKeyringRequest, TSetKeyringPassphraseRequest, TRemoveKeyringPassphraseRequest, TNotifyKeyringMigrationCompletedRequest, TExitRequest, TValidateKeyringPassphraseRequest, get_status, get_plotters, ping_command, stop_service, stop_plotting, start_service, exit_command, start_plotting, register_service, ping, is_running, add_private_key, check_keys, delete_all_keys, delete_key_by_fingerprint, get_all_private_keys, get_first_private_key, get_key_for_fingerprint, is_keyring_locked, keyring_status, unlock_keyring, migrate_keyring, set_keyring_passphrase, remove_keyring_passphrase, notify_keyring_migration_completed, exit, on_keyring_status_changed, validate_keyring_passphrase, } from "./daemon/index";
14
14
  export declare type WsFarmerMessage = GetMessageType<chia_farmer_service, new_farming_info_command, TNewFarmingInfoBroadCast> | GetMessageType<chia_farmer_service, new_signage_point_command, TNewSignagePointBroadCast> | GetMessageType<chia_farmer_service, new_plots_command, TNewPlotsBroadCast>;
15
15
  export declare type WsFullNodeMessage = GetMessageType<chia_full_node_service, get_blockchain_state_command, TGetBlockchainStateBroadCast>;
16
16
  export declare type WsHarvesterMessage = GetMessageType<chia_harvester_service, get_plots_command, TGetPlotsBroadCast>;
17
17
  export declare type WsWalletMessage = GetMessageType<chia_wallet_service, state_changed_command_of_wallet, TStateChangedBroadCastOfWallet>;
18
- export declare type WsPlotsMessage = GetMessageType<chia_plots_create_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots>;
19
- export declare type WsDaemonMessage = GetMessageType<daemon_service, exit_command, TExitResponse> | GetMessageType<daemon_service, get_status_command, TGetStatusResponse> | GetMessageType<daemon_service, is_running_command, TIsRunningResponse> | GetMessageType<daemon_service, ping_command, TPingResponse> | GetMessageType<daemon_service, register_service_command, TRegisterServiceResponse> | GetMessageType<daemon_service, start_plotting_command, TStartPlottingResponse> | GetMessageType<daemon_service, start_service_command, TStartServiceResponse> | GetMessageType<daemon_service, stop_plotting_command, TStopPlottingResponse> | GetMessageType<daemon_service, stop_service_command, TStopServiceResponse> | GetMessageType<daemon_service, add_private_key_command, TAddPrivateKeyResponse> | GetMessageType<daemon_service, check_keys_command, TCheckKeysResponse> | GetMessageType<daemon_service, delete_all_keys_command, TDeleteAllKeysResponse> | GetMessageType<daemon_service, delete_key_by_fingerprint_command, TDeleteKeyByFingerprintResponse> | GetMessageType<daemon_service, get_all_private_keys_command, TGetAllPrivateKeysResponse> | GetMessageType<daemon_service, get_first_private_key_command, TGetFirstPrivateKeyResponse> | GetMessageType<daemon_service, get_key_for_fingerprint_command, TGetKeyForFingerprintResponse> | GetMessageType<daemon_service, is_keyring_locked_command, TIsKeyringLockedResponse> | GetMessageType<daemon_service, keyring_status_command, TKeyringStatusResponse> | GetMessageType<daemon_service, unlock_keyring_command, TUnlockKeyringResponse> | GetMessageType<daemon_service, validate_keyring_passphrase_command, TValidateKeyringPassphraseResponse> | GetMessageType<daemon_service, migrate_keyring_command, TMigrateKeyringResponse> | GetMessageType<daemon_service, set_keyring_passphrase_command, TSetKeyringPassphraseResponse> | GetMessageType<daemon_service, remove_keyring_passphrase_command, TRemoveKeyringPassphraseResponse> | GetMessageType<daemon_service, notify_keyring_migration_completed_command, TNotifyKeyringMigrationCompletedResponse> | GetMessageType<daemon_service, keyring_status_changed_command, TKeyringStatusChangedBroadCast>;
18
+ export declare type WsPlotsMessage = GetMessageType<chia_plotter_service, state_changed_command_of_plots, TStateChangedBroadCastOfPlots>;
19
+ export declare type WsDaemonMessage = GetMessageType<daemon_service, exit_command, TExitResponse> | GetMessageType<daemon_service, get_status_command, TGetStatusResponse> | GetMessageType<daemon_service, get_plotters_command, TGetPlottersResponse> | GetMessageType<daemon_service, is_running_command, TIsRunningResponse> | GetMessageType<daemon_service, ping_command, TPingResponse> | GetMessageType<daemon_service, register_service_command, TRegisterServiceResponse> | GetMessageType<daemon_service, start_plotting_command, TStartPlottingResponse> | GetMessageType<daemon_service, start_service_command, TStartServiceResponse> | GetMessageType<daemon_service, stop_plotting_command, TStopPlottingResponse> | GetMessageType<daemon_service, stop_service_command, TStopServiceResponse> | GetMessageType<daemon_service, add_private_key_command, TAddPrivateKeyResponse> | GetMessageType<daemon_service, check_keys_command, TCheckKeysResponse> | GetMessageType<daemon_service, delete_all_keys_command, TDeleteAllKeysResponse> | GetMessageType<daemon_service, delete_key_by_fingerprint_command, TDeleteKeyByFingerprintResponse> | GetMessageType<daemon_service, get_all_private_keys_command, TGetAllPrivateKeysResponse> | GetMessageType<daemon_service, get_first_private_key_command, TGetFirstPrivateKeyResponse> | GetMessageType<daemon_service, get_key_for_fingerprint_command, TGetKeyForFingerprintResponse> | GetMessageType<daemon_service, is_keyring_locked_command, TIsKeyringLockedResponse> | GetMessageType<daemon_service, keyring_status_command, TKeyringStatusResponse> | GetMessageType<daemon_service, unlock_keyring_command, TUnlockKeyringResponse> | GetMessageType<daemon_service, validate_keyring_passphrase_command, TValidateKeyringPassphraseResponse> | GetMessageType<daemon_service, migrate_keyring_command, TMigrateKeyringResponse> | GetMessageType<daemon_service, set_keyring_passphrase_command, TSetKeyringPassphraseResponse> | GetMessageType<daemon_service, remove_keyring_passphrase_command, TRemoveKeyringPassphraseResponse> | GetMessageType<daemon_service, notify_keyring_migration_completed_command, TNotifyKeyringMigrationCompletedResponse> | GetMessageType<daemon_service, keyring_status_changed_command, TKeyringStatusChangedBroadCast>;
20
20
  export declare type WsMessage = WsFarmerMessage | WsFullNodeMessage | WsHarvesterMessage | WsWalletMessage | WsPlotsMessage | WsDaemonMessage;
package/api/ws/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validate_keyring_passphrase = exports.on_keyring_status_changed = exports.exit = exports.notify_keyring_migration_completed = exports.remove_keyring_passphrase = exports.set_keyring_passphrase = exports.migrate_keyring = exports.unlock_keyring = exports.keyring_status = exports.is_keyring_locked = exports.get_key_for_fingerprint = exports.get_first_private_key = exports.get_all_private_keys = exports.delete_key_by_fingerprint = exports.delete_all_keys = exports.check_keys = exports.add_private_key = exports.is_running = exports.ping = exports.register_service = exports.start_plotting = exports.exit_command = exports.start_service = exports.stop_plotting = exports.stop_service = exports.ping_command = exports.get_status = exports.daemon_service = exports.on_state_changed_of_plots = exports.state_changed_command_of_plots = exports.chia_plots_create_service = exports.on_state_changed_of_wallet = exports.on_message_from_wallet = exports.chia_wallet_service = exports.on_get_plots = exports.on_message_from_harvester = exports.chia_harvester_service = exports.on_get_blockchain_state = exports.on_message_from_full_node = exports.chia_full_node_service = exports.on_new_plots = exports.on_new_signage_point = exports.on_new_farming_info = exports.on_message_from_farmer = exports.chia_farmer_service = void 0;
3
+ exports.validate_keyring_passphrase = exports.on_keyring_status_changed = exports.exit = exports.notify_keyring_migration_completed = exports.remove_keyring_passphrase = exports.set_keyring_passphrase = exports.migrate_keyring = exports.unlock_keyring = exports.keyring_status = exports.is_keyring_locked = exports.get_key_for_fingerprint = exports.get_first_private_key = exports.get_all_private_keys = exports.delete_key_by_fingerprint = exports.delete_all_keys = exports.check_keys = exports.add_private_key = exports.is_running = exports.ping = exports.register_service = exports.start_plotting = exports.exit_command = exports.start_service = exports.stop_plotting = exports.stop_service = exports.ping_command = exports.get_plotters = exports.get_status = exports.daemon_service = exports.on_state_changed_of_plots = exports.state_changed_command_of_plots = exports.chia_plotter_service = exports.on_state_changed_of_wallet = exports.on_message_from_wallet = exports.chia_wallet_service = exports.on_get_plots = exports.on_message_from_harvester = exports.chia_harvester_service = exports.on_get_blockchain_state = exports.on_message_from_full_node = exports.chia_full_node_service = exports.on_new_plots = exports.on_new_signage_point = exports.on_new_farming_info = exports.on_message_from_farmer = exports.chia_farmer_service = void 0;
4
4
  var index_1 = require("./farmer/index");
5
5
  Object.defineProperty(exports, "chia_farmer_service", { enumerable: true, get: function () { return index_1.chia_farmer_service; } });
6
6
  Object.defineProperty(exports, "on_message_from_farmer", { enumerable: true, get: function () { return index_1.on_message_from_farmer; } });
@@ -20,12 +20,13 @@ Object.defineProperty(exports, "chia_wallet_service", { enumerable: true, get: f
20
20
  Object.defineProperty(exports, "on_message_from_wallet", { enumerable: true, get: function () { return index_4.on_message_from_wallet; } });
21
21
  Object.defineProperty(exports, "on_state_changed_of_wallet", { enumerable: true, get: function () { return index_4.on_state_changed_of_wallet; } });
22
22
  var index_5 = require("./chia_plots_create/index");
23
- Object.defineProperty(exports, "chia_plots_create_service", { enumerable: true, get: function () { return index_5.chia_plots_create_service; } });
23
+ Object.defineProperty(exports, "chia_plotter_service", { enumerable: true, get: function () { return index_5.chia_plotter_service; } });
24
24
  Object.defineProperty(exports, "state_changed_command_of_plots", { enumerable: true, get: function () { return index_5.state_changed_command_of_plots; } });
25
25
  Object.defineProperty(exports, "on_state_changed_of_plots", { enumerable: true, get: function () { return index_5.on_state_changed_of_plots; } });
26
26
  var index_6 = require("./daemon/index");
27
27
  Object.defineProperty(exports, "daemon_service", { enumerable: true, get: function () { return index_6.daemon_service; } });
28
28
  Object.defineProperty(exports, "get_status", { enumerable: true, get: function () { return index_6.get_status; } });
29
+ Object.defineProperty(exports, "get_plotters", { enumerable: true, get: function () { return index_6.get_plotters; } });
29
30
  Object.defineProperty(exports, "ping_command", { enumerable: true, get: function () { return index_6.ping_command; } });
30
31
  Object.defineProperty(exports, "stop_service", { enumerable: true, get: function () { return index_6.stop_service; } });
31
32
  Object.defineProperty(exports, "stop_plotting", { enumerable: true, get: function () { return index_6.stop_plotting; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chia-agent",
3
- "version": "2.0.6",
3
+ "version": "3.0.1",
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
@@ -15,11 +15,13 @@ export declare type TRPCAgentProps = {
15
15
  ca_cert?: string | Buffer;
16
16
  client_cert?: string | Buffer;
17
17
  client_key?: string | Buffer;
18
+ skip_hostname_verification?: boolean;
18
19
  } | {
19
20
  protocol: "https";
20
21
  host: string;
21
22
  port: number;
22
23
  configPath: string;
24
+ skip_hostname_verification?: boolean;
23
25
  } | {
24
26
  protocol: "http";
25
27
  host: string;
@@ -27,6 +29,7 @@ export declare type TRPCAgentProps = {
27
29
  } | {
28
30
  service: TDestination;
29
31
  configPath?: string;
32
+ skip_hostname_verification?: boolean;
30
33
  };
31
34
  export declare class RPCAgent {
32
35
  protected _protocol: "http" | "https";
@@ -36,6 +39,7 @@ export declare class RPCAgent {
36
39
  protected _clientCert?: string | Buffer;
37
40
  protected _clientKey?: string | Buffer;
38
41
  protected _agent: HttpsAgent | HttpAgent;
42
+ protected _skip_hostname_verification: boolean;
39
43
  constructor(props: TRPCAgentProps);
40
44
  protected _getConfig(configPath?: string): TConfig;
41
45
  protected _loadCertFilesFromConfig(config: TConfig): {
package/rpc/index.js CHANGED
@@ -58,6 +58,7 @@ class RPCAgent {
58
58
  this._caCert = "";
59
59
  this._clientCert = "";
60
60
  this._clientKey = "";
61
+ this._skip_hostname_verification = false;
61
62
  if ("protocol" in props) {
62
63
  this._protocol = props.protocol;
63
64
  this._hostname = props.host;
@@ -69,11 +70,13 @@ class RPCAgent {
69
70
  this._clientCert = certs.clientCert;
70
71
  this._clientKey = certs.clientKey;
71
72
  this._caCert = certs.caCert;
73
+ this._skip_hostname_verification = Boolean(props.skip_hostname_verification);
72
74
  }
73
75
  else {
74
76
  this._caCert = props.ca_cert;
75
77
  this._clientCert = props.client_cert;
76
78
  this._clientKey = props.client_key;
79
+ this._skip_hostname_verification = Boolean(props.skip_hostname_verification);
77
80
  }
78
81
  this._agent = new https_1.Agent({
79
82
  host: this._hostname,
@@ -99,6 +102,7 @@ class RPCAgent {
99
102
  this._clientCert = certs.clientCert;
100
103
  this._clientKey = certs.clientKey;
101
104
  this._caCert = certs.caCert;
105
+ this._skip_hostname_verification = Boolean(props.skip_hostname_verification);
102
106
  this._agent = new https_1.Agent({
103
107
  host: this._hostname,
104
108
  port: this._port,
@@ -161,6 +165,11 @@ class RPCAgent {
161
165
  "User-Agent": userAgent,
162
166
  },
163
167
  };
168
+ if (this._skip_hostname_verification) {
169
+ options.checkServerIdentity = () => {
170
+ return undefined;
171
+ };
172
+ }
164
173
  if (METHOD === "POST" || METHOD === "PUT" || METHOD === "DELETE") {
165
174
  options.headers = Object.assign(Object.assign({}, (options.headers || {})), { "Content-Type": "application/json;charset=utf-8", "Content-Length": body.length });
166
175
  }