@xelis/sdk 0.11.2 → 0.11.3
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.
|
@@ -76,7 +76,7 @@ var WSRPC = /** @class */ (function () {
|
|
|
76
76
|
};
|
|
77
77
|
WSRPC.prototype.listen = function (event, listener) {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
var eventData, idRefObject_1,
|
|
79
|
+
var eventData, idRefObject_1, onMessage;
|
|
80
80
|
var _this = this;
|
|
81
81
|
return __generator(this, function (_a) {
|
|
82
82
|
eventData = this.events.get(event);
|
|
@@ -87,18 +87,13 @@ var WSRPC = /** @class */ (function () {
|
|
|
87
87
|
else {
|
|
88
88
|
idRefObject_1 = {};
|
|
89
89
|
this.dataCall("subscribe", { notify: event }, idRefObject_1);
|
|
90
|
-
subscribed_1 = false;
|
|
91
90
|
onMessage = function (msgEvent) {
|
|
92
|
-
// the first message will return true if subscription is successful
|
|
93
|
-
if (!subscribed_1) {
|
|
94
|
-
subscribed_1 = true;
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
91
|
var eventData = _this.events.get(event);
|
|
98
92
|
if (eventData && typeof msgEvent.data === "string") {
|
|
99
93
|
try {
|
|
100
94
|
var data_1 = (0, parse_json_1.parseJSON)(msgEvent.data);
|
|
101
|
-
|
|
95
|
+
// event result will contain an event parameter with the event name defined
|
|
96
|
+
if (data_1.result["event"] === event && data_1.id === idRefObject_1.id) {
|
|
102
97
|
eventData.listeners.forEach(function (listener) {
|
|
103
98
|
if (data_1.error) {
|
|
104
99
|
listener(undefined, new Error(data_1.error.message));
|
|
@@ -70,7 +70,7 @@ var WSRPC = /** @class */ (function () {
|
|
|
70
70
|
};
|
|
71
71
|
WSRPC.prototype.listen = function (event, listener) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
var eventData, idRefObject_1,
|
|
73
|
+
var eventData, idRefObject_1, onMessage;
|
|
74
74
|
var _this = this;
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
eventData = this.events.get(event);
|
|
@@ -81,18 +81,13 @@ var WSRPC = /** @class */ (function () {
|
|
|
81
81
|
else {
|
|
82
82
|
idRefObject_1 = {};
|
|
83
83
|
this.dataCall("subscribe", { notify: event }, idRefObject_1);
|
|
84
|
-
subscribed_1 = false;
|
|
85
84
|
onMessage = function (msgEvent) {
|
|
86
|
-
// the first message will return true if subscription is successful
|
|
87
|
-
if (!subscribed_1) {
|
|
88
|
-
subscribed_1 = true;
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
85
|
var eventData = _this.events.get(event);
|
|
92
86
|
if (eventData && typeof msgEvent.data === "string") {
|
|
93
87
|
try {
|
|
94
88
|
var data_1 = parseJSON(msgEvent.data);
|
|
95
|
-
|
|
89
|
+
// event result will contain an event parameter with the event name defined
|
|
90
|
+
if (data_1.result["event"] === event && data_1.id === idRefObject_1.id) {
|
|
96
91
|
eventData.listeners.forEach(function (listener) {
|
|
97
92
|
if (data_1.error) {
|
|
98
93
|
listener(undefined, new Error(data_1.error.message));
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { RPCEvent
|
|
1
|
+
import { RPCEvent } from './types';
|
|
2
2
|
import * as types from './types';
|
|
3
3
|
import { WSRPC } from '../rpc/websocket';
|
|
4
4
|
export interface DaemonEventsData {
|
|
5
|
-
[RPCEvent.NewBlock]: types.Block
|
|
6
|
-
[RPCEvent.BlockOrdered]: types.BlockOrdered
|
|
7
|
-
[RPCEvent.BlockOrphaned]: types.BlockOrphaned
|
|
8
|
-
[RPCEvent.StableHeightChanged]: types.StableHeightChanged
|
|
9
|
-
[RPCEvent.StableTopoHeightChanged]: types.StableTopoHeightChanged
|
|
10
|
-
[RPCEvent.TransactionOrphaned]: types.TransactionResponse
|
|
11
|
-
[RPCEvent.TransactionAddedInMempool]: types.MempoolTransactionSummary
|
|
12
|
-
[RPCEvent.TransactionExecuted]: types.TransactionExecuted
|
|
13
|
-
[RPCEvent.InvokeContract]: types.InvokeContract
|
|
14
|
-
[RPCEvent.ContractTransfer]: types.ContractTransfer
|
|
15
|
-
[RPCEvent.ContractEvent]: types.ContractEvent
|
|
16
|
-
[RPCEvent.DeployContract]: types.NewContract
|
|
17
|
-
[RPCEvent.NewAsset]: types.AssetWithData
|
|
18
|
-
[RPCEvent.PeerConnected]: types.Peer
|
|
19
|
-
[RPCEvent.PeerDisconnected]: number
|
|
20
|
-
[RPCEvent.PeerStateUpdated]: types.Peer
|
|
21
|
-
[RPCEvent.PeerPeerListUpdated]: types.PeerPeerListUpdated
|
|
22
|
-
[RPCEvent.PeerPeerDisconnected]: types.PeerPeerDisconnected
|
|
23
|
-
[RPCEvent.NewBlockTemplate]: types.GetBlockTemplateResult
|
|
5
|
+
[RPCEvent.NewBlock]: types.Block;
|
|
6
|
+
[RPCEvent.BlockOrdered]: types.BlockOrdered;
|
|
7
|
+
[RPCEvent.BlockOrphaned]: types.BlockOrphaned;
|
|
8
|
+
[RPCEvent.StableHeightChanged]: types.StableHeightChanged;
|
|
9
|
+
[RPCEvent.StableTopoHeightChanged]: types.StableTopoHeightChanged;
|
|
10
|
+
[RPCEvent.TransactionOrphaned]: types.TransactionResponse;
|
|
11
|
+
[RPCEvent.TransactionAddedInMempool]: types.MempoolTransactionSummary;
|
|
12
|
+
[RPCEvent.TransactionExecuted]: types.TransactionExecuted;
|
|
13
|
+
[RPCEvent.InvokeContract]: types.InvokeContract;
|
|
14
|
+
[RPCEvent.ContractTransfer]: types.ContractTransfer;
|
|
15
|
+
[RPCEvent.ContractEvent]: types.ContractEvent;
|
|
16
|
+
[RPCEvent.DeployContract]: types.NewContract;
|
|
17
|
+
[RPCEvent.NewAsset]: types.AssetWithData;
|
|
18
|
+
[RPCEvent.PeerConnected]: types.Peer;
|
|
19
|
+
[RPCEvent.PeerDisconnected]: number;
|
|
20
|
+
[RPCEvent.PeerStateUpdated]: types.Peer;
|
|
21
|
+
[RPCEvent.PeerPeerListUpdated]: types.PeerPeerListUpdated;
|
|
22
|
+
[RPCEvent.PeerPeerDisconnected]: types.PeerPeerDisconnected;
|
|
23
|
+
[RPCEvent.NewBlockTemplate]: types.GetBlockTemplateResult;
|
|
24
24
|
}
|
|
25
25
|
export declare class DaemonMethods {
|
|
26
26
|
ws: WSRPC;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { WSRPC } from '../rpc/websocket';
|
|
2
|
-
import { RPCEventResult } from '../daemon/types';
|
|
3
2
|
import * as daemonTypes from '../daemon/types';
|
|
4
3
|
import { RPCEvent } from './types';
|
|
5
4
|
import * as types from './types';
|
|
6
5
|
import { Element } from '../data/element';
|
|
7
6
|
export interface WalletEventsData {
|
|
8
|
-
[RPCEvent.NewTopoheight]: types.NewTopoheightResult
|
|
9
|
-
[RPCEvent.NewAsset]: daemonTypes.AssetWithData
|
|
10
|
-
[RPCEvent.NewTransaction]: types.TransactionEntry
|
|
11
|
-
[RPCEvent.BalanceChanged]: types.BalanceChangedResult
|
|
12
|
-
[RPCEvent.Rescan]: types.RescanResult
|
|
13
|
-
[RPCEvent.HistorySynced]: types.HistorySyncedResult
|
|
14
|
-
[RPCEvent.Online]:
|
|
15
|
-
[RPCEvent.Offline]:
|
|
7
|
+
[RPCEvent.NewTopoheight]: types.NewTopoheightResult;
|
|
8
|
+
[RPCEvent.NewAsset]: daemonTypes.AssetWithData;
|
|
9
|
+
[RPCEvent.NewTransaction]: types.TransactionEntry;
|
|
10
|
+
[RPCEvent.BalanceChanged]: types.BalanceChangedResult;
|
|
11
|
+
[RPCEvent.Rescan]: types.RescanResult;
|
|
12
|
+
[RPCEvent.HistorySynced]: types.HistorySyncedResult;
|
|
13
|
+
[RPCEvent.Online]: void;
|
|
14
|
+
[RPCEvent.Offline]: void;
|
|
16
15
|
}
|
|
17
16
|
export declare class WalletMethods {
|
|
18
17
|
ws: WSRPC;
|
package/package.json
CHANGED