@super-protocol/sdk-js 0.12.8-beta.2 → 0.13.0-beta.0

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 (77) hide show
  1. package/build/TIIGenerator.js +16 -14
  2. package/build/connectors/BlockchainConnector.d.ts +1 -1
  3. package/build/connectors/BlockchainConnector.js +6 -4
  4. package/build/contracts/app.json +3581 -1393
  5. package/build/crypto/Crypto.d.ts +3 -3
  6. package/build/crypto/Crypto.js +3 -3
  7. package/build/crypto/nodejs/AES.d.ts +1 -1
  8. package/build/crypto/nodejs/AES.js +1 -1
  9. package/build/crypto/nodejs/ARIA.d.ts +1 -1
  10. package/build/crypto/nodejs/ARIA.js +1 -1
  11. package/build/index.d.ts +15 -15
  12. package/build/index.js +20 -22
  13. package/build/models/Offer.d.ts +47 -4
  14. package/build/models/Offer.js +159 -21
  15. package/build/models/Order.d.ts +29 -17
  16. package/build/models/Order.js +103 -74
  17. package/build/models/Provider.js +4 -2
  18. package/build/models/TeeOffer.d.ts +92 -11
  19. package/build/models/TeeOffer.js +305 -53
  20. package/build/providers/storage/ChunksDownloadDecorator.d.ts +0 -2
  21. package/build/providers/storage/ChunksDownloadDecorator.js +0 -3
  22. package/build/providers/storage/IStorageProvider.d.ts +0 -2
  23. package/build/providers/storage/StorjStorageProvider.d.ts +0 -2
  24. package/build/providers/storage/StorjStorageProvider.js +0 -15
  25. package/build/staticModels/Deposits.d.ts +71 -0
  26. package/build/staticModels/Deposits.js +303 -0
  27. package/build/staticModels/Offers.d.ts +58 -0
  28. package/build/staticModels/{OffersFactory.js → Offers.js} +115 -14
  29. package/build/staticModels/{OrdersFactory.d.ts → Orders.d.ts} +36 -43
  30. package/build/staticModels/{OrdersFactory.js → Orders.js} +103 -125
  31. package/build/staticModels/ProviderRegistry.d.ts +1 -1
  32. package/build/staticModels/ProviderRegistry.js +1 -1
  33. package/build/staticModels/Superpro.d.ts +2 -2
  34. package/build/staticModels/Superpro.js +1 -1
  35. package/build/staticModels/TeeOffers.d.ts +101 -0
  36. package/build/staticModels/TeeOffers.js +455 -0
  37. package/build/types/DepositInfo.d.ts +10 -0
  38. package/build/types/DepositInfo.js +9 -0
  39. package/build/types/Events.d.ts +0 -12
  40. package/build/types/HardwareInfo.d.ts +19 -0
  41. package/build/types/HardwareInfo.js +10 -0
  42. package/build/types/Offer.d.ts +0 -7
  43. package/build/types/Offer.js +0 -3
  44. package/build/types/OptionInfo.d.ts +10 -0
  45. package/build/types/OptionInfo.js +9 -0
  46. package/build/types/Order.d.ts +5 -1
  47. package/build/types/SlotInfo.d.ts +12 -0
  48. package/build/types/SlotInfo.js +10 -0
  49. package/build/types/SlotUsage.d.ts +16 -0
  50. package/build/types/SlotUsage.js +15 -0
  51. package/build/types/Superpro.d.ts +0 -14
  52. package/build/types/Superpro.js +1 -16
  53. package/build/types/TeeOfferInfo.d.ts +31 -0
  54. package/build/types/{TeeOffer.js → TeeOfferInfo.js} +2 -4
  55. package/build/types/TeeOfferOption.d.ts +21 -0
  56. package/build/types/TeeOfferOption.js +11 -0
  57. package/build/types/TeeOfferSlot.d.ts +22 -0
  58. package/build/types/TeeOfferSlot.js +11 -0
  59. package/build/types/ValueOfferSlot.d.ts +29 -0
  60. package/build/types/ValueOfferSlot.js +13 -0
  61. package/build/utils.d.ts +1 -0
  62. package/build/utils.js +5 -1
  63. package/package.json +1 -1
  64. package/build/models/Ballot.d.ts +0 -13
  65. package/build/models/Ballot.js +0 -70
  66. package/build/staticModels/OffersFactory.d.ts +0 -32
  67. package/build/staticModels/Staking.d.ts +0 -20
  68. package/build/staticModels/Staking.js +0 -116
  69. package/build/staticModels/TeeOffersFactory.d.ts +0 -36
  70. package/build/staticModels/TeeOffersFactory.js +0 -211
  71. package/build/staticModels/Voting.d.ts +0 -29
  72. package/build/staticModels/Voting.js +0 -91
  73. package/build/types/Ballot.d.ts +0 -75
  74. package/build/types/Ballot.js +0 -49
  75. package/build/types/Staking.d.ts +0 -27
  76. package/build/types/Staking.js +0 -22
  77. package/build/types/TeeOffer.d.ts +0 -25
