chia-agent 17.0.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/README.md +5 -5
- package/api/chia/protocols/harvester_protocol.d.ts +9 -3
- package/api/chia/protocols/solver_protocol.d.ts +8 -2
- package/api/chia_rs/chia-protocol/partial_proof.d.ts +4 -0
- package/api/chia_rs/chia-protocol/partial_proof.js +2 -0
- package/api/chia_rs/chia-protocol/proof_of_space.d.ts +5 -1
- package/api/chia_rs/chia-protocol/reward_chain_block.d.ts +1 -0
- package/api/chia_rs/chia-protocol/sub_epoch_summary.d.ts +1 -0
- package/api/rpc/wallet/index.d.ts +39 -31
- package/package.json +1 -1
- package/rpc/index.d.ts +7 -0
- package/rpc/index.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [19.0.0]
|
|
4
|
+
Support for [`chia-blockchain@2.6.1`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.6.1)
|
|
5
|
+
|
|
6
|
+
### Breaking change
|
|
7
|
+
- `ProofOfSpace` type was updated for v2 proof-of-space (follows `chia_rs@0.38.2`)
|
|
8
|
+
- Added `version`, `plot_index`, `meta_group` and `strength` fields (between `plot_public_key` and `size`)
|
|
9
|
+
- `size` now only carries the v1 k-size (0 for v2 proofs)
|
|
10
|
+
- This affects every RPC response embedding a `ProofOfSpace` (e.g. block records)
|
|
11
|
+
- `PartialProof`: `proof_fragments` was renamed to `fragments` (now 16 entries; follows `chia_rs@0.38.2`)
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- Structured RPC errors (added in chia-blockchain 2.6.1)
|
|
15
|
+
- RPC error responses now always include `structuredError: {code, message, data}`
|
|
16
|
+
(and `traceback` on the HTTP RPC path)
|
|
17
|
+
- `RpcError` now exposes a `structuredError` property
|
|
18
|
+
- Added `TStructuredError` and `TRpcErrorCode` types
|
|
19
|
+
- `create_signed_transaction`: new optional request parameters
|
|
20
|
+
`extra_delta`, `tail_reveal`, `tail_solution` (must be specified together) and `puzzle_decorator`
|
|
21
|
+
- [Harvester Protocol](./src/api/chia/protocols/harvester_protocol.ts)
|
|
22
|
+
- `PartialProofsData`: added `plot_index` and `meta_group`
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Synchronized `chia_rs` type definitions with `chia_rs@0.38.2`
|
|
26
|
+
- `nft_mint_nft`: upstream reverted the `royalty_amount` rename back to `royalty_percentage`
|
|
27
|
+
(chia-agent already used `royalty_percentage`; no type change)
|
|
28
|
+
- `take_offer`: the `sign` request parameter is now ignored by the wallet (signing is handled internally)
|
|
29
|
+
- `did_find_lost_did`: `latest_coin_id` now echoes the requested coin id
|
|
30
|
+
|
|
31
|
+
## [18.0.0]
|
|
32
|
+
Support for [`chia-blockchain@2.6.0`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.6.0)
|
|
33
|
+
|
|
34
|
+
### Breaking change
|
|
35
|
+
- `create_new_wallet`
|
|
36
|
+
- The response `type` is now the `WalletType` name string (`"CAT"`, `"DECENTRALIZED_ID"`, `"NFT"`, `"POOLING_WALLET"`)
|
|
37
|
+
instead of the integer enum value
|
|
38
|
+
- Pool wallet `mode: "recovery"` was removed
|
|
39
|
+
- Pool wallet response now includes `type`
|
|
40
|
+
- `asset_id`, `coin_name`, `newpuzhash`, `pubkey`, `launcher_id` and `p2_singleton_puzzle_hash` in responses
|
|
41
|
+
are now `0x`-prefixed hex
|
|
42
|
+
- The `{success: false, error: "invalid request"}` success-path variant was removed
|
|
43
|
+
(invalid requests now produce a standard RPC error response)
|
|
44
|
+
- `get_offer_summary`
|
|
45
|
+
- `summary.offered` / `summary.requested` amounts are now JSON strings (were numbers)
|
|
46
|
+
- `additions` / `removals` are now `0x`-prefixed hex
|
|
47
|
+
- DataLayer offer summaries are now typed as `TDataLayerOfferSummary`
|
|
48
|
+
- `create_signed_transaction` / `send_transaction_multi`
|
|
49
|
+
- Per-announcement `morph_bytes` was removed; only the top-level `morph_bytes` is applied
|
|
50
|
+
- All transaction endpoints now require a fully synced wallet
|
|
51
|
+
(may fail with `"Wallet needs to be fully synced before making transactions."`)
|
|
52
|
+
- `split_coins` with `number_of_coins == 0` and `combine_coins` with `number_of_coins < 2` now error
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
- [Harvester Protocol](./src/api/chia/protocols/harvester_protocol.ts)
|
|
56
|
+
- `PartialProofsData`: `partial_proofs` is now `PartialProof[]`; added `strength` and `plot_id`
|
|
57
|
+
- `Plot`: added `compression_level`; for v2 plots `size` now encodes `0x80 | strength`
|
|
58
|
+
- [Solver Protocol](./src/api/chia/protocols/solver_protocol.ts)
|
|
59
|
+
- `SolverInfo` is now `{partial_proof: PartialProof, plot_id, strength, size}`
|
|
60
|
+
- `SolverResponse.partial_proof` is now `PartialProof`
|
|
61
|
+
- Added `PartialProof` type (mirrors `chia_rs`)
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
- Synchronized `chia_rs` type definitions with `chia_rs@0.35.2`
|
|
65
|
+
- `SubEpochSummary`: added `challenge_merkle_root`
|
|
66
|
+
- `RewardChainBlock`: added `header_mmr_root`
|
|
67
|
+
- `create_offer_for_ids`: `offer` dictionary values are canonically strings now (`Record<str, str | int>`)
|
|
68
|
+
- `get_transactions`: `start` / `end` widened to `uint32`
|
|
69
|
+
- `get_all_offers`: `start` / `end` are now bounded to `uint16`
|
|
70
|
+
|
|
3
71
|
## [17.0.0]
|
|
4
72
|
Support for [`chia-blockchain@2.5.7`](https://github.com/Chia-Network/chia-blockchain/releases/tag/2.5.7)
|
|
5
73
|
|
|
@@ -2002,6 +2070,8 @@ daemon.sendMessage(destination, get_block_record_by_height_command, data);
|
|
|
2002
2070
|
Initial release.
|
|
2003
2071
|
|
|
2004
2072
|
<!-- [Unreleased]: https://github.com/Chia-Mine/chia-agent/compare/v0.0.1...v0.0.2 -->
|
|
2073
|
+
[19.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v18.0.0...v19.0.0
|
|
2074
|
+
[18.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v17.0.0...v18.0.0
|
|
2005
2075
|
[17.0.0]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.6...v17.0.0
|
|
2006
2076
|
[16.1.6]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.5...v16.1.6
|
|
2007
2077
|
[16.1.5]: https://github.com/Chia-Mine/chia-agent/compare/v16.1.4...v16.1.5
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://badge.fury.io/js/chia-agent) [](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.
|
|
5
|
+
Supports all RPC/Websocket API available at `2.6.1` 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,10 +22,10 @@ yarn add chia-agent
|
|
|
22
22
|
|
|
23
23
|
## Compatibility
|
|
24
24
|
This code is compatible with:
|
|
25
|
-
- [`
|
|
26
|
-
- [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/
|
|
27
|
-
- [`
|
|
28
|
-
- [Diff to the main branch of chia_rs](https://github.com/Chia-Network/chia_rs/compare/
|
|
25
|
+
- [`204fe59bd82984ec7c70794891a669a949e3edc3`](https://github.com/Chia-Network/chia-blockchain/tree/204fe59bd82984ec7c70794891a669a949e3edc3) of [chia-blockchain 2.6.1](https://github.com/Chia-Network/chia-blockchain)
|
|
26
|
+
- [Diff to the main branch of chia-blockchain](https://github.com/Chia-Network/chia-blockchain/compare/204fe59bd82984ec7c70794891a669a949e3edc3...main)
|
|
27
|
+
- [`da47ae281f1f8801542a743263db84fff3612de1`](https://github.com/Chia-Network/chia_rs/tree/da47ae281f1f8801542a743263db84fff3612de1) of [chia_rs 0.38.2](https://github.com/Chia-Network/chia_rs)
|
|
28
|
+
- [Diff to the main branch of chia_rs](https://github.com/Chia-Network/chia_rs/compare/da47ae281f1f8801542a743263db84fff3612de1...main)
|
|
29
29
|
- [`ef49150171cc243b09c0e5d5cb27f2249ffa3793`](https://github.com/Chia-Network/pool-reference/tree/ef49150171cc243b09c0e5d5cb27f2249ffa3793) of [pool-reference](https://github.com/Chia-Network/pool-reference)
|
|
30
30
|
- [Diff to the main branch of pool-reference](https://github.com/Chia-Network/pool-reference/compare/ef49150171cc243b09c0e5d5cb27f2249ffa3793...main)
|
|
31
31
|
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Optional, str } from "../types/_python_types_";
|
|
2
2
|
import { G1Element } from "../../chia_rs/chia-bls/lib";
|
|
3
|
-
import { uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
|
|
3
|
+
import { uint16, uint64, uint8 } from "../../chia_rs/wheel/python/sized_ints";
|
|
4
4
|
import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
|
|
5
|
+
import { PartialProof } from "../../chia_rs/chia-protocol/partial_proof";
|
|
5
6
|
export type PartialProofsData = {
|
|
6
7
|
challenge_hash: bytes32;
|
|
7
8
|
sp_hash: bytes32;
|
|
8
9
|
plot_identifier: str;
|
|
9
|
-
partial_proofs:
|
|
10
|
+
partial_proofs: PartialProof[];
|
|
10
11
|
signage_point_index: uint8;
|
|
11
12
|
plot_size: uint8;
|
|
13
|
+
plot_index: uint16;
|
|
14
|
+
meta_group: uint8;
|
|
15
|
+
strength: uint8;
|
|
16
|
+
plot_id: bytes32;
|
|
12
17
|
pool_public_key: Optional<G1Element>;
|
|
13
18
|
pool_contract_puzzle_hash: Optional<bytes32>;
|
|
14
19
|
plot_public_key: G1Element;
|
|
@@ -22,4 +27,5 @@ export type Plot = {
|
|
|
22
27
|
plot_public_key: G1Element;
|
|
23
28
|
file_size: uint64;
|
|
24
29
|
time_modified: uint64;
|
|
30
|
+
compression_level: Optional<uint8>;
|
|
25
31
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { bytes } from "../types/_python_types_";
|
|
2
|
+
import { uint8 } from "../../chia_rs/wheel/python/sized_ints";
|
|
3
|
+
import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
|
|
4
|
+
import { PartialProof } from "../../chia_rs/chia-protocol/partial_proof";
|
|
2
5
|
export type SolverInfo = {
|
|
3
|
-
partial_proof:
|
|
6
|
+
partial_proof: PartialProof;
|
|
7
|
+
plot_id: bytes32;
|
|
8
|
+
strength: uint8;
|
|
9
|
+
size: uint8;
|
|
4
10
|
};
|
|
5
11
|
export type SolverResponse = {
|
|
6
|
-
partial_proof:
|
|
12
|
+
partial_proof: PartialProof;
|
|
7
13
|
proof: bytes;
|
|
8
14
|
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { bytes32 } from "../wheel/python/sized_bytes";
|
|
2
2
|
import { bytes, Optional } from "../../chia/types/_python_types_";
|
|
3
3
|
import { G1Element } from "../chia-bls/lib";
|
|
4
|
-
import { uint8 } from "../wheel/python/sized_ints";
|
|
4
|
+
import { uint16, uint8 } from "../wheel/python/sized_ints";
|
|
5
5
|
export type ProofOfSpace = {
|
|
6
6
|
challenge: bytes32;
|
|
7
7
|
pool_public_key: Optional<G1Element>;
|
|
8
8
|
pool_contract_puzzle_hash: Optional<bytes32>;
|
|
9
9
|
plot_public_key: G1Element;
|
|
10
|
+
version: uint8;
|
|
11
|
+
plot_index: uint16;
|
|
12
|
+
meta_group: uint8;
|
|
13
|
+
strength: uint8;
|
|
10
14
|
size: uint8;
|
|
11
15
|
proof: bytes;
|
|
12
16
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletInfo } from "../../chia/wallet/wallet_info";
|
|
2
2
|
import { Coin } from "../../chia/types/blockchain_format/coin";
|
|
3
3
|
import { bool, bytes, False, None, Optional, str, True } from "../../chia/types/_python_types_";
|
|
4
|
-
import { int, uint16, uint32, uint64
|
|
4
|
+
import { int, uint16, uint32, uint64 } from "../../chia_rs/wheel/python/sized_ints";
|
|
5
5
|
import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
|
|
6
6
|
import { TransactionRecord, TransactionRecordConvenience, TransactionRecordConvenienceWithMetadata } from "../../chia/wallet/transaction_record";
|
|
7
7
|
import { TRPCAgent } from "../../../rpc";
|
|
@@ -169,7 +169,7 @@ export type TCreate_New_CAT_WalletRequest = {
|
|
|
169
169
|
asset_id: str;
|
|
170
170
|
};
|
|
171
171
|
export type TCreate_New_CAT_WalletResponse = {
|
|
172
|
-
type:
|
|
172
|
+
type: "CAT";
|
|
173
173
|
asset_id: str;
|
|
174
174
|
wallet_id: uint32;
|
|
175
175
|
transactions: TransactionRecordConvenience[];
|
|
@@ -192,13 +192,15 @@ export type TCreateNewDidWalletRequestRecovery = {
|
|
|
192
192
|
export type TCreate_New_DID_WalletRequest = TCreateNewDidWalletRequestNew | TCreateNewDidWalletRequestRecovery;
|
|
193
193
|
export type TCreateNewDidWalletResponseNew = {
|
|
194
194
|
success: True;
|
|
195
|
-
type:
|
|
195
|
+
type: "DECENTRALIZED_ID";
|
|
196
196
|
my_did: str;
|
|
197
197
|
wallet_id: uint32;
|
|
198
|
+
transactions: TransactionRecordConvenience[];
|
|
199
|
+
signing_responses?: str[];
|
|
198
200
|
};
|
|
199
201
|
export type TCreateNewDidWalletResponseRecovery = {
|
|
200
202
|
success: True;
|
|
201
|
-
type:
|
|
203
|
+
type: "DECENTRALIZED_ID";
|
|
202
204
|
my_did: str;
|
|
203
205
|
wallet_id: uint32;
|
|
204
206
|
coin_name: str;
|
|
@@ -217,7 +219,7 @@ export type TCreate_New_NFT_WalletRequest = {
|
|
|
217
219
|
};
|
|
218
220
|
export type TCreate_New_NFT_WalletResponse = {
|
|
219
221
|
success: True;
|
|
220
|
-
type:
|
|
222
|
+
type: "NFT";
|
|
221
223
|
wallet_id: uint32;
|
|
222
224
|
};
|
|
223
225
|
export type TCreate_New_Pool_WalletRequest = {
|
|
@@ -234,12 +236,9 @@ export type TCreate_New_Pool_WalletRequest = {
|
|
|
234
236
|
};
|
|
235
237
|
p2_singleton_delayed_ph?: str;
|
|
236
238
|
p2_singleton_delay_time?: uint64;
|
|
237
|
-
} | {
|
|
238
|
-
fee?: uint64;
|
|
239
|
-
wallet_type: "pool_wallet";
|
|
240
|
-
mode: "recovery";
|
|
241
239
|
};
|
|
242
240
|
export type TCreate_New_Pool_WalletResponse = {
|
|
241
|
+
type: "POOLING_WALLET";
|
|
243
242
|
total_fee: uint64;
|
|
244
243
|
transaction: TransactionRecord;
|
|
245
244
|
transactions: TransactionRecordConvenience[];
|
|
@@ -247,16 +246,12 @@ export type TCreate_New_Pool_WalletResponse = {
|
|
|
247
246
|
launcher_id: str;
|
|
248
247
|
p2_singleton_puzzle_hash: str;
|
|
249
248
|
};
|
|
250
|
-
export type TCreateWalletErrorResponse = {
|
|
251
|
-
success: False;
|
|
252
|
-
error: str;
|
|
253
|
-
};
|
|
254
249
|
export declare const create_new_wallet_command = "create_new_wallet";
|
|
255
250
|
export type create_new_wallet_command = typeof create_new_wallet_command;
|
|
256
251
|
export type TCreateNewWalletRequestWithTx = TCreate_New_CAT_WalletRequest | TCreate_New_Pool_WalletRequest;
|
|
257
252
|
export type TCreateNewWalletRequestWithoutTx = TCreate_New_DID_WalletRequest | TCreate_New_NFT_WalletRequest;
|
|
258
253
|
export type TCreateNewWalletRequest = (TCreateNewWalletRequestWithTx | TCreateNewWalletRequestWithoutTx) & TXEndpointRequest;
|
|
259
|
-
export type TCreateNewWalletResponse = TCreate_New_CAT_WalletResponse | TCreate_New_DID_WalletResponse | TCreate_New_NFT_WalletResponse | TCreate_New_Pool_WalletResponse
|
|
254
|
+
export type TCreateNewWalletResponse = TCreate_New_CAT_WalletResponse | TCreate_New_DID_WalletResponse | TCreate_New_NFT_WalletResponse | TCreate_New_Pool_WalletResponse;
|
|
260
255
|
export type GetCreateNewWalletResponse<REQ extends TCreateNewWalletRequest> = REQ extends TCreate_New_CAT_WalletRequest ? TCreate_New_CAT_WalletResponse : REQ extends TCreate_New_DID_WalletRequest ? REQ extends TCreateNewDidWalletRequestNew ? TCreateNewDidWalletResponseNew : TCreateNewDidWalletResponseRecovery : REQ extends TCreate_New_NFT_WalletRequest ? TCreate_New_NFT_WalletResponse : TCreate_New_Pool_WalletResponse;
|
|
261
256
|
export type WsCreateNewWalletMessage<R> = GetMessageType<chia_wallet_service, create_new_wallet_command, R>;
|
|
262
257
|
export declare function create_new_wallet<T extends TRPCAgent | TDaemon, D extends TCreateNewWalletRequest>(agent: T, data: D): Promise<ResType<T, D extends TCreateNewWalletRequestWithTx ? TxeResp<D, GetCreateNewWalletResponse<D>> : GetCreateNewWalletResponse<D>, WsCreateNewWalletMessage<D extends TCreateNewWalletRequestWithTx ? TxeResp<D, GetCreateNewWalletResponse<D>> : GetCreateNewWalletResponse<D>>>>;
|
|
@@ -302,8 +297,8 @@ export declare const get_transactions_command = "get_transactions";
|
|
|
302
297
|
export type get_transactions_command = typeof get_transactions_command;
|
|
303
298
|
export type TGetTransactionsRequest = {
|
|
304
299
|
wallet_id: int;
|
|
305
|
-
start?:
|
|
306
|
-
end?:
|
|
300
|
+
start?: uint32;
|
|
301
|
+
end?: uint32;
|
|
307
302
|
sort_key?: str;
|
|
308
303
|
reverse?: bool;
|
|
309
304
|
to_address?: str;
|
|
@@ -424,12 +419,10 @@ export type TAdditions = {
|
|
|
424
419
|
export type TCoinAnnouncement = {
|
|
425
420
|
coin_id: str;
|
|
426
421
|
message: str;
|
|
427
|
-
morph_bytes?: str;
|
|
428
422
|
};
|
|
429
423
|
export type TPuzzleAnnouncement = {
|
|
430
424
|
puzzle_hash: str;
|
|
431
425
|
message: str;
|
|
432
|
-
morph_bytes?: str;
|
|
433
426
|
};
|
|
434
427
|
export declare const create_signed_transaction_command = "create_signed_transaction";
|
|
435
428
|
export type create_signed_transaction_command = typeof create_signed_transaction_command;
|
|
@@ -440,7 +433,11 @@ export type TCreateSignedTransactionRequest = {
|
|
|
440
433
|
coins?: Coin[];
|
|
441
434
|
coin_announcements?: TCoinAnnouncement[];
|
|
442
435
|
puzzle_announcements?: TPuzzleAnnouncement[];
|
|
443
|
-
morph_bytes?:
|
|
436
|
+
morph_bytes?: str;
|
|
437
|
+
extra_delta?: str;
|
|
438
|
+
tail_reveal?: str;
|
|
439
|
+
tail_solution?: str;
|
|
440
|
+
puzzle_decorator?: ClawbackPuzzleDecoratorOverride[];
|
|
444
441
|
} & TXEndpointRequest;
|
|
445
442
|
export type TCreateSignedTransactionResponse = {
|
|
446
443
|
signed_txs: TransactionRecordConvenience[];
|
|
@@ -723,7 +720,7 @@ export declare function cat_get_asset_id<T extends TRPCAgent | TDaemon>(agent: T
|
|
|
723
720
|
export declare const create_offer_for_ids_command = "create_offer_for_ids";
|
|
724
721
|
export type create_offer_for_ids_command = typeof create_offer_for_ids_command;
|
|
725
722
|
export type TCreateOfferForIdsRequest = {
|
|
726
|
-
offer: Record<
|
|
723
|
+
offer: Record<str, str | int>;
|
|
727
724
|
fee?: uint64;
|
|
728
725
|
validate_only?: bool;
|
|
729
726
|
driver_dict?: TDriverDict;
|
|
@@ -743,16 +740,27 @@ export type TGetOfferSummaryRequest = {
|
|
|
743
740
|
offer: str;
|
|
744
741
|
advanced?: bool;
|
|
745
742
|
};
|
|
743
|
+
export type TOfferSummary = {
|
|
744
|
+
offered: Record<str, str>;
|
|
745
|
+
requested: Record<str, str>;
|
|
746
|
+
fees: int;
|
|
747
|
+
infos: TDriverDict;
|
|
748
|
+
additions: str[];
|
|
749
|
+
removals: str[];
|
|
750
|
+
valid_times: Omit<ConditionValidTimes, "max_secs_after_created" | "min_secs_since_created" | "max_blocks_after_created" | "min_blocks_since_created">;
|
|
751
|
+
};
|
|
752
|
+
export type TDataLayerOfferSummary = {
|
|
753
|
+
offered: Array<{
|
|
754
|
+
launcher_id: str;
|
|
755
|
+
new_root: str;
|
|
756
|
+
dependencies: Array<{
|
|
757
|
+
launcher_id: str;
|
|
758
|
+
values_to_prove: str[];
|
|
759
|
+
}>;
|
|
760
|
+
}>;
|
|
761
|
+
};
|
|
746
762
|
export type TGetOfferSummaryResponse = {
|
|
747
|
-
summary:
|
|
748
|
-
offered: Record<str, int>;
|
|
749
|
-
requested: Record<str, int>;
|
|
750
|
-
fees: int;
|
|
751
|
-
infos: TDriverDict;
|
|
752
|
-
additions: str[];
|
|
753
|
-
removals: str[];
|
|
754
|
-
valid_times: Omit<ConditionValidTimes, "max_secs_after_created" | "min_secs_since_created" | "max_blocks_after_created" | "min_blocks_since_created">;
|
|
755
|
-
};
|
|
763
|
+
summary: TOfferSummary | TDataLayerOfferSummary;
|
|
756
764
|
id: bytes32;
|
|
757
765
|
};
|
|
758
766
|
export type WsGetOfferSummaryMessage = GetMessageType<chia_wallet_service, get_offer_summary_command, TGetOfferSummaryResponse>;
|
|
@@ -798,8 +806,8 @@ export declare function get_offer<T extends TRPCAgent | TDaemon>(agent: T, data:
|
|
|
798
806
|
export declare const get_all_offers_command = "get_all_offers";
|
|
799
807
|
export type get_all_offers_command = typeof get_all_offers_command;
|
|
800
808
|
export type TGetAllOffersRequest = {
|
|
801
|
-
start?:
|
|
802
|
-
end?:
|
|
809
|
+
start?: uint16;
|
|
810
|
+
end?: uint16;
|
|
803
811
|
exclude_my_offers?: bool;
|
|
804
812
|
exclude_taken_offers?: bool;
|
|
805
813
|
include_completed?: bool;
|
package/package.json
CHANGED
package/rpc/index.d.ts
CHANGED
|
@@ -2,8 +2,15 @@ import { Agent as HttpsAgent } from "https";
|
|
|
2
2
|
import { Agent as HttpAgent } from "http";
|
|
3
3
|
import { TConfig } from "../config/index";
|
|
4
4
|
import { APIAgent } from "../agent/index";
|
|
5
|
+
export type TRpcErrorCode = "API_ERROR" | "BLOCK_DOES_NOT_EXIST" | "BLOCK_HASH_NOT_FOUND" | "BLOCK_HEIGHT_NOT_FOUND" | "BLOCK_IN_FORK" | "BLOCK_NOT_FOUND" | "COIN_RECORD_NOT_FOUND" | "CONSENSUS_ERROR" | "EOS_NOT_IN_CACHE" | "HEADER_HASH_NOT_IN_REQUEST" | "HEIGHT_NOT_IN_BLOCKCHAIN" | "HINT_NOT_IN_REQUEST" | "INTERNAL_ERROR" | "INVALID_BLOCK_OR_GENERATOR" | "INVALID_COST" | "INVALID_HEIGHT_FOR_COIN" | "INVALID_NETWORK_SPACE_REQUEST" | "NAME_NOT_IN_REQUEST" | "NAMES_NOT_IN_REQUEST" | "NEW_AND_OLD_MUST_DIFFER" | "NEWER_BLOCK_NOT_FOUND" | "NO_BLOCKS_IN_CHAIN" | "NO_COIN_NAME_IN_REQUEST" | "NO_END_IN_REQUEST" | "NO_HEADER_HASH_IN_REQUEST" | "NO_HEIGHT_IN_REQUEST" | "NO_START_IN_REQUEST" | "NO_TX_ID_IN_REQUEST" | "OLDER_BLOCK_NOT_FOUND" | "PARENT_IDS_NOT_IN_REQUEST" | "PEAK_IS_NONE" | "PROTOCOL_ERROR" | "PUZZLE_HASH_NOT_IN_REQUEST" | "PUZZLE_HASHES_NOT_IN_REQUEST" | "PUZZLE_SOLUTION_FAILED" | "REQUEST_MUST_CONTAIN_EXACTLY_ONE" | "SP_NOT_IN_CACHE" | "SPEND_BUNDLE_NOT_IN_REQUEST" | "TARGET_TIMES_NON_NEGATIVE" | "TARGET_TIMES_REQUIRED" | "TIMESTAMP_ERROR" | "TRANSACTION_FAILED" | "TX_NOT_IN_MEMPOOL" | "UNKNOWN" | "VALIDATION_ERROR";
|
|
6
|
+
export type TStructuredError = {
|
|
7
|
+
code: TRpcErrorCode | string;
|
|
8
|
+
message: string;
|
|
9
|
+
data: Record<string, unknown>;
|
|
10
|
+
};
|
|
5
11
|
export declare class RpcError extends Error {
|
|
6
12
|
response: unknown;
|
|
13
|
+
structuredError?: TStructuredError;
|
|
7
14
|
constructor(message: string, response: unknown);
|
|
8
15
|
}
|
|
9
16
|
type TDestination = "farmer" | "harvester" | "full_node" | "wallet" | "data_layer" | "solver" | "daemon" | "pool";
|
package/rpc/index.js
CHANGED
|
@@ -19,6 +19,11 @@ class RpcError extends Error {
|
|
|
19
19
|
super(message);
|
|
20
20
|
this.name = "RpcError";
|
|
21
21
|
this.response = response;
|
|
22
|
+
if (response &&
|
|
23
|
+
typeof response === "object" &&
|
|
24
|
+
"structuredError" in response) {
|
|
25
|
+
this.structuredError = response.structuredError;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
exports.RpcError = RpcError;
|