@tchain/tcabci-read-js-client 1.0.3 → 1.0.4
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/client.js +9 -10
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -57,7 +57,15 @@ class TCAbciClient {
|
|
|
57
57
|
this.#setConnected(true)
|
|
58
58
|
resolve(event)
|
|
59
59
|
}
|
|
60
|
-
this.#ws.onmessage =
|
|
60
|
+
this.#ws.onmessage = (message) => {
|
|
61
|
+
if (message.data === "OK" && message.data.length < 10) {
|
|
62
|
+
return { status: message.data }
|
|
63
|
+
}
|
|
64
|
+
if (this.listenCb) {
|
|
65
|
+
this.listenCb(toJSON(message.data))
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
})
|
|
62
70
|
}
|
|
63
71
|
Stop() {
|
|
@@ -167,15 +175,6 @@ class TCAbciClient {
|
|
|
167
175
|
const { WebSocket } = require("ws")
|
|
168
176
|
return WebSocket
|
|
169
177
|
}
|
|
170
|
-
#listen(message) {
|
|
171
|
-
if (message.data === "OK" && message.data.length < 10) {
|
|
172
|
-
return { status: message.data }
|
|
173
|
-
}
|
|
174
|
-
const txData = toJSON(message.data)
|
|
175
|
-
if (this.listenCb) {
|
|
176
|
-
this.listenCb(new Transaction(txData).ToJSONString())
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
178
|
#getConnected() {
|
|
180
179
|
return this.#connected
|
|
181
180
|
}
|