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