@xelis/sdk 0.11.26 → 0.11.28
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/dist/cjs/rpc/websocket.js +26 -13
- package/dist/esm/rpc/websocket.js +26 -13
- package/dist/types/daemon/types.d.ts +7 -1
- package/package.json +1 -1
|
@@ -125,20 +125,33 @@ class WSRPC {
|
|
|
125
125
|
}
|
|
126
126
|
dataCall(method, params, idRefObj) {
|
|
127
127
|
return new Promise(async (resolve, reject) => {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
idRefObj
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
const sendDataCall = async () => {
|
|
129
|
+
const id = this.methodIdIncrement++;
|
|
130
|
+
if (idRefObj)
|
|
131
|
+
idRefObj.id = id;
|
|
132
|
+
const request = { id, jsonrpc: `2.0`, method };
|
|
133
|
+
if (params)
|
|
134
|
+
request.params = params;
|
|
135
|
+
const data = JSON.stringify(request);
|
|
136
|
+
const [err, res] = await (0, await_to_js_1.default)(this.rawCall(id, data));
|
|
137
|
+
if (err)
|
|
138
|
+
return reject(err);
|
|
139
|
+
if (res.error) {
|
|
140
|
+
return reject(res.error.message);
|
|
141
|
+
}
|
|
142
|
+
return resolve(res.result);
|
|
143
|
+
};
|
|
144
|
+
// make sure connection is open or wait
|
|
145
|
+
if (this.socket.readyState === isomorphic_ws_1.default.OPEN) {
|
|
146
|
+
sendDataCall();
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const wait_for_open = () => {
|
|
150
|
+
sendDataCall();
|
|
151
|
+
this.socket.removeEventListener(`open`, wait_for_open);
|
|
152
|
+
};
|
|
153
|
+
this.socket.addEventListener(`open`, wait_for_open);
|
|
140
154
|
}
|
|
141
|
-
return resolve(res.result);
|
|
142
155
|
});
|
|
143
156
|
}
|
|
144
157
|
batchCall(requests) {
|
|
@@ -119,20 +119,33 @@ export class WSRPC {
|
|
|
119
119
|
}
|
|
120
120
|
dataCall(method, params, idRefObj) {
|
|
121
121
|
return new Promise(async (resolve, reject) => {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
idRefObj
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
const sendDataCall = async () => {
|
|
123
|
+
const id = this.methodIdIncrement++;
|
|
124
|
+
if (idRefObj)
|
|
125
|
+
idRefObj.id = id;
|
|
126
|
+
const request = { id, jsonrpc: `2.0`, method };
|
|
127
|
+
if (params)
|
|
128
|
+
request.params = params;
|
|
129
|
+
const data = JSON.stringify(request);
|
|
130
|
+
const [err, res] = await to(this.rawCall(id, data));
|
|
131
|
+
if (err)
|
|
132
|
+
return reject(err);
|
|
133
|
+
if (res.error) {
|
|
134
|
+
return reject(res.error.message);
|
|
135
|
+
}
|
|
136
|
+
return resolve(res.result);
|
|
137
|
+
};
|
|
138
|
+
// make sure connection is open or wait
|
|
139
|
+
if (this.socket.readyState === WebSocket.OPEN) {
|
|
140
|
+
sendDataCall();
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const wait_for_open = () => {
|
|
144
|
+
sendDataCall();
|
|
145
|
+
this.socket.removeEventListener(`open`, wait_for_open);
|
|
146
|
+
};
|
|
147
|
+
this.socket.addEventListener(`open`, wait_for_open);
|
|
134
148
|
}
|
|
135
|
-
return resolve(res.result);
|
|
136
149
|
});
|
|
137
150
|
}
|
|
138
151
|
batchCall(requests) {
|
|
@@ -299,12 +299,15 @@ export interface AccountHistory {
|
|
|
299
299
|
};
|
|
300
300
|
burn?: {
|
|
301
301
|
amount: number;
|
|
302
|
+
asset: string;
|
|
302
303
|
};
|
|
303
304
|
outgoing?: {
|
|
304
305
|
to: string;
|
|
306
|
+
asset: string;
|
|
305
307
|
};
|
|
306
308
|
incoming?: {
|
|
307
309
|
from: string;
|
|
310
|
+
asset: string;
|
|
308
311
|
};
|
|
309
312
|
multi_sig?: {
|
|
310
313
|
participants: string[];
|
|
@@ -313,8 +316,11 @@ export interface AccountHistory {
|
|
|
313
316
|
invoke_contract?: {
|
|
314
317
|
contract: string;
|
|
315
318
|
entry_id: number;
|
|
319
|
+
deposits: string[];
|
|
320
|
+
};
|
|
321
|
+
deploy_contract?: {
|
|
322
|
+
deposits?: string[];
|
|
316
323
|
};
|
|
317
|
-
deploy_contract?: {};
|
|
318
324
|
}
|
|
319
325
|
export interface PeerPeerListUpdated {
|
|
320
326
|
peer_id: string;
|
package/package.json
CHANGED