@xelis/sdk 0.8.4 → 0.9.1
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/README.md +6 -6
- package/dist/cjs/daemon/rpc.js +61 -43
- package/dist/cjs/daemon/types.js +6 -0
- package/dist/cjs/daemon/websocket.js +73 -55
- package/dist/cjs/react/daemon.js +2 -2
- package/dist/cjs/wallet/rpc.js +28 -22
- package/dist/cjs/wallet/types.js +13 -1
- package/dist/cjs/wallet/websocket.js +48 -21
- package/dist/cjs/xswd/websocket.js +6 -6
- package/dist/esm/daemon/rpc.js +20 -2
- package/dist/esm/daemon/types.js +6 -0
- package/dist/esm/daemon/websocket.js +20 -2
- package/dist/esm/wallet/rpc.js +10 -4
- package/dist/esm/wallet/types.js +12 -0
- package/dist/esm/wallet/websocket.js +32 -5
- package/dist/types/daemon/rpc.d.ts +47 -41
- package/dist/types/daemon/types.d.ts +46 -2
- package/dist/types/daemon/websocket.d.ts +9 -3
- package/dist/types/lib/rpc.d.ts +1 -1
- package/dist/types/lib/websocket.d.ts +1 -1
- package/dist/types/react/daemon.d.ts +2 -2
- package/dist/types/wallet/rpc.d.ts +8 -6
- package/dist/types/wallet/types.d.ts +56 -5
- package/dist/types/wallet/websocket.d.ts +15 -5
- package/dist/types/xswd/websocket.d.ts +5 -5
- package/package.json +42 -39
- package/test_dist/index_cjs.js +22 -0
- package/test_dist/index_esm.js +12 -0
|
@@ -16,8 +16,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
exports.__esModule = true;
|
|
18
18
|
exports.WS = exports.WalletMethods = void 0;
|
|
19
|
-
var
|
|
20
|
-
var
|
|
19
|
+
var websocket_1 = require("../lib/websocket");
|
|
20
|
+
var types_1 = require("./types");
|
|
21
21
|
var WalletMethods = /** @class */ (function () {
|
|
22
22
|
function WalletMethods(ws, prefix) {
|
|
23
23
|
if (prefix === void 0) { prefix = ""; }
|
|
@@ -27,54 +27,81 @@ var WalletMethods = /** @class */ (function () {
|
|
|
27
27
|
WalletMethods.prototype.dataCall = function (method, params) {
|
|
28
28
|
return this.ws.dataCall(this.prefix + method, params);
|
|
29
29
|
};
|
|
30
|
+
WalletMethods.prototype.onNewTopoheight = function (onData) {
|
|
31
|
+
return this.ws.listenEvent(types_1.RPCEvent.NewTopoheight, onData);
|
|
32
|
+
};
|
|
33
|
+
WalletMethods.prototype.onNewAsset = function (onData) {
|
|
34
|
+
return this.ws.listenEvent(types_1.RPCEvent.NewAsset, onData);
|
|
35
|
+
};
|
|
36
|
+
WalletMethods.prototype.onNewTransaction = function (onData) {
|
|
37
|
+
return this.ws.listenEvent(types_1.RPCEvent.NewTransaction, onData);
|
|
38
|
+
};
|
|
39
|
+
WalletMethods.prototype.onBalanceChanged = function (onData) {
|
|
40
|
+
return this.ws.listenEvent(types_1.RPCEvent.BalanceChanged, onData);
|
|
41
|
+
};
|
|
42
|
+
WalletMethods.prototype.onRescan = function (onData) {
|
|
43
|
+
return this.ws.listenEvent(types_1.RPCEvent.Rescan, onData);
|
|
44
|
+
};
|
|
45
|
+
WalletMethods.prototype.onOnline = function (onData) {
|
|
46
|
+
return this.ws.listenEvent(types_1.RPCEvent.Online, onData);
|
|
47
|
+
};
|
|
48
|
+
WalletMethods.prototype.onOffline = function (onData) {
|
|
49
|
+
return this.ws.listenEvent(types_1.RPCEvent.Offline, onData);
|
|
50
|
+
};
|
|
30
51
|
WalletMethods.prototype.getVersion = function () {
|
|
31
|
-
return this.dataCall(
|
|
52
|
+
return this.dataCall(types_1.RPCMethod.GetVersion);
|
|
32
53
|
};
|
|
33
54
|
WalletMethods.prototype.getNetwork = function () {
|
|
34
|
-
return this.dataCall(
|
|
55
|
+
return this.dataCall(types_1.RPCMethod.GetNetwork);
|
|
35
56
|
};
|
|
36
57
|
WalletMethods.prototype.getNonce = function () {
|
|
37
|
-
return this.dataCall(
|
|
58
|
+
return this.dataCall(types_1.RPCMethod.GetNonce);
|
|
38
59
|
};
|
|
39
60
|
WalletMethods.prototype.getTopoheight = function () {
|
|
40
|
-
return this.dataCall(
|
|
61
|
+
return this.dataCall(types_1.RPCMethod.GetTopoheight);
|
|
41
62
|
};
|
|
42
63
|
WalletMethods.prototype.getAddress = function (params) {
|
|
43
64
|
if (params === void 0) { params = {}; }
|
|
44
|
-
return this.dataCall(
|
|
65
|
+
return this.dataCall(types_1.RPCMethod.GetAddress, params);
|
|
45
66
|
};
|
|
46
67
|
WalletMethods.prototype.splitAddress = function (params) {
|
|
47
|
-
return this.dataCall(
|
|
68
|
+
return this.dataCall(types_1.RPCMethod.SplitAddress, params);
|
|
48
69
|
};
|
|
49
|
-
WalletMethods.prototype.rescan = function () {
|
|
50
|
-
return this.dataCall(
|
|
70
|
+
WalletMethods.prototype.rescan = function (params) {
|
|
71
|
+
return this.dataCall(types_1.RPCMethod.Rescan, params);
|
|
51
72
|
};
|
|
52
73
|
WalletMethods.prototype.getBalance = function (asset) {
|
|
53
|
-
return this.dataCall(
|
|
74
|
+
return this.dataCall(types_1.RPCMethod.GetBalance, { asset: asset });
|
|
54
75
|
};
|
|
55
76
|
WalletMethods.prototype.getTrackedAssets = function () {
|
|
56
|
-
return this.dataCall(
|
|
77
|
+
return this.dataCall(types_1.RPCMethod.GetTrackedAssets);
|
|
57
78
|
};
|
|
58
79
|
WalletMethods.prototype.getAssetPrecision = function (params) {
|
|
59
|
-
return this.dataCall(
|
|
80
|
+
return this.dataCall(types_1.RPCMethod.GetAssetPrecision, params);
|
|
60
81
|
};
|
|
61
82
|
WalletMethods.prototype.getTransaction = function (hash) {
|
|
62
|
-
return this.dataCall(
|
|
83
|
+
return this.dataCall(types_1.RPCMethod.GetTransaction, { hash: hash });
|
|
63
84
|
};
|
|
64
85
|
WalletMethods.prototype.buildTransaction = function (params) {
|
|
65
|
-
return this.dataCall(
|
|
86
|
+
return this.dataCall(types_1.RPCMethod.BuildTransaction, params);
|
|
66
87
|
};
|
|
67
88
|
WalletMethods.prototype.listTransactions = function (params) {
|
|
68
|
-
return this.dataCall(
|
|
89
|
+
return this.dataCall(types_1.RPCMethod.GetTransaction, params);
|
|
69
90
|
};
|
|
70
91
|
WalletMethods.prototype.isOnline = function () {
|
|
71
|
-
return this.dataCall(
|
|
92
|
+
return this.dataCall(types_1.RPCMethod.IsOnline);
|
|
72
93
|
};
|
|
73
94
|
WalletMethods.prototype.signData = function (data) {
|
|
74
|
-
return this.dataCall(
|
|
95
|
+
return this.dataCall(types_1.RPCMethod.SignData, data);
|
|
96
|
+
};
|
|
97
|
+
WalletMethods.prototype.estimateFees = function (params) {
|
|
98
|
+
return this.dataCall(types_1.RPCMethod.EstimateFees, params);
|
|
99
|
+
};
|
|
100
|
+
WalletMethods.prototype.setOnlineMode = function (params) {
|
|
101
|
+
return this.dataCall(types_1.RPCMethod.SetOfflineMode, params);
|
|
75
102
|
};
|
|
76
|
-
WalletMethods.prototype.
|
|
77
|
-
return this.dataCall(
|
|
103
|
+
WalletMethods.prototype.setOfflineMode = function () {
|
|
104
|
+
return this.dataCall(types_1.RPCMethod.SetOfflineMode);
|
|
78
105
|
};
|
|
79
106
|
return WalletMethods;
|
|
80
107
|
}());
|
|
@@ -87,6 +114,6 @@ var WS = /** @class */ (function (_super) {
|
|
|
87
114
|
return _this;
|
|
88
115
|
}
|
|
89
116
|
return WS;
|
|
90
|
-
}(
|
|
117
|
+
}(websocket_1.WS));
|
|
91
118
|
exports.WS = WS;
|
|
92
119
|
exports["default"] = WS;
|
|
@@ -16,16 +16,16 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
exports.__esModule = true;
|
|
18
18
|
exports.WS = void 0;
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
19
|
+
var websocket_1 = require("../lib/websocket");
|
|
20
|
+
var websocket_2 = require("../daemon/websocket");
|
|
21
|
+
var websocket_3 = require("../wallet/websocket");
|
|
22
22
|
var WS = /** @class */ (function (_super) {
|
|
23
23
|
__extends(WS, _super);
|
|
24
24
|
function WS() {
|
|
25
25
|
var _this = _super.call(this) || this;
|
|
26
26
|
_this.timeout = 0;
|
|
27
|
-
_this.daemon = new
|
|
28
|
-
_this.wallet = new
|
|
27
|
+
_this.daemon = new websocket_2.DaemonMethods(_this, "node.");
|
|
28
|
+
_this.wallet = new websocket_3.WalletMethods(_this, "wallet.");
|
|
29
29
|
return _this;
|
|
30
30
|
}
|
|
31
31
|
WS.prototype.authorize = function (app) {
|
|
@@ -33,6 +33,6 @@ var WS = /** @class */ (function (_super) {
|
|
|
33
33
|
return this.call("", {}, data);
|
|
34
34
|
};
|
|
35
35
|
return WS;
|
|
36
|
-
}(
|
|
36
|
+
}(websocket_1.WS));
|
|
37
37
|
exports.WS = WS;
|
|
38
38
|
exports["default"] = WS;
|
package/dist/esm/daemon/rpc.js
CHANGED
|
@@ -47,8 +47,8 @@ var RPC = /** @class */ (function (_super) {
|
|
|
47
47
|
RPC.prototype.getTopBlock = function (params) {
|
|
48
48
|
return this.post(RPCMethod.GetTopBlock, params);
|
|
49
49
|
};
|
|
50
|
-
RPC.prototype.submitBlock = function (
|
|
51
|
-
return this.post(RPCMethod.SubmitBlock,
|
|
50
|
+
RPC.prototype.submitBlock = function (params) {
|
|
51
|
+
return this.post(RPCMethod.SubmitBlock, params);
|
|
52
52
|
};
|
|
53
53
|
RPC.prototype.getBalance = function (params) {
|
|
54
54
|
return this.post(RPCMethod.GetBalance, params);
|
|
@@ -137,6 +137,24 @@ var RPC = /** @class */ (function (_super) {
|
|
|
137
137
|
RPC.prototype.getAccountRegistrationTopoheight = function (address) {
|
|
138
138
|
return this.post(RPCMethod.GetAccountRegistrationTopoheight, { address: address });
|
|
139
139
|
};
|
|
140
|
+
RPC.prototype.isAccountRegistered = function (params) {
|
|
141
|
+
return this.post(RPCMethod.IsAccountRegistered, params);
|
|
142
|
+
};
|
|
143
|
+
RPC.prototype.getMempoolCache = function (address) {
|
|
144
|
+
return this.post(RPCMethod.GetMempoolCache, { address: address });
|
|
145
|
+
};
|
|
146
|
+
RPC.prototype.getDifficulty = function () {
|
|
147
|
+
return this.post(RPCMethod.GetDifficulty);
|
|
148
|
+
};
|
|
149
|
+
RPC.prototype.validateAddress = function (params) {
|
|
150
|
+
return this.post(RPCMethod.ValidateAddress, params);
|
|
151
|
+
};
|
|
152
|
+
RPC.prototype.extractKeyFromAddress = function (params) {
|
|
153
|
+
return this.post(RPCMethod.ExtractKeyFromAddress, params);
|
|
154
|
+
};
|
|
155
|
+
RPC.prototype.createMinerWork = function (params) {
|
|
156
|
+
return this.post(RPCMethod.CreateMinerWork, params);
|
|
157
|
+
};
|
|
140
158
|
return RPC;
|
|
141
159
|
}(BaseRPC));
|
|
142
160
|
export { RPC };
|
package/dist/esm/daemon/types.js
CHANGED
|
@@ -52,6 +52,12 @@ export var RPCMethod;
|
|
|
52
52
|
RPCMethod["GetSizeOnDisk"] = "get_size_on_disk";
|
|
53
53
|
RPCMethod["IsTxExecutedInBlock"] = "is_tx_executed_in_block";
|
|
54
54
|
RPCMethod["GetAccountRegistrationTopoheight"] = "get_account_registration_topoheight";
|
|
55
|
+
RPCMethod["IsAccountRegistered"] = "is_account_registered";
|
|
56
|
+
RPCMethod["GetMempoolCache"] = "get_mempool_cache";
|
|
57
|
+
RPCMethod["GetDifficulty"] = "get_difficulty";
|
|
58
|
+
RPCMethod["ValidateAddress"] = "validate_address";
|
|
59
|
+
RPCMethod["ExtractKeyFromAddress"] = "extract_key_from_address";
|
|
60
|
+
RPCMethod["CreateMinerWork"] = "create_miner_work";
|
|
55
61
|
})(RPCMethod || (RPCMethod = {}));
|
|
56
62
|
export var RPCEvent;
|
|
57
63
|
(function (RPCEvent) {
|
|
@@ -133,8 +133,8 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
133
133
|
DaemonMethods.prototype.getTopBlock = function (params) {
|
|
134
134
|
return this.dataCall(RPCMethod.GetTopBlock, params);
|
|
135
135
|
};
|
|
136
|
-
DaemonMethods.prototype.submitBlock = function (
|
|
137
|
-
return this.dataCall(RPCMethod.SubmitBlock,
|
|
136
|
+
DaemonMethods.prototype.submitBlock = function (params) {
|
|
137
|
+
return this.dataCall(RPCMethod.SubmitBlock, params);
|
|
138
138
|
};
|
|
139
139
|
DaemonMethods.prototype.getBalance = function (params) {
|
|
140
140
|
return this.dataCall(RPCMethod.GetBalance, params);
|
|
@@ -220,6 +220,24 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
220
220
|
DaemonMethods.prototype.getAccountRegistrationTopoheight = function (address) {
|
|
221
221
|
return this.dataCall(RPCMethod.GetAccountRegistrationTopoheight, { address: address });
|
|
222
222
|
};
|
|
223
|
+
DaemonMethods.prototype.isAccountRegistered = function (params) {
|
|
224
|
+
return this.dataCall(RPCMethod.IsAccountRegistered, params);
|
|
225
|
+
};
|
|
226
|
+
DaemonMethods.prototype.getMempoolCacheResult = function (address) {
|
|
227
|
+
return this.dataCall(RPCMethod.GetMempoolCache, { address: address });
|
|
228
|
+
};
|
|
229
|
+
DaemonMethods.prototype.getDifficulty = function () {
|
|
230
|
+
return this.dataCall(RPCMethod.GetDifficulty);
|
|
231
|
+
};
|
|
232
|
+
DaemonMethods.prototype.validateAddress = function (params) {
|
|
233
|
+
return this.dataCall(RPCMethod.ValidateAddress, params);
|
|
234
|
+
};
|
|
235
|
+
DaemonMethods.prototype.extractKeyFromAddress = function (params) {
|
|
236
|
+
return this.dataCall(RPCMethod.ExtractKeyFromAddress, params);
|
|
237
|
+
};
|
|
238
|
+
DaemonMethods.prototype.createMinerWork = function (params) {
|
|
239
|
+
return this.dataCall(RPCMethod.CreateMinerWork, params);
|
|
240
|
+
};
|
|
223
241
|
return DaemonMethods;
|
|
224
242
|
}());
|
|
225
243
|
export { DaemonMethods };
|
package/dist/esm/wallet/rpc.js
CHANGED
|
@@ -89,8 +89,8 @@ var RPC = /** @class */ (function (_super) {
|
|
|
89
89
|
RPC.prototype.splitAddress = function (params) {
|
|
90
90
|
return this.post(RPCMethod.SplitAddress, params);
|
|
91
91
|
};
|
|
92
|
-
RPC.prototype.rescan = function () {
|
|
93
|
-
return this.post(RPCMethod.Rescan);
|
|
92
|
+
RPC.prototype.rescan = function (params) {
|
|
93
|
+
return this.post(RPCMethod.Rescan, params);
|
|
94
94
|
};
|
|
95
95
|
RPC.prototype.getBalance = function (asset) {
|
|
96
96
|
return this.post(RPCMethod.GetBalance, { asset: asset });
|
|
@@ -119,8 +119,14 @@ var RPC = /** @class */ (function (_super) {
|
|
|
119
119
|
RPC.prototype.signData = function (data) {
|
|
120
120
|
return this.post(RPCMethod.SignData, data);
|
|
121
121
|
};
|
|
122
|
-
RPC.prototype.estimateFees = function (
|
|
123
|
-
return this.post(RPCMethod.EstimateFees,
|
|
122
|
+
RPC.prototype.estimateFees = function (params) {
|
|
123
|
+
return this.post(RPCMethod.EstimateFees, params);
|
|
124
|
+
};
|
|
125
|
+
RPC.prototype.setOnlineMode = function (params) {
|
|
126
|
+
return this.post(RPCMethod.SetOnlineMode, params);
|
|
127
|
+
};
|
|
128
|
+
RPC.prototype.setOfflineMode = function () {
|
|
129
|
+
return this.post(RPCMethod.SetOfflineMode);
|
|
124
130
|
};
|
|
125
131
|
return RPC;
|
|
126
132
|
}(BaseRPC));
|
package/dist/esm/wallet/types.js
CHANGED
|
@@ -15,9 +15,21 @@ export var RPCMethod;
|
|
|
15
15
|
RPCMethod["BuildTransaction"] = "build_transaction";
|
|
16
16
|
RPCMethod["ListTransactions"] = "list_transactions";
|
|
17
17
|
RPCMethod["IsOnline"] = "is_online";
|
|
18
|
+
RPCMethod["SetOnlineMode"] = "set_online_mode";
|
|
19
|
+
RPCMethod["SetOfflineMode"] = "set_offline_mode";
|
|
18
20
|
RPCMethod["SignData"] = "sign_data";
|
|
19
21
|
RPCMethod["EstimateFees"] = "estimate_fees";
|
|
20
22
|
})(RPCMethod || (RPCMethod = {}));
|
|
23
|
+
export var RPCEvent;
|
|
24
|
+
(function (RPCEvent) {
|
|
25
|
+
RPCEvent["NewTopoheight"] = "new_topoheight";
|
|
26
|
+
RPCEvent["NewAsset"] = "new_asset";
|
|
27
|
+
RPCEvent["NewTransaction"] = "";
|
|
28
|
+
RPCEvent["BalanceChanged"] = "balance_changed";
|
|
29
|
+
RPCEvent["Rescan"] = "rescan";
|
|
30
|
+
RPCEvent["Online"] = "online";
|
|
31
|
+
RPCEvent["Offline"] = "offline";
|
|
32
|
+
})(RPCEvent || (RPCEvent = {}));
|
|
21
33
|
export var Permission;
|
|
22
34
|
(function (Permission) {
|
|
23
35
|
Permission[Permission["Ask"] = 0] = "Ask";
|
|
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
16
|
import { WS as BaseWS } from '../lib/websocket.js';
|
|
17
|
-
import { RPCMethod } from './types.js';
|
|
17
|
+
import { RPCMethod, RPCEvent } from './types.js';
|
|
18
18
|
var WalletMethods = /** @class */ (function () {
|
|
19
19
|
function WalletMethods(ws, prefix) {
|
|
20
20
|
if (prefix === void 0) { prefix = ""; }
|
|
@@ -24,6 +24,27 @@ var WalletMethods = /** @class */ (function () {
|
|
|
24
24
|
WalletMethods.prototype.dataCall = function (method, params) {
|
|
25
25
|
return this.ws.dataCall(this.prefix + method, params);
|
|
26
26
|
};
|
|
27
|
+
WalletMethods.prototype.onNewTopoheight = function (onData) {
|
|
28
|
+
return this.ws.listenEvent(RPCEvent.NewTopoheight, onData);
|
|
29
|
+
};
|
|
30
|
+
WalletMethods.prototype.onNewAsset = function (onData) {
|
|
31
|
+
return this.ws.listenEvent(RPCEvent.NewAsset, onData);
|
|
32
|
+
};
|
|
33
|
+
WalletMethods.prototype.onNewTransaction = function (onData) {
|
|
34
|
+
return this.ws.listenEvent(RPCEvent.NewTransaction, onData);
|
|
35
|
+
};
|
|
36
|
+
WalletMethods.prototype.onBalanceChanged = function (onData) {
|
|
37
|
+
return this.ws.listenEvent(RPCEvent.BalanceChanged, onData);
|
|
38
|
+
};
|
|
39
|
+
WalletMethods.prototype.onRescan = function (onData) {
|
|
40
|
+
return this.ws.listenEvent(RPCEvent.Rescan, onData);
|
|
41
|
+
};
|
|
42
|
+
WalletMethods.prototype.onOnline = function (onData) {
|
|
43
|
+
return this.ws.listenEvent(RPCEvent.Online, onData);
|
|
44
|
+
};
|
|
45
|
+
WalletMethods.prototype.onOffline = function (onData) {
|
|
46
|
+
return this.ws.listenEvent(RPCEvent.Offline, onData);
|
|
47
|
+
};
|
|
27
48
|
WalletMethods.prototype.getVersion = function () {
|
|
28
49
|
return this.dataCall(RPCMethod.GetVersion);
|
|
29
50
|
};
|
|
@@ -43,8 +64,8 @@ var WalletMethods = /** @class */ (function () {
|
|
|
43
64
|
WalletMethods.prototype.splitAddress = function (params) {
|
|
44
65
|
return this.dataCall(RPCMethod.SplitAddress, params);
|
|
45
66
|
};
|
|
46
|
-
WalletMethods.prototype.rescan = function () {
|
|
47
|
-
return this.dataCall(RPCMethod.Rescan);
|
|
67
|
+
WalletMethods.prototype.rescan = function (params) {
|
|
68
|
+
return this.dataCall(RPCMethod.Rescan, params);
|
|
48
69
|
};
|
|
49
70
|
WalletMethods.prototype.getBalance = function (asset) {
|
|
50
71
|
return this.dataCall(RPCMethod.GetBalance, { asset: asset });
|
|
@@ -70,8 +91,14 @@ var WalletMethods = /** @class */ (function () {
|
|
|
70
91
|
WalletMethods.prototype.signData = function (data) {
|
|
71
92
|
return this.dataCall(RPCMethod.SignData, data);
|
|
72
93
|
};
|
|
73
|
-
WalletMethods.prototype.estimateFees = function (
|
|
74
|
-
return this.dataCall(RPCMethod.EstimateFees,
|
|
94
|
+
WalletMethods.prototype.estimateFees = function (params) {
|
|
95
|
+
return this.dataCall(RPCMethod.EstimateFees, params);
|
|
96
|
+
};
|
|
97
|
+
WalletMethods.prototype.setOnlineMode = function (params) {
|
|
98
|
+
return this.dataCall(RPCMethod.SetOfflineMode, params);
|
|
99
|
+
};
|
|
100
|
+
WalletMethods.prototype.setOfflineMode = function () {
|
|
101
|
+
return this.dataCall(RPCMethod.SetOfflineMode);
|
|
75
102
|
};
|
|
76
103
|
return WalletMethods;
|
|
77
104
|
}());
|
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
import { Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetBalanceResult, P2PStatusResult, GetBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceResult, GetNonceParams, GetAccountHistoryParams, AccounHistory, DevFee, DiskSize, HasBalanceParams, HasBalanceResult, AssetData, IsTxExecutedInBlockParams, GetAssetParams, GetPeersResult, GetBlockTemplateResult, VersionedBalance, VersionedNonce, GetNonceAtTopoheightParams, HasNonceParams, HasNonceResult, TransactionResponse } from './types
|
|
2
|
-
import { RPC as BaseRPC } from '../lib/rpc
|
|
1
|
+
import { Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetBalanceResult, P2PStatusResult, GetBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceResult, GetNonceParams, GetAccountHistoryParams, AccounHistory, DevFee, DiskSize, HasBalanceParams, HasBalanceResult, AssetData, IsTxExecutedInBlockParams, GetAssetParams, GetPeersResult, GetBlockTemplateResult, VersionedBalance, VersionedNonce, GetNonceAtTopoheightParams, HasNonceParams, HasNonceResult, TransactionResponse, IsAccountRegisteredParams, GetMempoolCacheResult, GetDifficultyResult, ValidateAddressParams, ExtractKeyFromAddressParams, SubmitBlockParams, CreateMinerWorkParams, CreateMinerWorkResult } from './types';
|
|
2
|
+
import { RPC as BaseRPC } from '../lib/rpc';
|
|
3
3
|
export declare class RPC extends BaseRPC {
|
|
4
|
-
getVersion(): Promise<import("../lib/types
|
|
5
|
-
getHeight(): Promise<import("../lib/types
|
|
6
|
-
getTopoHeight(): Promise<import("../lib/types
|
|
7
|
-
getStableHeight(): Promise<import("../lib/types
|
|
8
|
-
getBlockTemplate(address: string): Promise<import("../lib/types
|
|
9
|
-
getBlockAtTopoHeight(params: GetBlockAtTopoHeightParams): Promise<import("../lib/types
|
|
10
|
-
getBlocksAtHeight(params: GetBlocksAtHeightParams): Promise<import("../lib/types
|
|
11
|
-
getBlockByHash(params: GetBlockByHashParams): Promise<import("../lib/types
|
|
12
|
-
getTopBlock(params: GetTopBlockParams): Promise<import("../lib/types
|
|
13
|
-
submitBlock(
|
|
14
|
-
getBalance(params: GetBalanceParams): Promise<import("../lib/types
|
|
15
|
-
hasBalance(params: HasBalanceParams): Promise<import("../lib/types
|
|
16
|
-
getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<import("../lib/types
|
|
17
|
-
getInfo(): Promise<import("../lib/types
|
|
18
|
-
getNonce(params: GetNonceParams): Promise<import("../lib/types
|
|
19
|
-
hasNonce(params: HasNonceParams): Promise<import("../lib/types
|
|
20
|
-
getNonceAtTopoheight(params: GetNonceAtTopoheightParams): Promise<import("../lib/types
|
|
21
|
-
getAsset(params: GetAssetParams): Promise<import("../lib/types
|
|
22
|
-
getAssets(): Promise<import("../lib/types
|
|
23
|
-
countAssets(): Promise<import("../lib/types
|
|
24
|
-
countAccounts(): Promise<import("../lib/types
|
|
25
|
-
countTransactions(): Promise<import("../lib/types
|
|
26
|
-
submitTransaction(hexData: string): Promise<import("../lib/types
|
|
27
|
-
getTransaction(hash: string): Promise<import("../lib/types
|
|
28
|
-
p2pStatus(): Promise<import("../lib/types
|
|
29
|
-
getPeers(): Promise<import("../lib/types
|
|
30
|
-
getMemPool(): Promise<import("../lib/types
|
|
31
|
-
getTips(): Promise<import("../lib/types
|
|
32
|
-
getDAGOrder(params: TopoHeightRangeParams): Promise<import("../lib/types
|
|
33
|
-
getBlocksRangeByTopoheight(params: TopoHeightRangeParams): Promise<import("../lib/types
|
|
34
|
-
getBlocksRangeByHeight(params: HeightRangeParams): Promise<import("../lib/types
|
|
35
|
-
getTransactions(txHashes: string[]): Promise<import("../lib/types
|
|
36
|
-
getAccountHistory(params: GetAccountHistoryParams): Promise<import("../lib/types
|
|
37
|
-
getAccountAssets(address: string): Promise<import("../lib/types
|
|
38
|
-
getAccounts(params: GetAccountsParams): Promise<import("../lib/types
|
|
39
|
-
isTxExecutedInBlock(params: IsTxExecutedInBlockParams): Promise<import("../lib/types
|
|
40
|
-
getDevFeeThresholds(): Promise<import("../lib/types
|
|
41
|
-
getSizeOnDisk(): Promise<import("../lib/types
|
|
42
|
-
getAccountRegistrationTopoheight(address: String): Promise<import("../lib/types
|
|
4
|
+
getVersion(): Promise<import("../lib/types").RPCResponse<string>>;
|
|
5
|
+
getHeight(): Promise<import("../lib/types").RPCResponse<number>>;
|
|
6
|
+
getTopoHeight(): Promise<import("../lib/types").RPCResponse<number>>;
|
|
7
|
+
getStableHeight(): Promise<import("../lib/types").RPCResponse<number>>;
|
|
8
|
+
getBlockTemplate(address: string): Promise<import("../lib/types").RPCResponse<GetBlockTemplateResult>>;
|
|
9
|
+
getBlockAtTopoHeight(params: GetBlockAtTopoHeightParams): Promise<import("../lib/types").RPCResponse<Block>>;
|
|
10
|
+
getBlocksAtHeight(params: GetBlocksAtHeightParams): Promise<import("../lib/types").RPCResponse<Block[]>>;
|
|
11
|
+
getBlockByHash(params: GetBlockByHashParams): Promise<import("../lib/types").RPCResponse<Block>>;
|
|
12
|
+
getTopBlock(params: GetTopBlockParams): Promise<import("../lib/types").RPCResponse<Block>>;
|
|
13
|
+
submitBlock(params: SubmitBlockParams): Promise<import("../lib/types").RPCResponse<boolean>>;
|
|
14
|
+
getBalance(params: GetBalanceParams): Promise<import("../lib/types").RPCResponse<GetBalanceResult>>;
|
|
15
|
+
hasBalance(params: HasBalanceParams): Promise<import("../lib/types").RPCResponse<HasBalanceResult>>;
|
|
16
|
+
getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<import("../lib/types").RPCResponse<VersionedBalance>>;
|
|
17
|
+
getInfo(): Promise<import("../lib/types").RPCResponse<GetInfoResult>>;
|
|
18
|
+
getNonce(params: GetNonceParams): Promise<import("../lib/types").RPCResponse<GetNonceResult>>;
|
|
19
|
+
hasNonce(params: HasNonceParams): Promise<import("../lib/types").RPCResponse<HasNonceResult>>;
|
|
20
|
+
getNonceAtTopoheight(params: GetNonceAtTopoheightParams): Promise<import("../lib/types").RPCResponse<VersionedNonce>>;
|
|
21
|
+
getAsset(params: GetAssetParams): Promise<import("../lib/types").RPCResponse<AssetData>>;
|
|
22
|
+
getAssets(): Promise<import("../lib/types").RPCResponse<string[]>>;
|
|
23
|
+
countAssets(): Promise<import("../lib/types").RPCResponse<number>>;
|
|
24
|
+
countAccounts(): Promise<import("../lib/types").RPCResponse<number>>;
|
|
25
|
+
countTransactions(): Promise<import("../lib/types").RPCResponse<number>>;
|
|
26
|
+
submitTransaction(hexData: string): Promise<import("../lib/types").RPCResponse<boolean>>;
|
|
27
|
+
getTransaction(hash: string): Promise<import("../lib/types").RPCResponse<TransactionResponse>>;
|
|
28
|
+
p2pStatus(): Promise<import("../lib/types").RPCResponse<P2PStatusResult>>;
|
|
29
|
+
getPeers(): Promise<import("../lib/types").RPCResponse<GetPeersResult>>;
|
|
30
|
+
getMemPool(): Promise<import("../lib/types").RPCResponse<TransactionResponse[]>>;
|
|
31
|
+
getTips(): Promise<import("../lib/types").RPCResponse<string[]>>;
|
|
32
|
+
getDAGOrder(params: TopoHeightRangeParams): Promise<import("../lib/types").RPCResponse<string[]>>;
|
|
33
|
+
getBlocksRangeByTopoheight(params: TopoHeightRangeParams): Promise<import("../lib/types").RPCResponse<Block[]>>;
|
|
34
|
+
getBlocksRangeByHeight(params: HeightRangeParams): Promise<import("../lib/types").RPCResponse<Block[]>>;
|
|
35
|
+
getTransactions(txHashes: string[]): Promise<import("../lib/types").RPCResponse<TransactionResponse[]>>;
|
|
36
|
+
getAccountHistory(params: GetAccountHistoryParams): Promise<import("../lib/types").RPCResponse<AccounHistory[]>>;
|
|
37
|
+
getAccountAssets(address: string): Promise<import("../lib/types").RPCResponse<string[]>>;
|
|
38
|
+
getAccounts(params: GetAccountsParams): Promise<import("../lib/types").RPCResponse<string[]>>;
|
|
39
|
+
isTxExecutedInBlock(params: IsTxExecutedInBlockParams): Promise<import("../lib/types").RPCResponse<boolean>>;
|
|
40
|
+
getDevFeeThresholds(): Promise<import("../lib/types").RPCResponse<DevFee[]>>;
|
|
41
|
+
getSizeOnDisk(): Promise<import("../lib/types").RPCResponse<DiskSize>>;
|
|
42
|
+
getAccountRegistrationTopoheight(address: String): Promise<import("../lib/types").RPCResponse<Number>>;
|
|
43
|
+
isAccountRegistered(params: IsAccountRegisteredParams): Promise<import("../lib/types").RPCResponse<boolean>>;
|
|
44
|
+
getMempoolCache(address: String): Promise<import("../lib/types").RPCResponse<GetMempoolCacheResult>>;
|
|
45
|
+
getDifficulty(): Promise<import("../lib/types").RPCResponse<GetDifficultyResult>>;
|
|
46
|
+
validateAddress(params: ValidateAddressParams): Promise<import("../lib/types").RPCResponse<boolean>>;
|
|
47
|
+
extractKeyFromAddress(params: ExtractKeyFromAddressParams): Promise<import("../lib/types").RPCResponse<string | number[]>>;
|
|
48
|
+
createMinerWork(params: CreateMinerWorkParams): Promise<import("../lib/types").RPCResponse<CreateMinerWorkResult>>;
|
|
43
49
|
}
|
|
44
50
|
export default RPC;
|
|
@@ -21,6 +21,8 @@ export interface Block {
|
|
|
21
21
|
difficulty: string;
|
|
22
22
|
supply?: number;
|
|
23
23
|
reward?: number;
|
|
24
|
+
dev_reward?: number;
|
|
25
|
+
miner_reward?: number;
|
|
24
26
|
cumulative_difficulty: string;
|
|
25
27
|
total_fees?: number;
|
|
26
28
|
total_size_in_bytes: number;
|
|
@@ -84,6 +86,7 @@ export interface P2PStatusResult {
|
|
|
84
86
|
peer_id: number;
|
|
85
87
|
our_topoheight: number;
|
|
86
88
|
best_topoheight: number;
|
|
89
|
+
median_topoheight: number;
|
|
87
90
|
max_peers: number;
|
|
88
91
|
}
|
|
89
92
|
export interface TopoHeightRangeParams {
|
|
@@ -286,12 +289,47 @@ export declare enum BlockType {
|
|
|
286
289
|
export interface GetBlockTemplateResult {
|
|
287
290
|
template: string;
|
|
288
291
|
height: number;
|
|
289
|
-
|
|
292
|
+
topoheight: number;
|
|
293
|
+
difficulty: string;
|
|
290
294
|
}
|
|
291
295
|
export interface HasNonceParams {
|
|
292
296
|
address: string;
|
|
293
297
|
topoheight?: number;
|
|
294
298
|
}
|
|
299
|
+
export interface IsAccountRegisteredParams {
|
|
300
|
+
address: string;
|
|
301
|
+
in_stable_height: boolean;
|
|
302
|
+
}
|
|
303
|
+
export interface GetMempoolCacheResult {
|
|
304
|
+
min: number;
|
|
305
|
+
max: number;
|
|
306
|
+
txs: string[];
|
|
307
|
+
balances: Map<string, string>;
|
|
308
|
+
}
|
|
309
|
+
export interface GetDifficultyResult {
|
|
310
|
+
difficulty: string;
|
|
311
|
+
hashrate: string;
|
|
312
|
+
hashrate_formatted: string;
|
|
313
|
+
}
|
|
314
|
+
export interface ValidateAddressParams {
|
|
315
|
+
address: string;
|
|
316
|
+
allow_integrated: boolean;
|
|
317
|
+
}
|
|
318
|
+
export interface ExtractKeyFromAddressParams {
|
|
319
|
+
address: string;
|
|
320
|
+
tx_as_hex: boolean;
|
|
321
|
+
}
|
|
322
|
+
export interface SubmitBlockParams {
|
|
323
|
+
block_template: string;
|
|
324
|
+
miner_work?: string;
|
|
325
|
+
}
|
|
326
|
+
export interface CreateMinerWorkParams {
|
|
327
|
+
template: string;
|
|
328
|
+
address?: string;
|
|
329
|
+
}
|
|
330
|
+
export interface CreateMinerWorkResult {
|
|
331
|
+
miner_work: string;
|
|
332
|
+
}
|
|
295
333
|
export declare enum RPCMethod {
|
|
296
334
|
GetVersion = "get_version",
|
|
297
335
|
GetInfo = "get_info",
|
|
@@ -331,7 +369,13 @@ export declare enum RPCMethod {
|
|
|
331
369
|
GetDevFeeThresholds = "get_dev_fee_thresholds",
|
|
332
370
|
GetSizeOnDisk = "get_size_on_disk",
|
|
333
371
|
IsTxExecutedInBlock = "is_tx_executed_in_block",
|
|
334
|
-
GetAccountRegistrationTopoheight = "get_account_registration_topoheight"
|
|
372
|
+
GetAccountRegistrationTopoheight = "get_account_registration_topoheight",
|
|
373
|
+
IsAccountRegistered = "is_account_registered",
|
|
374
|
+
GetMempoolCache = "get_mempool_cache",
|
|
375
|
+
GetDifficulty = "get_difficulty",
|
|
376
|
+
ValidateAddress = "validate_address",
|
|
377
|
+
ExtractKeyFromAddress = "extract_key_from_address",
|
|
378
|
+
CreateMinerWork = "create_miner_work"
|
|
335
379
|
}
|
|
336
380
|
export declare enum RPCEvent {
|
|
337
381
|
NewBlock = "new_block",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MessageEvent } from 'ws';
|
|
2
|
-
import { Block, GetInfoResult, GetPeersResult, RPCEventResult, TopoHeightRangeParams, P2PStatusResult, GetBalanceAtTopoHeightParams, GetBalanceResult, HeightRangeParams, BlockOrdered, GetBalanceParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceParams, GetNonceResult, GetAccountHistoryParams, AccounHistory, Peer, PeerPeerListUpdated, PeerPeerDisconnected, DevFee, DiskSize, AssetWithData, AssetData, GetAssetParams, HasBalanceParams, HasBalanceResult, IsTxExecutedInBlockParams, BlockOrphaned, VersionedBalance, StableHeightChanged, HasNonceResult, HasNonceParams, TransactionResponse } from './types
|
|
3
|
-
import { WS as BaseWS } from '../lib/websocket
|
|
2
|
+
import { Block, GetInfoResult, GetPeersResult, RPCEventResult, TopoHeightRangeParams, P2PStatusResult, GetBalanceAtTopoHeightParams, GetBalanceResult, HeightRangeParams, BlockOrdered, GetBalanceParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceParams, GetNonceResult, GetAccountHistoryParams, AccounHistory, Peer, PeerPeerListUpdated, PeerPeerDisconnected, DevFee, DiskSize, AssetWithData, AssetData, GetAssetParams, HasBalanceParams, HasBalanceResult, IsTxExecutedInBlockParams, BlockOrphaned, VersionedBalance, StableHeightChanged, HasNonceResult, HasNonceParams, TransactionResponse, IsAccountRegisteredParams, GetMempoolCacheResult, GetDifficultyResult, ValidateAddressParams, ExtractKeyFromAddressParams, SubmitBlockParams, CreateMinerWorkParams, CreateMinerWorkResult } from './types';
|
|
3
|
+
import { WS as BaseWS } from '../lib/websocket';
|
|
4
4
|
export declare class DaemonMethods {
|
|
5
5
|
ws: BaseWS;
|
|
6
6
|
prefix: string;
|
|
@@ -29,7 +29,7 @@ export declare class DaemonMethods {
|
|
|
29
29
|
getBlocksAtHeight(params: GetBlocksAtHeightParams): Promise<Block[]>;
|
|
30
30
|
getBlockByHash(params: GetBlockByHashParams): Promise<Block>;
|
|
31
31
|
getTopBlock(params: GetTopBlockParams): Promise<Block>;
|
|
32
|
-
submitBlock(
|
|
32
|
+
submitBlock(params: SubmitBlockParams): Promise<boolean>;
|
|
33
33
|
getBalance(params: GetBalanceParams): Promise<GetBalanceResult>;
|
|
34
34
|
hasBalance(params: HasBalanceParams): Promise<HasBalanceResult>;
|
|
35
35
|
getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<VersionedBalance>;
|
|
@@ -58,6 +58,12 @@ export declare class DaemonMethods {
|
|
|
58
58
|
getDevFeeThresholds(): Promise<DevFee[]>;
|
|
59
59
|
getSizeOnDisk(): Promise<DiskSize>;
|
|
60
60
|
getAccountRegistrationTopoheight(address: String): Promise<Number>;
|
|
61
|
+
isAccountRegistered(params: IsAccountRegisteredParams): Promise<boolean>;
|
|
62
|
+
getMempoolCacheResult(address: string): Promise<GetMempoolCacheResult>;
|
|
63
|
+
getDifficulty(): Promise<GetDifficultyResult>;
|
|
64
|
+
validateAddress(params: ValidateAddressParams): Promise<boolean>;
|
|
65
|
+
extractKeyFromAddress(params: ExtractKeyFromAddressParams): Promise<string | number[]>;
|
|
66
|
+
createMinerWork(params: CreateMinerWorkParams): Promise<CreateMinerWorkResult>;
|
|
61
67
|
}
|
|
62
68
|
export declare class WS extends BaseWS {
|
|
63
69
|
methods: DaemonMethods;
|
package/dist/types/lib/rpc.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ClientOptions, MessageEvent } from 'ws';
|
|
3
3
|
import WebSocket from 'isomorphic-ws';
|
|
4
4
|
import { ClientRequestArgs } from 'http';
|
|
5
|
-
import { RPCResponse } from './types
|
|
5
|
+
import { RPCResponse } from './types';
|
|
6
6
|
export declare class WS {
|
|
7
7
|
endpoint: string;
|
|
8
8
|
socket?: WebSocket;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { MessageEvent } from 'ws';
|
|
3
|
-
import DaemonWS from '../daemon/websocket
|
|
4
|
-
import { RPCEvent } from '../daemon/types
|
|
3
|
+
import DaemonWS from '../daemon/websocket';
|
|
4
|
+
import { RPCEvent } from '../daemon/types';
|
|
5
5
|
export declare const INITIATING = -1;
|
|
6
6
|
interface NodeSocket {
|
|
7
7
|
daemon: DaemonWS;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GetAssetParams, HasBalanceResult
|
|
2
|
-
import { GetAddressParams, SplitAddressParams, SplitAddressResult, BuildTransactionParams, BuildTransactionResult, ListTransactionParams, Signature, TransactionEntry } from './types
|
|
3
|
-
import { RPC as BaseRPC } from '../lib/rpc
|
|
4
|
-
import { RPCResponse } from '../lib/types
|
|
1
|
+
import { GetAssetParams, HasBalanceResult } from '../daemon/types';
|
|
2
|
+
import { GetAddressParams, SplitAddressParams, SplitAddressResult, BuildTransactionParams, BuildTransactionResult, ListTransactionParams, Signature, TransactionEntry, RescanParams, SetOnlineModeParams, EstimateFeesParams } from './types';
|
|
3
|
+
import { RPC as BaseRPC } from '../lib/rpc';
|
|
4
|
+
import { RPCResponse } from '../lib/types';
|
|
5
5
|
export declare class RPC extends BaseRPC {
|
|
6
6
|
auth: string;
|
|
7
7
|
constructor(endpoint: string, username: string, password: string);
|
|
@@ -12,7 +12,7 @@ export declare class RPC extends BaseRPC {
|
|
|
12
12
|
getTopoheight(): Promise<RPCResponse<number>>;
|
|
13
13
|
getAddress(params?: GetAddressParams): Promise<RPCResponse<string>>;
|
|
14
14
|
splitAddress(params: SplitAddressParams): Promise<RPCResponse<SplitAddressResult>>;
|
|
15
|
-
rescan(): Promise<RPCResponse<
|
|
15
|
+
rescan(params: RescanParams): Promise<RPCResponse<boolean>>;
|
|
16
16
|
getBalance(asset?: string): Promise<RPCResponse<number>>;
|
|
17
17
|
hasBalance(asset?: string): Promise<RPCResponse<HasBalanceResult>>;
|
|
18
18
|
getTrackedAssets(): Promise<RPCResponse<string[]>>;
|
|
@@ -22,6 +22,8 @@ export declare class RPC extends BaseRPC {
|
|
|
22
22
|
listTransactions(params?: ListTransactionParams): Promise<RPCResponse<TransactionEntry[]>>;
|
|
23
23
|
isOnline(): Promise<RPCResponse<boolean>>;
|
|
24
24
|
signData(data: any): Promise<RPCResponse<Signature>>;
|
|
25
|
-
estimateFees(
|
|
25
|
+
estimateFees(params: EstimateFeesParams): Promise<RPCResponse<number>>;
|
|
26
|
+
setOnlineMode(params: SetOnlineModeParams): Promise<RPCResponse<boolean>>;
|
|
27
|
+
setOfflineMode(): Promise<RPCResponse<boolean>>;
|
|
26
28
|
}
|
|
27
29
|
export default RPC;
|