@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
package/README.md
CHANGED
|
@@ -35,8 +35,8 @@ Use Daemon WebSocket RPC connection.
|
|
|
35
35
|
|
|
36
36
|
```js
|
|
37
37
|
// ESM
|
|
38
|
-
import { TESTNET_NODE_WS } from '@xelis/sdk/config'
|
|
39
|
-
import DaemonWS from '@xelis/sdk/daemon/websocket'
|
|
38
|
+
import { TESTNET_NODE_WS } from '@xelis/sdk/config.js'
|
|
39
|
+
import DaemonWS from '@xelis/sdk/daemon/websocket.js'
|
|
40
40
|
// CommonJS
|
|
41
41
|
// const { TESTNET_NODE_RPC } = require('@xelis/sdk/config')
|
|
42
42
|
// const { WS: DaemonWS } = require('@xelis/sdk/daemon/websocket')
|
|
@@ -55,8 +55,8 @@ Use Wallet WebSocket RPC connection.
|
|
|
55
55
|
|
|
56
56
|
```js
|
|
57
57
|
// ESM
|
|
58
|
-
import { LOCAL_WALLET_WS } from '@xelis/sdk/config'
|
|
59
|
-
import DaemonWS from '@xelis/sdk/wallet/websocket'
|
|
58
|
+
import { LOCAL_WALLET_WS } from '@xelis/sdk/config.js'
|
|
59
|
+
import DaemonWS from '@xelis/sdk/wallet/websocket.js'
|
|
60
60
|
// CommonJS
|
|
61
61
|
// const { LOCAL_WALLET_WS } = require('@xelis/sdk/config')
|
|
62
62
|
// const { WS: WalletWS } = require('@xelis/sdk/wallet/websocket')
|
|
@@ -75,8 +75,8 @@ Use XSWD protocol.
|
|
|
75
75
|
|
|
76
76
|
```js
|
|
77
77
|
// ESM
|
|
78
|
-
import { LOCAL_XSWD_WS } from '@xelis/sdk/config'
|
|
79
|
-
import XSWD from '@xelis/sdk/xswd/websocket'
|
|
78
|
+
import { LOCAL_XSWD_WS } from '@xelis/sdk/config.js'
|
|
79
|
+
import XSWD from '@xelis/sdk/xswd/websocket.js'
|
|
80
80
|
// CommonJS
|
|
81
81
|
// const { LOCAL_XSWD_WS } = require('@xelis/sdk/config')
|
|
82
82
|
// const { WS: XSWD } = require('@xelis/sdk/xswd/websocket')
|
package/dist/cjs/daemon/rpc.js
CHANGED
|
@@ -16,131 +16,149 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
exports.__esModule = true;
|
|
18
18
|
exports.RPC = void 0;
|
|
19
|
-
var
|
|
20
|
-
var
|
|
19
|
+
var types_1 = require("./types");
|
|
20
|
+
var rpc_1 = require("../lib/rpc");
|
|
21
21
|
var RPC = /** @class */ (function (_super) {
|
|
22
22
|
__extends(RPC, _super);
|
|
23
23
|
function RPC() {
|
|
24
24
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
25
|
}
|
|
26
26
|
RPC.prototype.getVersion = function () {
|
|
27
|
-
return this.post(
|
|
27
|
+
return this.post(types_1.RPCMethod.GetVersion);
|
|
28
28
|
};
|
|
29
29
|
RPC.prototype.getHeight = function () {
|
|
30
|
-
return this.post(
|
|
30
|
+
return this.post(types_1.RPCMethod.GetHeight);
|
|
31
31
|
};
|
|
32
32
|
RPC.prototype.getTopoHeight = function () {
|
|
33
|
-
return this.post(
|
|
33
|
+
return this.post(types_1.RPCMethod.GetTopoHeight);
|
|
34
34
|
};
|
|
35
35
|
RPC.prototype.getStableHeight = function () {
|
|
36
|
-
return this.post(
|
|
36
|
+
return this.post(types_1.RPCMethod.GetStableHeight);
|
|
37
37
|
};
|
|
38
38
|
RPC.prototype.getBlockTemplate = function (address) {
|
|
39
|
-
return this.post(
|
|
39
|
+
return this.post(types_1.RPCMethod.GetBlockTemplate, { address: address });
|
|
40
40
|
};
|
|
41
41
|
RPC.prototype.getBlockAtTopoHeight = function (params) {
|
|
42
|
-
return this.post(
|
|
42
|
+
return this.post(types_1.RPCMethod.GetBlockAtTopoHeight, params);
|
|
43
43
|
};
|
|
44
44
|
RPC.prototype.getBlocksAtHeight = function (params) {
|
|
45
|
-
return this.post(
|
|
45
|
+
return this.post(types_1.RPCMethod.GetBlocksAtHeight, params);
|
|
46
46
|
};
|
|
47
47
|
RPC.prototype.getBlockByHash = function (params) {
|
|
48
|
-
return this.post(
|
|
48
|
+
return this.post(types_1.RPCMethod.GetBlockByHash, params);
|
|
49
49
|
};
|
|
50
50
|
RPC.prototype.getTopBlock = function (params) {
|
|
51
|
-
return this.post(
|
|
51
|
+
return this.post(types_1.RPCMethod.GetTopBlock, params);
|
|
52
52
|
};
|
|
53
|
-
RPC.prototype.submitBlock = function (
|
|
54
|
-
return this.post(
|
|
53
|
+
RPC.prototype.submitBlock = function (params) {
|
|
54
|
+
return this.post(types_1.RPCMethod.SubmitBlock, params);
|
|
55
55
|
};
|
|
56
56
|
RPC.prototype.getBalance = function (params) {
|
|
57
|
-
return this.post(
|
|
57
|
+
return this.post(types_1.RPCMethod.GetBalance, params);
|
|
58
58
|
};
|
|
59
59
|
RPC.prototype.hasBalance = function (params) {
|
|
60
|
-
return this.post(
|
|
60
|
+
return this.post(types_1.RPCMethod.HasBalance, params);
|
|
61
61
|
};
|
|
62
62
|
RPC.prototype.getBalanceAtTopoHeight = function (params) {
|
|
63
|
-
return this.post(
|
|
63
|
+
return this.post(types_1.RPCMethod.GetBalanceAtTopoHeight, params);
|
|
64
64
|
};
|
|
65
65
|
RPC.prototype.getInfo = function () {
|
|
66
|
-
return this.post(
|
|
66
|
+
return this.post(types_1.RPCMethod.GetInfo);
|
|
67
67
|
};
|
|
68
68
|
RPC.prototype.getNonce = function (params) {
|
|
69
|
-
return this.post(
|
|
69
|
+
return this.post(types_1.RPCMethod.GetNonce, params);
|
|
70
70
|
};
|
|
71
71
|
RPC.prototype.hasNonce = function (params) {
|
|
72
|
-
return this.post(
|
|
72
|
+
return this.post(types_1.RPCMethod.HasNonce, params);
|
|
73
73
|
};
|
|
74
74
|
RPC.prototype.getNonceAtTopoheight = function (params) {
|
|
75
|
-
return this.post(
|
|
75
|
+
return this.post(types_1.RPCMethod.GetNonceAtTopoheight, params);
|
|
76
76
|
};
|
|
77
77
|
RPC.prototype.getAsset = function (params) {
|
|
78
|
-
return this.post(
|
|
78
|
+
return this.post(types_1.RPCMethod.GetAsset, params);
|
|
79
79
|
};
|
|
80
80
|
RPC.prototype.getAssets = function () {
|
|
81
|
-
return this.post(
|
|
81
|
+
return this.post(types_1.RPCMethod.GetAssets);
|
|
82
82
|
};
|
|
83
83
|
RPC.prototype.countAssets = function () {
|
|
84
|
-
return this.post(
|
|
84
|
+
return this.post(types_1.RPCMethod.CountAssets);
|
|
85
85
|
};
|
|
86
86
|
RPC.prototype.countAccounts = function () {
|
|
87
|
-
return this.post(
|
|
87
|
+
return this.post(types_1.RPCMethod.CountAccounts);
|
|
88
88
|
};
|
|
89
89
|
RPC.prototype.countTransactions = function () {
|
|
90
|
-
return this.post(
|
|
90
|
+
return this.post(types_1.RPCMethod.CountTransactions);
|
|
91
91
|
};
|
|
92
92
|
RPC.prototype.submitTransaction = function (hexData) {
|
|
93
|
-
return this.post(
|
|
93
|
+
return this.post(types_1.RPCMethod.SubmitTransaction, { data: hexData });
|
|
94
94
|
};
|
|
95
95
|
RPC.prototype.getTransaction = function (hash) {
|
|
96
|
-
return this.post(
|
|
96
|
+
return this.post(types_1.RPCMethod.GetTransaction, { hash: hash });
|
|
97
97
|
};
|
|
98
98
|
RPC.prototype.p2pStatus = function () {
|
|
99
|
-
return this.post(
|
|
99
|
+
return this.post(types_1.RPCMethod.P2PStatus);
|
|
100
100
|
};
|
|
101
101
|
RPC.prototype.getPeers = function () {
|
|
102
|
-
return this.post(
|
|
102
|
+
return this.post(types_1.RPCMethod.GetPeers);
|
|
103
103
|
};
|
|
104
104
|
RPC.prototype.getMemPool = function () {
|
|
105
|
-
return this.post(
|
|
105
|
+
return this.post(types_1.RPCMethod.GetMempool);
|
|
106
106
|
};
|
|
107
107
|
RPC.prototype.getTips = function () {
|
|
108
|
-
return this.post(
|
|
108
|
+
return this.post(types_1.RPCMethod.GetTips);
|
|
109
109
|
};
|
|
110
110
|
RPC.prototype.getDAGOrder = function (params) {
|
|
111
|
-
return this.post(
|
|
111
|
+
return this.post(types_1.RPCMethod.GetDAGOrder, params);
|
|
112
112
|
};
|
|
113
113
|
RPC.prototype.getBlocksRangeByTopoheight = function (params) {
|
|
114
|
-
return this.post(
|
|
114
|
+
return this.post(types_1.RPCMethod.GetBlocksRangeByTopoheight, params);
|
|
115
115
|
};
|
|
116
116
|
RPC.prototype.getBlocksRangeByHeight = function (params) {
|
|
117
|
-
return this.post(
|
|
117
|
+
return this.post(types_1.RPCMethod.GetBlocksRangeByHeight, params);
|
|
118
118
|
};
|
|
119
119
|
RPC.prototype.getTransactions = function (txHashes) {
|
|
120
|
-
return this.post(
|
|
120
|
+
return this.post(types_1.RPCMethod.GetTransactions, { tx_hashes: txHashes });
|
|
121
121
|
};
|
|
122
122
|
RPC.prototype.getAccountHistory = function (params) {
|
|
123
|
-
return this.post(
|
|
123
|
+
return this.post(types_1.RPCMethod.GetAccountHistory, params);
|
|
124
124
|
};
|
|
125
125
|
RPC.prototype.getAccountAssets = function (address) {
|
|
126
|
-
return this.post(
|
|
126
|
+
return this.post(types_1.RPCMethod.GetAccountAssets, { address: address });
|
|
127
127
|
};
|
|
128
128
|
RPC.prototype.getAccounts = function (params) {
|
|
129
|
-
return this.post(
|
|
129
|
+
return this.post(types_1.RPCMethod.GetAccounts, params);
|
|
130
130
|
};
|
|
131
131
|
RPC.prototype.isTxExecutedInBlock = function (params) {
|
|
132
|
-
return this.post(
|
|
132
|
+
return this.post(types_1.RPCMethod.IsTxExecutedInBlock, params);
|
|
133
133
|
};
|
|
134
134
|
RPC.prototype.getDevFeeThresholds = function () {
|
|
135
|
-
return this.post(
|
|
135
|
+
return this.post(types_1.RPCMethod.GetDevFeeThresholds);
|
|
136
136
|
};
|
|
137
137
|
RPC.prototype.getSizeOnDisk = function () {
|
|
138
|
-
return this.post(
|
|
138
|
+
return this.post(types_1.RPCMethod.GetSizeOnDisk);
|
|
139
139
|
};
|
|
140
140
|
RPC.prototype.getAccountRegistrationTopoheight = function (address) {
|
|
141
|
-
return this.post(
|
|
141
|
+
return this.post(types_1.RPCMethod.GetAccountRegistrationTopoheight, { address: address });
|
|
142
|
+
};
|
|
143
|
+
RPC.prototype.isAccountRegistered = function (params) {
|
|
144
|
+
return this.post(types_1.RPCMethod.IsAccountRegistered, params);
|
|
145
|
+
};
|
|
146
|
+
RPC.prototype.getMempoolCache = function (address) {
|
|
147
|
+
return this.post(types_1.RPCMethod.GetMempoolCache, { address: address });
|
|
148
|
+
};
|
|
149
|
+
RPC.prototype.getDifficulty = function () {
|
|
150
|
+
return this.post(types_1.RPCMethod.GetDifficulty);
|
|
151
|
+
};
|
|
152
|
+
RPC.prototype.validateAddress = function (params) {
|
|
153
|
+
return this.post(types_1.RPCMethod.ValidateAddress, params);
|
|
154
|
+
};
|
|
155
|
+
RPC.prototype.extractKeyFromAddress = function (params) {
|
|
156
|
+
return this.post(types_1.RPCMethod.ExtractKeyFromAddress, params);
|
|
157
|
+
};
|
|
158
|
+
RPC.prototype.createMinerWork = function (params) {
|
|
159
|
+
return this.post(types_1.RPCMethod.CreateMinerWork, params);
|
|
142
160
|
};
|
|
143
161
|
return RPC;
|
|
144
|
-
}(
|
|
162
|
+
}(rpc_1.RPC));
|
|
145
163
|
exports.RPC = RPC;
|
|
146
164
|
exports["default"] = RPC;
|
package/dist/cjs/daemon/types.js
CHANGED
|
@@ -55,6 +55,12 @@ var RPCMethod;
|
|
|
55
55
|
RPCMethod["GetSizeOnDisk"] = "get_size_on_disk";
|
|
56
56
|
RPCMethod["IsTxExecutedInBlock"] = "is_tx_executed_in_block";
|
|
57
57
|
RPCMethod["GetAccountRegistrationTopoheight"] = "get_account_registration_topoheight";
|
|
58
|
+
RPCMethod["IsAccountRegistered"] = "is_account_registered";
|
|
59
|
+
RPCMethod["GetMempoolCache"] = "get_mempool_cache";
|
|
60
|
+
RPCMethod["GetDifficulty"] = "get_difficulty";
|
|
61
|
+
RPCMethod["ValidateAddress"] = "validate_address";
|
|
62
|
+
RPCMethod["ExtractKeyFromAddress"] = "extract_key_from_address";
|
|
63
|
+
RPCMethod["CreateMinerWork"] = "create_miner_work";
|
|
58
64
|
})(RPCMethod = exports.RPCMethod || (exports.RPCMethod = {}));
|
|
59
65
|
var RPCEvent;
|
|
60
66
|
(function (RPCEvent) {
|
|
@@ -52,8 +52,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
52
52
|
};
|
|
53
53
|
exports.__esModule = true;
|
|
54
54
|
exports.WS = exports.DaemonMethods = void 0;
|
|
55
|
-
var
|
|
56
|
-
var
|
|
55
|
+
var types_1 = require("./types");
|
|
56
|
+
var websocket_1 = require("../lib/websocket");
|
|
57
57
|
var DaemonMethods = /** @class */ (function () {
|
|
58
58
|
function DaemonMethods(ws, prefix) {
|
|
59
59
|
if (prefix === void 0) { prefix = ""; }
|
|
@@ -71,157 +71,175 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
71
71
|
return this.ws.dataCall(this.prefix + method, params);
|
|
72
72
|
};
|
|
73
73
|
DaemonMethods.prototype.onNewBlock = function (onData) {
|
|
74
|
-
return this.listenEvent(
|
|
74
|
+
return this.listenEvent(types_1.RPCEvent.NewBlock, onData);
|
|
75
75
|
};
|
|
76
76
|
DaemonMethods.prototype.onTransactionAddedInMempool = function (onData) {
|
|
77
|
-
return this.listenEvent(
|
|
77
|
+
return this.listenEvent(types_1.RPCEvent.TransactionAddedInMempool, onData);
|
|
78
78
|
};
|
|
79
79
|
DaemonMethods.prototype.onTransactionExecuted = function (onData) {
|
|
80
|
-
return this.listenEvent(
|
|
80
|
+
return this.listenEvent(types_1.RPCEvent.TransactionExecuted, onData);
|
|
81
81
|
};
|
|
82
82
|
DaemonMethods.prototype.onBlockOrdered = function (onData) {
|
|
83
|
-
return this.listenEvent(
|
|
83
|
+
return this.listenEvent(types_1.RPCEvent.BlockOrdered, onData);
|
|
84
84
|
};
|
|
85
85
|
DaemonMethods.prototype.onPeerConnected = function (onData) {
|
|
86
|
-
return this.listenEvent(
|
|
86
|
+
return this.listenEvent(types_1.RPCEvent.PeerConnected, onData);
|
|
87
87
|
};
|
|
88
88
|
DaemonMethods.prototype.onPeerDisconnected = function (onData) {
|
|
89
|
-
return this.listenEvent(
|
|
89
|
+
return this.listenEvent(types_1.RPCEvent.PeerDisconnected, onData);
|
|
90
90
|
};
|
|
91
91
|
DaemonMethods.prototype.onPeerPeerListUpdated = function (onData) {
|
|
92
|
-
return this.listenEvent(
|
|
92
|
+
return this.listenEvent(types_1.RPCEvent.PeerPeerListUpdated, onData);
|
|
93
93
|
};
|
|
94
94
|
DaemonMethods.prototype.onPeerPeerDisconnected = function (onData) {
|
|
95
|
-
return this.listenEvent(
|
|
95
|
+
return this.listenEvent(types_1.RPCEvent.PeerPeerDisconnected, onData);
|
|
96
96
|
};
|
|
97
97
|
DaemonMethods.prototype.onPeerStateUpdated = function (onData) {
|
|
98
|
-
return this.listenEvent(
|
|
98
|
+
return this.listenEvent(types_1.RPCEvent.PeerStateUpdated, onData);
|
|
99
99
|
};
|
|
100
100
|
DaemonMethods.prototype.onNewAsset = function (onData) {
|
|
101
|
-
return this.listenEvent(
|
|
101
|
+
return this.listenEvent(types_1.RPCEvent.NewAsset, onData);
|
|
102
102
|
};
|
|
103
103
|
DaemonMethods.prototype.onBlockOrphaned = function (onData) {
|
|
104
|
-
return this.listenEvent(
|
|
104
|
+
return this.listenEvent(types_1.RPCEvent.BlockOrphaned, onData);
|
|
105
105
|
};
|
|
106
106
|
DaemonMethods.prototype.onTransactionOrphaned = function (onData) {
|
|
107
|
-
return this.listenEvent(
|
|
107
|
+
return this.listenEvent(types_1.RPCEvent.TransactionOrphaned, onData);
|
|
108
108
|
};
|
|
109
109
|
DaemonMethods.prototype.onStableHeightChanged = function (onData) {
|
|
110
|
-
return this.listenEvent(
|
|
110
|
+
return this.listenEvent(types_1.RPCEvent.StableHeightChanged, onData);
|
|
111
111
|
};
|
|
112
112
|
DaemonMethods.prototype.getVersion = function () {
|
|
113
|
-
return this.dataCall(
|
|
113
|
+
return this.dataCall(types_1.RPCMethod.GetVersion);
|
|
114
114
|
};
|
|
115
115
|
DaemonMethods.prototype.getHeight = function () {
|
|
116
|
-
return this.dataCall(
|
|
116
|
+
return this.dataCall(types_1.RPCMethod.GetHeight);
|
|
117
117
|
};
|
|
118
118
|
DaemonMethods.prototype.getTopoHeight = function () {
|
|
119
|
-
return this.dataCall(
|
|
119
|
+
return this.dataCall(types_1.RPCMethod.GetTopoHeight);
|
|
120
120
|
};
|
|
121
121
|
DaemonMethods.prototype.getStableHeight = function () {
|
|
122
|
-
return this.dataCall(
|
|
122
|
+
return this.dataCall(types_1.RPCMethod.GetStableHeight);
|
|
123
123
|
};
|
|
124
124
|
DaemonMethods.prototype.getBlockTemplate = function (address) {
|
|
125
|
-
return this.dataCall(
|
|
125
|
+
return this.dataCall(types_1.RPCMethod.GetBlockTemplate, { address: address });
|
|
126
126
|
};
|
|
127
127
|
DaemonMethods.prototype.getBlockAtTopoHeight = function (params) {
|
|
128
|
-
return this.dataCall(
|
|
128
|
+
return this.dataCall(types_1.RPCMethod.GetBlockAtTopoHeight, params);
|
|
129
129
|
};
|
|
130
130
|
DaemonMethods.prototype.getBlocksAtHeight = function (params) {
|
|
131
|
-
return this.dataCall(
|
|
131
|
+
return this.dataCall(types_1.RPCMethod.GetBlocksAtHeight, params);
|
|
132
132
|
};
|
|
133
133
|
DaemonMethods.prototype.getBlockByHash = function (params) {
|
|
134
|
-
return this.dataCall(
|
|
134
|
+
return this.dataCall(types_1.RPCMethod.GetBlockByHash, params);
|
|
135
135
|
};
|
|
136
136
|
DaemonMethods.prototype.getTopBlock = function (params) {
|
|
137
|
-
return this.dataCall(
|
|
137
|
+
return this.dataCall(types_1.RPCMethod.GetTopBlock, params);
|
|
138
138
|
};
|
|
139
|
-
DaemonMethods.prototype.submitBlock = function (
|
|
140
|
-
return this.dataCall(
|
|
139
|
+
DaemonMethods.prototype.submitBlock = function (params) {
|
|
140
|
+
return this.dataCall(types_1.RPCMethod.SubmitBlock, params);
|
|
141
141
|
};
|
|
142
142
|
DaemonMethods.prototype.getBalance = function (params) {
|
|
143
|
-
return this.dataCall(
|
|
143
|
+
return this.dataCall(types_1.RPCMethod.GetBalance, params);
|
|
144
144
|
};
|
|
145
145
|
DaemonMethods.prototype.hasBalance = function (params) {
|
|
146
|
-
return this.dataCall(
|
|
146
|
+
return this.dataCall(types_1.RPCMethod.HasBalance, params);
|
|
147
147
|
};
|
|
148
148
|
DaemonMethods.prototype.getBalanceAtTopoHeight = function (params) {
|
|
149
|
-
return this.dataCall(
|
|
149
|
+
return this.dataCall(types_1.RPCMethod.GetBalanceAtTopoHeight, params);
|
|
150
150
|
};
|
|
151
151
|
DaemonMethods.prototype.getInfo = function () {
|
|
152
|
-
return this.dataCall(
|
|
152
|
+
return this.dataCall(types_1.RPCMethod.GetInfo);
|
|
153
153
|
};
|
|
154
154
|
DaemonMethods.prototype.getNonce = function (params) {
|
|
155
|
-
return this.dataCall(
|
|
155
|
+
return this.dataCall(types_1.RPCMethod.GetNonce, params);
|
|
156
156
|
};
|
|
157
157
|
DaemonMethods.prototype.hasNonce = function (params) {
|
|
158
|
-
return this.dataCall(
|
|
158
|
+
return this.dataCall(types_1.RPCMethod.HasNonce, params);
|
|
159
159
|
};
|
|
160
160
|
DaemonMethods.prototype.getAsset = function (params) {
|
|
161
|
-
return this.dataCall(
|
|
161
|
+
return this.dataCall(types_1.RPCMethod.GetAsset, params);
|
|
162
162
|
};
|
|
163
163
|
DaemonMethods.prototype.getAssets = function () {
|
|
164
|
-
return this.dataCall(
|
|
164
|
+
return this.dataCall(types_1.RPCMethod.GetAssets);
|
|
165
165
|
};
|
|
166
166
|
DaemonMethods.prototype.countAssets = function () {
|
|
167
|
-
return this.dataCall(
|
|
167
|
+
return this.dataCall(types_1.RPCMethod.CountAssets);
|
|
168
168
|
};
|
|
169
169
|
DaemonMethods.prototype.countAccounts = function () {
|
|
170
|
-
return this.dataCall(
|
|
170
|
+
return this.dataCall(types_1.RPCMethod.CountAccounts);
|
|
171
171
|
};
|
|
172
172
|
DaemonMethods.prototype.countTransactions = function () {
|
|
173
|
-
return this.dataCall(
|
|
173
|
+
return this.dataCall(types_1.RPCMethod.CountTransactions);
|
|
174
174
|
};
|
|
175
175
|
DaemonMethods.prototype.submitTransaction = function (hexData) {
|
|
176
|
-
return this.dataCall(
|
|
176
|
+
return this.dataCall(types_1.RPCMethod.SubmitTransaction, { data: hexData });
|
|
177
177
|
};
|
|
178
178
|
DaemonMethods.prototype.getTransaction = function (hash) {
|
|
179
|
-
return this.dataCall(
|
|
179
|
+
return this.dataCall(types_1.RPCMethod.GetTransaction, { hash: hash });
|
|
180
180
|
};
|
|
181
181
|
DaemonMethods.prototype.p2pStatus = function () {
|
|
182
|
-
return this.dataCall(
|
|
182
|
+
return this.dataCall(types_1.RPCMethod.P2PStatus);
|
|
183
183
|
};
|
|
184
184
|
DaemonMethods.prototype.getPeers = function () {
|
|
185
|
-
return this.dataCall(
|
|
185
|
+
return this.dataCall(types_1.RPCMethod.GetPeers);
|
|
186
186
|
};
|
|
187
187
|
DaemonMethods.prototype.getMemPool = function () {
|
|
188
|
-
return this.dataCall(
|
|
188
|
+
return this.dataCall(types_1.RPCMethod.GetMempool);
|
|
189
189
|
};
|
|
190
190
|
DaemonMethods.prototype.getTips = function () {
|
|
191
|
-
return this.dataCall(
|
|
191
|
+
return this.dataCall(types_1.RPCMethod.GetTips);
|
|
192
192
|
};
|
|
193
193
|
DaemonMethods.prototype.getDAGOrder = function (params) {
|
|
194
|
-
return this.dataCall(
|
|
194
|
+
return this.dataCall(types_1.RPCMethod.GetDAGOrder, params);
|
|
195
195
|
};
|
|
196
196
|
DaemonMethods.prototype.getBlocksRangeByTopoheight = function (params) {
|
|
197
|
-
return this.dataCall(
|
|
197
|
+
return this.dataCall(types_1.RPCMethod.GetBlocksRangeByTopoheight, params);
|
|
198
198
|
};
|
|
199
199
|
DaemonMethods.prototype.getBlocksRangeByHeight = function (params) {
|
|
200
|
-
return this.dataCall(
|
|
200
|
+
return this.dataCall(types_1.RPCMethod.GetBlocksRangeByHeight, params);
|
|
201
201
|
};
|
|
202
202
|
DaemonMethods.prototype.getTransactions = function (txHashes) {
|
|
203
|
-
return this.dataCall(
|
|
203
|
+
return this.dataCall(types_1.RPCMethod.GetTransactions, { tx_hashes: txHashes });
|
|
204
204
|
};
|
|
205
205
|
DaemonMethods.prototype.getAccountHistory = function (params) {
|
|
206
|
-
return this.dataCall(
|
|
206
|
+
return this.dataCall(types_1.RPCMethod.GetAccountHistory, params);
|
|
207
207
|
};
|
|
208
208
|
DaemonMethods.prototype.getAccountAssets = function (address) {
|
|
209
|
-
return this.dataCall(
|
|
209
|
+
return this.dataCall(types_1.RPCMethod.GetAccountAssets, { address: address });
|
|
210
210
|
};
|
|
211
211
|
DaemonMethods.prototype.getAccounts = function (params) {
|
|
212
|
-
return this.dataCall(
|
|
212
|
+
return this.dataCall(types_1.RPCMethod.GetAccounts, params);
|
|
213
213
|
};
|
|
214
214
|
DaemonMethods.prototype.isTxExecutedInBlock = function (params) {
|
|
215
|
-
return this.dataCall(
|
|
215
|
+
return this.dataCall(types_1.RPCMethod.IsTxExecutedInBlock, params);
|
|
216
216
|
};
|
|
217
217
|
DaemonMethods.prototype.getDevFeeThresholds = function () {
|
|
218
|
-
return this.dataCall(
|
|
218
|
+
return this.dataCall(types_1.RPCMethod.GetDevFeeThresholds);
|
|
219
219
|
};
|
|
220
220
|
DaemonMethods.prototype.getSizeOnDisk = function () {
|
|
221
|
-
return this.dataCall(
|
|
221
|
+
return this.dataCall(types_1.RPCMethod.GetSizeOnDisk);
|
|
222
222
|
};
|
|
223
223
|
DaemonMethods.prototype.getAccountRegistrationTopoheight = function (address) {
|
|
224
|
-
return this.dataCall(
|
|
224
|
+
return this.dataCall(types_1.RPCMethod.GetAccountRegistrationTopoheight, { address: address });
|
|
225
|
+
};
|
|
226
|
+
DaemonMethods.prototype.isAccountRegistered = function (params) {
|
|
227
|
+
return this.dataCall(types_1.RPCMethod.IsAccountRegistered, params);
|
|
228
|
+
};
|
|
229
|
+
DaemonMethods.prototype.getMempoolCacheResult = function (address) {
|
|
230
|
+
return this.dataCall(types_1.RPCMethod.GetMempoolCache, { address: address });
|
|
231
|
+
};
|
|
232
|
+
DaemonMethods.prototype.getDifficulty = function () {
|
|
233
|
+
return this.dataCall(types_1.RPCMethod.GetDifficulty);
|
|
234
|
+
};
|
|
235
|
+
DaemonMethods.prototype.validateAddress = function (params) {
|
|
236
|
+
return this.dataCall(types_1.RPCMethod.ValidateAddress, params);
|
|
237
|
+
};
|
|
238
|
+
DaemonMethods.prototype.extractKeyFromAddress = function (params) {
|
|
239
|
+
return this.dataCall(types_1.RPCMethod.ExtractKeyFromAddress, params);
|
|
240
|
+
};
|
|
241
|
+
DaemonMethods.prototype.createMinerWork = function (params) {
|
|
242
|
+
return this.dataCall(types_1.RPCMethod.CreateMinerWork, params);
|
|
225
243
|
};
|
|
226
244
|
return DaemonMethods;
|
|
227
245
|
}());
|
|
@@ -234,6 +252,6 @@ var WS = /** @class */ (function (_super) {
|
|
|
234
252
|
return _this;
|
|
235
253
|
}
|
|
236
254
|
return WS;
|
|
237
|
-
}(
|
|
255
|
+
}(websocket_1.WS));
|
|
238
256
|
exports.WS = WS;
|
|
239
257
|
exports["default"] = WS;
|
package/dist/cjs/react/daemon.js
CHANGED
|
@@ -74,9 +74,9 @@ exports.__esModule = true;
|
|
|
74
74
|
exports.useNodeSocket = exports.useNodeSocketSubscribe = exports.NodeSocketProvider = exports.INITIATING = void 0;
|
|
75
75
|
var react_1 = __importStar(require("react"));
|
|
76
76
|
var await_to_js_1 = __importDefault(require("await-to-js"));
|
|
77
|
-
var
|
|
77
|
+
var websocket_1 = __importDefault(require("../daemon/websocket"));
|
|
78
78
|
exports.INITIATING = -1;
|
|
79
|
-
var daemon = new
|
|
79
|
+
var daemon = new websocket_1["default"]();
|
|
80
80
|
var Context = (0, react_1.createContext)({
|
|
81
81
|
err: undefined,
|
|
82
82
|
daemon: daemon,
|
package/dist/cjs/wallet/rpc.js
CHANGED
|
@@ -53,8 +53,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
53
53
|
exports.__esModule = true;
|
|
54
54
|
exports.RPC = void 0;
|
|
55
55
|
var js_base64_1 = require("js-base64");
|
|
56
|
-
var
|
|
57
|
-
var
|
|
56
|
+
var types_1 = require("./types");
|
|
57
|
+
var rpc_1 = require("../lib/rpc");
|
|
58
58
|
var RPC = /** @class */ (function (_super) {
|
|
59
59
|
__extends(RPC, _super);
|
|
60
60
|
function RPC(endpoint, username, password) {
|
|
@@ -74,58 +74,64 @@ var RPC = /** @class */ (function (_super) {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
RPC.prototype.getVersion = function () {
|
|
77
|
-
return this.post(
|
|
77
|
+
return this.post(types_1.RPCMethod.GetVersion);
|
|
78
78
|
};
|
|
79
79
|
RPC.prototype.getNetwork = function () {
|
|
80
|
-
return this.post(
|
|
80
|
+
return this.post(types_1.RPCMethod.GetNetwork);
|
|
81
81
|
};
|
|
82
82
|
RPC.prototype.getNonce = function () {
|
|
83
|
-
return this.post(
|
|
83
|
+
return this.post(types_1.RPCMethod.GetNonce);
|
|
84
84
|
};
|
|
85
85
|
RPC.prototype.getTopoheight = function () {
|
|
86
|
-
return this.post(
|
|
86
|
+
return this.post(types_1.RPCMethod.GetTopoheight);
|
|
87
87
|
};
|
|
88
88
|
RPC.prototype.getAddress = function (params) {
|
|
89
89
|
if (params === void 0) { params = {}; }
|
|
90
|
-
return this.post(
|
|
90
|
+
return this.post(types_1.RPCMethod.GetAddress, params);
|
|
91
91
|
};
|
|
92
92
|
RPC.prototype.splitAddress = function (params) {
|
|
93
|
-
return this.post(
|
|
93
|
+
return this.post(types_1.RPCMethod.SplitAddress, params);
|
|
94
94
|
};
|
|
95
|
-
RPC.prototype.rescan = function () {
|
|
96
|
-
return this.post(
|
|
95
|
+
RPC.prototype.rescan = function (params) {
|
|
96
|
+
return this.post(types_1.RPCMethod.Rescan, params);
|
|
97
97
|
};
|
|
98
98
|
RPC.prototype.getBalance = function (asset) {
|
|
99
|
-
return this.post(
|
|
99
|
+
return this.post(types_1.RPCMethod.GetBalance, { asset: asset });
|
|
100
100
|
};
|
|
101
101
|
RPC.prototype.hasBalance = function (asset) {
|
|
102
|
-
return this.post(
|
|
102
|
+
return this.post(types_1.RPCMethod.HasBalance, { asset: asset });
|
|
103
103
|
};
|
|
104
104
|
RPC.prototype.getTrackedAssets = function () {
|
|
105
|
-
return this.post(
|
|
105
|
+
return this.post(types_1.RPCMethod.GetTrackedAssets);
|
|
106
106
|
};
|
|
107
107
|
RPC.prototype.getAssetPrecision = function (params) {
|
|
108
|
-
return this.post(
|
|
108
|
+
return this.post(types_1.RPCMethod.GetAssetPrecision, params);
|
|
109
109
|
};
|
|
110
110
|
RPC.prototype.getTransaction = function (hash) {
|
|
111
|
-
return this.post(
|
|
111
|
+
return this.post(types_1.RPCMethod.GetTransaction, { hash: hash });
|
|
112
112
|
};
|
|
113
113
|
RPC.prototype.buildTransaction = function (params) {
|
|
114
|
-
return this.post(
|
|
114
|
+
return this.post(types_1.RPCMethod.BuildTransaction, params);
|
|
115
115
|
};
|
|
116
116
|
RPC.prototype.listTransactions = function (params) {
|
|
117
|
-
return this.post(
|
|
117
|
+
return this.post(types_1.RPCMethod.ListTransactions, params);
|
|
118
118
|
};
|
|
119
119
|
RPC.prototype.isOnline = function () {
|
|
120
|
-
return this.post(
|
|
120
|
+
return this.post(types_1.RPCMethod.IsOnline);
|
|
121
121
|
};
|
|
122
122
|
RPC.prototype.signData = function (data) {
|
|
123
|
-
return this.post(
|
|
123
|
+
return this.post(types_1.RPCMethod.SignData, data);
|
|
124
124
|
};
|
|
125
|
-
RPC.prototype.estimateFees = function (
|
|
126
|
-
return this.post(
|
|
125
|
+
RPC.prototype.estimateFees = function (params) {
|
|
126
|
+
return this.post(types_1.RPCMethod.EstimateFees, params);
|
|
127
|
+
};
|
|
128
|
+
RPC.prototype.setOnlineMode = function (params) {
|
|
129
|
+
return this.post(types_1.RPCMethod.SetOnlineMode, params);
|
|
130
|
+
};
|
|
131
|
+
RPC.prototype.setOfflineMode = function () {
|
|
132
|
+
return this.post(types_1.RPCMethod.SetOfflineMode);
|
|
127
133
|
};
|
|
128
134
|
return RPC;
|
|
129
|
-
}(
|
|
135
|
+
}(rpc_1.RPC));
|
|
130
136
|
exports.RPC = RPC;
|
|
131
137
|
exports["default"] = RPC;
|
package/dist/cjs/wallet/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.Permission = exports.RPCMethod = void 0;
|
|
3
|
+
exports.Permission = exports.RPCEvent = exports.RPCMethod = void 0;
|
|
4
4
|
var RPCMethod;
|
|
5
5
|
(function (RPCMethod) {
|
|
6
6
|
RPCMethod["GetVersion"] = "get_version";
|
|
@@ -18,9 +18,21 @@ var RPCMethod;
|
|
|
18
18
|
RPCMethod["BuildTransaction"] = "build_transaction";
|
|
19
19
|
RPCMethod["ListTransactions"] = "list_transactions";
|
|
20
20
|
RPCMethod["IsOnline"] = "is_online";
|
|
21
|
+
RPCMethod["SetOnlineMode"] = "set_online_mode";
|
|
22
|
+
RPCMethod["SetOfflineMode"] = "set_offline_mode";
|
|
21
23
|
RPCMethod["SignData"] = "sign_data";
|
|
22
24
|
RPCMethod["EstimateFees"] = "estimate_fees";
|
|
23
25
|
})(RPCMethod = exports.RPCMethod || (exports.RPCMethod = {}));
|
|
26
|
+
var RPCEvent;
|
|
27
|
+
(function (RPCEvent) {
|
|
28
|
+
RPCEvent["NewTopoheight"] = "new_topoheight";
|
|
29
|
+
RPCEvent["NewAsset"] = "new_asset";
|
|
30
|
+
RPCEvent["NewTransaction"] = "";
|
|
31
|
+
RPCEvent["BalanceChanged"] = "balance_changed";
|
|
32
|
+
RPCEvent["Rescan"] = "rescan";
|
|
33
|
+
RPCEvent["Online"] = "online";
|
|
34
|
+
RPCEvent["Offline"] = "offline";
|
|
35
|
+
})(RPCEvent = exports.RPCEvent || (exports.RPCEvent = {}));
|
|
24
36
|
var Permission;
|
|
25
37
|
(function (Permission) {
|
|
26
38
|
Permission[Permission["Ask"] = 0] = "Ask";
|