chia-agent 14.4.0 → 14.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## [14.5.0]
4
+ ### Changed
5
+ - Added error logs
6
+ - [Wallet RPC API](./src/api/rpc/wallet)
7
+ - Added CHIP-0029 support for the following Wallet RPC APIs
8
+ - [`set_wallet_resync_on_startup`](./src/api/rpc/wallet/README.md#set_wallet_resync_on_startupagent-params)
9
+ - [`get_sync_status`](./src/api/rpc/wallet/README.md#get_sync_statusagent)
10
+ - [`get_height_info`](./src/api/rpc/wallet/README.md#get_height_infoagent)
11
+ - [`push_tx`](./src/api/rpc/wallet/README.md#push_txagent-params)
12
+ - [`push_transactions`](./src/api/rpc/wallet/README.md#push_transactionsagent-params)
13
+ - [`get_timestamp_for_height`](./src/api/rpc/wallet/README.md#get_timestamp_for_heightagent)
14
+ - [`set_auto_claim`](./src/api/rpc/wallet/README.md#set_auto_claimagent-params)
15
+ - [`get_auto_claim`](./src/api/rpc/wallet/README.md#get_auto_claimagent-params)
16
+ - [`vc_mint`](./src/api/rpc/wallet/README.md#vc_mintagent-params)
17
+ - [`vc_get`](./src/api/rpc/wallet/README.md#vc_getagent-params)
18
+ - [`vc_get_list`](./src/api/rpc/wallet/README.md#vc_get_listagent-params)
19
+ - [`vc_spend`](./src/api/rpc/wallet/README.md#vc_spendagent-params)
20
+ - [`vc_add_proofs`](./src/api/rpc/wallet/README.md#vc_add_proofsagent-params)
21
+ - [`vc_get_proofs_for_root`](./src/api/rpc/wallet/README.md#vc_get_proofs_for_rootagent-params)
22
+ - [`vc_revoke`](./src/api/rpc/wallet/README.md#vc_revokeagent-params)
23
+ - [`vc_get_list`](./src/api/rpc/wallet/README.md#vc_get_listagent-params)
24
+ - Changed the response type of `proofs`
25
+ - [`vc_add_proofs`](./src/api/rpc/wallet/README.md#vc_add_proofsagent-params)
26
+ - Changed the request type
27
+ - [`vc_get_proofs_for_root`](./src/api/rpc/wallet/README.md#vc_get_proofs_for_rootagent-params)
28
+ - Changed the response type
29
+ - [`vc_mint`](./src/api/rpc/wallet/README.md#vc_mintagent-params)
30
+ - Removed `signing_responses` from the response properties.
31
+ - [`vc_spend`](./src/api/rpc/wallet/README.md#vc_spendagent-params)
32
+ - Removed `signing_responses` from the response properties.
33
+ - [`vc_revoke`](./src/api/rpc/wallet/README.md#vc_revokeagent-params)
34
+ - Removed `signing_responses` from the response properties.
35
+ - Add the following properties to `SpendBundleConditions`
36
+ - `validated_signature`
37
+ - `execution_cost`
38
+ - `condition_cost`
39
+ ### Added
40
+ - [New Common RPC API](./src/api/rpc/common)
41
+ - [`get_log_level`](./src/api/rpc/common/README.md#get_log_levelagent)
42
+ - [`set_log_level`](./src/api/rpc/common/README.md#set_log_levelagent-params)
43
+ - [`reset_log_level`](./src/api/rpc/common/README.md#reset_log_levelagent)
44
+ ### Fixed
45
+ - [`get_timestamp_for_height`](./src/api/rpc/wallet/README.md#get_timestamp_for_heightagent)
46
+ - Fixed a missing request param
47
+ - [`vc_get`](./src/api/rpc/wallet/README.md#vc_getagent-params)
48
+ - Fixed the response type to `Optional<VCRecord>` from `VCRecord | None`.
49
+ - [`push_transactions`](./src/api/rpc/wallet/README.md#push_transactionsagent-params)
50
+ - Each element of `transactions` in the request can be `TransactionRecord`
51
+ - Fixed the type of [`TransactionEndpointResponseCHIP0029`](./src/api/chia/rpc/wallet_request_types.ts)
52
+ - Fixed a typo: `VersionBlob` -> `VersionedBlob`
53
+ - Fixed incorrect type of [`WalletCoinRecordWithMetadata`](./src/api/chia/wallet/wallet_coin_record.ts)
54
+
3
55
  ## [14.4.0]
4
56
  ### Changed
5
57
  - Updated npm dependencies
@@ -1774,6 +1826,7 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
1774
1826
  Initial release.
1775
1827
 
1776
1828
  <!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
1829
+ [14.4.1]: https://github.com/Chia-Mine/chia-agent/compare/v14.4.0...v14.4.1
1777
1830
  [14.4.0]: https://github.com/Chia-Mine/chia-agent/compare/v14.3.3...v14.4.0
1778
1831
  [14.3.3]: https://github.com/Chia-Mine/chia-agent/compare/v14.3.2...v14.3.3
1779
1832
  [14.3.2]: https://github.com/Chia-Mine/chia-agent/compare/v14.3.1...v14.3.2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  [![npm version](https://badge.fury.io/js/chia-agent.svg)](https://badge.fury.io/js/chia-agent) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
3
 
4
4
  chia rpc/websocket client library for NodeJS.
5
- Supports all RPC/Websocket API available at `2.4.4` of [`chia-blockchain`](https://github.com/Chia-Network/chia-blockchain/).
5
+ Supports all RPC/Websocket API available at `2.5.1`/`2.5.2` of [`chia-blockchain`](https://github.com/Chia-Network/chia-blockchain/).
6
6
  \(If you need previous version, search for the corresponding release [here](https://github.com/Chia-Mine/chia-agent/releases)\)
7
7
 
8
8
  you can develop your own nodejs script with `chia-agent` to:
@@ -22,12 +22,12 @@ yarn add chia-agent
22
22
 
23
23
  ## Compatibility
24
24
  This code is compatible with:
25
- - [`39739520211670d398173f87cd1e97c755274195`](https://github.com/Chia-Network/chia-blockchain/tree/39739520211670d398173f87cd1e97c755274195) of [chia-blockchain 2.4.4](https://github.com/Chia-Network/chia-blockchain)
26
- - [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/39739520211670d398173f87cd1e97c755274195...main)
27
- - [`54fffb4968364640b4f5dd18d586821e67eaa631`](https://github.com/Chia-Network/pool-reference/tree/54fffb4968364640b4f5dd18d586821e67eaa631) of [pool-reference](https://github.com/Chia-Network/pool-reference)
28
- - [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/54fffb4968364640b4f5dd18d586821e67eaa631...main)
29
- - [`c6cd98f637f07e60f68203c4c27b8cf3a559ae9b`](https://github.com/Chia-Network/chia_rs/tree/c6cd98f637f07e60f68203c4c27b8cf3a559ae9b) of [chia_rs 0.14.0](https://github.com/Chia-Network/chia_rs)
30
- - [Diff to the main branch of chia_rs](https://github.com/Chia-Network/chia_rs/compare/c6cd98f637f07e60f68203c4c27b8cf3a559ae9b...main)
25
+ - [`ddd5a0cbcb7a4ebb106ee4d27692b3118b6fdc4a`](https://github.com/Chia-Network/chia-blockchain/tree/ddd5a0cbcb7a4ebb106ee4d27692b3118b6fdc4a) of [chia-blockchain 2.5.2](https://github.com/Chia-Network/chia-blockchain)
26
+ - [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/ddd5a0cbcb7a4ebb106ee4d27692b3118b6fdc4a...main)
27
+ - [`ac72355b9220fa975bab857fe740892845017a30`](https://github.com/Chia-Network/pool-reference/tree/ac72355b9220fa975bab857fe740892845017a30) of [pool-reference](https://github.com/Chia-Network/pool-reference)
28
+ - [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/ac72355b9220fa975bab857fe740892845017a30...main)
29
+ - [`0b6571ea254fe22dfc692f9ef058b6a4e224a081`](https://github.com/Chia-Network/chia_rs/tree/0b6571ea254fe22dfc692f9ef058b6a4e224a081) of [chia_rs 0.18.0](https://github.com/Chia-Network/chia_rs)
30
+ - [Diff to the main branch of chia_rs](https://github.com/Chia-Network/chia_rs/compare/0b6571ea254fe22dfc692f9ef058b6a4e224a081...main)
31
31
 
32
32
  ## API
33
33
  There are 2 kinds of APIs in chia.
@@ -1,7 +1,5 @@
1
- import { bool, False, int, str, True } from "../types/_python_types_";
2
- import { Condition, ConditionValidTimes } from "../wallet/conditions";
3
- import { TXConfigLoader, TXEndpointForCompat } from "../wallet/util/tx_config";
4
- import { UnsignedTransaction } from "../wallet/signer_protocol";
1
+ import { int, str, True } from "../types/_python_types_";
2
+ import { Condition } from "../wallet/conditions";
5
3
  export type ExtraCondition = {
6
4
  opcode: str | int;
7
5
  args: Condition;
@@ -9,23 +7,10 @@ export type ExtraCondition = {
9
7
  export type TranslationLayerKey = "CHIP-0028";
10
8
  export type CHIP0029 = {
11
9
  "CHIP-0029": True;
12
- } | {
13
- "CHIP-0029"?: False;
14
10
  };
15
11
  export type Marshall = {
16
12
  translation?: TranslationLayerKey;
17
13
  } & CHIP0029;
18
- export type TXEndpointRequest = {
19
- wallet_type: str;
20
- extra_conditions?: ExtraCondition[];
21
- push?: bool;
22
- merge_spends?: bool;
23
- sign?: bool;
24
- translation?: TranslationLayerKey;
25
- } & CHIP0029 & TXConfigLoader & TXEndpointForCompat & Partial<ConditionValidTimes>;
26
- export type CHIP0029UnsignedTransaction<T extends TXEndpointRequest> = T extends {
27
- "CHIP-0029"?: True;
28
- } ? str[] : UnsignedTransaction[];
29
- export type TxeResp<Req extends TXEndpointRequest, Res> = Res & {
30
- unsigned_transactions: CHIP0029UnsignedTransaction<Req>;
31
- };
14
+ export type MaybeMarshall<T, Res, MarshalledRes> = T extends {
15
+ "CHIP-0029": True;
16
+ } ? MarshalledRes : Res;
@@ -3,7 +3,10 @@ import { bytes32 } from "../types/blockchain_format/sized_bytes";
3
3
  import { Notification } from "../wallet/notification_store";
4
4
  import { SignedTransaction, SigningInstructions, SigningResponse, Spend, UnsignedTransaction } from "../wallet/signer_protocol";
5
5
  import { Marshall } from "./util";
6
- import { TransactionRecord } from "../wallet/transaction_record";
6
+ import { TransactionRecord, TransactionRecordConvenience } from "../wallet/transaction_record";
7
+ import { WalletSpendBundle } from "../wallet/wallet_spend_bundle";
8
+ import { TXEndpointRequest } from "./wallet_rpc_api";
9
+ import { VCRecord } from "../wallet/vc_wallet/vc_store";
7
10
  export type GetNotifications = {
8
11
  ids?: bytes32[];
9
12
  start?: uint32;
@@ -74,14 +77,29 @@ export type TransactionEndpointResponse = {
74
77
  };
75
78
  export type TransactionEndpointResponseCHIP0029 = {
76
79
  unsigned_transactions: str[];
77
- transactions: str[];
80
+ transactions: TransactionRecord[];
81
+ };
82
+ export type PushTransactions = TransactionEndpointRequest & {
83
+ transactions: Array<TransactionRecord | TransactionRecordConvenience | str>;
84
+ push: Optional<bool>;
85
+ } & TXEndpointRequest;
86
+ export type PushTransactionsCHIP0029 = PushTransactions & Marshall;
87
+ export type PushTransactionsResponse = TransactionEndpointResponse;
88
+ export type PushTransactionsResponseCHIP0029 = TransactionEndpointResponseCHIP0029;
89
+ export type GetTimestampForHeightRequest = {
90
+ height: uint32;
91
+ };
92
+ export type GetTimestampForHeightRequestCHIP0029 = GetTimestampForHeightRequest & Marshall;
93
+ export type GetTimestampForHeightResponse = {
94
+ timestamp: uint64;
78
95
  };
79
96
  export type SplitCoins = TransactionEndpointRequest & {
80
97
  wallet_id: uint32;
81
98
  number_of_coins: uint16;
82
99
  amount_per_coin: uint64;
83
100
  target_coin_id: bytes32;
84
- } & Marshall;
101
+ } & TXEndpointRequest;
102
+ export type SplitCoinsCHIP0029 = SplitCoins & Marshall;
85
103
  export type SplitCoinsResponse = TransactionEndpointResponse;
86
104
  export type SplitCoinsResponseCHIP0029 = TransactionEndpointResponseCHIP0029;
87
105
  export type CombineCoins = TransactionEndpointRequest & {
@@ -91,9 +109,69 @@ export type CombineCoins = TransactionEndpointRequest & {
91
109
  target_coin_ids: bytes32[];
92
110
  target_coin_amount?: uint64;
93
111
  coin_num_limit: uint16;
94
- } & Marshall;
112
+ } & TXEndpointRequest;
113
+ export type CombineCoinsCHIP0029 = CombineCoins & Marshall;
95
114
  export type CombineCoinsResponse = TransactionEndpointResponse;
96
115
  export type CombineCoinsResponseCHIP0029 = TransactionEndpointResponseCHIP0029;
116
+ export type VCMint = TransactionEndpointRequest & {
117
+ did_id: str;
118
+ target_address: Optional<str>;
119
+ } & TXEndpointRequest;
120
+ export type VCMintCHIP0029 = VCMint & Marshall;
121
+ export type VcMintResponse = TransactionEndpointResponse & {
122
+ vc_record: VCRecord;
123
+ };
124
+ export type VcMintResponseCHIP0029 = TransactionEndpointResponseCHIP0029 & {
125
+ vc_record: VCRecord;
126
+ };
127
+ export type VCGet = {
128
+ vc_id: bytes32;
129
+ };
130
+ export type VCGetCHIP0029 = VCGet & Marshall;
131
+ export type VcGetResponse = {
132
+ vc_record: Optional<VCRecord>;
133
+ };
134
+ export type VcGetList = {
135
+ start: uint32;
136
+ end: uint32;
137
+ };
138
+ export type VcGetListCHIP0029 = VcGetList & Marshall;
139
+ export type VCProofsRPC = {
140
+ key_value_pairs: Array<[str, str]>;
141
+ };
142
+ export type VCProofWithHash = {
143
+ hash: bytes32;
144
+ proof: Optional<VCProofsRPC>;
145
+ };
146
+ export type VcRecordWithCoinID = VCRecord & {
147
+ coin_id: bytes32;
148
+ };
149
+ export type VcGetListResponse = {
150
+ vc_records: VcRecordWithCoinID[];
151
+ proofs: VCProofWithHash[];
152
+ };
153
+ export type VcSpend = TransactionEndpointRequest & {
154
+ vc_id: bytes32;
155
+ new_puzhash: Optional<bytes32>;
156
+ new_proof_hash: Optional<bytes32>;
157
+ provider_inner_puzhash: Optional<bytes32>;
158
+ } & TXEndpointRequest;
159
+ export type VcSpendCHIP0029 = VcSpend & Marshall;
160
+ export type VcSpendResponse = TransactionEndpointResponse;
161
+ export type VcSpendResponseCHIP0029 = TransactionEndpointResponseCHIP0029;
162
+ export type VcAddProofs = VCProofsRPC;
163
+ export type VcAddProofsCHIP0029 = VCProofsRPC & Marshall;
164
+ export type VCGetProofsForRoot = {
165
+ root: bytes32;
166
+ };
167
+ export type VCGetProofsForRootCHIP0029 = VCGetProofsForRoot & Marshall;
168
+ export type VCGetProofsForRootResponse = VCProofsRPC;
169
+ export type VcRevoke = TransactionEndpointRequest & {
170
+ vc_parent_id: bytes32;
171
+ } & TXEndpointRequest;
172
+ export type VcRevokeCHIP0029 = VcRevoke & Marshall;
173
+ export type VcRevokeResponse = TransactionEndpointResponse;
174
+ export type VcRevokeResponseCHIP0029 = TransactionEndpointResponseCHIP0029;
97
175
  export type LogIn = {
98
176
  fingerprint: uint32;
99
177
  };
@@ -143,3 +221,21 @@ export type CheckDeleteKeyResponse = {
143
221
  used_for_pool_rewards: bool;
144
222
  wallet_balance: bool;
145
223
  };
224
+ export type SetWalletResyncOnStartup = {
225
+ enable?: bool;
226
+ };
227
+ export type SetWalletResyncOnStartupCHIP0029 = SetWalletResyncOnStartup & Marshall;
228
+ export type GetSyncStatus = Marshall;
229
+ export type GetSyncStatusResponse = {
230
+ synced: bool;
231
+ syncing: bool;
232
+ genesis_initialized: bool;
233
+ };
234
+ export type GetHeightInfo = Marshall;
235
+ export type GetHeightInfoResponse = {
236
+ height: uint32;
237
+ };
238
+ export type PushTX = {
239
+ spend_bundle: WalletSpendBundle | str;
240
+ };
241
+ export type PushTXCHIP0029 = PushTX & Marshall;
@@ -0,0 +1,19 @@
1
+ import { bool, str, True } from "../types/_python_types_";
2
+ import { TXConfigLoader, TXEndpointForCompat } from "../wallet/util/tx_config";
3
+ import { ConditionValidTimes } from "../wallet/conditions";
4
+ import { UnsignedTransaction } from "../wallet/signer_protocol";
5
+ import { CHIP0029, ExtraCondition, TranslationLayerKey } from "./util";
6
+ export type TXEndpointRequest = {
7
+ wallet_type: str;
8
+ extra_conditions?: ExtraCondition[];
9
+ push?: bool;
10
+ merge_spends?: bool;
11
+ sign?: bool;
12
+ translation?: TranslationLayerKey;
13
+ } & CHIP0029 & TXConfigLoader & TXEndpointForCompat & Partial<ConditionValidTimes>;
14
+ export type CHIP0029UnsignedTransaction<T extends TXEndpointRequest> = T extends {
15
+ "CHIP-0029"?: True;
16
+ } ? str[] : UnsignedTransaction[];
17
+ export type TxeResp<Req extends TXEndpointRequest, Res> = {
18
+ unsigned_transactions: CHIP0029UnsignedTransaction<Req>;
19
+ } & Res;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import { bytes, uint16 } from "../types/_python_types_";
2
- export type VersionBlob = {
2
+ export type VersionedBlob = {
3
3
  version: uint16;
4
4
  blob: bytes;
5
5
  };
@@ -1,11 +1,13 @@
1
1
  import { bool, uint16, uint64 } from "../../../types/_python_types_";
2
2
  import { bytes32 } from "../../../types/blockchain_format/sized_bytes";
3
+ import { Marshall } from "../../../rpc/util";
3
4
  export type AutoClaimSettings = {
4
5
  enabled: bool;
5
6
  tx_fee: uint64;
6
7
  min_amount: uint64;
7
8
  batch_size: uint16;
8
9
  };
10
+ export type AutoClaimSettingsCHIP0029 = AutoClaimSettings & Marshall;
9
11
  export type ClawbackMetadata = {
10
12
  time_lock: uint64;
11
13
  sender_puzzle_hash: bytes32;
@@ -1,8 +1,9 @@
1
- import { bool, int, Optional, str, uint32 } from "../types/_python_types_";
1
+ import { bool, int, Optional, str, uint32, uint64 } from "../types/_python_types_";
2
2
  import { Coin } from "../types/blockchain_format/coin";
3
3
  import { CoinType, StreamableWalletIdentifier, WalletType } from "./util/wallet_types";
4
4
  import { ClawbackMetadata } from "./puzzles/clawback/metadata";
5
- import { VersionBlob } from "../util/streamable";
5
+ import { VersionedBlob } from "../util/streamable";
6
+ import { bytes32 } from "../types/blockchain_format/sized_bytes";
6
7
  export type WalletCoinRecord = {
7
8
  coin: Coin;
8
9
  confirmed_block_height: uint32;
@@ -12,9 +13,12 @@ export type WalletCoinRecord = {
12
13
  wallet_type: typeof WalletType[keyof typeof WalletType];
13
14
  wallet_id: int;
14
15
  coin_type: typeof CoinType[keyof typeof CoinType];
15
- metadata: Optional<VersionBlob>;
16
+ metadata: Optional<VersionedBlob>;
16
17
  };
17
- export type WalletCoinRecordWithMetadata = WalletCoinRecord & {
18
+ export type WalletCoinRecordWithMetadata = {
19
+ parent_coin_info: bytes32;
20
+ puzzle_hash: bytes32;
21
+ amount: uint64;
18
22
  id: str;
19
23
  type: typeof CoinType[keyof typeof CoinType];
20
24
  wallet_identifier: StreamableWalletIdentifier;
@@ -1,4 +1,4 @@
1
- import { bytes, Optional, uint128, uint32, uint64 } from "../../../chia/types/_python_types_";
1
+ import { bool, bytes, Optional, uint128, uint32, uint64 } from "../../../chia/types/_python_types_";
2
2
  import { bytes32 } from "../../../chia/types/blockchain_format/sized_bytes";
3
3
  import { PublicKey } from "../../chia-bls/public_key";
4
4
  export type SpendConditions = {
@@ -33,4 +33,7 @@ export type SpendBundleConditions = {
33
33
  cost: uint64;
34
34
  removal_amount: uint128;
35
35
  addition_amount: uint128;
36
+ validated_signature: bool;
37
+ execution_cost: uint64;
38
+ condition_cost: uint64;
36
39
  };
@@ -1,4 +1,4 @@
1
- import { False, str, True, uint16 } from "../../chia/types/_python_types_";
1
+ import { bool, False, str, True, uint16 } from "../../chia/types/_python_types_";
2
2
  import { TRPCAgent } from "../../../rpc/index";
3
3
  import { GetMessageType, ResType, TConnectionGeneral } from "../../types";
4
4
  import { TConnectionFullNode } from "../../ws/full_node/index";
@@ -74,5 +74,30 @@ export type THealthzResponse = {
74
74
  };
75
75
  export type WsHealthzMessage = GetMessageType<chia_common_service, healthz_command, THealthzResponse>;
76
76
  export declare function healthz<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, THealthzResponse, WsHealthzMessage>>;
77
- export type RpcCommonMessage = TGetNetworkInfoResponse | TGetConnectionsResponse | TOpenConnectionResponse | TCloseConnectionResponse | TStopNodeResponse | TGetRoutesResponse | TGetVersionResponse | THealthzResponse;
78
- export type RpcCommonMessageOnWs = WsGetNetworkInfoMessage | WsGetConnectionsMessage | WsOpenConnectionMessage | WsCloseConnectionMessage | WsStopNodeMessage | WsGetRoutesMessage | WsGetVersionMessage | WsHealthzMessage;
77
+ export declare const get_log_level_command = "get_log_level";
78
+ export type get_log_level_command = typeof get_log_level_command;
79
+ export type TGetLogLevelResponse = {
80
+ success: True;
81
+ level: str;
82
+ available_levels: str[];
83
+ };
84
+ export type WsGetLogLevelMessage = GetMessageType<chia_common_service, get_log_level_command, TGetLogLevelResponse>;
85
+ export declare function get_log_level<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, TGetLogLevelResponse, WsGetLogLevelMessage>>;
86
+ export declare const set_log_level_command = "set_log_level";
87
+ export type set_log_level_command = typeof set_log_level_command;
88
+ export type TSetLogLevelRequest = {
89
+ level: str;
90
+ };
91
+ export type TSetLogLevelResponse = TGetLogLevelResponse & {
92
+ success: bool;
93
+ errors: str[];
94
+ };
95
+ export type WsSetLogLevelMessage = GetMessageType<chia_common_service, set_log_level_command, TSetLogLevelResponse>;
96
+ export declare function set_log_level<T extends TRPCAgent | TDaemon>(agent: T, params: TSetLogLevelRequest): Promise<ResType<T, TSetLogLevelResponse, WsSetLogLevelMessage>>;
97
+ export declare const reset_log_level_command = "reset_log_level";
98
+ export type reset_log_level_command = typeof reset_log_level_command;
99
+ export type TResetLogLevelResponse = TSetLogLevelResponse;
100
+ export type WsResetLogLevelMessage = GetMessageType<chia_common_service, reset_log_level_command, TResetLogLevelResponse>;
101
+ export declare function reset_log_level<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, TSetLogLevelResponse, WsResetLogLevelMessage>>;
102
+ export type RpcCommonMessage = TGetNetworkInfoResponse | TGetConnectionsResponse | TOpenConnectionResponse | TCloseConnectionResponse | TStopNodeResponse | TGetRoutesResponse | TGetVersionResponse | THealthzResponse | TGetLogLevelResponse | TSetLogLevelResponse | TResetLogLevelResponse;
103
+ export type RpcCommonMessageOnWs = WsGetNetworkInfoMessage | WsGetConnectionsMessage | WsOpenConnectionMessage | WsCloseConnectionMessage | WsStopNodeMessage | WsGetRoutesMessage | WsGetVersionMessage | WsHealthzMessage | WsGetLogLevelMessage | WsSetLogLevelMessage | WsResetLogLevelMessage;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.healthz = exports.healthz_command = exports.get_version = exports.get_version_command = exports.get_routes = exports.get_routes_command = exports.stop_node = exports.stop_node_command = exports.close_connection = exports.close_connection_command = exports.open_connection = exports.open_connection_command = exports.get_connections = exports.get_connections_command = exports.get_network_info = exports.get_network_info_command = exports.chia_common_service = void 0;
12
+ exports.reset_log_level = exports.reset_log_level_command = exports.set_log_level = exports.set_log_level_command = exports.get_log_level = exports.get_log_level_command = exports.healthz = exports.healthz_command = exports.get_version = exports.get_version_command = exports.get_routes = exports.get_routes_command = exports.stop_node = exports.stop_node_command = exports.close_connection = exports.close_connection_command = exports.open_connection = exports.open_connection_command = exports.get_connections = exports.get_connections_command = exports.get_network_info = exports.get_network_info_command = exports.chia_common_service = void 0;
13
13
  exports.chia_common_service = "";
14
14
  exports.get_network_info_command = "get_network_info";
15
15
  function get_network_info(agent) {
@@ -67,3 +67,24 @@ function healthz(agent) {
67
67
  });
68
68
  }
69
69
  exports.healthz = healthz;
70
+ exports.get_log_level_command = "get_log_level";
71
+ function get_log_level(agent) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ return agent.sendMessage(exports.chia_common_service, exports.get_log_level_command);
74
+ });
75
+ }
76
+ exports.get_log_level = get_log_level;
77
+ exports.set_log_level_command = "set_log_level";
78
+ function set_log_level(agent, params) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ return agent.sendMessage(exports.chia_common_service, exports.set_log_level_command, params);
81
+ });
82
+ }
83
+ exports.set_log_level = set_log_level;
84
+ exports.reset_log_level_command = "reset_log_level";
85
+ function reset_log_level(agent) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ return agent.sendMessage(exports.chia_common_service, exports.reset_log_level_command);
88
+ });
89
+ }
90
+ exports.reset_log_level = reset_log_level;
@@ -11,5 +11,5 @@ export { chia_data_layer_service, TWalletLogInRequest, TWalletLogInResponse, wal
11
11
  import type { RpcCrawlerMessage } from "./crawler/index";
12
12
  export { chia_crawler_service, TGetIpsAfterTimestampRequest, TGetIpsAfterTimestampResponse, TGetPeerCountsResponse, get_ips_after_timestamp, get_peer_counts, } from "./crawler/index";
13
13
  import type { RpcCommonMessage } from "./common/index";
14
- export { chia_common_service, TGetNetworkInfoResponse, TGetConnectionsRequest, TGetConnectionsResponse, TOpenConnectionRequest, TOpenConnectionResponse, TCloseConnectionRequest, TCloseConnectionResponse, TStopNodeResponse, TGetRoutesResponse, TGetVersionResponse, THealthzResponse, get_network_info, get_connections, open_connection, close_connection, stop_node, get_routes, get_version, healthz, } from "./common/index";
14
+ export { chia_common_service, TGetNetworkInfoResponse, TGetConnectionsRequest, TGetConnectionsResponse, TOpenConnectionRequest, TOpenConnectionResponse, TCloseConnectionRequest, TCloseConnectionResponse, TStopNodeResponse, TGetRoutesResponse, TGetVersionResponse, THealthzResponse, TGetLogLevelResponse, TSetLogLevelResponse, TResetLogLevelResponse, get_network_info, get_connections, open_connection, close_connection, stop_node, get_routes, get_version, healthz, get_log_level, set_log_level, reset_log_level, } from "./common/index";
15
15
  export type RpcMessage = RpcFarmerMessage | RpcFullNodeMessage | RpcHarvesterMessage | RpcWalletMessage | RpcDataLayerMessage | RpcCrawlerMessage | RpcCommonMessage;
package/api/rpc/index.js CHANGED
@@ -4,7 +4,7 @@ exports.get_all_puzzle_hashes = exports.get_all_coins = exports.get_farming_ph =
4
4
  exports.did_create_backup_file = exports.did_create_attest = exports.did_get_wallet_name = exports.did_set_wallet_name = exports.delete_key = exports.set_wallet_resync_on_startup = exports.delete_all_keys = exports.nft_transfer_bulk = exports.nft_set_did_bulk = exports.nft_mint_bulk = exports.nft_calculate_royalties = exports.combine_coins = exports.split_coins = exports.get_transaction_memo = exports.verify_signature = exports.sign_message_by_id = exports.sign_message_by_address = exports.send_notification = exports.delete_notifications = exports.get_notifications = exports.extend_derivation_index = exports.get_current_derivation_index = exports.select_coins = exports.delete_unconfirmed_transactions = exports.create_signed_transaction = exports.create_offer_for_ids = exports.create_new_wallet = exports.check_offer_validity = exports.cat_spend = exports.cat_set_name = exports.cat_asset_id_to_name = exports.get_stray_cats = exports.cat_get_name = exports.cat_get_asset_id = exports.cancel_offers = exports.cancel_offer = exports.add_rate_limited_funds = exports.add_key = exports.chia_wallet_service = exports.update_harvester_config = exports.get_harvester_config = exports.remove_plot_directory = exports.refresh_plots = exports.get_plots = exports.get_plot_directories = exports.delete_plot = exports.add_plot_directory = exports.chia_harvester_service = exports.reorg_blocks = exports.revert_blocks = void 0;
5
5
  exports.get_next_address = exports.get_offer_summary = exports.get_offers_count = exports.get_offer = exports.get_logged_in_fingerprint = exports.get_initial_freeze_period_of_wallet = exports.get_height_info = exports.get_farmed_amount = exports.get_cat_list = exports.get_all_offers = exports.generate_mnemonic = exports.get_auto_claim = exports.set_auto_claim = exports.get_timestamp_for_height = exports.nft_add_uri = exports.nft_get_info = exports.nft_transfer_nft = exports.nft_set_nft_status = exports.nft_get_wallets_with_dids = exports.nft_get_wallet_did = exports.nft_get_by_did = exports.nft_set_nft_did = exports.nft_get_nfts = exports.nft_count_nfts = exports.nft_mint_nft = exports.dao_free_coins_from_finished_proposals = exports.dao_close_proposal = exports.dao_parse_proposal = exports.dao_vote_on_proposal = exports.dao_create_proposal = exports.dao_exit_lockup = exports.dao_get_proposal_state = exports.dao_get_proposals = exports.dao_send_to_lockup = exports.dao_get_rules = exports.dao_get_treasury_id = exports.dao_get_treasury_balance = exports.dao_add_funds_to_treasury = exports.dao_adjust_filter_level = exports.did_update_metadata = exports.did_update_recovery_ids = exports.did_spend = exports.did_recovery_spend = exports.did_get_metadata = exports.did_get_recovery_list = exports.did_get_pubkey = exports.did_get_current_coin_info = exports.did_get_information_needed_for_recovery = exports.did_get_did = exports.did_transfer_did = void 0;
6
6
  exports.wallet_log_in = exports.chia_data_layer_service = exports.execute_signing_instructions = exports.submit_transactions = exports.apply_signatures = exports.gather_signing_info = exports.crcat_approve_pending = exports.vc_revoke = exports.vc_get_proofs_for_root = exports.vc_add_proofs = exports.vc_spend = exports.vc_get_list = exports.vc_get = exports.vc_mint = exports.dl_verify_proof = exports.dl_delete_mirror = exports.dl_new_mirror = exports.dl_get_mirrors = exports.dl_owned_singletons = exports.dl_history = exports.dl_update_multiple = exports.dl_update_root = exports.dl_singletons_by_root = exports.dl_latest_singleton = exports.dl_stop_tracking = exports.dl_track_new = exports.create_new_dl = exports.take_offer = exports.get_coin_records = exports.spend_clawback_coins = exports.send_transaction_multi = exports.send_transaction = exports.send_clawback_transaction = exports.rl_set_user_info = exports.pw_status = exports.pw_absorb_rewards = exports.pw_self_pool = exports.pw_join_pool = exports.push_transactions = exports.push_tx_wallet = exports.log_in = exports.get_wallets = exports.get_wallet_balances = exports.get_wallet_balance = exports.get_transactions = exports.get_transaction = exports.get_transaction_count = exports.get_sync_status = exports.get_public_keys = exports.get_private_key = void 0;
7
- exports.healthz = exports.get_version = exports.get_routes = exports.stop_node = exports.close_connection = exports.open_connection = exports.get_connections = exports.get_network_info = exports.chia_common_service = exports.get_peer_counts = exports.get_ips_after_timestamp = exports.chia_crawler_service = exports.verify_proof = exports.get_proof = exports.clear_pending_roots = exports.check_plugins = exports.get_sync_status_dl = exports.cancel_offer_dl = exports.verify_offer = exports.take_offer_dl = exports.make_offer = exports.add_missing_files = exports.get_root_history = exports.get_kv_diff = exports.subscriptions = exports.remove_subscriptions = exports.get_mirrors = exports.delete_mirror = exports.add_mirror = exports.unsubscribe = exports.subscribe = exports.insert = exports.delete_key_dl = exports.get_roots = exports.get_local_root = exports.get_root = exports.get_ancestors = exports.get_keys_values = exports.get_keys = exports.get_value = exports.submit_all_pending_roots = exports.submit_pending_root = exports.multistore_batch_update = exports.batch_update = exports.get_owned_stores = exports.create_data_store = void 0;
7
+ exports.reset_log_level = exports.set_log_level = exports.get_log_level = exports.healthz = exports.get_version = exports.get_routes = exports.stop_node = exports.close_connection = exports.open_connection = exports.get_connections = exports.get_network_info = exports.chia_common_service = exports.get_peer_counts = exports.get_ips_after_timestamp = exports.chia_crawler_service = exports.verify_proof = exports.get_proof = exports.clear_pending_roots = exports.check_plugins = exports.get_sync_status_dl = exports.cancel_offer_dl = exports.verify_offer = exports.take_offer_dl = exports.make_offer = exports.add_missing_files = exports.get_root_history = exports.get_kv_diff = exports.subscriptions = exports.remove_subscriptions = exports.get_mirrors = exports.delete_mirror = exports.add_mirror = exports.unsubscribe = exports.subscribe = exports.insert = exports.delete_key_dl = exports.get_roots = exports.get_local_root = exports.get_root = exports.get_ancestors = exports.get_keys_values = exports.get_keys = exports.get_value = exports.submit_all_pending_roots = exports.submit_pending_root = exports.multistore_batch_update = exports.batch_update = exports.get_owned_stores = exports.create_data_store = void 0;
8
8
  var index_1 = require("./farmer/index");
9
9
  Object.defineProperty(exports, "chia_farmer_service", { enumerable: true, get: function () { return index_1.chia_farmer_service; } });
10
10
  Object.defineProperty(exports, "get_reward_targets", { enumerable: true, get: function () { return index_1.get_reward_targets; } });
@@ -258,3 +258,6 @@ Object.defineProperty(exports, "stop_node", { enumerable: true, get: function ()
258
258
  Object.defineProperty(exports, "get_routes", { enumerable: true, get: function () { return index_7.get_routes; } });
259
259
  Object.defineProperty(exports, "get_version", { enumerable: true, get: function () { return index_7.get_version; } });
260
260
  Object.defineProperty(exports, "healthz", { enumerable: true, get: function () { return index_7.healthz; } });
261
+ Object.defineProperty(exports, "get_log_level", { enumerable: true, get: function () { return index_7.get_log_level; } });
262
+ Object.defineProperty(exports, "set_log_level", { enumerable: true, get: function () { return index_7.set_log_level; } });
263
+ Object.defineProperty(exports, "reset_log_level", { enumerable: true, get: function () { return index_7.reset_log_level; } });
@@ -17,20 +17,20 @@ import { TDaemon } from "../../../daemon/index";
17
17
  import { CoinRecord } from "../../chia/types/coin_record";
18
18
  import { SigningMode } from "../../chia/types/signing_mode";
19
19
  import { Balance } from "../../chia/wallet/wallet_node";
20
- import { AutoClaimSettings } from "../../chia/wallet/puzzles/clawback/metadata";
20
+ import { AutoClaimSettings, AutoClaimSettingsCHIP0029 } from "../../chia/wallet/puzzles/clawback/metadata";
21
21
  import { GetCoinRecords } from "../../chia/wallet/wallet_coin_store";
22
22
  import { WalletCoinRecordWithMetadata } from "../../chia/wallet/wallet_coin_record";
23
- import { VCRecord } from "../../chia/wallet/vc_wallet/vc_store";
24
23
  import { TransactionTypeFilter } from "../../chia/wallet/util/quality_filter";
25
24
  import { TXConfigLoader } from "../../chia/wallet/util/tx_config";
26
25
  import { ConditionValidTimes } from "../../chia/wallet/conditions";
27
26
  import { DAOInfo, DAORules, ProposalInfo } from "../../chia/wallet/dao_wallet/dao_info";
28
27
  import { ParsedProposalSpend, ParsedProposalUpdate, ProposalState } from "../../chia/wallet/dao_wallet/dao_wallet";
29
28
  import { DLProof, VerifyProofResponse } from "../../chia/data_layer/data_layer_util";
30
- import { GetNotifications, GetNotificationsResponse, GatherSigningInfo, GatherSigningInfoCHIP0029, GatherSigningInfoResponse, GatherSigningInfoResponseCHIP0029, ApplySignatures, ApplySignaturesCHIP0029, ApplySignaturesResponse, ApplySignaturesResponseCHIP0029, SubmitTransactions, SubmitTransactionsCHIP0029, SubmitTransactionsResponse, SubmitTransactionsResponseCHIP0029, ExecuteSigningInstructionsCHIP0029, ExecuteSigningInstructionsResponseCHIP0029, ExecuteSigningInstructionsResponse, ExecuteSigningInstructions, SplitCoins, SplitCoinsResponse, SplitCoinsResponseCHIP0029, CombineCoinsResponse, CombineCoins, CombineCoinsResponseCHIP0029, LogIn, LogInResponse, GetLoggedInFingerprintResponse, GetPublicKeysResponse, GetPrivateKeyRequest, GetPrivateKeyResponse, GenerateMnemonicResponse, AddKeyRequest, AddKeyResponse, DeleteKeyRequest, CheckDeleteKeyRequest, CheckDeleteKeyResponse } from "../../chia/rpc/wallet_request_types";
31
- import { TXEndpointRequest, TxeResp } from "../../chia/rpc/util";
29
+ import { AddKeyRequest, AddKeyResponse, ApplySignatures, ApplySignaturesCHIP0029, ApplySignaturesResponse, ApplySignaturesResponseCHIP0029, CheckDeleteKeyRequest, CheckDeleteKeyResponse, CombineCoins, CombineCoinsCHIP0029, CombineCoinsResponse, CombineCoinsResponseCHIP0029, DeleteKeyRequest, ExecuteSigningInstructions, ExecuteSigningInstructionsCHIP0029, ExecuteSigningInstructionsResponse, ExecuteSigningInstructionsResponseCHIP0029, GatherSigningInfo, GatherSigningInfoCHIP0029, GatherSigningInfoResponse, GatherSigningInfoResponseCHIP0029, GenerateMnemonicResponse, GetHeightInfo, GetHeightInfoResponse, GetLoggedInFingerprintResponse, GetNotifications, GetNotificationsResponse, GetPrivateKeyRequest, GetPrivateKeyResponse, GetPublicKeysResponse, GetSyncStatus, GetSyncStatusResponse, GetTimestampForHeightRequest, GetTimestampForHeightRequestCHIP0029, GetTimestampForHeightResponse, LogIn, LogInResponse, PushTransactions, PushTransactionsCHIP0029, PushTransactionsResponse, PushTransactionsResponseCHIP0029, PushTX, PushTXCHIP0029, SetWalletResyncOnStartup, SetWalletResyncOnStartupCHIP0029, SplitCoins, SplitCoinsCHIP0029, SplitCoinsResponse, SplitCoinsResponseCHIP0029, SubmitTransactions, SubmitTransactionsCHIP0029, SubmitTransactionsResponse, SubmitTransactionsResponseCHIP0029, VcAddProofs, VcAddProofsCHIP0029, VCGet, VCGetCHIP0029, VcGetList, VcGetListCHIP0029, VcGetListResponse, VCGetProofsForRoot, VCGetProofsForRootCHIP0029, VCGetProofsForRootResponse, VcGetResponse, VCMint, VCMintCHIP0029, VcMintResponse, VcMintResponseCHIP0029, VcRevoke, VcRevokeCHIP0029, VcRevokeResponse, VcRevokeResponseCHIP0029, VcSpend, VcSpendCHIP0029, VcSpendResponse, VcSpendResponseCHIP0029 } from "../../chia/rpc/wallet_request_types";
32
30
  import { SigningResponse, UnsignedTransaction } from "../../chia/wallet/signer_protocol";
33
31
  import { WalletSpendBundle } from "../../chia/wallet/wallet_spend_bundle";
32
+ import { TXEndpointRequest, TxeResp } from "../../chia/rpc/wallet_rpc_api";
33
+ import { Marshall, MaybeMarshall } from "../../chia/rpc/util";
34
34
  export declare const chia_wallet_service = "chia_wallet";
35
35
  export type chia_wallet_service = typeof chia_wallet_service;
36
36
  export declare const log_in_command = "log_in";
@@ -85,9 +85,7 @@ export type WsDeleteAllKeysMessage = GetMessageType<chia_wallet_service, delete_
85
85
  export declare function delete_all_keys<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, TDeleteAllKeysResponse, WsDeleteAllKeysMessage>>;
86
86
  export declare const set_wallet_resync_on_startup_command = "set_wallet_resync_on_startup";
87
87
  export type set_wallet_resync_on_startup_command = typeof set_wallet_resync_on_startup_command;
88
- export type TSetWalletResyncOnStartupRequest = {
89
- enable?: bool;
90
- };
88
+ export type TSetWalletResyncOnStartupRequest = SetWalletResyncOnStartup | SetWalletResyncOnStartupCHIP0029;
91
89
  export type TSetWalletResyncOnStartupResponse = {
92
90
  success: True;
93
91
  };
@@ -95,55 +93,46 @@ export type WsSetWalletResyncOnStartupMessage = GetMessageType<chia_wallet_servi
95
93
  export declare function set_wallet_resync_on_startup<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, TSetWalletResyncOnStartupResponse, WsSetWalletResyncOnStartupMessage>>;
96
94
  export declare const get_sync_status_command = "get_sync_status";
97
95
  export type get_sync_status_command = typeof get_sync_status_command;
98
- export type TGetSyncStatusResponse = {
99
- synced: bool;
100
- syncing: bool;
101
- genesis_initialized: bool;
102
- };
103
- export type WsGetSyncStatusMessage = GetMessageType<chia_wallet_service, get_sync_status_command, TGetSyncStatusResponse>;
104
- export declare function get_sync_status<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, TGetSyncStatusResponse, WsGetSyncStatusMessage>>;
96
+ export type TGetSyncStatus = GetSyncStatus;
97
+ export type TGetSyncStatusResponse = GetSyncStatusResponse;
98
+ export type WsGetSyncStatusMessage<R> = GetMessageType<chia_wallet_service, get_sync_status_command, R>;
99
+ export declare function get_sync_status<T extends TRPCAgent | TDaemon, D extends TGetSyncStatus | undefined = undefined>(agent: T, data?: D): Promise<ResType<T, GetSyncStatusResponse, WsGetSyncStatusMessage<GetSyncStatusResponse>>>;
105
100
  export declare const get_height_info_command = "get_height_info";
106
101
  export type get_height_info_command = typeof get_height_info_command;
107
- export type TGetHeightInfoResponse = {
108
- height: uint32;
109
- };
110
- export type WsGetHeightInfoMessage = GetMessageType<chia_wallet_service, get_height_info_command, TGetHeightInfoResponse>;
111
- export declare function get_height_info<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, TGetHeightInfoResponse, WsGetHeightInfoMessage>>;
102
+ export type TGetHeightInfoRequest = GetHeightInfo;
103
+ export type TGetHeightInfoResponse = GetHeightInfoResponse;
104
+ export type WsGetHeightInfoMessage<R> = GetMessageType<chia_wallet_service, get_height_info_command, R>;
105
+ export declare function get_height_info<T extends TRPCAgent | TDaemon, D extends TGetHeightInfoRequest | undefined = undefined>(agent: T, data?: D): Promise<ResType<T, GetHeightInfoResponse, WsGetHeightInfoMessage<GetHeightInfoResponse>>>;
112
106
  export declare const push_tx_command = "push_tx";
113
107
  export type push_tx_command = typeof push_tx_command;
114
- export type TPushTxRequest = {
115
- spend_bundle: str;
116
- };
108
+ export type TPushTxRequest = PushTX | PushTXCHIP0029;
117
109
  export type TPushTxResponse = Record<string, never>;
118
110
  export type WsPushTxMessageOfWallet = GetMessageType<chia_wallet_service, push_tx_command, TPushTxResponse>;
119
111
  export declare function push_tx<T extends TRPCAgent | TDaemon>(agent: T, data: TPushTxRequest): Promise<ResType<T, TPushTxResponseOfWallet, WsPushTxMessageOfWallet>>;
120
112
  export declare const push_transactions_command = "push_transactions";
121
113
  export type push_transactions_command = typeof push_transactions_command;
122
- export type TPushTransactionsRequest = {
123
- transactions: Array<TransactionRecordConvenience | str>;
124
- fee?: uint64;
125
- } & TXEndpointRequest;
126
- export type TPushTransactionsResponse = Record<string, never>;
127
- export type WsPushTransactionsMessage = GetMessageType<chia_wallet_service, push_transactions_command, TPushTransactionsResponse>;
128
- export declare function push_transactions<T extends TRPCAgent | TDaemon>(agent: T, data: TPushTransactionsRequest): Promise<ResType<T, TPushTransactionsResponse, WsPushTransactionsMessage>>;
114
+ export type TPushTransactionsRequest = PushTransactions | PushTransactionsCHIP0029;
115
+ export type TPushTransactionsResponse = PushTransactionsResponse | PushTransactionsResponseCHIP0029;
116
+ export type WsPushTransactionsMessage<R> = GetMessageType<chia_wallet_service, push_transactions_command, R>;
117
+ export declare function push_transactions<T extends TRPCAgent | TDaemon, D extends PushTransactions | PushTransactionsCHIP0029>(agent: T, data: D): Promise<ResType<T, MaybeMarshall<D, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponse, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponseCHIP0029>, WsPushTransactionsMessage<MaybeMarshall<D, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponse, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponseCHIP0029>>>>;
129
118
  export declare const get_timestamp_for_height_command = "get_timestamp_for_height";
130
119
  export type get_timestamp_for_height_command = typeof get_timestamp_for_height_command;
131
- export type TGetTimestampForHeightResponse = {
132
- timestamp: uint64;
133
- };
134
- export type WsGetTimestampForHeightMessage = GetMessageType<chia_wallet_service, get_timestamp_for_height_command, TGetTimestampForHeightResponse>;
135
- export declare function get_timestamp_for_height<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, TGetTimestampForHeightResponse, WsGetTimestampForHeightMessage>>;
120
+ export type TGetTimestampForHeightRequest = GetTimestampForHeightRequest | GetTimestampForHeightRequestCHIP0029;
121
+ export type TGetTimestampForHeightResponse = GetTimestampForHeightResponse;
122
+ export type WsGetTimestampForHeightMessage<R> = GetMessageType<chia_wallet_service, get_timestamp_for_height_command, R>;
123
+ export declare function get_timestamp_for_height<T extends TRPCAgent | TDaemon, D extends TGetTimestampForHeightRequest>(agent: T, params: D): Promise<ResType<T, GetTimestampForHeightResponse, WsGetTimestampForHeightMessage<GetTimestampForHeightResponse>>>;
136
124
  export declare const set_auto_claim_command = "set_auto_claim";
137
125
  export type set_auto_claim_command = typeof set_auto_claim_command;
138
- export type TSetAutoClaimRequest = AutoClaimSettings;
139
- export type TSetAutoClaimResponse = AutoClaimSettings;
140
- export type WsSetAutoClaimMessage = GetMessageType<chia_wallet_service, set_auto_claim_command, TSetAutoClaimResponse>;
141
- export declare function set_auto_claim<T extends TRPCAgent | TDaemon>(agent: T, data: TSetAutoClaimRequest): Promise<ResType<T, AutoClaimSettings, WsSetAutoClaimMessage>>;
126
+ export type TSetAutoClaimRequest = AutoClaimSettings | (AutoClaimSettingsCHIP0029 & Marshall);
127
+ export type TSetAutoClaimResponse = AutoClaimSettings | AutoClaimSettingsCHIP0029;
128
+ export type WsSetAutoClaimMessage<R> = GetMessageType<chia_wallet_service, set_auto_claim_command, R>;
129
+ export declare function set_auto_claim<T extends TRPCAgent | TDaemon, D extends TSetAutoClaimRequest>(agent: T, data: D): Promise<ResType<T, MaybeMarshall<D, AutoClaimSettings, AutoClaimSettingsCHIP0029>, WsSetAutoClaimMessage<MaybeMarshall<D, AutoClaimSettings, AutoClaimSettingsCHIP0029>>>>;
142
130
  export declare const get_auto_claim_command = "get_auto_claim";
143
131
  export type get_auto_claim_command = typeof get_auto_claim_command;
144
- export type TGetAutoClaimResponse = AutoClaimSettings;
145
- export type WsGetAutoClaimMessage = GetMessageType<chia_wallet_service, get_auto_claim_command, TGetAutoClaimResponse>;
146
- export declare function get_auto_claim<T extends TRPCAgent | TDaemon>(agent: T): Promise<ResType<T, AutoClaimSettings, WsGetAutoClaimMessage>>;
132
+ export type TGetAutoClaimRequest = Marshall;
133
+ export type TGetAutoClaimResponse = AutoClaimSettings | AutoClaimSettingsCHIP0029;
134
+ export type WsGetAutoClaimMessage<R> = GetMessageType<chia_wallet_service, get_auto_claim_command, R>;
135
+ export declare function get_auto_claim<T extends TRPCAgent | TDaemon, D extends TGetAutoClaimRequest | undefined = undefined>(agent: T, params?: D): Promise<ResType<T, MaybeMarshall<D, AutoClaimSettings, AutoClaimSettingsCHIP0029>, WsGetAutoClaimMessage<MaybeMarshall<D, AutoClaimSettings, AutoClaimSettingsCHIP0029>>>>;
147
136
  export declare const get_initial_freeze_period_command_of_wallet = "get_initial_freeze_period";
148
137
  export type get_initial_freeze_period_command_of_wallet = typeof get_initial_freeze_period_command_of_wallet;
149
138
  export type TGetInitialFreezePeriodResponseOfWallet = {
@@ -607,7 +596,7 @@ export type WsGetTransactionMemoMessage = GetMessageType<chia_wallet_service, ge
607
596
  export declare function get_transaction_memo<T extends TRPCAgent | TDaemon>(agent: T, data: TGetTransactionMemoRequest): Promise<ResType<T, TGetTransactionMemoResponse, WsGetTransactionMemoMessage>>;
608
597
  export declare const split_coins_command = "split_coins";
609
598
  export type split_coins_command = typeof split_coins_command;
610
- export type TSplitCoinsRequest = SplitCoins & TXEndpointRequest;
599
+ export type TSplitCoinsRequest = SplitCoins | SplitCoinsCHIP0029;
611
600
  export type TSplitCoinsResponse = SplitCoinsResponse | SplitCoinsResponseCHIP0029;
612
601
  export type WsSplitCoinsMessage<R> = GetMessageType<chia_wallet_service, split_coins_command, R>;
613
602
  export declare function split_coins<T extends TRPCAgent | TDaemon, D extends TSplitCoinsRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, D extends {
@@ -617,7 +606,7 @@ export declare function split_coins<T extends TRPCAgent | TDaemon, D extends TSp
617
606
  } ? import("../../chia/rpc/wallet_request_types").TransactionEndpointResponse : import("../../chia/rpc/wallet_request_types").TransactionEndpointResponseCHIP0029>>>>;
618
607
  export declare const combine_coins_command = "combine_coins";
619
608
  export type combine_coins_command = typeof combine_coins_command;
620
- export type TCombineCoinsRequest = CombineCoins & TXEndpointRequest;
609
+ export type TCombineCoinsRequest = CombineCoins & CombineCoinsCHIP0029;
621
610
  export type TCombineCoinsResponse = CombineCoinsResponse | CombineCoinsResponseCHIP0029;
622
611
  export type WsCombineCoinsMessage<R> = GetMessageType<chia_wallet_service, combine_coins_command, R>;
623
612
  export declare function combine_coins<T extends TRPCAgent | TDaemon, D extends TCombineCoinsRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, D extends {
@@ -1920,97 +1909,48 @@ export type TDlVerifyProofRequest = DLProof;
1920
1909
  export type TDlVerifyProofResponse = VerifyProofResponse;
1921
1910
  export type WsDlVerifyProofMessage = GetMessageType<chia_wallet_service, dl_verify_proof_command, TDlVerifyProofResponse>;
1922
1911
  export declare function dl_verify_proof<T extends TRPCAgent | TDaemon>(agent: T, data: TDlVerifyProofRequest): Promise<ResType<T, VerifyProofResponse, WsDlVerifyProofMessage>>;
1923
- export type VCMint = {
1924
- did_id: str;
1925
- target_address: Optional<str>;
1926
- fee: uint64;
1927
- };
1928
1912
  export declare const vc_mint_command = "vc_mint";
1929
1913
  export type vc_mint_command = typeof vc_mint_command;
1930
- export type TVcMintRequest = VCMint & TXEndpointRequest;
1931
- export type TVcMintResponse = {
1932
- vc_record: VCRecord;
1933
- transactions: TransactionRecordConvenience[];
1934
- signing_responses?: str[];
1935
- };
1914
+ export type TVcMintRequest = VCMint | VCMintCHIP0029;
1915
+ export type TVcMintResponse = VcMintResponse | VcMintResponseCHIP0029;
1936
1916
  export type WsVcMintMessage<R> = GetMessageType<chia_wallet_service, vc_mint_command, R>;
1937
- export declare function vc_mint<T extends TRPCAgent | TDaemon, D extends TVcMintRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, TVcMintResponse>, WsVcMintMessage<TxeResp<D, TVcMintResponse>>>>;
1938
- export type VCGet = {
1939
- vc_id: bytes32;
1940
- };
1917
+ export declare function vc_mint<T extends TRPCAgent | TDaemon, D extends TVcMintRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, MaybeMarshall<D, VcMintResponse, VcMintResponseCHIP0029>>, WsVcMintMessage<TxeResp<D, MaybeMarshall<D, VcMintResponse, VcMintResponseCHIP0029>>>>>;
1941
1918
  export declare const vc_get_command = "vc_get";
1942
1919
  export type vc_get_command = typeof vc_get_command;
1943
- export type TVcGetRequest = VCGet;
1944
- export type TVcGetResponse = {
1945
- vc_record: VCRecord | None;
1946
- };
1920
+ export type TVcGetRequest = VCGet | VCGetCHIP0029;
1921
+ export type TVcGetResponse = VcGetResponse;
1947
1922
  export type WsVcGetMessage = GetMessageType<chia_wallet_service, vc_get_command, TVcGetResponse>;
1948
- export declare function vc_get<T extends TRPCAgent | TDaemon>(agent: T, data: TVcGetRequest): Promise<ResType<T, TVcGetResponse, WsVcGetMessage>>;
1949
- export type VcGetList = {
1950
- start: uint32;
1951
- end: uint32;
1952
- };
1923
+ export declare function vc_get<T extends TRPCAgent | TDaemon>(agent: T, data: TVcGetRequest): Promise<ResType<T, VcGetResponse, WsVcGetMessage>>;
1953
1924
  export declare const vc_get_list_command = "vc_get_list";
1954
1925
  export type vc_get_list_command = typeof vc_get_list_command;
1955
- export type TVcGetListRequest = VcGetList;
1956
- export type TVcGetListResponse = {
1957
- vc_records: Array<VCRecord & {
1958
- coin_id: str;
1959
- }>;
1960
- proofs: Record<str, Record<str, str> | None>;
1961
- };
1926
+ export type TVcGetListRequest = VcGetList | VcGetListCHIP0029;
1927
+ export type TVcGetListResponse = VcGetListResponse;
1962
1928
  export type WsVcGetListMessage = GetMessageType<chia_wallet_service, vc_get_list_command, TVcGetListResponse>;
1963
- export declare function vc_get_list<T extends TRPCAgent | TDaemon>(agent: T, data: TVcGetListRequest): Promise<ResType<T, TVcGetListResponse, WsVcGetListMessage>>;
1964
- export type VcSpend = {
1965
- vc_id: bytes32;
1966
- new_puzhash: Optional<bytes32>;
1967
- new_proof_hash: Optional<bytes32>;
1968
- provider_inner_puzhash: Optional<bytes32>;
1969
- fee: uint64;
1970
- };
1929
+ export declare function vc_get_list<T extends TRPCAgent | TDaemon>(agent: T, data: TVcGetListRequest): Promise<ResType<T, VcGetListResponse, WsVcGetListMessage>>;
1971
1930
  export declare const vc_spend_command = "vc_spend";
1972
1931
  export type vc_spend_command = typeof vc_spend_command;
1973
- export type TVcSpendRequest = VcSpend & TXEndpointRequest;
1974
- export type TVcSpendResponse = {
1975
- transactions: TransactionRecordConvenience[];
1976
- signing_responses?: str[];
1977
- };
1932
+ export type TVcSpendRequest = VcSpend | VcSpendCHIP0029;
1933
+ export type TVcSpendResponse = VcSpendResponse | VcSpendResponseCHIP0029;
1978
1934
  export type WsVcSpendMessage<R> = GetMessageType<chia_wallet_service, vc_spend_command, R>;
1979
- export declare function vc_spend<T extends TRPCAgent | TDaemon, D extends TVcSpendRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, TVcSpendResponse>, WsVcSpendMessage<TxeResp<D, TVcSpendResponse>>>>;
1935
+ export declare function vc_spend<T extends TRPCAgent | TDaemon, D extends TVcSpendRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, MaybeMarshall<D, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponse, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponseCHIP0029>>, WsVcSpendMessage<TxeResp<D, MaybeMarshall<D, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponse, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponseCHIP0029>>>>>;
1980
1936
  export declare const vc_add_proofs_command = "vc_add_proofs";
1981
1937
  export type vc_add_proofs_command = typeof vc_add_proofs_command;
1982
- export type TVcAddProofsRequest = {
1983
- proofs: {
1984
- key_value_pairs: Record<str, str>;
1985
- };
1986
- };
1938
+ export type TVcAddProofsRequest = VcAddProofs | VcAddProofsCHIP0029;
1987
1939
  export type TVcAddProofsResponse = Record<string, never>;
1988
1940
  export type WsVcAddProofsMessage = GetMessageType<chia_wallet_service, vc_add_proofs_command, TVcAddProofsResponse>;
1989
1941
  export declare function vc_add_proofs<T extends TRPCAgent | TDaemon>(agent: T, data: TVcAddProofsRequest): Promise<ResType<T, TVcAddProofsResponse, WsVcAddProofsMessage>>;
1990
- export type VCGetProofsForRoot = {
1991
- root: bytes32;
1992
- };
1993
1942
  export declare const vc_get_proofs_for_root_command = "vc_get_proofs_for_root";
1994
1943
  export type vc_get_proofs_for_root_command = typeof vc_get_proofs_for_root_command;
1995
- export type TVcGetProofsForRootRequest = VCGetProofsForRoot;
1996
- export type TVcGetProofsForRootResponse = {
1997
- proofs: Record<str, str>;
1998
- };
1944
+ export type TVcGetProofsForRootRequest = VCGetProofsForRoot | VCGetProofsForRootCHIP0029;
1945
+ export type TVcGetProofsForRootResponse = VCGetProofsForRootResponse;
1999
1946
  export type WsVcGetProofsForRootMessage = GetMessageType<chia_wallet_service, vc_get_proofs_for_root_command, TVcGetProofsForRootResponse>;
2000
- export declare function vc_get_proofs_for_root<T extends TRPCAgent | TDaemon>(agent: T, data: TVcGetProofsForRootRequest): Promise<ResType<T, TVcGetProofsForRootResponse, WsVcGetProofsForRootMessage>>;
2001
- export type VcRevoke = {
2002
- vc_parent_id: bytes32;
2003
- fee: uint64;
2004
- };
1947
+ export declare function vc_get_proofs_for_root<T extends TRPCAgent | TDaemon>(agent: T, data: TVcGetProofsForRootRequest): Promise<ResType<T, import("../../chia/rpc/wallet_request_types").VCProofsRPC, WsVcGetProofsForRootMessage>>;
2005
1948
  export declare const vc_revoke_command = "vc_revoke";
2006
1949
  export type vc_revoke_command = typeof vc_revoke_command;
2007
- export type TVcRevokeRequest = VcRevoke & TXEndpointRequest;
2008
- export type TVcRevokeResponse = {
2009
- transactions: TransactionRecordConvenience[];
2010
- signing_responses?: str[];
2011
- };
1950
+ export type TVcRevokeRequest = VcRevoke | VcRevokeCHIP0029;
1951
+ export type TVcRevokeResponse = VcRevokeResponse | VcRevokeResponseCHIP0029;
2012
1952
  export type WsVcRevokeMessage<R> = GetMessageType<chia_wallet_service, vc_revoke_command, R>;
2013
- export declare function vc_revoke<T extends TRPCAgent | TDaemon, D extends TVcRevokeRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, TVcRevokeResponse>, WsVcRevokeMessage<TxeResp<D, TVcRevokeResponse>>>>;
1953
+ export declare function vc_revoke<T extends TRPCAgent | TDaemon, D extends TVcRevokeRequest>(agent: T, data: D): Promise<ResType<T, TxeResp<D, MaybeMarshall<D, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponse, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponseCHIP0029>>, WsVcRevokeMessage<TxeResp<D, MaybeMarshall<D, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponse, import("../../chia/rpc/wallet_request_types").TransactionEndpointResponseCHIP0029>>>>>;
2014
1954
  export type CrcatApprovePending = {
2015
1955
  wallet_id: uint32;
2016
1956
  min_amount_to_claim: uint64;
@@ -89,14 +89,14 @@ function set_wallet_resync_on_startup(agent) {
89
89
  exports.set_wallet_resync_on_startup = set_wallet_resync_on_startup;
90
90
  // # Wallet node
91
91
  exports.get_sync_status_command = "get_sync_status";
92
- function get_sync_status(agent) {
92
+ function get_sync_status(agent, data) {
93
93
  return __awaiter(this, void 0, void 0, function* () {
94
94
  return agent.sendMessage(exports.chia_wallet_service, exports.get_sync_status_command);
95
95
  });
96
96
  }
97
97
  exports.get_sync_status = get_sync_status;
98
98
  exports.get_height_info_command = "get_height_info";
99
- function get_height_info(agent) {
99
+ function get_height_info(agent, data) {
100
100
  return __awaiter(this, void 0, void 0, function* () {
101
101
  return agent.sendMessage(exports.chia_wallet_service, exports.get_height_info_command);
102
102
  });
@@ -117,9 +117,9 @@ function push_transactions(agent, data) {
117
117
  }
118
118
  exports.push_transactions = push_transactions;
119
119
  exports.get_timestamp_for_height_command = "get_timestamp_for_height";
120
- function get_timestamp_for_height(agent) {
120
+ function get_timestamp_for_height(agent, params) {
121
121
  return __awaiter(this, void 0, void 0, function* () {
122
- return agent.sendMessage(exports.chia_wallet_service, exports.get_timestamp_for_height_command);
122
+ return agent.sendMessage(exports.chia_wallet_service, exports.get_timestamp_for_height_command, params);
123
123
  });
124
124
  }
125
125
  exports.get_timestamp_for_height = get_timestamp_for_height;
@@ -131,9 +131,9 @@ function set_auto_claim(agent, data) {
131
131
  }
132
132
  exports.set_auto_claim = set_auto_claim;
133
133
  exports.get_auto_claim_command = "get_auto_claim";
134
- function get_auto_claim(agent) {
134
+ function get_auto_claim(agent, params) {
135
135
  return __awaiter(this, void 0, void 0, function* () {
136
- return agent.sendMessage(exports.chia_wallet_service, exports.get_auto_claim_command);
136
+ return agent.sendMessage(exports.chia_wallet_service, exports.get_auto_claim_command, params);
137
137
  });
138
138
  }
139
139
  exports.get_auto_claim = get_auto_claim;
package/daemon/index.d.ts CHANGED
@@ -26,6 +26,7 @@ declare class Daemon {
26
26
  get connected(): boolean;
27
27
  get closing(): boolean;
28
28
  constructor(serviceName?: string);
29
+ protected onRejection(e: unknown): null;
29
30
  /**
30
31
  * Connect to local daemon via websocket.
31
32
  * @param daemonServerURL
package/daemon/index.js CHANGED
@@ -71,10 +71,31 @@ class Daemon {
71
71
  this.onClose = this.onClose.bind(this);
72
72
  this.onPing = this.onPing.bind(this);
73
73
  this.onPong = this.onPong.bind(this);
74
+ this.onRejection = this.onRejection.bind(this);
74
75
  if (serviceName) {
75
76
  this._serviceName = serviceName;
76
77
  }
77
78
  }
79
+ onRejection(e) {
80
+ if (typeof e === "string") {
81
+ (0, logger_1.getLogger)().error(`Error: ${e}`);
82
+ }
83
+ else if (e instanceof Error) {
84
+ (0, logger_1.getLogger)().error(`Error ${e.name}: ${e.message}`);
85
+ if (e.stack) {
86
+ (0, logger_1.getLogger)().error(e.stack);
87
+ }
88
+ }
89
+ else {
90
+ try {
91
+ (0, logger_1.getLogger)().error(`Error: ${JSON.stringify(e)}`);
92
+ }
93
+ catch (_) {
94
+ (0, logger_1.getLogger)().error("Unknown error");
95
+ }
96
+ }
97
+ return null;
98
+ }
78
99
  /**
79
100
  * Connect to local daemon via websocket.
80
101
  * @param daemonServerURL
@@ -96,14 +117,18 @@ class Daemon {
96
117
  return false;
97
118
  }
98
119
  (0, logger_1.getLogger)().debug(`Opening websocket connection to ${daemonServerURL}`);
99
- const result = yield (0, connection_1.open)(daemonServerURL, timeoutMs);
120
+ const result = yield (0, connection_1.open)(daemonServerURL, timeoutMs)
121
+ .catch(this.onRejection);
122
+ if (!result) {
123
+ return false;
124
+ }
100
125
  this._socket = result.ws;
101
126
  this._socket.on("error", this.onError);
102
127
  this._socket.addEventListener("message", this.onMessage);
103
128
  this._socket.on("close", this.onClose);
104
129
  this._socket.on("ping", this.onPing);
105
130
  this._socket.on("pong", this.onPong);
106
- yield this.onOpen(result.openEvent, daemonServerURL);
131
+ yield this.onOpen(result.openEvent, daemonServerURL).catch(this.onRejection);
107
132
  return true;
108
133
  });
109
134
  }
@@ -116,6 +141,7 @@ class Daemon {
116
141
  (0, logger_1.getLogger)().debug("Closing web socket connection");
117
142
  this._socket.close();
118
143
  this._closing = true;
144
+ this._connectedUrl = "";
119
145
  this._onClosePromise = resolve; // Resolved in onClose function.
120
146
  }));
121
147
  });
@@ -175,6 +201,7 @@ class Daemon {
175
201
  });
176
202
  if (error || !result) {
177
203
  (0, logger_1.getLogger)().error("Failed to register agent service to daemon");
204
+ (0, logger_1.getLogger)().error(error instanceof Error ? `${error.name}: ${error.message}` : JSON.stringify(error));
178
205
  throw new Error("Subscribe failed");
179
206
  }
180
207
  this._subscriptions.push(service);
@@ -310,7 +337,7 @@ class Daemon {
310
337
  this._subscriptions = [];
311
338
  this._closeEventListeners.forEach(l => l(event));
312
339
  this.clearAllEventListeners();
313
- (0, logger_1.getLogger)().info("Closed ws connection");
340
+ (0, logger_1.getLogger)().info(`Closed ws connection. code:${event.code} wasClean:${event.wasClean} reason:${event.reason}`);
314
341
  if (this._onClosePromise) {
315
342
  this._onClosePromise();
316
343
  this._onClosePromise = undefined;
package/index.d.ts CHANGED
@@ -2,3 +2,6 @@ export * from "./logger";
2
2
  export * from "./daemon/index";
3
3
  export * from "./rpc/index";
4
4
  export * from "./config/index";
5
+ export { VCMint } from "./api/chia/rpc/wallet_request_types";
6
+ export { VcSpend } from "./api/chia/rpc/wallet_request_types";
7
+ export { VcRevoke } from "./api/chia/rpc/wallet_request_types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chia-agent",
3
- "version": "14.4.0",
3
+ "version": "14.5.0",
4
4
  "author": "ChiaMineJP <admin@chiamine.jp>",
5
5
  "description": "chia rpc/websocket client library",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@chiamine/json-bigint": "^1.0.3",
30
- "ws": "^8.18.0",
30
+ "ws": "^8.18.1",
31
31
  "yaml": "^2.4.2"
32
32
  }
33
33
  }