@@ -48,11 +48,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
48
48
  var logger_1 = __importDefault(require("../logger"));
49
49
  var app_json_1 = __importDefault(require("../contracts/app.json"));
50
50
  var utils_1 = require("../utils");
51
- var TeeOffer_1 = require("../types/TeeOffer");
51
+ var TeeOfferInfo_1 = require("../types/TeeOfferInfo");
52
52
  var Origins_1 = require("../types/Origins");
53
53
  var Superpro_1 = __importDefault(require("../staticModels/Superpro"));
54
54
  var BlockchainConnector_1 = __importDefault(require("../connectors/BlockchainConnector"));
55
55
  var TxManager_1 = __importDefault(require("../utils/TxManager"));
56
+ var HardwareInfo_1 = require("../types/HardwareInfo");
57
+ var TeeOfferOption_1 = require("../types/TeeOfferOption");
58
+ var TeeOfferSlot_1 = require("../types/TeeOfferSlot");
59
+ var OptionInfo_1 = require("../types/OptionInfo");
60
+ var SlotUsage_1 = require("../types/SlotUsage");
61
+ var utils_2 = require("ethers/lib/utils");
62
+ var SlotInfo_1 = require("../types/SlotInfo");
56
63
  var TeeOffer = /** @class */ (function () {
57
64
  function TeeOffer(offerId) {
58
65
  this.id = offerId;
@@ -102,33 +109,275 @@ var TeeOffer = /** @class */ (function () {
102
109
  */
103
110
  TeeOffer.prototype.getInfo = function () {
104
111
  return __awaiter(this, void 0, void 0, function () {
105
- var _a, teeOfferInfoParams, enabled;
112
+ var _a, teeOfferInfoParams;
106
113
  return __generator(this, function (_b) {
107
114
  switch (_b.label) {
108
115
  case 0: return [4 /*yield*/, TeeOffer.contract.methods.getTeeOffer(this.id).call()];
109
116
  case 1:
110
- _a = _b.sent(), teeOfferInfoParams = _a[2], enabled = _a[3];
111
- this.offerInfo = (0, utils_1.tupleToObject)(teeOfferInfoParams, TeeOffer_1.TeeOfferInfoStructure);
112
- this.offerInfo.enabled = enabled;
117
+ _a = _b.sent(), teeOfferInfoParams = _a[2];
118
+ this.offerInfo = (0, utils_1.tupleToObject)(teeOfferInfoParams, TeeOfferInfo_1.TeeOfferInfoStructure);
113
119
  return [2 /*return*/, this.offerInfo];
114
120
  }
115
121
  });
116
122
  });
117
123
  };
118
124
  /**
119
- * Function for fetching TEE offer provider from blockchain
125
+ * Function for fetching TEE offer hardware info from blockchain
120
126
  */
121
- TeeOffer.prototype.getProvider = function () {
127
+ TeeOffer.prototype.getHardwareInfo = function () {
122
128
  return __awaiter(this, void 0, void 0, function () {
123
- var _a;
124
- return __generator(this, function (_b) {
125
- switch (_b.label) {
129
+ var hardwareInfo;
130
+ return __generator(this, function (_a) {
131
+ switch (_a.label) {
132
+ case 0: return [4 /*yield*/, TeeOffer.contract.methods.getTeeOfferHardwareInfo(this.id).call()];
133
+ case 1:
134
+ hardwareInfo = _a.sent();
135
+ return [2 /*return*/, (0, utils_1.tupleToObject)(hardwareInfo, HardwareInfo_1.HardwareInfoStructure)];
136
+ }
137
+ });
138
+ });
139
+ };
140
+ /**
141
+ * Function for fetching TEE offer options info from blockchain
142
+ * @param begin - The first element of range.
143
+ * @param end - One past the final element in the range.
144
+ * @returns {Promise<TeeOfferOption[]>}
145
+ */
146
+ TeeOffer.prototype.getOptions = function (begin, end) {
147
+ return __awaiter(this, void 0, void 0, function () {
148
+ var teeOfferOption;
149
+ return __generator(this, function (_a) {
150
+ switch (_a.label) {
151
+ case 0: return [4 /*yield*/, TeeOffer.contract.methods.getTeeOfferOptions(this.id, begin, end).call()];
152
+ case 1:
153
+ teeOfferOption = _a.sent();
154
+ return [2 /*return*/, (0, utils_1.tupleToObjectsArray)(teeOfferOption, TeeOfferOption_1.TeeOfferOptionStructure)];
155
+ }
156
+ });
157
+ });
158
+ };
159
+ /**
160
+ * Function for fetching tee offer slot by id
161
+ * @param optionId - Slot ID
162
+ */
163
+ TeeOffer.prototype.getOptionById = function (optionId) {
164
+ return __awaiter(this, void 0, void 0, function () {
165
+ var teeOfferOption;
166
+ return __generator(this, function (_a) {
167
+ switch (_a.label) {
168
+ case 0: return [4 /*yield*/, TeeOffer.contract.methods.getTeeOfferSlotById(this.id, optionId).call()];
169
+ case 1:
170
+ teeOfferOption = _a.sent();
171
+ return [2 /*return*/, (0, utils_1.tupleToObject)(teeOfferOption, TeeOfferOption_1.TeeOfferOptionStructure)];
172
+ }
173
+ });
174
+ });
175
+ };
176
+ /**
177
+ * Function for fetching whether tee offer slot exists or not
178
+ * @param optionId - Option ID
179
+ */
180
+ TeeOffer.prototype.isOptionExists = function (optionId) {
181
+ return __awaiter(this, void 0, void 0, function () {
182
+ return __generator(this, function (_a) {
183
+ switch (_a.label) {
184
+ case 0: return [4 /*yield*/, TeeOffer.contract.methods.isTeeOfferSlotExists(this.id, optionId).call()];
185
+ case 1: return [2 /*return*/, _a.sent()];
186
+ }
187
+ });
188
+ });
189
+ };
190
+ /**
191
+ * Function for add option usage to the tee offer
192
+ * @param optionId - Option ID
193
+ * @param info - New option info
194
+ * @param usage - New slot usage info
195
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
196
+ */
197
+ TeeOffer.prototype.addOption = function (info, usage, externalId, transactionOptions) {
198
+ if (externalId === void 0) { externalId = "default"; }
199
+ return __awaiter(this, void 0, void 0, function () {
200
+ var contract, newInfoTuple, newUsageTuple, formattedExternalId;
201
+ return __generator(this, function (_a) {
202
+ switch (_a.label) {
126
203
  case 0:
127
- _a = this;
128
- return [4 /*yield*/, TeeOffer.contract.methods.getOfferProviderAuthority(this.id).call()];
204
+ contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
205
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
206
+ newInfoTuple = (0, utils_1.objectToTuple)(info, OptionInfo_1.OptionInfoStructure);
207
+ newUsageTuple = (0, utils_1.objectToTuple)(usage, SlotUsage_1.SlotUsageStructure);
208
+ formattedExternalId = (0, utils_2.formatBytes32String)(externalId);
209
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.addOption, [this.id, formattedExternalId, newInfoTuple, newUsageTuple], transactionOptions)];
129
210
  case 1:
130
- _a.providerAuthority = _b.sent();
131
- return [2 /*return*/, this.providerAuthority];
211
+ _a.sent();
212
+ return [2 /*return*/];
213
+ }
214
+ });
215
+ });
216
+ };
217
+ /**
218
+ * Function for update option info and usage
219
+ * @param optionId - Option ID
220
+ * @param newInfo - New option info
221
+ * @param newUsage - New slot usage info
222
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
223
+ */
224
+ TeeOffer.prototype.updateOption = function (optionId, newInfo, newUsage, transactionOptions) {
225
+ return __awaiter(this, void 0, void 0, function () {
226
+ var contract, newInfoTuple, newUsageTuple;
227
+ return __generator(this, function (_a) {
228
+ switch (_a.label) {
229
+ case 0:
230
+ contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
231
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
232
+ newInfoTuple = (0, utils_1.objectToTuple)(newInfo, OptionInfo_1.OptionInfoStructure);
233
+ newUsageTuple = (0, utils_1.objectToTuple)(newUsage, SlotUsage_1.SlotUsageStructure);
234
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.updateOption, [this.id, optionId, newInfoTuple, newUsageTuple], transactionOptions)];
235
+ case 1:
236
+ _a.sent();
237
+ return [2 /*return*/];
238
+ }
239
+ });
240
+ });
241
+ };
242
+ /**
243
+ * Function for delete option
244
+ * @param optionId - Option ID
245
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
246
+ */
247
+ TeeOffer.prototype.deleteOption = function (optionId, transactionOptions) {
248
+ return __awaiter(this, void 0, void 0, function () {
249
+ var contract;
250
+ return __generator(this, function (_a) {
251
+ switch (_a.label) {
252
+ case 0:
253
+ contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
254
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
255
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.deleteOption, [this.id, optionId], transactionOptions)];
256
+ case 1:
257
+ _a.sent();
258
+ return [2 /*return*/];
259
+ }
260
+ });
261
+ });
262
+ };
263
+ /**
264
+ * Function for fetching whether tee offer slot exists or not
265
+ * @param slotId - Slot ID
266
+ */
267
+ TeeOffer.prototype.isSlotExists = function (slotId) {
268
+ return __awaiter(this, void 0, void 0, function () {
269
+ return __generator(this, function (_a) {
270
+ switch (_a.label) {
271
+ case 0: return [4 /*yield*/, TeeOffer.contract.methods.isTeeOfferSlotExists(this.id, slotId).call()];
272
+ case 1: return [2 /*return*/, _a.sent()];
273
+ }
274
+ });
275
+ });
276
+ };
277
+ /**
278
+ * Function for fetching tee offer slot by id
279
+ * @param slotId - Slot ID
280
+ */
281
+ TeeOffer.prototype.getSlotById = function (slotId) {
282
+ return __awaiter(this, void 0, void 0, function () {
283
+ var slot;
284
+ return __generator(this, function (_a) {
285
+ switch (_a.label) {
286
+ case 0: return [4 /*yield*/, TeeOffer.contract.methods.getTeeOfferSlotById(this.id, slotId).call()];
287
+ case 1:
288
+ slot = _a.sent();
289
+ return [2 /*return*/, (0, utils_1.tupleToObject)(slot, TeeOfferSlot_1.TeeOfferSlotStructure)];
290
+ }
291
+ });
292
+ });
293
+ };
294
+ /**
295
+ * Function for fetching TEE offer slots info from blockchain
296
+ * @param begin - The first element of range.
297
+ * @param end - One past the final element in the range.
298
+ * @returns {Promise<TeeOfferSlot[]>}
299
+ */
300
+ TeeOffer.prototype.getSlots = function (begin, end) {
301
+ return __awaiter(this, void 0, void 0, function () {
302
+ var slots;
303
+ return __generator(this, function (_a) {
304
+ switch (_a.label) {
305
+ case 0: return [4 /*yield*/, TeeOffer.contract.methods.getTeeOfferSlots(this.id, begin, end).call()];
306
+ case 1:
307
+ slots = _a.sent();
308
+ return [2 /*return*/, (0, utils_1.tupleToObjectsArray)(slots, TeeOfferSlot_1.TeeOfferSlotStructure)];
309
+ }
310
+ });
311
+ });
312
+ };
313
+ /**
314
+ * Function for add slot usage to the tee offer
315
+ * @param info - New option info
316
+ * @param usage - New slot usage info
317
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
318
+ */
319
+ TeeOffer.prototype.addSlot = function (info, usage, externalId, transactionOptions) {
320
+ if (externalId === void 0) { externalId = "default"; }
321
+ return __awaiter(this, void 0, void 0, function () {
322
+ var contract, infoTuple, usageTuple, formattedExternalId;
323
+ return __generator(this, function (_a) {
324
+ switch (_a.label) {
325
+ case 0:
326
+ contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
327
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
328
+ infoTuple = (0, utils_1.objectToTuple)(info, SlotInfo_1.SlotInfoStructure);
329
+ usageTuple = (0, utils_1.objectToTuple)(usage, SlotUsage_1.SlotUsageStructure);
330
+ formattedExternalId = (0, utils_2.formatBytes32String)(externalId);
331
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.addTeeOfferSlot, [this.id, formattedExternalId, infoTuple, usageTuple], transactionOptions)];
332
+ case 1:
333
+ _a.sent();
334
+ return [2 /*return*/];
335
+ }
336
+ });
337
+ });
338
+ };
339
+ /**
340
+ * Function for update slot usage to the tee offer
341
+ * @param slotId - Slot ID
342
+ * @param newInfo - New slot info
343
+ * @param newUsage - New slot usage info
344
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
345
+ */
346
+ TeeOffer.prototype.updateSlot = function (slotId, newInfo, newUsage, transactionOptions) {
347
+ return __awaiter(this, void 0, void 0, function () {
348
+ var contract, newInfoTuple, newUsageTuple;
349
+ return __generator(this, function (_a) {
350
+ switch (_a.label) {
351
+ case 0:
352
+ contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
353
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
354
+ newInfoTuple = (0, utils_1.objectToTuple)(newInfo, SlotInfo_1.SlotInfoStructure);
355
+ newUsageTuple = (0, utils_1.objectToTuple)(newUsage, SlotUsage_1.SlotUsageStructure);
356
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.updateTeeOfferSlot, [this.id, slotId, newInfoTuple, newUsageTuple], transactionOptions)];
357
+ case 1:
358
+ _a.sent();
359
+ return [2 /*return*/];
360
+ }
361
+ });
362
+ });
363
+ };
364
+ /**
365
+ * Function for delete slot usage to the tee offer
366
+ * @param slotId - Slot ID
367
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
368
+ */
369
+ TeeOffer.prototype.deleteSlot = function (slotId, transactionOptions) {
370
+ return __awaiter(this, void 0, void 0, function () {
371
+ var contract;
372
+ return __generator(this, function (_a) {
373
+ switch (_a.label) {
374
+ case 0:
375
+ contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
376
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
377
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.updateTeeOfferSlot, [this.id, slotId], transactionOptions)];
378
+ case 1:
379
+ _a.sent();
380
+ return [2 /*return*/];
132
381
  }
133
382
  });
134
383
  });
