chia-agent 10.1.0 → 11.1.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 +167 -47
- package/README.md +5 -5
- package/api/chia/data_layer/data_layer_util.d.ts +6 -0
- package/api/chia/types/blockchain_format/program.d.ts +0 -2
- package/api/chia/types/blockchain_format/serialized_program.d.ts +2 -0
- package/api/chia/types/blockchain_format/serialized_program.js +2 -0
- package/api/chia/types/coin_spend.d.ts +1 -1
- package/api/chia/types/full_block.d.ts +1 -1
- package/api/chia/types/mempool_item.d.ts +11 -2
- package/api/chia/wallet/nft_wallet/nft_info.d.ts +2 -0
- package/api/chia/wallet/wallet_node.d.ts +10 -0
- package/api/chia/wallet/wallet_node.js +2 -0
- package/api/rpc/data_layer/index.d.ts +8 -3
- package/api/rpc/data_layer/index.js +8 -1
- package/api/rpc/full_node/index.d.ts +101 -9
- package/api/rpc/full_node/index.js +65 -1
- package/api/rpc/index.d.ts +3 -3
- package/api/rpc/index.js +19 -4
- package/api/rpc/wallet/index.d.ts +63 -11
- package/api/rpc/wallet/index.js +26 -5
- package/api/ws/farmer/index.d.ts +13 -3
- package/api/ws/farmer/index.js +32 -3
- package/api/ws/harvester/index.d.ts +14 -4
- package/api/ws/harvester/index.js +27 -1
- package/api/ws/index.d.ts +3 -3
- package/api/ws/index.js +10 -4
- package/api/ws/wallet/index.d.ts +33 -15
- package/api/ws/wallet/index.js +40 -11
- package/package.json +2 -2
package/api/ws/wallet/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TDaemon } from "../../../daemon/index";
|
|
2
2
|
import { GetMessageType, TConnectionGeneral } from "../../types";
|
|
3
|
-
import { uint32 } from "../../chia/types/_python_types_";
|
|
3
|
+
import { int, str, uint32 } from "../../chia/types/_python_types_";
|
|
4
4
|
import { TransactionRecord } from "../../chia/wallet/transaction_record";
|
|
5
5
|
export declare const chia_wallet_service = "chia_wallet";
|
|
6
6
|
export declare type chia_wallet_service = typeof chia_wallet_service;
|
|
@@ -16,13 +16,17 @@ export declare type state_changed_command_of_wallet = typeof state_changed_comma
|
|
|
16
16
|
export declare type TStateChangedBroadCastOfWallet = {
|
|
17
17
|
state: "add_connection" | "new_block" | "wallet_created" | "added_stray_cat" | "offer_added" | "offer_cancelled" | "new_on_chain_notification";
|
|
18
18
|
} | {
|
|
19
|
-
state: "coin_removed" | "coin_added" | "pending_transaction" | "did_coin_added" | "nft_coin_added" | "nft_coin_removed" | "nft_coin_updated" | "nft_coin_did_set";
|
|
19
|
+
state: "coin_removed" | "coin_added" | "pending_transaction" | "did_coin_added" | "nft_coin_added" | "nft_coin_removed" | "nft_coin_updated" | "nft_coin_did_set" | "wallet_removed";
|
|
20
20
|
wallet_id: uint32;
|
|
21
21
|
} | {
|
|
22
22
|
state: "tx_update";
|
|
23
23
|
wallet_id: uint32;
|
|
24
24
|
additional_data: {
|
|
25
25
|
transaction: TransactionRecord;
|
|
26
|
+
} | {
|
|
27
|
+
transaction: TransactionRecord;
|
|
28
|
+
error: str;
|
|
29
|
+
status: int;
|
|
26
30
|
};
|
|
27
31
|
} | {
|
|
28
32
|
state: "new_derivation_index";
|
|
@@ -32,20 +36,34 @@ export declare type TStateChangedBroadCastOfWallet = {
|
|
|
32
36
|
};
|
|
33
37
|
export declare type WsStateChangedWalletMessage = GetMessageType<chia_wallet_service, state_changed_command_of_wallet, TStateChangedBroadCastOfWallet>;
|
|
34
38
|
export declare function on_state_changed_of_wallet(daemon: TDaemon, callback: (e: WsStateChangedWalletMessage) => unknown): Promise<() => void>;
|
|
35
|
-
export declare const
|
|
36
|
-
export declare type
|
|
37
|
-
export declare type
|
|
38
|
-
export declare type WsSyncChangedWalletMessage = GetMessageType<chia_wallet_service,
|
|
39
|
-
export declare function
|
|
40
|
-
export declare const
|
|
41
|
-
export declare type
|
|
42
|
-
export declare type
|
|
39
|
+
export declare const sync_changed_command = "sync_changed";
|
|
40
|
+
export declare type sync_changed_command = typeof sync_changed_command;
|
|
41
|
+
export declare type TSyncChangedBroadCast = {};
|
|
42
|
+
export declare type WsSyncChangedWalletMessage = GetMessageType<chia_wallet_service, sync_changed_command, TSyncChangedBroadCast>;
|
|
43
|
+
export declare function on_sync_changed(daemon: TDaemon, callback: (e: WsSyncChangedWalletMessage) => unknown): Promise<() => void>;
|
|
44
|
+
export declare const coin_added_command = "coin_added";
|
|
45
|
+
export declare type coin_added_command = typeof coin_added_command;
|
|
46
|
+
export declare type TCoinAddedBroadCast = {
|
|
43
47
|
state: "coin_added";
|
|
44
48
|
wallet_id: uint32;
|
|
45
49
|
};
|
|
46
|
-
export declare type
|
|
47
|
-
export declare function
|
|
48
|
-
export declare
|
|
49
|
-
export declare type
|
|
50
|
-
export declare type
|
|
50
|
+
export declare type WsCoinAddedMessage = GetMessageType<chia_wallet_service, coin_added_command, TCoinAddedBroadCast>;
|
|
51
|
+
export declare function on_coin_added(daemon: TDaemon, callback: (e: WsCoinAddedMessage) => unknown): Promise<() => void>;
|
|
52
|
+
export declare const add_connection_command = "add_connection";
|
|
53
|
+
export declare type add_connection_command = typeof add_connection_command;
|
|
54
|
+
export declare type TAddConnectionBroadCast = {
|
|
55
|
+
state: "add_connection";
|
|
56
|
+
};
|
|
57
|
+
export declare type WsAddConnectionMessage = GetMessageType<chia_wallet_service, add_connection_command, TAddConnectionBroadCast>;
|
|
58
|
+
export declare function on_add_connection(daemon: TDaemon, callback: (e: WsAddConnectionMessage) => unknown): Promise<() => void>;
|
|
59
|
+
export declare const close_connection_command = "close_connection";
|
|
60
|
+
export declare type close_connection_command = typeof close_connection_command;
|
|
61
|
+
export declare type TCloseConnectionBroadCast = {
|
|
62
|
+
state: "close_connection";
|
|
63
|
+
};
|
|
64
|
+
export declare type WsCloseConnectionMessage = GetMessageType<chia_wallet_service, close_connection_command, TCloseConnectionBroadCast>;
|
|
65
|
+
export declare function on_close_connection(daemon: TDaemon, callback: (e: WsCloseConnectionMessage) => unknown): Promise<() => void>;
|
|
66
|
+
export declare type WsWalletMessage = WsGetConnectionsWalletMessage | WsSyncChangedWalletMessage | WsStateChangedWalletMessage | WsCoinAddedMessage | WsAddConnectionMessage | WsCloseConnectionMessage;
|
|
67
|
+
export declare type chia_wallet_commands = get_connections_command | sync_changed_command | state_changed_command_of_wallet | coin_added_command | add_connection_command | close_connection_command;
|
|
68
|
+
export declare type TChiaWalletBroadcast = TGetConnectionsBroadCast | TSyncChangedBroadCast | TStateChangedBroadCastOfWallet | TCoinAddedBroadCast | TAddConnectionBroadCast | TCloseConnectionBroadCast;
|
|
51
69
|
export declare function on_message_from_wallet(daemon: TDaemon, callback: (e: WsWalletMessage) => unknown): Promise<() => void>;
|
package/api/ws/wallet/index.js
CHANGED
|
@@ -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.on_message_from_wallet = exports.
|
|
12
|
+
exports.on_message_from_wallet = exports.on_close_connection = exports.close_connection_command = exports.on_add_connection = exports.add_connection_command = exports.on_coin_added = exports.coin_added_command = exports.on_sync_changed = exports.sync_changed_command = exports.on_state_changed_of_wallet = exports.state_changed_command_of_wallet = exports.on_get_connections = exports.get_connections_command = exports.chia_wallet_service = void 0;
|
|
13
13
|
const types_1 = require("../../types");
|
|
14
14
|
exports.chia_wallet_service = "chia_wallet";
|
|
15
15
|
exports.get_connections_command = "get_connections";
|
|
@@ -38,36 +38,65 @@ function on_state_changed_of_wallet(daemon, callback) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
exports.on_state_changed_of_wallet = on_state_changed_of_wallet;
|
|
41
|
-
// "sync_changed" and "
|
|
42
|
-
exports.
|
|
43
|
-
function
|
|
41
|
+
// "sync_changed", "coin_added", "add_connection" and "close_connection" below are for metrics services.
|
|
42
|
+
exports.sync_changed_command = "sync_changed";
|
|
43
|
+
function on_sync_changed(daemon, callback) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
yield daemon.subscribe(types_1.metrics_service);
|
|
46
46
|
const messageListener = (e) => {
|
|
47
|
-
if (e.origin === exports.chia_wallet_service && e.command === exports.
|
|
47
|
+
if (e.origin === exports.chia_wallet_service && e.command === exports.sync_changed_command) {
|
|
48
48
|
callback(e);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
return daemon.addMessageListener(exports.chia_wallet_service, messageListener);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
56
|
-
function
|
|
54
|
+
exports.on_sync_changed = on_sync_changed;
|
|
55
|
+
exports.coin_added_command = "coin_added";
|
|
56
|
+
function on_coin_added(daemon, callback) {
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
yield daemon.subscribe(types_1.metrics_service);
|
|
59
59
|
const messageListener = (e) => {
|
|
60
|
-
if (e.origin === exports.chia_wallet_service && e.command === exports.
|
|
60
|
+
if (e.origin === exports.chia_wallet_service && e.command === exports.coin_added_command) {
|
|
61
61
|
callback(e);
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
return daemon.addMessageListener(exports.chia_wallet_service, messageListener);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
exports.
|
|
67
|
+
exports.on_coin_added = on_coin_added;
|
|
68
|
+
exports.add_connection_command = "add_connection";
|
|
69
|
+
function on_add_connection(daemon, callback) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
yield daemon.subscribe(types_1.metrics_service);
|
|
72
|
+
const messageListener = (e) => {
|
|
73
|
+
if (e.origin === exports.chia_wallet_service && e.command === exports.add_connection_command) {
|
|
74
|
+
callback(e);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return daemon.addMessageListener(exports.chia_wallet_service, messageListener);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
exports.on_add_connection = on_add_connection;
|
|
81
|
+
exports.close_connection_command = "close_connection";
|
|
82
|
+
function on_close_connection(daemon, callback) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
yield daemon.subscribe(types_1.metrics_service);
|
|
85
|
+
const messageListener = (e) => {
|
|
86
|
+
if (e.origin === exports.chia_wallet_service && e.command === exports.close_connection_command) {
|
|
87
|
+
callback(e);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return daemon.addMessageListener(exports.chia_wallet_service, messageListener);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.on_close_connection = on_close_connection;
|
|
68
94
|
function on_message_from_wallet(daemon, callback) {
|
|
69
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
yield
|
|
96
|
+
yield Promise.all([
|
|
97
|
+
daemon.subscribe(types_1.wallet_ui_service),
|
|
98
|
+
daemon.subscribe(types_1.metrics_service),
|
|
99
|
+
]);
|
|
71
100
|
const messageListener = (e) => {
|
|
72
101
|
if (e.origin === exports.chia_wallet_service) {
|
|
73
102
|
callback(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chia-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"author": "ChiaMineJP <admin@chiamine.jp>",
|
|
5
5
|
"description": "chia rpc/websocket client library",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"ws": "^8.5.0",
|
|
30
|
-
"yaml": "^
|
|
30
|
+
"yaml": "^2.2.2"
|
|
31
31
|
}
|
|
32
32
|
}
|