@xelis/sdk 0.9.11 → 0.10.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/dist/cjs/address/address.js +55 -0
- package/dist/cjs/address/bech32.js +167 -0
- package/dist/cjs/config.js +4 -2
- package/dist/cjs/daemon/rpc.js +122 -71
- package/dist/cjs/daemon/types.js +44 -24
- package/dist/cjs/daemon/websocket.js +129 -105
- package/dist/cjs/data/element.js +84 -0
- package/dist/cjs/data/value.js +327 -0
- package/dist/cjs/{lib/rpc.js → rpc/http.js} +68 -18
- package/dist/cjs/rpc/parse_json/parse_json.js +15 -0
- package/dist/cjs/{lib → rpc}/websocket.js +119 -79
- package/dist/cjs/wallet/rpc.js +81 -70
- package/dist/cjs/wallet/types.js +44 -1
- package/dist/cjs/wallet/websocket.js +77 -14
- package/dist/cjs/xswd/websocket.js +3 -3
- package/dist/esm/address/address.js +53 -0
- package/dist/esm/address/bech32.js +161 -0
- package/dist/esm/config.js +3 -1
- package/dist/esm/daemon/rpc.js +122 -71
- package/dist/esm/daemon/types.js +44 -24
- package/dist/esm/daemon/websocket.js +130 -106
- package/dist/esm/data/element.js +81 -0
- package/dist/esm/data/value.js +324 -0
- package/dist/esm/{lib/rpc.js → rpc/http.js} +67 -17
- package/dist/esm/rpc/parse_json/parse_json.js +8 -0
- package/dist/esm/{lib → rpc}/websocket.js +118 -78
- package/dist/esm/wallet/rpc.js +81 -70
- package/dist/esm/wallet/types.js +43 -0
- package/dist/esm/wallet/websocket.js +77 -14
- package/dist/esm/xswd/websocket.js +3 -3
- package/dist/types/address/address.d.ts +12 -0
- package/dist/types/address/bech32.d.ts +6 -0
- package/dist/types/config.d.ts +2 -0
- package/dist/types/daemon/rpc.d.ts +68 -51
- package/dist/types/daemon/types.d.ts +216 -44
- package/dist/types/daemon/websocket.d.ts +77 -56
- package/dist/types/data/element.d.ts +20 -0
- package/dist/types/data/value.d.ts +50 -0
- package/dist/types/rpc/http.d.ts +9 -0
- package/dist/types/rpc/parse_json/parse_json.d.ts +1 -0
- package/dist/types/{lib → rpc}/websocket.d.ts +14 -10
- package/dist/types/wallet/rpc.d.ts +45 -26
- package/dist/types/wallet/types.d.ts +244 -21
- package/dist/types/wallet/websocket.d.ts +47 -22
- package/dist/types/xswd/websocket.d.ts +3 -3
- package/package.json +5 -4
- package/dist/cjs/lib/parse_data.js +0 -15
- package/dist/esm/lib/parse_data.js +0 -11
- package/dist/types/lib/parse_data.d.ts +0 -1
- package/dist/types/lib/rpc.d.ts +0 -7
- /package/dist/cjs/{lib → rpc}/types.js +0 -0
- /package/dist/esm/{lib → rpc}/types.js +0 -0
- /package/dist/types/{lib → rpc}/types.d.ts +0 -0
|
@@ -13,98 +13,68 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
-
function step(op) {
|
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
-
switch (op[0]) {
|
|
35
|
-
case 0: case 1: t = op; break;
|
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
46
|
-
}
|
|
47
|
-
op = body.call(thisArg, _);
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
import { RPCEvent, RPCMethod } from './types.js';
|
|
53
|
-
import { WS as BaseWS } from '../lib/websocket.js';
|
|
16
|
+
import { RPCMethod, RPCEvent } from './types.js';
|
|
17
|
+
import { WSRPC } from '../rpc/websocket.js';
|
|
54
18
|
var DaemonMethods = /** @class */ (function () {
|
|
55
19
|
function DaemonMethods(ws, prefix) {
|
|
56
20
|
if (prefix === void 0) { prefix = ""; }
|
|
57
21
|
this.ws = ws;
|
|
58
22
|
this.prefix = prefix;
|
|
59
23
|
}
|
|
60
|
-
DaemonMethods.prototype.listenEvent = function (event, onData) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
return [2 /*return*/, this.ws.listenEvent(this.prefix + event, onData)];
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
24
|
DaemonMethods.prototype.dataCall = function (method, params) {
|
|
68
25
|
return this.ws.dataCall(this.prefix + method, params);
|
|
69
26
|
};
|
|
70
27
|
DaemonMethods.prototype.onNewBlock = function (onData) {
|
|
71
|
-
return this.listenEvent(RPCEvent.NewBlock, onData);
|
|
28
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.NewBlock, onData);
|
|
29
|
+
};
|
|
30
|
+
DaemonMethods.prototype.onBlockOrdered = function (onData) {
|
|
31
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.BlockOrdered, onData);
|
|
32
|
+
};
|
|
33
|
+
DaemonMethods.prototype.onBlockOrphaned = function (onData) {
|
|
34
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.BlockOrphaned, onData);
|
|
35
|
+
};
|
|
36
|
+
DaemonMethods.prototype.onStableHeightChanged = function (onData) {
|
|
37
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.StableHeightChanged, onData);
|
|
38
|
+
};
|
|
39
|
+
DaemonMethods.prototype.onStableTopoHeightChanged = function (onData) {
|
|
40
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.StableTopoHeightChanged, onData);
|
|
41
|
+
};
|
|
42
|
+
DaemonMethods.prototype.onTransactionOrphaned = function (onData) {
|
|
43
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.TransactionOrphaned, onData);
|
|
72
44
|
};
|
|
73
45
|
DaemonMethods.prototype.onTransactionAddedInMempool = function (onData) {
|
|
74
|
-
return this.listenEvent(RPCEvent.TransactionAddedInMempool, onData);
|
|
46
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.TransactionAddedInMempool, onData);
|
|
75
47
|
};
|
|
76
48
|
DaemonMethods.prototype.onTransactionExecuted = function (onData) {
|
|
77
|
-
return this.listenEvent(RPCEvent.TransactionExecuted, onData);
|
|
49
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.TransactionExecuted, onData);
|
|
78
50
|
};
|
|
79
|
-
DaemonMethods.prototype.
|
|
80
|
-
|
|
51
|
+
DaemonMethods.prototype.onInvokeContract = function (contract, onData) {
|
|
52
|
+
var _a;
|
|
53
|
+
return this.ws.listenEvent((_a = {}, _a[this.prefix + RPCEvent.InvokeContract] = { contract: contract }, _a), onData);
|
|
81
54
|
};
|
|
82
|
-
DaemonMethods.prototype.
|
|
83
|
-
return this.listenEvent(RPCEvent.
|
|
55
|
+
DaemonMethods.prototype.onDeployContract = function (onData) {
|
|
56
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.DeployContract, onData);
|
|
84
57
|
};
|
|
85
|
-
DaemonMethods.prototype.
|
|
86
|
-
return this.listenEvent(RPCEvent.
|
|
58
|
+
DaemonMethods.prototype.onNewAsset = function (onData) {
|
|
59
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.NewAsset, onData);
|
|
87
60
|
};
|
|
88
|
-
DaemonMethods.prototype.
|
|
89
|
-
return this.listenEvent(RPCEvent.
|
|
61
|
+
DaemonMethods.prototype.onPeerConnected = function (onData) {
|
|
62
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.PeerConnected, onData);
|
|
90
63
|
};
|
|
91
|
-
DaemonMethods.prototype.
|
|
92
|
-
return this.listenEvent(RPCEvent.
|
|
64
|
+
DaemonMethods.prototype.onPeerDisconnected = function (onData) {
|
|
65
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.PeerDisconnected, onData);
|
|
93
66
|
};
|
|
94
67
|
DaemonMethods.prototype.onPeerStateUpdated = function (onData) {
|
|
95
|
-
return this.listenEvent(RPCEvent.PeerStateUpdated, onData);
|
|
68
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.PeerStateUpdated, onData);
|
|
96
69
|
};
|
|
97
|
-
DaemonMethods.prototype.
|
|
98
|
-
return this.listenEvent(RPCEvent.
|
|
99
|
-
};
|
|
100
|
-
DaemonMethods.prototype.onBlockOrphaned = function (onData) {
|
|
101
|
-
return this.listenEvent(RPCEvent.BlockOrphaned, onData);
|
|
70
|
+
DaemonMethods.prototype.onPeerPeerListUpdated = function (onData) {
|
|
71
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.PeerPeerListUpdated, onData);
|
|
102
72
|
};
|
|
103
|
-
DaemonMethods.prototype.
|
|
104
|
-
return this.listenEvent(RPCEvent.
|
|
73
|
+
DaemonMethods.prototype.onPeerPeerDisconnected = function (onData) {
|
|
74
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.PeerPeerDisconnected, onData);
|
|
105
75
|
};
|
|
106
|
-
DaemonMethods.prototype.
|
|
107
|
-
return this.listenEvent(RPCEvent.
|
|
76
|
+
DaemonMethods.prototype.onNewBlockTemplate = function (onData) {
|
|
77
|
+
return this.ws.listenEvent(this.prefix + RPCEvent.NewBlockTemplate, onData);
|
|
108
78
|
};
|
|
109
79
|
DaemonMethods.prototype.getVersion = function () {
|
|
110
80
|
return this.dataCall(RPCMethod.GetVersion);
|
|
@@ -115,17 +85,32 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
115
85
|
DaemonMethods.prototype.getTopoheight = function () {
|
|
116
86
|
return this.dataCall(RPCMethod.GetTopoheight);
|
|
117
87
|
};
|
|
88
|
+
DaemonMethods.prototype.getPrunedTopoheight = function () {
|
|
89
|
+
return this.dataCall(RPCMethod.GetPrunedTopoheight);
|
|
90
|
+
};
|
|
91
|
+
DaemonMethods.prototype.getInfo = function () {
|
|
92
|
+
return this.dataCall(RPCMethod.GetInfo);
|
|
93
|
+
};
|
|
94
|
+
DaemonMethods.prototype.getDifficulty = function () {
|
|
95
|
+
return this.dataCall(RPCMethod.GetDifficulty);
|
|
96
|
+
};
|
|
97
|
+
DaemonMethods.prototype.getTips = function () {
|
|
98
|
+
return this.dataCall(RPCMethod.GetTips);
|
|
99
|
+
};
|
|
100
|
+
DaemonMethods.prototype.getDevFeeThresholds = function () {
|
|
101
|
+
return this.dataCall(RPCMethod.GetDevFeeThresholds);
|
|
102
|
+
};
|
|
103
|
+
DaemonMethods.prototype.getSizeOnDisk = function () {
|
|
104
|
+
return this.dataCall(RPCMethod.GetSizeOnDisk);
|
|
105
|
+
};
|
|
118
106
|
DaemonMethods.prototype.getStableHeight = function () {
|
|
119
107
|
return this.dataCall(RPCMethod.GetStableHeight);
|
|
120
108
|
};
|
|
121
109
|
DaemonMethods.prototype.getStableTopoheight = function () {
|
|
122
110
|
return this.dataCall(RPCMethod.GetStableTopoheight);
|
|
123
111
|
};
|
|
124
|
-
DaemonMethods.prototype.
|
|
125
|
-
return this.dataCall(RPCMethod.
|
|
126
|
-
};
|
|
127
|
-
DaemonMethods.prototype.getBlockTemplate = function (address) {
|
|
128
|
-
return this.dataCall(RPCMethod.GetBlockTemplate, { address: address });
|
|
112
|
+
DaemonMethods.prototype.getHardForks = function () {
|
|
113
|
+
return this.dataCall(RPCMethod.GetHardForks);
|
|
129
114
|
};
|
|
130
115
|
DaemonMethods.prototype.getBlockAtTopoheight = function (params) {
|
|
131
116
|
return this.dataCall(RPCMethod.GetBlockAtTopoheight, params);
|
|
@@ -139,27 +124,27 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
139
124
|
DaemonMethods.prototype.getTopBlock = function (params) {
|
|
140
125
|
return this.dataCall(RPCMethod.GetTopBlock, params);
|
|
141
126
|
};
|
|
142
|
-
DaemonMethods.prototype.submitBlock = function (params) {
|
|
143
|
-
return this.dataCall(RPCMethod.SubmitBlock, params);
|
|
144
|
-
};
|
|
145
127
|
DaemonMethods.prototype.getBalance = function (params) {
|
|
146
128
|
return this.dataCall(RPCMethod.GetBalance, params);
|
|
147
129
|
};
|
|
130
|
+
DaemonMethods.prototype.getStableBalance = function (params) {
|
|
131
|
+
return this.dataCall(RPCMethod.GetStableBalance, params);
|
|
132
|
+
};
|
|
148
133
|
DaemonMethods.prototype.hasBalance = function (params) {
|
|
149
134
|
return this.dataCall(RPCMethod.HasBalance, params);
|
|
150
135
|
};
|
|
151
136
|
DaemonMethods.prototype.getBalanceAtTopoheight = function (params) {
|
|
152
137
|
return this.dataCall(RPCMethod.GetBalanceAtTopoheight, params);
|
|
153
138
|
};
|
|
154
|
-
DaemonMethods.prototype.getInfo = function () {
|
|
155
|
-
return this.dataCall(RPCMethod.GetInfo);
|
|
156
|
-
};
|
|
157
139
|
DaemonMethods.prototype.getNonce = function (params) {
|
|
158
140
|
return this.dataCall(RPCMethod.GetNonce, params);
|
|
159
141
|
};
|
|
160
142
|
DaemonMethods.prototype.hasNonce = function (params) {
|
|
161
143
|
return this.dataCall(RPCMethod.HasNonce, params);
|
|
162
144
|
};
|
|
145
|
+
DaemonMethods.prototype.getNonceAtTopoheight = function (params) {
|
|
146
|
+
return this.dataCall(RPCMethod.GetNonceAtTopoheight, params);
|
|
147
|
+
};
|
|
163
148
|
DaemonMethods.prototype.getAsset = function (params) {
|
|
164
149
|
return this.dataCall(RPCMethod.GetAsset, params);
|
|
165
150
|
};
|
|
@@ -169,18 +154,30 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
169
154
|
DaemonMethods.prototype.countAssets = function () {
|
|
170
155
|
return this.dataCall(RPCMethod.CountAssets);
|
|
171
156
|
};
|
|
157
|
+
DaemonMethods.prototype.countTransactions = function () {
|
|
158
|
+
return this.dataCall(RPCMethod.CountTransactions);
|
|
159
|
+
};
|
|
172
160
|
DaemonMethods.prototype.countAccounts = function () {
|
|
173
161
|
return this.dataCall(RPCMethod.CountAccounts);
|
|
174
162
|
};
|
|
175
|
-
DaemonMethods.prototype.
|
|
176
|
-
return this.dataCall(RPCMethod.
|
|
163
|
+
DaemonMethods.prototype.countContracts = function () {
|
|
164
|
+
return this.dataCall(RPCMethod.CountContracts);
|
|
177
165
|
};
|
|
178
166
|
DaemonMethods.prototype.submitTransaction = function (hexData) {
|
|
179
167
|
return this.dataCall(RPCMethod.SubmitTransaction, { data: hexData });
|
|
180
168
|
};
|
|
169
|
+
DaemonMethods.prototype.getTransactionExecutor = function (hash) {
|
|
170
|
+
return this.dataCall(RPCMethod.GetTransactionExecutor, { hash: hash });
|
|
171
|
+
};
|
|
181
172
|
DaemonMethods.prototype.getTransaction = function (hash) {
|
|
182
173
|
return this.dataCall(RPCMethod.GetTransaction, { hash: hash });
|
|
183
174
|
};
|
|
175
|
+
DaemonMethods.prototype.getTransactions = function (txHashes) {
|
|
176
|
+
return this.dataCall(RPCMethod.GetTransactions, { tx_hashes: txHashes });
|
|
177
|
+
};
|
|
178
|
+
DaemonMethods.prototype.isTxExecutedInBlock = function (params) {
|
|
179
|
+
return this.dataCall(RPCMethod.IsTxExecutedInBlock, params);
|
|
180
|
+
};
|
|
184
181
|
DaemonMethods.prototype.p2pStatus = function () {
|
|
185
182
|
return this.dataCall(RPCMethod.P2PStatus);
|
|
186
183
|
};
|
|
@@ -190,8 +187,11 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
190
187
|
DaemonMethods.prototype.getMemPool = function () {
|
|
191
188
|
return this.dataCall(RPCMethod.GetMempool);
|
|
192
189
|
};
|
|
193
|
-
DaemonMethods.prototype.
|
|
194
|
-
return this.dataCall(RPCMethod.
|
|
190
|
+
DaemonMethods.prototype.getMempoolCache = function (address) {
|
|
191
|
+
return this.dataCall(RPCMethod.GetMempoolCache, { address: address });
|
|
192
|
+
};
|
|
193
|
+
DaemonMethods.prototype.getEstimatedFeeRates = function () {
|
|
194
|
+
return this.dataCall(RPCMethod.GetEstimatedFeeRates);
|
|
195
195
|
};
|
|
196
196
|
DaemonMethods.prototype.getDAGOrder = function (params) {
|
|
197
197
|
return this.dataCall(RPCMethod.GetDAGOrder, params);
|
|
@@ -202,9 +202,6 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
202
202
|
DaemonMethods.prototype.getBlocksRangeByHeight = function (params) {
|
|
203
203
|
return this.dataCall(RPCMethod.GetBlocksRangeByHeight, params);
|
|
204
204
|
};
|
|
205
|
-
DaemonMethods.prototype.getTransactions = function (txHashes) {
|
|
206
|
-
return this.dataCall(RPCMethod.GetTransactions, { tx_hashes: txHashes });
|
|
207
|
-
};
|
|
208
205
|
DaemonMethods.prototype.getAccountHistory = function (params) {
|
|
209
206
|
return this.dataCall(RPCMethod.GetAccountHistory, params);
|
|
210
207
|
};
|
|
@@ -214,38 +211,65 @@ var DaemonMethods = /** @class */ (function () {
|
|
|
214
211
|
DaemonMethods.prototype.getAccounts = function (params) {
|
|
215
212
|
return this.dataCall(RPCMethod.GetAccounts, params);
|
|
216
213
|
};
|
|
217
|
-
DaemonMethods.prototype.isTxExecutedInBlock = function (params) {
|
|
218
|
-
return this.dataCall(RPCMethod.IsTxExecutedInBlock, params);
|
|
219
|
-
};
|
|
220
|
-
DaemonMethods.prototype.getDevFeeThresholds = function () {
|
|
221
|
-
return this.dataCall(RPCMethod.GetDevFeeThresholds);
|
|
222
|
-
};
|
|
223
|
-
DaemonMethods.prototype.getSizeOnDisk = function () {
|
|
224
|
-
return this.dataCall(RPCMethod.GetSizeOnDisk);
|
|
225
|
-
};
|
|
226
|
-
DaemonMethods.prototype.getAccountRegistrationTopoheight = function (address) {
|
|
227
|
-
return this.dataCall(RPCMethod.GetAccountRegistrationTopoheight, { address: address });
|
|
228
|
-
};
|
|
229
214
|
DaemonMethods.prototype.isAccountRegistered = function (params) {
|
|
230
215
|
return this.dataCall(RPCMethod.IsAccountRegistered, params);
|
|
231
216
|
};
|
|
232
|
-
DaemonMethods.prototype.
|
|
233
|
-
return this.dataCall(RPCMethod.
|
|
234
|
-
};
|
|
235
|
-
DaemonMethods.prototype.getDifficulty = function () {
|
|
236
|
-
return this.dataCall(RPCMethod.GetDifficulty);
|
|
217
|
+
DaemonMethods.prototype.getAccountRegistrationTopoheight = function (address) {
|
|
218
|
+
return this.dataCall(RPCMethod.GetAccountRegistrationTopoheight, { address: address });
|
|
237
219
|
};
|
|
238
220
|
DaemonMethods.prototype.validateAddress = function (params) {
|
|
239
221
|
return this.dataCall(RPCMethod.ValidateAddress, params);
|
|
240
222
|
};
|
|
223
|
+
DaemonMethods.prototype.splitAddress = function (params) {
|
|
224
|
+
return this.dataCall(RPCMethod.SplitAddress, params);
|
|
225
|
+
};
|
|
241
226
|
DaemonMethods.prototype.extractKeyFromAddress = function (params) {
|
|
242
227
|
return this.dataCall(RPCMethod.ExtractKeyFromAddress, params);
|
|
243
228
|
};
|
|
229
|
+
DaemonMethods.prototype.makeIntegratedAddress = function (params) {
|
|
230
|
+
return this.dataCall(RPCMethod.MakeIntegratedAddress, params);
|
|
231
|
+
};
|
|
232
|
+
DaemonMethods.prototype.decryptExtraData = function (params) {
|
|
233
|
+
return this.dataCall(RPCMethod.DecryptExtraData, params);
|
|
234
|
+
};
|
|
235
|
+
DaemonMethods.prototype.getMultisigAtTopoheight = function (params) {
|
|
236
|
+
return this.dataCall(RPCMethod.GetMultisigAtTopoheight, params);
|
|
237
|
+
};
|
|
238
|
+
DaemonMethods.prototype.getMultisig = function (params) {
|
|
239
|
+
return this.dataCall(RPCMethod.GetMultisig, params);
|
|
240
|
+
};
|
|
241
|
+
DaemonMethods.prototype.hasMultisig = function (params) {
|
|
242
|
+
return this.dataCall(RPCMethod.HasMultisig, params);
|
|
243
|
+
};
|
|
244
|
+
DaemonMethods.prototype.hasMultisigAtTopoheight = function (params) {
|
|
245
|
+
return this.dataCall(RPCMethod.HasMultisigAtTopoheight, params);
|
|
246
|
+
};
|
|
247
|
+
DaemonMethods.prototype.getContractOutputs = function (params) {
|
|
248
|
+
return this.dataCall(RPCMethod.GetContractOutputs, params);
|
|
249
|
+
};
|
|
250
|
+
DaemonMethods.prototype.getContractModule = function (params) {
|
|
251
|
+
return this.dataCall(RPCMethod.GetContractModule, params);
|
|
252
|
+
};
|
|
253
|
+
DaemonMethods.prototype.getContractData = function (params) {
|
|
254
|
+
return this.dataCall(RPCMethod.GetContractData, params);
|
|
255
|
+
};
|
|
256
|
+
DaemonMethods.prototype.getContractDataAtTopoheight = function (params) {
|
|
257
|
+
return this.dataCall(RPCMethod.GetContractDataAtTopoheight, params);
|
|
258
|
+
};
|
|
259
|
+
DaemonMethods.prototype.getContractBalance = function (params) {
|
|
260
|
+
return this.dataCall(RPCMethod.GetContractBalance, params);
|
|
261
|
+
};
|
|
262
|
+
DaemonMethods.prototype.getContractBalanceAtTopoheight = function (params) {
|
|
263
|
+
return this.dataCall(RPCMethod.GetContractBalanceAtTopoheight, params);
|
|
264
|
+
};
|
|
265
|
+
DaemonMethods.prototype.getBlockTemplate = function (address) {
|
|
266
|
+
return this.dataCall(RPCMethod.GetBlockTemplate, { address: address });
|
|
267
|
+
};
|
|
244
268
|
DaemonMethods.prototype.getMinerWork = function (params) {
|
|
245
269
|
return this.dataCall(RPCMethod.GetMinerWork, params);
|
|
246
270
|
};
|
|
247
|
-
DaemonMethods.prototype.
|
|
248
|
-
return this.dataCall(RPCMethod.
|
|
271
|
+
DaemonMethods.prototype.submitBlock = function (params) {
|
|
272
|
+
return this.dataCall(RPCMethod.SubmitBlock, params);
|
|
249
273
|
};
|
|
250
274
|
return DaemonMethods;
|
|
251
275
|
}());
|
|
@@ -258,6 +282,6 @@ var WS = /** @class */ (function (_super) {
|
|
|
258
282
|
return _this;
|
|
259
283
|
}
|
|
260
284
|
return WS;
|
|
261
|
-
}(
|
|
285
|
+
}(WSRPC));
|
|
262
286
|
export { WS };
|
|
263
287
|
export default WS;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Value, ValueReader, ValueWriter } from "./value.js";
|
|
2
|
+
export var ElementType;
|
|
3
|
+
(function (ElementType) {
|
|
4
|
+
ElementType[ElementType["Value"] = 0] = "Value";
|
|
5
|
+
ElementType[ElementType["Array"] = 1] = "Array";
|
|
6
|
+
ElementType[ElementType["Fields"] = 2] = "Fields";
|
|
7
|
+
})(ElementType || (ElementType = {}));
|
|
8
|
+
var Element = /** @class */ (function () {
|
|
9
|
+
function Element() {
|
|
10
|
+
}
|
|
11
|
+
Element.v = function (data) {
|
|
12
|
+
var element = new Element();
|
|
13
|
+
element.value = Value["new"](data);
|
|
14
|
+
return element;
|
|
15
|
+
};
|
|
16
|
+
Element.value = function (value) {
|
|
17
|
+
var element = new Element();
|
|
18
|
+
element.value = value;
|
|
19
|
+
return element;
|
|
20
|
+
};
|
|
21
|
+
Element.array = function (arr) {
|
|
22
|
+
var element = new Element();
|
|
23
|
+
element.array = arr;
|
|
24
|
+
return element;
|
|
25
|
+
};
|
|
26
|
+
Element.fields = function (fields) {
|
|
27
|
+
var element = new Element();
|
|
28
|
+
element.fields = fields;
|
|
29
|
+
return element;
|
|
30
|
+
};
|
|
31
|
+
Element.prototype.validate = function () {
|
|
32
|
+
var count = 0;
|
|
33
|
+
var eType = 0;
|
|
34
|
+
if (this.value) {
|
|
35
|
+
count++;
|
|
36
|
+
eType = ElementType.Value;
|
|
37
|
+
}
|
|
38
|
+
if (this.array) {
|
|
39
|
+
count++;
|
|
40
|
+
eType = ElementType.Array;
|
|
41
|
+
}
|
|
42
|
+
if (this.fields) {
|
|
43
|
+
count++;
|
|
44
|
+
eType = ElementType.Fields;
|
|
45
|
+
}
|
|
46
|
+
if (count > 1) {
|
|
47
|
+
throw "only one field (Value, Array, or Fields) must be set";
|
|
48
|
+
}
|
|
49
|
+
return eType;
|
|
50
|
+
};
|
|
51
|
+
Element.fromBytes = function (data) {
|
|
52
|
+
var reader = new ValueReader(data);
|
|
53
|
+
return reader.read();
|
|
54
|
+
};
|
|
55
|
+
Element.prototype.toBytes = function () {
|
|
56
|
+
var writer = new ValueWriter();
|
|
57
|
+
writer.write(this);
|
|
58
|
+
return new Uint8Array(writer.data);
|
|
59
|
+
};
|
|
60
|
+
Element.prototype.toObject = function () {
|
|
61
|
+
var vType = this.validate();
|
|
62
|
+
switch (vType) {
|
|
63
|
+
case ElementType.Value:
|
|
64
|
+
return this.value.data;
|
|
65
|
+
case ElementType.Array:
|
|
66
|
+
var arr_1 = [];
|
|
67
|
+
this.array.forEach(function (item) {
|
|
68
|
+
arr_1.push(item.toObject());
|
|
69
|
+
});
|
|
70
|
+
return arr_1;
|
|
71
|
+
case ElementType.Fields:
|
|
72
|
+
var obj_1 = {};
|
|
73
|
+
this.fields.forEach(function (item, key) {
|
|
74
|
+
obj_1[key.data] = item.toObject();
|
|
75
|
+
});
|
|
76
|
+
return obj_1;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return Element;
|
|
80
|
+
}());
|
|
81
|
+
export { Element };
|