@@ -179,22 +428,6 @@ var TeeOffer = /** @class */ (function () {
179
428
  });
180
429
  });
181
430
  };
182
- /**
183
- * Function for fetching tcb provider from blockchain
184
- */
185
- TeeOffer.prototype.getTcb = function () {
186
- return __awaiter(this, void 0, void 0, function () {
187
- var offerInfo;
188
- return __generator(this, function (_a) {
189
- switch (_a.label) {
190
- case 0: return [4 /*yield*/, this.getInfo()];
191
- case 1:
192
- offerInfo = _a.sent();
193
- return [2 /*return*/, offerInfo.tcb];
194
- }
195
- });
196
- });
197
- };
198
431
  /**
199
432
  * Function for fetching TLB provider from blockchain
200
433
  */
@@ -211,24 +444,6 @@ var TeeOffer = /** @class */ (function () {
211
444
  });
212
445
  });
213
446
  };
214
- /**
215
- * Function for offer closing price calculation
216
- */
217
- TeeOffer.prototype.getClosingPrice = function (startDate) {
218
- return __awaiter(this, void 0, void 0, function () {
219
- var _a;
220
- return __generator(this, function (_b) {
221
- switch (_b.label) {
222
- case 0:
223
- _a = this;
224
- return [4 /*yield*/, TeeOffer.contract.methods.getOfferClosingPrice(this.id, startDate, 0).call()];
225
- case 1:
226
- _a.closingPrice = _b.sent();
227
- return [2 /*return*/, this.closingPrice];
228
- }
229
- });
230
- });
231
- };
232
447
  /**
233
448
  * Function for fetching last TLB addition time for this TEE offer
234
449
  */
