chia-agent 2.0.4 → 3.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,72 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.0.1]
4
+ ### Added
5
+ - Added `skip_hostname_verification` option for `RPCAgent`
6
+
7
+ ## [3.0.0]
8
+ ### Minor Breaking Change
9
+ - Service name of plotter was changed:
10
+ `chia plots create` => `chia_plotter`.
11
+ If you have a code which starts plotting via daemon websocket API, you might write like this:
12
+ ```typescript
13
+ const {getDaemon} = require("chia-agent");
14
+ const {start_plotting} = require("chia-agent/api/ws");
15
+ const daemon = getDaemon(); // This is the websocket connection handler
16
+ await daemon.connect(); // connect to local daemon using config file.
17
+ const response = await start_plotting(daemon, {service: "chia plots create", ...});
18
+ ```
19
+ On and after chia-blockchain@1.2.11, you must rewrite the last line of the above code like this:
20
+ ```typescript
21
+ const response = await start_plotting(daemon, {service: "chia_plotter", ...});
22
+ ```
23
+ Please note you need to also update other code lines which refers to old service name(`chia plots create`).
24
+ ### Changed
25
+ - Updated [`start_plotting`](./src/api/ws/daemon/README.md#start_plottingdaemon-params) of Daemon Websocket API
26
+ - Updated [`create_new_wallet`](./src/api/rpc/wallet/README.md#create_new_walletagent-params) of Wallet RPC API
27
+ - Updated [`get_trade`](./src/api/rpc/wallet/README.md#get_tradeagent-params) of Wallet RPC API
28
+ - Updated [`pw_join_pool`](./src/api/rpc/wallet/README.md#pw_join_poolagent-params) of Wallet RPC API
29
+ - Updated [`pw_self_pool`](./src/api/rpc/wallet/README.md#pw_self_poolagent-params) of Wallet RPC API
30
+ - Updated [`pw_absorb_rewards`](./src/api/rpc/wallet/README.md#pw_absorb_rewardsagent-params) of Wallet RPC API
31
+ - Updated [`pw_status`](./src/api/rpc/wallet/README.md#pw_statusagent-params) of Wallet RPC API
32
+ ### Added
33
+ - [New daemon api](./src/api/ws/daemon)
34
+ - [`get_plotters`](./src/api/ws/daemon/README.md#get_plottersdaemon)
35
+
36
+ ## [2.0.6]
37
+ ### Changed
38
+ - Updated [`keyring_status`](./src/api/ws/daemon/README.md#keyring_statusdaemon) of Daemon Websocket API
39
+ - Updated [`migrate_keyring`](./src/api/ws/daemon/README.md#migrate_keyringdaemon-params)
40
+ - Updated [`set_keyring_passphrase`](./src/api/ws/daemon/README.md#set_keyring_passphrasedaemon-params)
41
+
42
+ ## [2.0.5]
43
+ ### Changed
44
+ - Updated [`keyring_status`](./src/api/ws/daemon/README.md#keyring_statusdaemon) of Daemon Websocket API
45
+ - Updated [`start_plotting`](./src/api/ws/daemon/README.md#start_plottingdaemon-params) of Daemon Websocket API
46
+ ### Fixed
47
+ - Added missing properties for
48
+ - [`ping`](./src/api/ws/daemon/README.md#pingdaemon)
49
+ - [`start_service`](./src/api/ws/daemon/README.md#start_servicedaemon-params)
50
+ - [`start_plotting`](./src/api/ws/daemon/README.md#start_plottingdaemon-params)
51
+ - [`stop_plotting`](./src/api/ws/daemon/README.md#stop_plottingdaemon-params)
52
+ - [`stop_service`](./src/api/ws/daemon/README.md#stop_servicedaemon-params)
53
+ - [`is_running`](./src/api/ws/daemon/README.md#is_runningdaemon-params)
54
+ - [`exit`](./src/api/ws/daemon/README.md#exitdaemon)
55
+ - [`get_status`](./src/api/ws/daemon/README.md#get_statusdaemon)
56
+ - [`stop_service`](./src/api/ws/daemon/README.md#stop_servicedaemon-params)
57
+ ### Added
58
+ - [New daemon api](./src/api/ws/daemon)
59
+ - [`validate_keyring_passphrase`](./src/api/ws/daemon/README.md#validate_keyring_passphrasedaemon-params)
60
+ - [`migrate_keyring`](./src/api/ws/daemon/README.md#migrate_keyringdaemon-params)
61
+ - [`notify_keyring_migration_completed`](./src/api/ws/daemon/README.md#notify_keyring_migration_completeddaemon-params)
62
+ - [`keyring_status_changed`](./src/api/ws/daemon/README.md#on_keyring_status_changed)
63
+ ### Deprecated
64
+ - `did_spend`
65
+ Note: `chia-blockchain` no longer responds to `/did_spend` wallet API endpoint on and after 1.2.8.
66
+ For now, I don't remove `/did_spend` from `chia-agent` but only remove from API document.
67
+
3
68
  ## [2.0.4]
4
- This release corresponds to chia-blockchain@1.2.6, which introduced no external API changes.
69
+ This release corresponds to chia-blockchain@1.2.6, which introduced no external API changes.
5
70
 
6
71
  ## [2.0.3]
7
72
  This release corresponds to chia-blockchain@1.2.5 which only updates install script.
@@ -142,6 +207,10 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
142
207
  Initial release.
143
208
 
144
209
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
210
+ [3.0.1]: https://github.com/Chia-Mine/chia-agent/compare/v3.0.0...v3.0.1
211
+ [3.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.6...v3.0.0
212
+ [2.0.6]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.5...v2.0.6
213
+ [2.0.5]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.4...v2.0.5
145
214
  [2.0.4]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.3...v2.0.4
146
215
  [2.0.3]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.2...v2.0.3
147
216
  [2.0.2]: https://github.com/Chia-Mine/chia-agent/compare/v2.0.1...v2.0.2
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.6`.
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,10 +26,10 @@ yarn add chia-agent
26
26
 
27
27
  ## Compatibility
28
28
  This code is compatible with:
29
- - [`5fc67c72c76f24a46285b127c6a4f9b4ea2b533a`](https://github.com/Chia-Network/chia-blockchain/tree/5fc67c72c76f24a46285b127c6a4f9b4ea2b533a) of [chia-blockchain@1.2.6](https://github.com/Chia-Network/chia-blockchain)
30
- - [Diff to the latest chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/5fc67c72c76f24a46285b127c6a4f9b4ea2b533a...main)
31
- - [`32907fb429fead42ce74e62ac1abf87759217c0d`](https://github.com/Chia-Network/pool-reference/tree/32907fb429fead42ce74e62ac1abf87759217c0d) of [pool-reference](https://github.com/Chia-Network/pool-reference)
32
- - [Diff to the latest pool-reference](https://github.com/Chia-Network/chia-blockchain/compare/32907fb429fead42ce74e62ac1abf87759217c0d...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
+ - [`d6d1d0ea41b81e1c6b23688206c6ab3ba6418a95`](https://github.com/Chia-Network/pool-reference/tree/d6d1d0ea41b81e1c6b23688206c6ab3ba6418a95) of [pool-reference](https://github.com/Chia-Network/pool-reference)
32
+ - [Diff to the latest pool-reference](https://github.com/Chia-Network/pool-reference/compare/d6d1d0ea41b81e1c6b23688206c6ab3ba6418a95...main)
33
33
 
34
34
  ## API
35
35
  There are 2 kinds of APIs in chia.
@@ -124,7 +124,7 @@ Once source files is build by `npm run build:prod`, files will be output to `/di
124
124
  Then the files/directories are published to npm registry.
125
125
  Please note it does not upload files in project root to npm registry, but files inside '/dist'.
126
126
 
127
- [Read details here](https://github.com/Chia-Mine/chia-agent/blob/v1.1.0/BUILD.md)
127
+ [Read details here](https://github.com/Chia-Mine/chia-agent/blob/main/BUILD.md)
128
128
 
129
129
  ## Donation
130
130
  For continuous development, please support me with donation
@@ -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>;
@@ -281,6 +281,7 @@ exports.did_update_recovery_ids = did_update_recovery_ids;
281
281
  exports.did_spend_command = "did_spend";
282
282
  function did_spend(agent, data) {
283
283
  return __awaiter(this, void 0, void 0, function* () {
284
+ console.warn("did_spend was deprecated at chia-blockchain@1.2.8.");
284
285
  return agent.sendMessage(exports.chia_wallet_service, exports.did_spend_command, data);
285
286
  });
286
287
  }
@@ -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,29 +29,48 @@ 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;
73
+ ids: str[];
52
74
  service_name: str;
53
75
  };
54
76
  export declare function start_plotting(daemon: TDaemon, data: TStartPlottingRequest): Promise<GetMessageType<"daemon", "start_plotting", TStartPlottingResponse>>;
@@ -66,7 +88,10 @@ export declare type stop_service_command = typeof stop_service_command;
66
88
  export declare type TStopServiceRequest = {
67
89
  service: str;
68
90
  };
69
- export declare type TStopServiceResponse = {};
91
+ export declare type TStopServiceResponse = {
92
+ success: bool;
93
+ service_name: str;
94
+ };
70
95
  export declare function stop_service(daemon: TDaemon, data: TStopServiceRequest): Promise<GetMessageType<"daemon", "stop_service", TStopServiceResponse>>;
71
96
  export declare const is_running_command = "is_running";
72
97
  export declare type is_running_command = typeof is_running_command;
@@ -196,8 +221,16 @@ export declare type TKeyringStatusResponse = {
196
221
  success: bool;
197
222
  is_keyring_locked: bool;
198
223
  passphrase_support_enabled: bool;
224
+ can_save_passphrase: bool;
199
225
  user_passphrase_is_set: bool;
200
226
  needs_migration: bool;
227
+ can_remove_legacy_keys: bool;
228
+ can_set_passphrase_hint: bool;
229
+ passphrase_hint: str;
230
+ passphrase_requirements: {} | {
231
+ is_optional: True;
232
+ min_length: int;
233
+ };
201
234
  };
202
235
  export declare function keyring_status(daemon: TDaemon): Promise<GetMessageType<"daemon", "keyring_status", TKeyringStatusResponse>>;
203
236
  export declare const unlock_keyring_command = "unlock_keyring";
@@ -207,18 +240,43 @@ export declare type TUnlockKeyringRequest = {
207
240
  };
208
241
  export declare type TUnlockKeyringResponse = {
209
242
  success: bool;
210
- error: string | None;
243
+ error: str | None;
211
244
  };
212
245
  export declare function unlock_keyring(daemon: TDaemon, data: TUnlockKeyringRequest): Promise<GetMessageType<"daemon", "unlock_keyring", TUnlockKeyringResponse>>;
246
+ export declare const validate_keyring_passphrase_command = "validate_keyring_passphrase";
247
+ export declare type validate_keyring_passphrase_command = typeof validate_keyring_passphrase_command;
248
+ export declare type TValidateKeyringPassphraseRequest = {
249
+ key: string;
250
+ };
251
+ export declare type TValidateKeyringPassphraseResponse = {
252
+ success: bool;
253
+ error: str | None;
254
+ };
255
+ export declare function validate_keyring_passphrase(daemon: TDaemon, data: TValidateKeyringPassphraseRequest): Promise<GetMessageType<"daemon", "validate_keyring_passphrase", TValidateKeyringPassphraseResponse>>;
256
+ export declare const migrate_keyring_command = "migrate_keyring";
257
+ export declare type migrate_keyring_command = typeof migrate_keyring_command;
258
+ export declare type TMigrateKeyringRequest = {
259
+ passphrase?: str;
260
+ passphrase_hint?: str;
261
+ save_passphrase?: bool;
262
+ cleanup_legacy_keyring?: bool;
263
+ };
264
+ export declare type TMigrateKeyringResponse = {
265
+ success: bool;
266
+ error: str | None;
267
+ };
268
+ export declare function migrate_keyring(daemon: TDaemon, data: TMigrateKeyringRequest): Promise<GetMessageType<"daemon", "migrate_keyring", TMigrateKeyringResponse>>;
213
269
  export declare const set_keyring_passphrase_command = "set_keyring_passphrase";
214
270
  export declare type set_keyring_passphrase_command = typeof set_keyring_passphrase_command;
215
271
  export declare type TSetKeyringPassphraseRequest = {
216
- current_passphrase: string;
217
- new_passphrase: string;
272
+ current_passphrase: str;
273
+ new_passphrase: str;
274
+ passphrase_hint?: str;
275
+ save_passphrase?: bool;
218
276
  };
219
277
  export declare type TSetKeyringPassphraseResponse = {
220
278
  success: bool;
221
- error: string;
279
+ error: str;
222
280
  };
223
281
  export declare function set_keyring_passphrase(daemon: TDaemon, data: TSetKeyringPassphraseRequest): Promise<GetMessageType<"daemon", "set_keyring_passphrase", TSetKeyringPassphraseResponse>>;
224
282
  export declare const remove_keyring_passphrase_command = "remove_keyring_passphrase";
@@ -228,9 +286,19 @@ export declare type TRemoveKeyringPassphraseRequest = {
228
286
  };
229
287
  export declare type TRemoveKeyringPassphraseResponse = {
230
288
  success: bool;
231
- error: string;
289
+ error: str;
232
290
  };
233
291
  export declare function remove_keyring_passphrase(daemon: TDaemon, data: TRemoveKeyringPassphraseRequest): Promise<GetMessageType<"daemon", "remove_keyring_passphrase", TRemoveKeyringPassphraseResponse>>;
292
+ export declare const notify_keyring_migration_completed_command = "notify_keyring_migration_completed";
293
+ export declare type notify_keyring_migration_completed_command = typeof notify_keyring_migration_completed_command;
294
+ export declare type TNotifyKeyringMigrationCompletedRequest = {
295
+ key: str;
296
+ };
297
+ export declare type TNotifyKeyringMigrationCompletedResponse = {
298
+ success: bool;
299
+ error: str;
300
+ };
301
+ export declare function notify_keyring_migration_completed(daemon: TDaemon, data: TNotifyKeyringMigrationCompletedRequest): Promise<GetMessageType<"daemon", "notify_keyring_migration_completed", TNotifyKeyringMigrationCompletedResponse>>;
234
302
  export declare const exit_command = "exit";
235
303
  export declare type exit_command = typeof exit_command;
236
304
  export declare type TExitRequest = {};
@@ -271,3 +339,21 @@ export declare type TGetStatusResponse = {
271
339
  genesis_initialized: True;
272
340
  };
273
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>>;
354
+ export declare const keyring_status_changed_command = "keyring_status_changed";
355
+ export declare type keyring_status_changed_command = typeof keyring_status_changed_command;
356
+ export declare type TKeyringStatusChangedBroadCast = {
357
+ keyring_status_changed: TKeyringStatusResponse;
358
+ };
359
+ export declare function on_keyring_status_changed(daemon: TDaemon, callback: (e: GetMessageType<daemon_service, keyring_status_changed_command, TKeyringStatusChangedBroadCast>) => unknown): Promise<() => void>;
@@ -9,7 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.get_status = exports.get_status_command = exports.register_service = exports.register_service_command = exports.exit = exports.exit_command = exports.remove_keyring_passphrase = exports.remove_keyring_passphrase_command = exports.set_keyring_passphrase = exports.set_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;
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
+ // The daemon service currently does not provide state_change event as of v1.1.5.
15
+ const types_1 = require("../../types");
13
16
  exports.daemon_service = "daemon";
14
17
  exports.ping_command = "ping";
15
18
  function ping(daemon) {
@@ -123,6 +126,20 @@ function unlock_keyring(daemon, data) {
123
126
  });
124
127
  }
125
128
  exports.unlock_keyring = unlock_keyring;
129
+ exports.validate_keyring_passphrase_command = "validate_keyring_passphrase";
130
+ function validate_keyring_passphrase(daemon, data) {
131
+ return __awaiter(this, void 0, void 0, function* () {
132
+ return daemon.sendMessage(exports.daemon_service, exports.validate_keyring_passphrase_command, data);
133
+ });
134
+ }
135
+ exports.validate_keyring_passphrase = validate_keyring_passphrase;
136
+ exports.migrate_keyring_command = "migrate_keyring";
137
+ function migrate_keyring(daemon, data) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ return daemon.sendMessage(exports.daemon_service, exports.migrate_keyring_command, data);
140
+ });
141
+ }
142
+ exports.migrate_keyring = migrate_keyring;
126
143
  exports.set_keyring_passphrase_command = "set_keyring_passphrase";
127
144
  function set_keyring_passphrase(daemon, data) {
128
145
  return __awaiter(this, void 0, void 0, function* () {
@@ -137,6 +154,13 @@ function remove_keyring_passphrase(daemon, data) {
137
154
  });
138
155
  }
139
156
  exports.remove_keyring_passphrase = remove_keyring_passphrase;
157
+ exports.notify_keyring_migration_completed_command = "notify_keyring_migration_completed";
158
+ function notify_keyring_migration_completed(daemon, data) {
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ return daemon.sendMessage(exports.daemon_service, exports.notify_keyring_migration_completed_command, data);
161
+ });
162
+ }
163
+ exports.notify_keyring_migration_completed = notify_keyring_migration_completed;
140
164
  exports.exit_command = "exit";
141
165
  function exit(daemon) {
142
166
  return __awaiter(this, void 0, void 0, function* () {
@@ -158,3 +182,24 @@ function get_status(daemon) {
158
182
  });
159
183
  }
160
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;
192
+ //// From here subscribe/listen style APIs ////
193
+ exports.keyring_status_changed_command = "keyring_status_changed";
194
+ function on_keyring_status_changed(daemon, callback) {
195
+ return __awaiter(this, void 0, void 0, function* () {
196
+ yield daemon.subscribe(types_1.wallet_ui_service);
197
+ const messageListener = (e) => {
198
+ if (e.origin === exports.daemon_service && e.command === exports.keyring_status_changed_command) {
199
+ callback(e);
200
+ }
201
+ };
202
+ return daemon.addMessageListener(exports.daemon_service, messageListener);
203
+ });
204
+ }
205
+ exports.on_keyring_status_changed = on_keyring_status_changed;
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, TExitResponse, TGetStatusResponse, TIsRunningResponse, TAddPrivateKeyResponse, TCheckKeysResponse, TDeleteAllKeysResponse, TDeleteKeyByFingerprintResponse, TGetAllPrivateKeysResponse, TGetFirstPrivateKeyResponse, TGetKeyForFingerprintResponse, TIsKeyringLockedResponse, TKeyringStatusResponse, TUnlockKeyringResponse, TSetKeyringPassphraseResponse, TRemoveKeyringPassphraseResponse, TPingResponse, TRegisterServiceResponse, TStartPlottingResponse, TStartServiceResponse, TStopPlottingResponse, TStopServiceResponse } 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, TSetKeyringPassphraseResponse, TRemoveKeyringPassphraseResponse, TPingResponse, TStopPlottingRequest, TRegisterServiceRequest, TPlotQueue, TPingRequest, TGetStatusRequest, TStartServiceRequest, TStartPlottingRequest, TStopServiceRequest, TIsRunningRequest, TAddPrivateKeyRequest, TCheckKeysRequest, TDeleteAllKeysRequest, TDeleteKeyByFingerprintRequest, TGetAllPrivateKeysRequest, TGetFirstPrivateKeyRequest, TGetKeyForFingerprintRequest, TUnlockKeyringRequest, TSetKeyringPassphraseRequest, TRemoveKeyringPassphraseRequest, TExitRequest, 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, set_keyring_passphrase, remove_keyring_passphrase, exit, } 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, set_keyring_passphrase_command, TSetKeyringPassphraseResponse> | GetMessageType<daemon_service, remove_keyring_passphrase_command, TRemoveKeyringPassphraseResponse>;
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.exit = exports.remove_keyring_passphrase = exports.set_keyring_passphrase = 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; } });
@@ -45,6 +46,10 @@ Object.defineProperty(exports, "get_key_for_fingerprint", { enumerable: true, ge
45
46
  Object.defineProperty(exports, "is_keyring_locked", { enumerable: true, get: function () { return index_6.is_keyring_locked; } });
46
47
  Object.defineProperty(exports, "keyring_status", { enumerable: true, get: function () { return index_6.keyring_status; } });
47
48
  Object.defineProperty(exports, "unlock_keyring", { enumerable: true, get: function () { return index_6.unlock_keyring; } });
49
+ Object.defineProperty(exports, "migrate_keyring", { enumerable: true, get: function () { return index_6.migrate_keyring; } });
48
50
  Object.defineProperty(exports, "set_keyring_passphrase", { enumerable: true, get: function () { return index_6.set_keyring_passphrase; } });
49
51
  Object.defineProperty(exports, "remove_keyring_passphrase", { enumerable: true, get: function () { return index_6.remove_keyring_passphrase; } });
52
+ Object.defineProperty(exports, "notify_keyring_migration_completed", { enumerable: true, get: function () { return index_6.notify_keyring_migration_completed; } });
50
53
  Object.defineProperty(exports, "exit", { enumerable: true, get: function () { return index_6.exit; } });
54
+ Object.defineProperty(exports, "on_keyring_status_changed", { enumerable: true, get: function () { return index_6.on_keyring_status_changed; } });
55
+ Object.defineProperty(exports, "validate_keyring_passphrase", { enumerable: true, get: function () { return index_6.validate_keyring_passphrase; } });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chia-agent",
3
- "version": "2.0.4",
4
- "author": "Admin ChiaMineJP <admin@chiamine.jp>",
3
+ "version": "3.0.1-beta.0",
4
+ "author": "ChiaMineJP <admin@chiamine.jp>",
5
5
  "description": "chia rpc/websocket client library",
6
6
  "license": "MIT",
7
7
  "repository": {
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
  }