@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.
- package/build/TIIGenerator.js +16 -14
- package/build/connectors/BlockchainConnector.d.ts +1 -1
- package/build/connectors/BlockchainConnector.js +6 -4
- package/build/contracts/app.json +3581 -1393
- package/build/crypto/Crypto.d.ts +3 -3
- package/build/crypto/Crypto.js +3 -3
- package/build/crypto/nodejs/AES.d.ts +1 -1
- package/build/crypto/nodejs/AES.js +1 -1
- package/build/crypto/nodejs/ARIA.d.ts +1 -1
- package/build/crypto/nodejs/ARIA.js +1 -1
- package/build/index.d.ts +15 -15
- package/build/index.js +20 -22
- package/build/models/Offer.d.ts +47 -4
- package/build/models/Offer.js +159 -21
- package/build/models/Order.d.ts +29 -17
- package/build/models/Order.js +103 -74
- package/build/models/Provider.js +4 -2
- package/build/models/TeeOffer.d.ts +92 -11
- package/build/models/TeeOffer.js +305 -53
- package/build/providers/storage/ChunksDownloadDecorator.d.ts +0 -2
- package/build/providers/storage/ChunksDownloadDecorator.js +0 -3
- package/build/providers/storage/IStorageProvider.d.ts +0 -2
- package/build/providers/storage/StorjStorageProvider.d.ts +0 -2
- package/build/providers/storage/StorjStorageProvider.js +0 -15
- package/build/staticModels/Deposits.d.ts +71 -0
- package/build/staticModels/Deposits.js +303 -0
- package/build/staticModels/Offers.d.ts +58 -0
- package/build/staticModels/{OffersFactory.js → Offers.js} +115 -14
- package/build/staticModels/{OrdersFactory.d.ts → Orders.d.ts} +36 -43
- package/build/staticModels/{OrdersFactory.js → Orders.js} +103 -125
- package/build/staticModels/ProviderRegistry.d.ts +1 -1
- package/build/staticModels/ProviderRegistry.js +1 -1
- package/build/staticModels/Superpro.d.ts +2 -2
- package/build/staticModels/Superpro.js +1 -1
- package/build/staticModels/TeeOffers.d.ts +101 -0
- package/build/staticModels/TeeOffers.js +455 -0
- package/build/types/DepositInfo.d.ts +10 -0
- package/build/types/DepositInfo.js +9 -0
- package/build/types/Events.d.ts +0 -12
- package/build/types/HardwareInfo.d.ts +19 -0
- package/build/types/HardwareInfo.js +10 -0
- package/build/types/Offer.d.ts +0 -7
- package/build/types/Offer.js +0 -3
- package/build/types/OptionInfo.d.ts +10 -0
- package/build/types/OptionInfo.js +9 -0
- package/build/types/Order.d.ts +5 -1
- package/build/types/SlotInfo.d.ts +12 -0
- package/build/types/SlotInfo.js +10 -0
- package/build/types/SlotUsage.d.ts +16 -0
- package/build/types/SlotUsage.js +15 -0
- package/build/types/Superpro.d.ts +0 -14
- package/build/types/Superpro.js +1 -16
- package/build/types/TeeOfferInfo.d.ts +31 -0
- package/build/types/{TeeOffer.js → TeeOfferInfo.js} +2 -4
- package/build/types/TeeOfferOption.d.ts +21 -0
- package/build/types/TeeOfferOption.js +11 -0
- package/build/types/TeeOfferSlot.d.ts +22 -0
- package/build/types/TeeOfferSlot.js +11 -0
- package/build/types/ValueOfferSlot.d.ts +29 -0
- package/build/types/ValueOfferSlot.js +13 -0
- package/build/utils.d.ts +1 -0
- package/build/utils.js +5 -1
- package/package.json +1 -1
- package/build/models/Ballot.d.ts +0 -13
- package/build/models/Ballot.js +0 -70
- package/build/staticModels/OffersFactory.d.ts +0 -32
- package/build/staticModels/Staking.d.ts +0 -20
- package/build/staticModels/Staking.js +0 -116
- package/build/staticModels/TeeOffersFactory.d.ts +0 -36
- package/build/staticModels/TeeOffersFactory.js +0 -211
- package/build/staticModels/Voting.d.ts +0 -29
- package/build/staticModels/Voting.js +0 -91
- package/build/types/Ballot.d.ts +0 -75
- package/build/types/Ballot.js +0 -49
- package/build/types/Staking.d.ts +0 -27
- package/build/types/Staking.js +0 -22
- package/build/types/TeeOffer.d.ts +0 -25
package/build/models/Order.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OrderInfo, OrderResult, ExtendedOrderInfo, OrderStatus } from "../types/Order";
|
|
2
2
|
import { TransactionOptions } from "../types/Web3";
|
|
3
3
|
import { Origins } from "../types/Origins";
|
|
4
|
-
import {
|
|
4
|
+
import { OptionInfo } from "../types/OptionInfo";
|
|
5
5
|
declare class Order {
|
|
6
6
|
private static contract;
|
|
7
7
|
private logger;
|
|
@@ -22,6 +22,10 @@ declare class Order {
|
|
|
22
22
|
* Check if order exist
|
|
23
23
|
*/
|
|
24
24
|
isExist(): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if order is in `processing` state
|
|
27
|
+
*/
|
|
28
|
+
isOrderProcessing(): Promise<boolean>;
|
|
25
29
|
/**
|
|
26
30
|
* Function for fetching order info from blockchain
|
|
27
31
|
*/
|
|
@@ -43,10 +47,21 @@ declare class Order {
|
|
|
43
47
|
* Function for fetching order deposit spent from blockchain
|
|
44
48
|
*/
|
|
45
49
|
getDepositSpent(): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Function for fetching order options deposit spent from blockchain
|
|
52
|
+
*/
|
|
53
|
+
getOptionsDepositSpent(): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Function for fetching order deposit spent from blockchain
|
|
56
|
+
*/
|
|
57
|
+
getOrderTeeOptions(): Promise<{
|
|
58
|
+
options: OptionInfo[];
|
|
59
|
+
count: number[];
|
|
60
|
+
}>;
|
|
46
61
|
/**
|
|
47
62
|
* Function for fetching hold deposits sum of the order and its suborders
|
|
48
63
|
*/
|
|
49
|
-
|
|
64
|
+
calculateTotalOrderDeposit(): Promise<string>;
|
|
50
65
|
/**
|
|
51
66
|
* Function for fetching reserve for output order
|
|
52
67
|
*/
|
|
@@ -68,9 +83,9 @@ declare class Order {
|
|
|
68
83
|
*/
|
|
69
84
|
getAwaitingPayment(): Promise<boolean>;
|
|
70
85
|
/**
|
|
71
|
-
* Function for fetching
|
|
86
|
+
* Function for fetching deposit of order from blockchain
|
|
72
87
|
*/
|
|
73
|
-
|
|
88
|
+
getDeposit(): Promise<string>;
|
|
74
89
|
/**
|
|
75
90
|
* Function for fetching start of processing date
|
|
76
91
|
*/
|
|
@@ -87,6 +102,10 @@ declare class Order {
|
|
|
87
102
|
* Sets deposit spent
|
|
88
103
|
*/
|
|
89
104
|
setDepositSpent(value: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Sets options deposit spent
|
|
107
|
+
*/
|
|
108
|
+
setOptionsDepositSpent(value: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
90
109
|
/**
|
|
91
110
|
* Function for updating status of contract
|
|
92
111
|
*/
|
|
@@ -107,6 +126,10 @@ declare class Order {
|
|
|
107
126
|
* Completes order
|
|
108
127
|
*/
|
|
109
128
|
complete(status: OrderStatus, encryptedResult?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Unlocks profit
|
|
131
|
+
*/
|
|
132
|
+
unlockProfit(transactionOptions?: TransactionOptions): Promise<void>;
|
|
110
133
|
/**
|
|
111
134
|
* Function for creating sub orders for current order
|
|
112
135
|
* @param subOrderInfo - order info for new subOrder
|
|
@@ -122,23 +145,12 @@ declare class Order {
|
|
|
122
145
|
* @returns {Promise<string[]>} - tx hashes
|
|
123
146
|
*/
|
|
124
147
|
createSubOrders(subOrdersInfo: ExtendedOrderInfo[], transactionOptions: TransactionOptions): Promise<string[]>;
|
|
125
|
-
getSubOrder(consumer: string, externalId: string): Promise<SubOrderCreatedEvent>;
|
|
126
|
-
/**
|
|
127
|
-
* Function for withdrawing profit from order
|
|
128
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
129
|
-
*/
|
|
130
|
-
withdrawProfit(transactionOptions?: TransactionOptions): Promise<void>;
|
|
131
|
-
/**
|
|
132
|
-
* Function for withdrawing change from order
|
|
133
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
134
|
-
*/
|
|
135
|
-
withdrawChange(transactionOptions?: TransactionOptions): Promise<void>;
|
|
136
148
|
/**
|
|
137
149
|
* Function for adding event listeners to contract events
|
|
138
150
|
* @param callback - function for processing each order related with event
|
|
139
|
-
* @
|
|
151
|
+
* @returns unsubscribe - function unsubscribing from event
|
|
140
152
|
*/
|
|
141
|
-
|
|
153
|
+
onStatusUpdated(callback: onOrderStatusUpdatedCallback): () => void;
|
|
142
154
|
}
|
|
143
155
|
export type onOrderStatusUpdatedCallback = (status: OrderStatus) => void;
|
|
144
156
|
export default Order;
|
package/build/models/Order.js
CHANGED
|
@@ -67,6 +67,7 @@ var BlockchainConnector_1 = __importDefault(require("../connectors/BlockchainCon
|
|
|
67
67
|
var Superpro_1 = __importDefault(require("../staticModels/Superpro"));
|
|
68
68
|
var TxManager_1 = __importDefault(require("../utils/TxManager"));
|
|
69
69
|
var BlockchainEventsListener_1 = __importDefault(require("../connectors/BlockchainEventsListener"));
|
|
70
|
+
var OptionInfo_1 = require("../types/OptionInfo");
|
|
70
71
|
var Order = /** @class */ (function () {
|
|
71
72
|
function Order(orderId) {
|
|
72
73
|
this.id = orderId;
|
|
@@ -96,6 +97,19 @@ var Order = /** @class */ (function () {
|
|
|
96
97
|
});
|
|
97
98
|
});
|
|
98
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* Check if order is in `processing` state
|
|
102
|
+
*/
|
|
103
|
+
Order.prototype.isOrderProcessing = function () {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
+
return __generator(this, function (_a) {
|
|
106
|
+
switch (_a.label) {
|
|
107
|
+
case 0: return [4 /*yield*/, Order.contract.methods.isOrderProcessing(this.id).call()];
|
|
108
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
99
113
|
/**
|
|
100
114
|
* Function for fetching order info from blockchain
|
|
101
115
|
*/
|
|
@@ -189,17 +203,48 @@ var Order = /** @class */ (function () {
|
|
|
189
203
|
Order.prototype.getDepositSpent = function () {
|
|
190
204
|
return __awaiter(this, void 0, void 0, function () {
|
|
191
205
|
return __generator(this, function (_a) {
|
|
192
|
-
return [2 /*return*/, Order.contract.methods.
|
|
206
|
+
return [2 /*return*/, Order.contract.methods.getOrderDepositSpent(this.id).call()];
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Function for fetching order options deposit spent from blockchain
|
|
212
|
+
*/
|
|
213
|
+
Order.prototype.getOptionsDepositSpent = function () {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
215
|
+
return __generator(this, function (_a) {
|
|
216
|
+
return [2 /*return*/, Order.contract.methods.getOptionsDepositSpent(this.id).call()];
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Function for fetching order deposit spent from blockchain
|
|
222
|
+
*/
|
|
223
|
+
Order.prototype.getOrderTeeOptions = function () {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
225
|
+
var _a, options, count;
|
|
226
|
+
return __generator(this, function (_b) {
|
|
227
|
+
switch (_b.label) {
|
|
228
|
+
case 0: return [4 /*yield*/, Order.contract.methods.getOrderTeeOptions(this.id).call()];
|
|
229
|
+
case 1:
|
|
230
|
+
_a = _b.sent(), options = _a[0], count = _a[1];
|
|
231
|
+
options = (0, utils_1.tupleToObjectsArray)(options, OptionInfo_1.OptionInfoStructure);
|
|
232
|
+
count = count.map(function (item) { return +item; });
|
|
233
|
+
return [2 /*return*/, {
|
|
234
|
+
options: options,
|
|
235
|
+
count: count,
|
|
236
|
+
}];
|
|
237
|
+
}
|
|
193
238
|
});
|
|
194
239
|
});
|
|
195
240
|
};
|
|
196
241
|
/**
|
|
197
242
|
* Function for fetching hold deposits sum of the order and its suborders
|
|
198
243
|
*/
|
|
199
|
-
Order.prototype.
|
|
244
|
+
Order.prototype.calculateTotalOrderDeposit = function () {
|
|
200
245
|
return __awaiter(this, void 0, void 0, function () {
|
|
201
246
|
return __generator(this, function (_a) {
|
|
202
|
-
return [2 /*return*/, Order.contract.methods.
|
|
247
|
+
return [2 /*return*/, Order.contract.methods.calculateTotalOrderDeposit(this.id).call()];
|
|
203
248
|
});
|
|
204
249
|
});
|
|
205
250
|
};
|
|
@@ -265,12 +310,12 @@ var Order = /** @class */ (function () {
|
|
|
265
310
|
});
|
|
266
311
|
};
|
|
267
312
|
/**
|
|
268
|
-
* Function for fetching
|
|
313
|
+
* Function for fetching deposit of order from blockchain
|
|
269
314
|
*/
|
|
270
|
-
Order.prototype.
|
|
315
|
+
Order.prototype.getDeposit = function () {
|
|
271
316
|
return __awaiter(this, void 0, void 0, function () {
|
|
272
317
|
return __generator(this, function (_a) {
|
|
273
|
-
return [2 /*return*/, Order.contract.methods.
|
|
318
|
+
return [2 /*return*/, Order.contract.methods.getOrderDeposit(this.id).call()];
|
|
274
319
|
});
|
|
275
320
|
});
|
|
276
321
|
};
|
|
@@ -338,6 +383,24 @@ var Order = /** @class */ (function () {
|
|
|
338
383
|
});
|
|
339
384
|
});
|
|
340
385
|
};
|
|
386
|
+
/**
|
|
387
|
+
* Sets options deposit spent
|
|
388
|
+
*/
|
|
389
|
+
Order.prototype.setOptionsDepositSpent = function (value, transactionOptions) {
|
|
390
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
391
|
+
return __generator(this, function (_a) {
|
|
392
|
+
switch (_a.label) {
|
|
393
|
+
case 0:
|
|
394
|
+
transactionOptions !== null && transactionOptions !== void 0 ? transactionOptions : this.checkInitOrder(transactionOptions);
|
|
395
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
396
|
+
return [4 /*yield*/, TxManager_1.default.execute(Order.contract.methods.setOptionsDepositSpent, [this.id, value], transactionOptions)];
|
|
397
|
+
case 1:
|
|
398
|
+
_a.sent();
|
|
399
|
+
return [2 /*return*/];
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
};
|
|
341
404
|
/**
|
|
342
405
|
* Function for updating status of contract
|
|
343
406
|
*/
|
|
@@ -435,6 +498,24 @@ var Order = /** @class */ (function () {
|
|
|
435
498
|
});
|
|
436
499
|
});
|
|
437
500
|
};
|
|
501
|
+
/**
|
|
502
|
+
* Unlocks profit
|
|
503
|
+
*/
|
|
504
|
+
Order.prototype.unlockProfit = function (transactionOptions) {
|
|
505
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
506
|
+
return __generator(this, function (_a) {
|
|
507
|
+
switch (_a.label) {
|
|
508
|
+
case 0:
|
|
509
|
+
transactionOptions !== null && transactionOptions !== void 0 ? transactionOptions : this.checkInitOrder(transactionOptions);
|
|
510
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
511
|
+
return [4 /*yield*/, TxManager_1.default.execute(Order.contract.methods.unlockProfit, [this.id], transactionOptions)];
|
|
512
|
+
case 1:
|
|
513
|
+
_a.sent();
|
|
514
|
+
return [2 /*return*/];
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
|
+
};
|
|
438
519
|
/**
|
|
439
520
|
* Function for creating sub orders for current order
|
|
440
521
|
* @param subOrderInfo - order info for new subOrder
|
|
@@ -511,70 +592,12 @@ var Order = /** @class */ (function () {
|
|
|
511
592
|
});
|
|
512
593
|
});
|
|
513
594
|
};
|
|
514
|
-
Order.prototype.getSubOrder = function (consumer, externalId) {
|
|
515
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
516
|
-
var filter, foundIds, notFound, response;
|
|
517
|
-
return __generator(this, function (_a) {
|
|
518
|
-
switch (_a.label) {
|
|
519
|
-
case 0:
|
|
520
|
-
filter = {
|
|
521
|
-
consumer: consumer,
|
|
522
|
-
externalId: (0, utils_2.formatBytes32String)(externalId),
|
|
523
|
-
};
|
|
524
|
-
return [4 /*yield*/, Order.contract.getPastEvents("SubOrderCreated", { filter: filter })];
|
|
525
|
-
case 1:
|
|
526
|
-
foundIds = _a.sent();
|
|
527
|
-
notFound = { consumer: consumer, externalId: externalId, subOfferId: "-1", subOrderId: "-1", parentOrderId: "-1" };
|
|
528
|
-
response = foundIds.length > 0 ? foundIds[0].returnValues : notFound;
|
|
529
|
-
return [2 /*return*/, response];
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
});
|
|
533
|
-
};
|
|
534
|
-
/**
|
|
535
|
-
* Function for withdrawing profit from order
|
|
536
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
537
|
-
*/
|
|
538
|
-
Order.prototype.withdrawProfit = function (transactionOptions) {
|
|
539
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
540
|
-
return __generator(this, function (_a) {
|
|
541
|
-
switch (_a.label) {
|
|
542
|
-
case 0:
|
|
543
|
-
transactionOptions !== null && transactionOptions !== void 0 ? transactionOptions : this.checkInitOrder(transactionOptions);
|
|
544
|
-
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
545
|
-
return [4 /*yield*/, TxManager_1.default.execute(Order.contract.methods.withdrawProfit, [this.id], transactionOptions)];
|
|
546
|
-
case 1:
|
|
547
|
-
_a.sent();
|
|
548
|
-
return [2 /*return*/];
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
});
|
|
552
|
-
};
|
|
553
|
-
/**
|
|
554
|
-
* Function for withdrawing change from order
|
|
555
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
556
|
-
*/
|
|
557
|
-
Order.prototype.withdrawChange = function (transactionOptions) {
|
|
558
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
559
|
-
return __generator(this, function (_a) {
|
|
560
|
-
switch (_a.label) {
|
|
561
|
-
case 0:
|
|
562
|
-
transactionOptions !== null && transactionOptions !== void 0 ? transactionOptions : this.checkInitOrder(transactionOptions);
|
|
563
|
-
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
564
|
-
return [4 /*yield*/, TxManager_1.default.execute(Order.contract.methods.withdrawChange, [this.id], transactionOptions)];
|
|
565
|
-
case 1:
|
|
566
|
-
_a.sent();
|
|
567
|
-
return [2 /*return*/];
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
});
|
|
571
|
-
};
|
|
572
595
|
/**
|
|
573
596
|
* Function for adding event listeners to contract events
|
|
574
597
|
* @param callback - function for processing each order related with event
|
|
575
|
-
* @
|
|
598
|
+
* @returns unsubscribe - function unsubscribing from event
|
|
576
599
|
*/
|
|
577
|
-
Order.prototype.
|
|
600
|
+
Order.prototype.onStatusUpdated = function (callback) {
|
|
578
601
|
var _this = this;
|
|
579
602
|
var logger = this.logger.child({ method: "onOrderStatusUpdated" });
|
|
580
603
|
// TODO: add ability to use this event without https provider initialization
|
|
@@ -619,7 +642,13 @@ var Order = /** @class */ (function () {
|
|
|
619
642
|
], Order.prototype, "getDepositSpent", null);
|
|
620
643
|
__decorate([
|
|
621
644
|
(0, utils_1.incrementMethodCall)()
|
|
622
|
-
], Order.prototype, "
|
|
645
|
+
], Order.prototype, "getOptionsDepositSpent", null);
|
|
646
|
+
__decorate([
|
|
647
|
+
(0, utils_1.incrementMethodCall)()
|
|
648
|
+
], Order.prototype, "getOrderTeeOptions", null);
|
|
649
|
+
__decorate([
|
|
650
|
+
(0, utils_1.incrementMethodCall)()
|
|
651
|
+
], Order.prototype, "calculateTotalOrderDeposit", null);
|
|
623
652
|
__decorate([
|
|
624
653
|
(0, utils_1.incrementMethodCall)()
|
|
625
654
|
], Order.prototype, "calculateOrderOutputReserve", null);
|
|
@@ -637,7 +666,7 @@ var Order = /** @class */ (function () {
|
|
|
637
666
|
], Order.prototype, "getAwaitingPayment", null);
|
|
638
667
|
__decorate([
|
|
639
668
|
(0, utils_1.incrementMethodCall)()
|
|
640
|
-
], Order.prototype, "
|
|
669
|
+
], Order.prototype, "getDeposit", null);
|
|
641
670
|
__decorate([
|
|
642
671
|
(0, utils_1.incrementMethodCall)()
|
|
643
672
|
], Order.prototype, "getStartDate", null);
|
|
@@ -650,6 +679,9 @@ var Order = /** @class */ (function () {
|
|
|
650
679
|
__decorate([
|
|
651
680
|
(0, utils_1.incrementMethodCall)()
|
|
652
681
|
], Order.prototype, "setDepositSpent", null);
|
|
682
|
+
__decorate([
|
|
683
|
+
(0, utils_1.incrementMethodCall)()
|
|
684
|
+
], Order.prototype, "setOptionsDepositSpent", null);
|
|
653
685
|
__decorate([
|
|
654
686
|
(0, utils_1.incrementMethodCall)()
|
|
655
687
|
], Order.prototype, "updateStatus", null);
|
|
@@ -667,16 +699,13 @@ var Order = /** @class */ (function () {
|
|
|
667
699
|
], Order.prototype, "complete", null);
|
|
668
700
|
__decorate([
|
|
669
701
|
(0, utils_1.incrementMethodCall)()
|
|
670
|
-
], Order.prototype, "
|
|
702
|
+
], Order.prototype, "unlockProfit", null);
|
|
671
703
|
__decorate([
|
|
672
704
|
(0, utils_1.incrementMethodCall)()
|
|
673
|
-
], Order.prototype, "
|
|
674
|
-
__decorate([
|
|
675
|
-
(0, utils_1.incrementMethodCall)()
|
|
676
|
-
], Order.prototype, "getSubOrder", null);
|
|
705
|
+
], Order.prototype, "createSubOrder", null);
|
|
677
706
|
__decorate([
|
|
678
707
|
(0, utils_1.incrementMethodCall)()
|
|
679
|
-
], Order.prototype, "
|
|
708
|
+
], Order.prototype, "createSubOrders", null);
|
|
680
709
|
return Order;
|
|
681
710
|
}());
|
|
682
711
|
exports.default = Order;
|
package/build/models/Provider.js
CHANGED
|
@@ -154,9 +154,11 @@ var Provider = /** @class */ (function () {
|
|
|
154
154
|
switch (_b.label) {
|
|
155
155
|
case 0:
|
|
156
156
|
_a = this;
|
|
157
|
-
return [4 /*yield*/, Provider.contractProviders.methods
|
|
157
|
+
return [4 /*yield*/, Provider.contractProviders.methods
|
|
158
|
+
.getProviderViolationRate(this.providerId)
|
|
159
|
+
.call()];
|
|
158
160
|
case 1:
|
|
159
|
-
_a.violationRate = _b.sent();
|
|
161
|
+
_a.violationRate = +(_b.sent());
|
|
160
162
|
return [2 /*return*/, this.violationRate];
|
|
161
163
|
}
|
|
162
164
|
});
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { TeeOfferInfo } from "../types/
|
|
1
|
+
import { TeeOfferInfo } from "../types/TeeOfferInfo";
|
|
2
2
|
import { TransactionOptions } from "../types/Web3";
|
|
3
3
|
import { OfferType } from "../types/Offer";
|
|
4
4
|
import { Origins } from "../types/Origins";
|
|
5
|
+
import { HardwareInfo } from "../types/HardwareInfo";
|
|
6
|
+
import { TeeOfferOption } from "../types/TeeOfferOption";
|
|
7
|
+
import { TeeOfferSlot } from "../types/TeeOfferSlot";
|
|
8
|
+
import { OptionInfo } from "../types/OptionInfo";
|
|
9
|
+
import { SlotUsage } from "../types/SlotUsage";
|
|
10
|
+
import { SlotInfo } from "../types/SlotInfo";
|
|
5
11
|
declare class TeeOffer {
|
|
6
12
|
private static contract;
|
|
7
13
|
private logger;
|
|
@@ -37,9 +43,86 @@ declare class TeeOffer {
|
|
|
37
43
|
*/
|
|
38
44
|
getInfo(): Promise<TeeOfferInfo>;
|
|
39
45
|
/**
|
|
40
|
-
* Function for fetching TEE offer
|
|
46
|
+
* Function for fetching TEE offer hardware info from blockchain
|
|
41
47
|
*/
|
|
42
|
-
|
|
48
|
+
getHardwareInfo(): Promise<HardwareInfo>;
|
|
49
|
+
/**
|
|
50
|
+
* Function for fetching TEE offer options info from blockchain
|
|
51
|
+
* @param begin - The first element of range.
|
|
52
|
+
* @param end - One past the final element in the range.
|
|
53
|
+
* @returns {Promise<TeeOfferOption[]>}
|
|
54
|
+
*/
|
|
55
|
+
getOptions(begin: number, end: number): Promise<TeeOfferOption[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Function for fetching tee offer slot by id
|
|
58
|
+
* @param optionId - Slot ID
|
|
59
|
+
*/
|
|
60
|
+
getOptionById(optionId: string): Promise<TeeOfferOption>;
|
|
61
|
+
/**
|
|
62
|
+
* Function for fetching whether tee offer slot exists or not
|
|
63
|
+
* @param optionId - Option ID
|
|
64
|
+
*/
|
|
65
|
+
isOptionExists(optionId: string): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Function for add option usage to the tee offer
|
|
68
|
+
* @param optionId - Option ID
|
|
69
|
+
* @param info - New option info
|
|
70
|
+
* @param usage - New slot usage info
|
|
71
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
72
|
+
*/
|
|
73
|
+
addOption(info: OptionInfo, usage: SlotUsage, externalId?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Function for update option info and usage
|
|
76
|
+
* @param optionId - Option ID
|
|
77
|
+
* @param newInfo - New option info
|
|
78
|
+
* @param newUsage - New slot usage info
|
|
79
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
80
|
+
*/
|
|
81
|
+
updateOption(optionId: string, newInfo: OptionInfo, newUsage: SlotUsage, transactionOptions?: TransactionOptions): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Function for delete option
|
|
84
|
+
* @param optionId - Option ID
|
|
85
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
86
|
+
*/
|
|
87
|
+
deleteOption(optionId: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Function for fetching whether tee offer slot exists or not
|
|
90
|
+
* @param slotId - Slot ID
|
|
91
|
+
*/
|
|
92
|
+
isSlotExists(slotId: string): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Function for fetching tee offer slot by id
|
|
95
|
+
* @param slotId - Slot ID
|
|
96
|
+
*/
|
|
97
|
+
getSlotById(slotId: string): Promise<TeeOfferSlot>;
|
|
98
|
+
/**
|
|
99
|
+
* Function for fetching TEE offer slots info from blockchain
|
|
100
|
+
* @param begin - The first element of range.
|
|
101
|
+
* @param end - One past the final element in the range.
|
|
102
|
+
* @returns {Promise<TeeOfferSlot[]>}
|
|
103
|
+
*/
|
|
104
|
+
getSlots(begin: number, end: number): Promise<TeeOfferSlot[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Function for add slot usage to the tee offer
|
|
107
|
+
* @param info - New option info
|
|
108
|
+
* @param usage - New slot usage info
|
|
109
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
110
|
+
*/
|
|
111
|
+
addSlot(info: SlotInfo, usage: SlotUsage, externalId?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Function for update slot usage to the tee offer
|
|
114
|
+
* @param slotId - Slot ID
|
|
115
|
+
* @param newInfo - New slot info
|
|
116
|
+
* @param newUsage - New slot usage info
|
|
117
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
118
|
+
*/
|
|
119
|
+
updateSlot(slotId: string, newInfo: SlotInfo, newUsage: SlotUsage, transactionOptions?: TransactionOptions): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Function for delete slot usage to the tee offer
|
|
122
|
+
* @param slotId - Slot ID
|
|
123
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
124
|
+
*/
|
|
125
|
+
deleteSlot(slotId: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
43
126
|
/**
|
|
44
127
|
* Function for fetching TEE offer provider authority account from blockchain
|
|
45
128
|
*/
|
|
@@ -49,18 +132,10 @@ declare class TeeOffer {
|
|
|
49
132
|
*/
|
|
50
133
|
getOfferType(): Promise<OfferType>;
|
|
51
134
|
isTeeOfferVerifying(): Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* Function for fetching tcb provider from blockchain
|
|
54
|
-
*/
|
|
55
|
-
getTcb(): Promise<string>;
|
|
56
135
|
/**
|
|
57
136
|
* Function for fetching TLB provider from blockchain
|
|
58
137
|
*/
|
|
59
138
|
getTlb(): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Function for offer closing price calculation
|
|
62
|
-
*/
|
|
63
|
-
getClosingPrice(startDate: number): Promise<string>;
|
|
64
139
|
/**
|
|
65
140
|
* Function for fetching last TLB addition time for this TEE offer
|
|
66
141
|
*/
|
|
@@ -99,6 +174,12 @@ declare class TeeOffer {
|
|
|
99
174
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
100
175
|
*/
|
|
101
176
|
setInfo(newInfo: TeeOfferInfo, transactionOptions?: TransactionOptions): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Updates offer hardware info
|
|
179
|
+
* @param newHardwareInfo - new offer hardware info
|
|
180
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
181
|
+
*/
|
|
182
|
+
setHardwareInfo(newHardwareInfo: HardwareInfo, transactionOptions?: TransactionOptions): Promise<void>;
|
|
102
183
|
/**
|
|
103
184
|
* Updates description in offer info
|
|
104
185
|
* @param description - new description
|