@@ -369,7 +584,7 @@ var TeeOffer = /** @class */ (function () {
369
584
  case 0:
370
585
  transactionOptions !== null && transactionOptions !== void 0 ? transactionOptions : this.checkInitTeeOffer(transactionOptions);
371
586
  (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
372
- newInfoTuple = (0, utils_1.objectToTuple)(newInfo, TeeOffer_1.TeeOfferInfoStructure);
587
+ newInfoTuple = (0, utils_1.objectToTuple)(newInfo, TeeOfferInfo_1.TeeOfferInfoStructure);
373
588
  return [4 /*yield*/, TxManager_1.default.execute(TeeOffer.contract.methods.setTeeOfferInfo, [this.id, newInfoTuple], transactionOptions)];
374
589
  case 1:
375
590
  _a.sent();
@@ -380,6 +595,28 @@ var TeeOffer = /** @class */ (function () {
380
595
  });
381
596
  });
382
597
  };
598
+ /**
599
+ * Updates offer hardware info
600
+ * @param newHardwareInfo - new offer hardware info
601
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
602
+ */
603
+ TeeOffer.prototype.setHardwareInfo = function (newHardwareInfo, transactionOptions) {
604
+ return __awaiter(this, void 0, void 0, function () {
605
+ var newHardwareInfoTuple;
606
+ return __generator(this, function (_a) {
607
+ switch (_a.label) {
608
+ case 0:
609
+ transactionOptions !== null && transactionOptions !== void 0 ? transactionOptions : this.checkInitTeeOffer(transactionOptions);
610
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
611
+ newHardwareInfoTuple = (0, utils_1.objectToTuple)(newHardwareInfo, TeeOfferInfo_1.TeeOfferInfoStructure);
612
+ return [4 /*yield*/, TxManager_1.default.execute(TeeOffer.contract.methods.setTeeOfferHardwareInfo, [this.id, newHardwareInfoTuple], transactionOptions)];
613
+ case 1:
614
+ _a.sent();
615
+ return [2 /*return*/];
616
+ }
617
+ });
618
+ });
619
+ };
383
620
  /**
384
621
  * Updates description in offer info
385
622
  * @param description - new description
@@ -477,7 +714,25 @@ var TeeOffer = /** @class */ (function () {
477
714
  ], TeeOffer.prototype, "getInfo", null);
