chia-agent 14.3.3 → 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 +108 -0
- package/README.md +7 -7
- package/api/chia/rpc/util.d.ts +6 -21
- package/api/chia/rpc/wallet_request_types.d.ts +178 -2
- package/api/chia/rpc/wallet_rpc_api.d.ts +19 -0
- package/api/chia/rpc/wallet_rpc_api.js +2 -0
- package/api/chia/util/streamable.d.ts +1 -1
- package/api/chia/wallet/dao_wallet/dao_wallet.d.ts +6 -2
- package/api/chia/wallet/puzzles/clawback/metadata.d.ts +2 -0
- package/api/chia/wallet/transaction_record.d.ts +2 -2
- package/api/chia/wallet/wallet_coin_record.d.ts +8 -4
- package/api/chia/wallet/wallet_spend_bundle.d.ts +2 -0
- package/api/chia/wallet/wallet_spend_bundle.js +2 -0
- package/api/chia_rs/chia-consensus/gen/owned_conditions.d.ts +6 -3
- package/api/rpc/common/index.d.ts +28 -3
- package/api/rpc/common/index.js +22 -1
- package/api/rpc/full_node/index.js +1 -0
- package/api/rpc/index.d.ts +2 -2
- package/api/rpc/index.js +9 -4
- package/api/rpc/wallet/index.d.ts +105 -194
- package/api/rpc/wallet/index.js +26 -11
- package/daemon/index.d.ts +1 -0
- package/daemon/index.js +30 -3
- package/index.d.ts +3 -0
- package/package.json +2 -2
package/daemon/index.d.ts
CHANGED
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(
|
|
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.
|
|
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.
|
|
30
|
+
"ws": "^8.18.1",
|
|
31
31
|
"yaml": "^2.4.2"
|
|
32
32
|
}
|
|
33
33
|
}
|