478
715
  __decorate([
479
716
  (0, utils_1.incrementMethodCall)()
480
- ], TeeOffer.prototype, "getProvider", null);
717
+ ], TeeOffer.prototype, "getHardwareInfo", null);
718
+ __decorate([
719
+ (0, utils_1.incrementMethodCall)()
720
+ ], TeeOffer.prototype, "addOption", null);
721
+ __decorate([
722
+ (0, utils_1.incrementMethodCall)()
723
+ ], TeeOffer.prototype, "updateOption", null);
724
+ __decorate([
725
+ (0, utils_1.incrementMethodCall)()
726
+ ], TeeOffer.prototype, "deleteOption", null);
727
+ __decorate([
728
+ (0, utils_1.incrementMethodCall)()
729
+ ], TeeOffer.prototype, "addSlot", null);
730
+ __decorate([
731
+ (0, utils_1.incrementMethodCall)()
732
+ ], TeeOffer.prototype, "updateSlot", null);
733
+ __decorate([
734
+ (0, utils_1.incrementMethodCall)()
735
+ ], TeeOffer.prototype, "deleteSlot", null);
481
736
  __decorate([
482
737
  (0, utils_1.incrementMethodCall)()
483
738
  ], TeeOffer.prototype, "getProviderAuthority", null);
@@ -490,9 +745,6 @@ var TeeOffer = /** @class */ (function () {
490
745
  __decorate([
491
746
  (0, utils_1.incrementMethodCall)()
492
747
  ], TeeOffer.prototype, "getTlb", null);
493
- __decorate([
494
- (0, utils_1.incrementMethodCall)()
495
- ], TeeOffer.prototype, "getClosingPrice", null);
496
748
  __decorate([
497
749
  (0, utils_1.incrementMethodCall)()
498
750
  ], TeeOffer.prototype, "getOrigins", null);
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  import { Readable } from "stream";
4
- import Offer from "../../models/Offer";
5
4
  import StorageObject from "../../types/storage/StorageObject";
6
5
  import IStorageProvider, { DownloadConfig } from "./IStorageProvider";
7
6
  export type DownloadChunkMethodType = (provider: IStorageProvider, objectPath: string, chunk: ChunkType) => Promise<Buffer>;
@@ -34,5 +33,4 @@ export declare class DownloadDecorator implements IStorageProvider {
34
33
  listObjects(remotePath: string): Promise<StorageObject[]>;
35
34
  getObjectSize(remotePath: string): Promise<number>;
36
35
  getLastModified(remotePath: string): Promise<Date>;
37
- calculateStorageDeposit(offer: Offer, sizeMb: number, hours: number): Promise<string>;
38
36
  }
@@ -281,9 +281,6 @@ var DownloadDecorator = /** @class */ (function () {
281
281
  DownloadDecorator.prototype.getLastModified = function (remotePath) {
282
282
  return this.provider.getLastModified(remotePath);
283
283
  };
284
- DownloadDecorator.prototype.calculateStorageDeposit = function (offer, sizeMb, hours) {
285
- return this.provider.calculateStorageDeposit(offer, sizeMb, hours);
286
- };
287
284
  return DownloadDecorator;
288
285
  }());
289
286
  exports.DownloadDecorator = DownloadDecorator;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- import Offer from "../../models/Offer";
3
2
  import StorageObject from "../../types/storage/StorageObject";
4
3
  import stream from "stream";
5
4
  export type DownloadConfig = {
@@ -13,5 +12,4 @@ export default interface IStorageProvider {
13
12
  listObjects(remotePath: string): Promise<StorageObject[]>;
14
13
  getObjectSize(remotePath: string): Promise<number>;
15
14
  getLastModified(remotePath: string): Promise<Date>;
16
- calculateStorageDeposit(offer: Offer, sizeMb: number, hours: number): Promise<string>;
17
15
  }
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import IStorageProvider, { DownloadConfig } from "./IStorageProvider";
3
- import Offer from "../../models/Offer";
4
3
  import StorageObject from "../../types/storage/StorageObject";
5
4
  import stream from "stream";
6
5
  export default class StorJStorageProvider implements IStorageProvider {
@@ -13,7 +12,6 @@ export default class StorJStorageProvider implements IStorageProvider {
13
12
  private _project?;
14
13
  private _storj?;
15
14
  constructor(credentials: any);
16
- calculateStorageDeposit(offer: Offer, sizeMb: number, hours: number): Promise<string>;
17
15
  uploadFile(inputStream: stream.Readable, remotePath: string, contentLength: number, progressListener?: (total: number, current: number) => void): Promise<void>;
18
16
  downloadFile(remotePath: string, config: DownloadConfig, progressListener?: (total: number, current: number) => void): Promise<stream.Readable>;
19
17
  deleteObject(remotePath: string): Promise<void>;
@@ -62,7 +62,6 @@ var buffer_1 = require("buffer");
62
62
  var utils_1 = require("../../utils");
63
63
  var stream_1 = __importDefault(require("stream"));
64
64
  var logger_1 = __importDefault(require("../../logger"));
65
- var ethers_1 = require("ethers");
66
65
  var StorJStorageProvider = /** @class */ (function () {
67
66
  function StorJStorageProvider(credentials) {
68
67
  this.logger = logger_1.default.child({ className: "StorJStorageProvider" });
@@ -81,20 +80,6 @@ var StorJStorageProvider = /** @class */ (function () {
81
80
  }
82
81
  this.accessToken = credentials.token;
83
82
  }
84
- StorJStorageProvider.prototype.calculateStorageDeposit = function (offer, sizeMb, hours) {
85
- return __awaiter(this, void 0, void 0, function () {
86
- var offerInfo, properties;
87
- return __generator(this, function (_a) {
88
- switch (_a.label) {
89
- case 0: return [4 /*yield*/, offer.getInfo()];
90
- case 1:
91
- offerInfo = _a.sent();
92
- properties = JSON.parse(offerInfo.properties);
93
- return [2 /*return*/, ethers_1.BigNumber.from(properties.priceMbPerHour).mul(sizeMb).mul(hours).toString()];
94
- }
95
- });
96
- });
97
- };
98
83
  StorJStorageProvider.prototype.uploadFile = function (inputStream, remotePath, contentLength, progressListener) {
99
84
  var _a, inputStream_1, inputStream_1_1;
100
85
  var _b, e_1, _c, _d;
@@ -0,0 +1,71 @@
1
+ import { BlockInfo, TransactionOptions } from "../types/Web3";
2
+ import { DepositInfo } from "../types/DepositInfo";
3
+ declare class Deposits {
4
+ private static readonly logger;
5
+ static get address(): string;
6
+ /**
7
+ * Function for fetching deposit info
8
+ * @param depositOwner - Deposit owner
9
+ */
10
+ static getDepositInfo(depositOwner: string): Promise<DepositInfo>;
11
+ /**
12
+ * Function for fetching amount of locked tokens
13
+ * @param depositOwner - Deposit owner
14
+ */
15
+ static getLockedTokensAmount(depositOwner: string): Promise<string>;
16
+ /**
17
+ * Function for replenish deposit
18
+ * @param amount - replenish amount
19
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
20
+ * @returns {Promise<void>} - Does not return id of created order!
21
+ */
22
+ static replenish(amount: string, transactionOptions?: TransactionOptions): Promise<void>;
23
+ /**
24
+ * Function for replenish deposit of given account
25
+ * @param beneficiary - account
26
+ * @param amount - replenish amount
27
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
28
+ * @returns {Promise<void>} - Does not return id of created order!
29
+ */
30
+ static replenishFor(beneficiary: string, amount: string, transactionOptions?: TransactionOptions): Promise<void>;
31
+ /**
32
+ * Function for withdraw deposit
33
+ * @param amount - withdraw amount
34
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
35
+ * @returns {Promise<void>} - Does not return id of created order!
36
+ */
37
+ static withdraw(amount: string, transactionOptions?: TransactionOptions): Promise<void>;
38
+ /**
39
+ * Function for adding event listeners on DepositReplenished event in contract
40
+ * @param owner - owner address
41
+ * @param callback - function for processing created order
42
+ * @returns unsubscribe - unsubscribe function from event
43
+ */
44
+ static onDepositReplenished(callback: onDepositReplenishedCallback, owner?: string): () => void;
45
+ /**
46
+ * Function for adding event listeners on DepositWithdrawn event in contract
47
+ * @param owner - owner address
48
+ * @param callback - function for processing created order
49
+ * @returns unsubscribe - unsubscribe function from event
50
+ */
51
+ static onDepositWithdrawn(callback: onDepositWithdrawnCallback, owner?: string): () => void;
52
+ /**
53
+ * Function for adding event listeners on DepositPartLocked event in contract
54
+ * @param owner - owner address
55
+ * @param callback - function for processing created order
56
+ * @returns unsubscribe - unsubscribe function from event
57
+ */
58
+ static onDepositPartLocked(callback: onDepositPartLockedCallback, owner?: string): () => void;
59
+ /**
60
+ * Function for adding event listeners on DepositPartUnlocked event in contract
61
+ * @param owner - owner address
62
+ * @param callback - function for processing created order
63
+ * @returns unsubscribe - unsubscribe function from event
64
+ */
65
+ static onDepositPartUnlocked(callback: onDepositPartUnlockedCallback, owner?: string): () => void;
66
+ }
67
+ export type onDepositReplenishedCallback = (owner: string, amount: string, totalLocked: string, block?: BlockInfo) => void;
68
+ export type onDepositWithdrawnCallback = (owner: string, amount: string, totalLocked: string, block?: BlockInfo) => void;
69
+ export type onDepositPartLockedCallback = (owner: string, amount: string, totalLocked: string, block?: BlockInfo) => void;
70
+ export type onDepositPartUnlockedCallback = (owner: string, amount: string, totalLocked: string, block?: BlockInfo) => void;
71
+ export default Deposits;