@super-protocol/sdk-js 0.13.0-beta.1 → 0.13.0-beta.11
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/connectors/BlockchainConnector.js +11 -4
- package/build/contracts/app.json +184 -63
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/models/Offer.d.ts +6 -2
- package/build/models/Offer.js +17 -4
- package/build/models/Order.d.ts +6 -9
- package/build/models/Order.js +26 -21
- package/build/models/TCB.d.ts +2 -2
- package/build/models/TeeOffer.d.ts +11 -2
- package/build/models/TeeOffer.js +42 -2
- package/build/staticModels/BaseStaticModel.d.ts +4 -0
- package/build/staticModels/BaseStaticModel.js +22 -0
- package/build/staticModels/Consensus.d.ts +18 -1
- package/build/staticModels/Consensus.js +138 -0
- package/build/staticModels/Offers.d.ts +8 -2
- package/build/staticModels/Offers.js +36 -2
- package/build/staticModels/Orders.js +18 -18
- package/build/staticModels/TeeOffers.d.ts +13 -2
- package/build/staticModels/TeeOffers.js +52 -2
- package/build/types/Consensus.d.ts +4 -4
- package/build/types/Events.d.ts +18 -0
- package/build/types/Order.d.ts +51 -8
- package/build/types/Order.js +17 -3
- package/package.json +1 -1
|
@@ -361,7 +361,7 @@ var BlockchainConnector = /** @class */ (function (_super) {
|
|
|
361
361
|
BlockchainConnector.prototype.getTransactions = function (addresses, startBlock, lastBlock, batchSize) {
|
|
362
362
|
if (batchSize === void 0) { batchSize = constants_1.BLOCK_SIZE_TO_FETCH_TRANSACTION; }
|
|
363
363
|
return __awaiter(this, void 0, void 0, function () {
|
|
364
|
-
var blockchainLastBlock, transactionsByAddress, batch, getBlock, batchLastBlock, blockNumber, blocks;
|
|
364
|
+
var blockchainLastBlock, transactionsByAddress, validAddresses, batch, getBlock, batchLastBlock, blockNumber, blocks;
|
|
365
365
|
return __generator(this, function (_a) {
|
|
366
366
|
switch (_a.label) {
|
|
367
367
|
case 0:
|
|
@@ -379,7 +379,14 @@ var BlockchainConnector = /** @class */ (function (_super) {
|
|
|
379
379
|
startBlock = Math.max(lastBlock - 1000, 0);
|
|
380
380
|
}
|
|
381
381
|
transactionsByAddress = {};
|
|
382
|
-
addresses.
|
|
382
|
+
validAddresses = addresses.filter(function (address) { var _a; return (_a = store_1.default.web3Https) === null || _a === void 0 ? void 0 : _a.utils.isAddress(address); });
|
|
383
|
+
if (!validAddresses.length) {
|
|
384
|
+
return [2 /*return*/, {
|
|
385
|
+
transactionsByAddress: transactionsByAddress,
|
|
386
|
+
lastBlock: lastBlock,
|
|
387
|
+
}];
|
|
388
|
+
}
|
|
389
|
+
validAddresses.forEach(function (address) { return (transactionsByAddress[address] = []); });
|
|
383
390
|
_a.label = 2;
|
|
384
391
|
case 2:
|
|
385
392
|
if (!(startBlock <= lastBlock)) return [3 /*break*/, 4];
|
|
@@ -397,9 +404,9 @@ var BlockchainConnector = /** @class */ (function (_super) {
|
|
|
397
404
|
return;
|
|
398
405
|
block.transactions.forEach(function (transaction) {
|
|
399
406
|
var address = null;
|
|
400
|
-
if (
|
|
407
|
+
if (validAddresses.includes(transaction.from))
|
|
401
408
|
address = transaction.from;
|
|
402
|
-
else if (transaction.to &&
|
|
409
|
+
else if (transaction.to && validAddresses.includes(transaction.to))
|
|
403
410
|
address = transaction.to;
|
|
404
411
|
if (address) {
|
|
405
412
|
transactionsByAddress[address].push(__assign(__assign({}, transaction), { timestamp: +block.timestamp * 1000, input: transaction.input }));
|
package/build/contracts/app.json
CHANGED
|
@@ -4213,9 +4213,9 @@
|
|
|
4213
4213
|
"type": "uint256[]"
|
|
4214
4214
|
},
|
|
4215
4215
|
{
|
|
4216
|
-
"internalType": "uint256
|
|
4217
|
-
"name": "
|
|
4218
|
-
"type": "uint256
|
|
4216
|
+
"internalType": "uint256",
|
|
4217
|
+
"name": "outputOffer",
|
|
4218
|
+
"type": "uint256"
|
|
4219
4219
|
}
|
|
4220
4220
|
],
|
|
4221
4221
|
"internalType": "struct OrderArgs",
|
|
@@ -4316,9 +4316,9 @@
|
|
|
4316
4316
|
"type": "uint256[]"
|
|
4317
4317
|
},
|
|
4318
4318
|
{
|
|
4319
|
-
"internalType": "uint256
|
|
4320
|
-
"name": "
|
|
4321
|
-
"type": "uint256
|
|
4319
|
+
"internalType": "uint256",
|
|
4320
|
+
"name": "outputOffer",
|
|
4321
|
+
"type": "uint256"
|
|
4322
4322
|
}
|
|
4323
4323
|
],
|
|
4324
4324
|
"internalType": "struct OrderArgs",
|
|
@@ -4419,9 +4419,9 @@
|
|
|
4419
4419
|
"type": "uint256[]"
|
|
4420
4420
|
},
|
|
4421
4421
|
{
|
|
4422
|
-
"internalType": "uint256
|
|
4423
|
-
"name": "
|
|
4424
|
-
"type": "uint256
|
|
4422
|
+
"internalType": "uint256",
|
|
4423
|
+
"name": "outputOffer",
|
|
4424
|
+
"type": "uint256"
|
|
4425
4425
|
}
|
|
4426
4426
|
],
|
|
4427
4427
|
"internalType": "struct OrderArgs",
|
|
@@ -4534,9 +4534,9 @@
|
|
|
4534
4534
|
"type": "uint256[]"
|
|
4535
4535
|
},
|
|
4536
4536
|
{
|
|
4537
|
-
"internalType": "uint256
|
|
4538
|
-
"name": "
|
|
4539
|
-
"type": "uint256
|
|
4537
|
+
"internalType": "uint256",
|
|
4538
|
+
"name": "outputOffer",
|
|
4539
|
+
"type": "uint256"
|
|
4540
4540
|
}
|
|
4541
4541
|
],
|
|
4542
4542
|
"internalType": "struct OrderArgs",
|
|
@@ -5246,9 +5246,9 @@
|
|
|
5246
5246
|
"type": "uint256[]"
|
|
5247
5247
|
},
|
|
5248
5248
|
{
|
|
5249
|
-
"internalType": "uint256
|
|
5250
|
-
"name": "
|
|
5251
|
-
"type": "uint256
|
|
5249
|
+
"internalType": "uint256",
|
|
5250
|
+
"name": "outputOffer",
|
|
5251
|
+
"type": "uint256"
|
|
5252
5252
|
}
|
|
5253
5253
|
],
|
|
5254
5254
|
"internalType": "struct OrderArgs",
|
|
@@ -5412,12 +5412,117 @@
|
|
|
5412
5412
|
"type": "uint256"
|
|
5413
5413
|
}
|
|
5414
5414
|
],
|
|
5415
|
-
"name": "
|
|
5415
|
+
"name": "getOrderSelectedUsage",
|
|
5416
5416
|
"outputs": [
|
|
5417
5417
|
{
|
|
5418
|
-
"
|
|
5418
|
+
"components": [
|
|
5419
|
+
{
|
|
5420
|
+
"components": [
|
|
5421
|
+
{
|
|
5422
|
+
"internalType": "uint64",
|
|
5423
|
+
"name": "cpuCores",
|
|
5424
|
+
"type": "uint64"
|
|
5425
|
+
},
|
|
5426
|
+
{
|
|
5427
|
+
"internalType": "uint64",
|
|
5428
|
+
"name": "ram",
|
|
5429
|
+
"type": "uint64"
|
|
5430
|
+
},
|
|
5431
|
+
{
|
|
5432
|
+
"internalType": "uint64",
|
|
5433
|
+
"name": "diskUsage",
|
|
5434
|
+
"type": "uint64"
|
|
5435
|
+
}
|
|
5436
|
+
],
|
|
5437
|
+
"internalType": "struct SlotInfo",
|
|
5438
|
+
"name": "slotInfo",
|
|
5439
|
+
"type": "tuple"
|
|
5440
|
+
},
|
|
5441
|
+
{
|
|
5442
|
+
"components": [
|
|
5443
|
+
{
|
|
5444
|
+
"internalType": "enum PriceType",
|
|
5445
|
+
"name": "priceType",
|
|
5446
|
+
"type": "uint8"
|
|
5447
|
+
},
|
|
5448
|
+
{
|
|
5449
|
+
"internalType": "uint256",
|
|
5450
|
+
"name": "price",
|
|
5451
|
+
"type": "uint256"
|
|
5452
|
+
},
|
|
5453
|
+
{
|
|
5454
|
+
"internalType": "uint64",
|
|
5455
|
+
"name": "minTimeMinutes",
|
|
5456
|
+
"type": "uint64"
|
|
5457
|
+
},
|
|
5458
|
+
{
|
|
5459
|
+
"internalType": "uint64",
|
|
5460
|
+
"name": "maxTimeMinutes",
|
|
5461
|
+
"type": "uint64"
|
|
5462
|
+
}
|
|
5463
|
+
],
|
|
5464
|
+
"internalType": "struct SlotUsage",
|
|
5465
|
+
"name": "slotUsage",
|
|
5466
|
+
"type": "tuple"
|
|
5467
|
+
},
|
|
5468
|
+
{
|
|
5469
|
+
"components": [
|
|
5470
|
+
{
|
|
5471
|
+
"internalType": "uint64",
|
|
5472
|
+
"name": "bandwidth",
|
|
5473
|
+
"type": "uint64"
|
|
5474
|
+
},
|
|
5475
|
+
{
|
|
5476
|
+
"internalType": "uint64",
|
|
5477
|
+
"name": "traffic",
|
|
5478
|
+
"type": "uint64"
|
|
5479
|
+
},
|
|
5480
|
+
{
|
|
5481
|
+
"internalType": "uint64",
|
|
5482
|
+
"name": "externalPort",
|
|
5483
|
+
"type": "uint64"
|
|
5484
|
+
}
|
|
5485
|
+
],
|
|
5486
|
+
"internalType": "struct OptionInfo[]",
|
|
5487
|
+
"name": "optionInfo",
|
|
5488
|
+
"type": "tuple[]"
|
|
5489
|
+
},
|
|
5490
|
+
{
|
|
5491
|
+
"components": [
|
|
5492
|
+
{
|
|
5493
|
+
"internalType": "enum PriceType",
|
|
5494
|
+
"name": "priceType",
|
|
5495
|
+
"type": "uint8"
|
|
5496
|
+
},
|
|
5497
|
+
{
|
|
5498
|
+
"internalType": "uint256",
|
|
5499
|
+
"name": "price",
|
|
5500
|
+
"type": "uint256"
|
|
5501
|
+
},
|
|
5502
|
+
{
|
|
5503
|
+
"internalType": "uint64",
|
|
5504
|
+
"name": "minTimeMinutes",
|
|
5505
|
+
"type": "uint64"
|
|
5506
|
+
},
|
|
5507
|
+
{
|
|
5508
|
+
"internalType": "uint64",
|
|
5509
|
+
"name": "maxTimeMinutes",
|
|
5510
|
+
"type": "uint64"
|
|
5511
|
+
}
|
|
5512
|
+
],
|
|
5513
|
+
"internalType": "struct SlotUsage[]",
|
|
5514
|
+
"name": "optionUsage",
|
|
5515
|
+
"type": "tuple[]"
|
|
5516
|
+
},
|
|
5517
|
+
{
|
|
5518
|
+
"internalType": "uint32[]",
|
|
5519
|
+
"name": "optionsCount",
|
|
5520
|
+
"type": "uint32[]"
|
|
5521
|
+
}
|
|
5522
|
+
],
|
|
5523
|
+
"internalType": "struct OrderUsage",
|
|
5419
5524
|
"name": "",
|
|
5420
|
-
"type": "
|
|
5525
|
+
"type": "tuple"
|
|
5421
5526
|
}
|
|
5422
5527
|
],
|
|
5423
5528
|
"stateMutability": "view",
|
|
@@ -5431,34 +5536,12 @@
|
|
|
5431
5536
|
"type": "uint256"
|
|
5432
5537
|
}
|
|
5433
5538
|
],
|
|
5434
|
-
"name": "
|
|
5539
|
+
"name": "getOrderSubOrders",
|
|
5435
5540
|
"outputs": [
|
|
5436
5541
|
{
|
|
5437
|
-
"
|
|
5438
|
-
{
|
|
5439
|
-
"internalType": "uint64",
|
|
5440
|
-
"name": "bandwidth",
|
|
5441
|
-
"type": "uint64"
|
|
5442
|
-
},
|
|
5443
|
-
{
|
|
5444
|
-
"internalType": "uint64",
|
|
5445
|
-
"name": "traffic",
|
|
5446
|
-
"type": "uint64"
|
|
5447
|
-
},
|
|
5448
|
-
{
|
|
5449
|
-
"internalType": "uint64",
|
|
5450
|
-
"name": "externalPort",
|
|
5451
|
-
"type": "uint64"
|
|
5452
|
-
}
|
|
5453
|
-
],
|
|
5454
|
-
"internalType": "struct OptionInfo[]",
|
|
5455
|
-
"name": "",
|
|
5456
|
-
"type": "tuple[]"
|
|
5457
|
-
},
|
|
5458
|
-
{
|
|
5459
|
-
"internalType": "uint32[]",
|
|
5542
|
+
"internalType": "uint256[]",
|
|
5460
5543
|
"name": "",
|
|
5461
|
-
"type": "
|
|
5544
|
+
"type": "uint256[]"
|
|
5462
5545
|
}
|
|
5463
5546
|
],
|
|
5464
5547
|
"stateMutability": "view",
|
|
@@ -7135,9 +7218,28 @@
|
|
|
7135
7218
|
"stateMutability": "view",
|
|
7136
7219
|
"type": "function"
|
|
7137
7220
|
},
|
|
7221
|
+
{
|
|
7222
|
+
"inputs": [
|
|
7223
|
+
{
|
|
7224
|
+
"internalType": "uint256",
|
|
7225
|
+
"name": "teeOfferId",
|
|
7226
|
+
"type": "uint256"
|
|
7227
|
+
}
|
|
7228
|
+
],
|
|
7229
|
+
"name": "getTeeOfferSlotsCount",
|
|
7230
|
+
"outputs": [
|
|
7231
|
+
{
|
|
7232
|
+
"internalType": "uint256",
|
|
7233
|
+
"name": "",
|
|
7234
|
+
"type": "uint256"
|
|
7235
|
+
}
|
|
7236
|
+
],
|
|
7237
|
+
"stateMutability": "view",
|
|
7238
|
+
"type": "function"
|
|
7239
|
+
},
|
|
7138
7240
|
{
|
|
7139
7241
|
"inputs": [],
|
|
7140
|
-
"name": "
|
|
7242
|
+
"name": "getTeeOffersSlotsCountTotal",
|
|
7141
7243
|
"outputs": [
|
|
7142
7244
|
{
|
|
7143
7245
|
"internalType": "uint256",
|
|
@@ -7916,9 +8018,28 @@
|
|
|
7916
8018
|
"stateMutability": "view",
|
|
7917
8019
|
"type": "function"
|
|
7918
8020
|
},
|
|
8021
|
+
{
|
|
8022
|
+
"inputs": [
|
|
8023
|
+
{
|
|
8024
|
+
"internalType": "uint256",
|
|
8025
|
+
"name": "offerId",
|
|
8026
|
+
"type": "uint256"
|
|
8027
|
+
}
|
|
8028
|
+
],
|
|
8029
|
+
"name": "getValueOfferSlotsCount",
|
|
8030
|
+
"outputs": [
|
|
8031
|
+
{
|
|
8032
|
+
"internalType": "uint256",
|
|
8033
|
+
"name": "",
|
|
8034
|
+
"type": "uint256"
|
|
8035
|
+
}
|
|
8036
|
+
],
|
|
8037
|
+
"stateMutability": "view",
|
|
8038
|
+
"type": "function"
|
|
8039
|
+
},
|
|
7919
8040
|
{
|
|
7920
8041
|
"inputs": [],
|
|
7921
|
-
"name": "
|
|
8042
|
+
"name": "getValueOffersSlotsCountTotal",
|
|
7922
8043
|
"outputs": [
|
|
7923
8044
|
{
|
|
7924
8045
|
"internalType": "uint256",
|
|
@@ -8129,9 +8250,9 @@
|
|
|
8129
8250
|
"type": "uint256[]"
|
|
8130
8251
|
},
|
|
8131
8252
|
{
|
|
8132
|
-
"internalType": "uint256
|
|
8133
|
-
"name": "
|
|
8134
|
-
"type": "uint256
|
|
8253
|
+
"internalType": "uint256",
|
|
8254
|
+
"name": "outputOffer",
|
|
8255
|
+
"type": "uint256"
|
|
8135
8256
|
}
|
|
8136
8257
|
],
|
|
8137
8258
|
"internalType": "struct OrderArgs",
|
|
@@ -8208,9 +8329,9 @@
|
|
|
8208
8329
|
"type": "uint256[]"
|
|
8209
8330
|
},
|
|
8210
8331
|
{
|
|
8211
|
-
"internalType": "uint256
|
|
8212
|
-
"name": "
|
|
8213
|
-
"type": "uint256
|
|
8332
|
+
"internalType": "uint256",
|
|
8333
|
+
"name": "outputOffer",
|
|
8334
|
+
"type": "uint256"
|
|
8214
8335
|
}
|
|
8215
8336
|
],
|
|
8216
8337
|
"internalType": "struct OrderArgs",
|
|
@@ -10108,9 +10229,9 @@
|
|
|
10108
10229
|
"type": "uint256[]"
|
|
10109
10230
|
},
|
|
10110
10231
|
{
|
|
10111
|
-
"internalType": "uint256
|
|
10112
|
-
"name": "
|
|
10113
|
-
"type": "uint256
|
|
10232
|
+
"internalType": "uint256",
|
|
10233
|
+
"name": "outputOffer",
|
|
10234
|
+
"type": "uint256"
|
|
10114
10235
|
}
|
|
10115
10236
|
],
|
|
10116
10237
|
"internalType": "struct OrderArgs",
|
|
@@ -10216,9 +10337,9 @@
|
|
|
10216
10337
|
"type": "uint256[]"
|
|
10217
10338
|
},
|
|
10218
10339
|
{
|
|
10219
|
-
"internalType": "uint256
|
|
10220
|
-
"name": "
|
|
10221
|
-
"type": "uint256
|
|
10340
|
+
"internalType": "uint256",
|
|
10341
|
+
"name": "outputOffer",
|
|
10342
|
+
"type": "uint256"
|
|
10222
10343
|
}
|
|
10223
10344
|
],
|
|
10224
10345
|
"internalType": "struct OrderArgs",
|
|
@@ -10334,9 +10455,9 @@
|
|
|
10334
10455
|
"type": "uint256[]"
|
|
10335
10456
|
},
|
|
10336
10457
|
{
|
|
10337
|
-
"internalType": "uint256
|
|
10338
|
-
"name": "
|
|
10339
|
-
"type": "uint256
|
|
10458
|
+
"internalType": "uint256",
|
|
10459
|
+
"name": "outputOffer",
|
|
10460
|
+
"type": "uint256"
|
|
10340
10461
|
}
|
|
10341
10462
|
],
|
|
10342
10463
|
"internalType": "struct OrderArgs",
|
|
@@ -10583,9 +10704,9 @@
|
|
|
10583
10704
|
"type": "uint256[]"
|
|
10584
10705
|
},
|
|
10585
10706
|
{
|
|
10586
|
-
"internalType": "uint256
|
|
10587
|
-
"name": "
|
|
10588
|
-
"type": "uint256
|
|
10707
|
+
"internalType": "uint256",
|
|
10708
|
+
"name": "outputOffer",
|
|
10709
|
+
"type": "uint256"
|
|
10589
10710
|
}
|
|
10590
10711
|
],
|
|
10591
10712
|
"internalType": "struct OrderArgs",
|
package/build/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export * from "./types/HardwareInfo";
|
|
|
46
46
|
export * from "./types/SlotInfo";
|
|
47
47
|
export * from "./types/SlotUsage";
|
|
48
48
|
export * from "./types/OptionInfo";
|
|
49
|
+
export * from "./types/TeeOfferInfo";
|
|
49
50
|
export * from "./types/TeeOfferOption";
|
|
50
51
|
export * from "./types/TeeOfferSlot";
|
|
51
52
|
export * from "./types/Provider";
|
package/build/index.js
CHANGED
|
@@ -96,6 +96,7 @@ __exportStar(require("./types/HardwareInfo"), exports);
|
|
|
96
96
|
__exportStar(require("./types/SlotInfo"), exports);
|
|
97
97
|
__exportStar(require("./types/SlotUsage"), exports);
|
|
98
98
|
__exportStar(require("./types/OptionInfo"), exports);
|
|
99
|
+
__exportStar(require("./types/TeeOfferInfo"), exports);
|
|
99
100
|
__exportStar(require("./types/TeeOfferOption"), exports);
|
|
100
101
|
__exportStar(require("./types/TeeOfferSlot"), exports);
|
|
101
102
|
__exportStar(require("./types/Provider"), exports);
|
package/build/models/Offer.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ declare class Offer {
|
|
|
67
67
|
/**
|
|
68
68
|
* Function for fetching offer hold deposit
|
|
69
69
|
*/
|
|
70
|
-
getMinDeposit(slotId:
|
|
70
|
+
getMinDeposit(slotId: string): Promise<string>;
|
|
71
71
|
/**
|
|
72
72
|
* Function for fetching cheapest value offer from blockchain
|
|
73
73
|
*/
|
|
@@ -83,13 +83,17 @@ declare class Offer {
|
|
|
83
83
|
* @param slotId - Slot ID
|
|
84
84
|
*/
|
|
85
85
|
getSlotById(slotId: string): Promise<ValueOfferSlot>;
|
|
86
|
+
/**
|
|
87
|
+
* @returns this TEE offer slots count
|
|
88
|
+
*/
|
|
89
|
+
getSlotsCount(): Promise<string>;
|
|
86
90
|
/**
|
|
87
91
|
* Function for fetching offer slots info from blockchain
|
|
88
92
|
* @param begin - The first element of range.
|
|
89
93
|
* @param end - One past the final element in the range.
|
|
90
94
|
* @returns {Promise<ValueOfferSlot[]>}
|
|
91
95
|
*/
|
|
92
|
-
getSlots(begin
|
|
96
|
+
getSlots(begin?: number, end?: number): Promise<ValueOfferSlot[]>;
|
|
93
97
|
/**
|
|
94
98
|
* Function for add slot usage to the value offer
|
|
95
99
|
* @param slotInfo - slot info
|
package/build/models/Offer.js
CHANGED
|
@@ -254,16 +254,14 @@ var Offer = /** @class */ (function () {
|
|
|
254
254
|
/**
|
|
255
255
|
* Function for fetching offer hold deposit
|
|
256
256
|
*/
|
|
257
|
-
Offer.prototype.getMinDeposit = function (slotId
|
|
257
|
+
Offer.prototype.getMinDeposit = function (slotId) {
|
|
258
258
|
return __awaiter(this, void 0, void 0, function () {
|
|
259
259
|
var _a;
|
|
260
260
|
return __generator(this, function (_b) {
|
|
261
261
|
switch (_b.label) {
|
|
262
262
|
case 0:
|
|
263
263
|
_a = this;
|
|
264
|
-
return [4 /*yield*/, Offer.contract.methods
|
|
265
|
-
.getOfferMinDeposit(this.id, slotId, slotCount, optionsIds, optionsCount)
|
|
266
|
-
.call()];
|
|
264
|
+
return [4 /*yield*/, Offer.contract.methods.getOfferMinDeposit(this.id, slotId, "0", [], []).call()];
|
|
267
265
|
case 1:
|
|
268
266
|
_a.minDeposit = _b.sent();
|
|
269
267
|
return [2 /*return*/, this.minDeposit];
|
|
@@ -332,6 +330,19 @@ var Offer = /** @class */ (function () {
|
|
|
332
330
|
});
|
|
333
331
|
});
|
|
334
332
|
};
|
|
333
|
+
/**
|
|
334
|
+
* @returns this TEE offer slots count
|
|
335
|
+
*/
|
|
336
|
+
Offer.prototype.getSlotsCount = function () {
|
|
337
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
338
|
+
return __generator(this, function (_a) {
|
|
339
|
+
switch (_a.label) {
|
|
340
|
+
case 0: return [4 /*yield*/, Offer.contract.methods.getValueOfferSlotsCount().call()];
|
|
341
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
};
|
|
335
346
|
/**
|
|
336
347
|
* Function for fetching offer slots info from blockchain
|
|
337
348
|
* @param begin - The first element of range.
|
|
@@ -339,6 +350,8 @@ var Offer = /** @class */ (function () {
|
|
|
339
350
|
* @returns {Promise<ValueOfferSlot[]>}
|
|
340
351
|
*/
|
|
341
352
|
Offer.prototype.getSlots = function (begin, end) {
|
|
353
|
+
if (begin === void 0) { begin = 0; }
|
|
354
|
+
if (end === void 0) { end = 999999; }
|
|
342
355
|
return __awaiter(this, void 0, void 0, function () {
|
|
343
356
|
var slots, _i, slots_1, slot, _a, _b, _c;
|
|
344
357
|
return __generator(this, function (_d) {
|
package/build/models/Order.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { OrderInfo, OrderResult, ExtendedOrderInfo, OrderStatus } from "../types/Order";
|
|
1
|
+
import { OrderInfo, OrderResult, ExtendedOrderInfo, OrderStatus, OrderUsage } from "../types/Order";
|
|
2
2
|
import { TransactionOptions } from "../types/Web3";
|
|
3
3
|
import { Origins } from "../types/Origins";
|
|
4
|
-
import { OptionInfo } from "../types/OptionInfo";
|
|
5
4
|
declare class Order {
|
|
6
5
|
private static contract;
|
|
7
6
|
private logger;
|
|
7
|
+
selectedUsage?: OrderUsage;
|
|
8
8
|
orderInfo?: OrderInfo;
|
|
9
9
|
orderResult?: OrderResult;
|
|
10
10
|
subOrders?: string[];
|
|
@@ -54,10 +54,7 @@ declare class Order {
|
|
|
54
54
|
/**
|
|
55
55
|
* Function for fetching order deposit spent from blockchain
|
|
56
56
|
*/
|
|
57
|
-
|
|
58
|
-
options: OptionInfo[];
|
|
59
|
-
count: number[];
|
|
60
|
-
}>;
|
|
57
|
+
getSelectedUsage(): Promise<OrderUsage>;
|
|
61
58
|
/**
|
|
62
59
|
* Function for fetching hold deposits sum of the order and its suborders
|
|
63
60
|
*/
|
|
@@ -129,11 +126,11 @@ declare class Order {
|
|
|
129
126
|
/**
|
|
130
127
|
* Function for creating sub orders for current order
|
|
131
128
|
* @param subOrderInfo - order info for new subOrder
|
|
132
|
-
* @param
|
|
129
|
+
* @param blockParentOrder - is sub order blocking
|
|
133
130
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
134
|
-
* @returns
|
|
131
|
+
* @returns Promise<void> - Does not return id of created sub order!
|
|
135
132
|
*/
|
|
136
|
-
createSubOrder(subOrderInfo: OrderInfo,
|
|
133
|
+
createSubOrder(subOrderInfo: OrderInfo, blockParentOrder: boolean, deposit?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
137
134
|
/**
|
|
138
135
|
* Function for creating pack of sub orders (wokflow) for current order
|
|
139
136
|
* @param subOrdersInfo - orders info for new subOrders
|
package/build/models/Order.js
CHANGED
|
@@ -67,7 +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
|
|
70
|
+
var TeeOffers_1 = __importDefault(require("../staticModels/TeeOffers"));
|
|
71
71
|
var Order = /** @class */ (function () {
|
|
72
72
|
function Order(orderId) {
|
|
73
73
|
this.id = orderId;
|
|
@@ -223,20 +223,25 @@ var Order = /** @class */ (function () {
|
|
|
223
223
|
/**
|
|
224
224
|
* Function for fetching order deposit spent from blockchain
|
|
225
225
|
*/
|
|
226
|
-
Order.prototype.
|
|
226
|
+
Order.prototype.getSelectedUsage = function () {
|
|
227
227
|
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
-
var _a,
|
|
229
|
-
return __generator(this, function (
|
|
230
|
-
switch (
|
|
231
|
-
case 0:
|
|
228
|
+
var _a, _b, _c, _d, _e;
|
|
229
|
+
return __generator(this, function (_f) {
|
|
230
|
+
switch (_f.label) {
|
|
231
|
+
case 0:
|
|
232
|
+
_a = this;
|
|
233
|
+
_b = utils_1.tupleToObject;
|
|
234
|
+
return [4 /*yield*/, Order.contract.methods.getOrderSelectedUsage(this.id).call()];
|
|
232
235
|
case 1:
|
|
233
|
-
_a = _b.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
236
|
+
_a.selectedUsage = _b.apply(void 0, [_f.sent(), Order_1.OrderUsageStructure]);
|
|
237
|
+
this.selectedUsage.optionsCount = this.selectedUsage.optionsCount.map(function (item) { return +item; });
|
|
238
|
+
_c = this.selectedUsage;
|
|
239
|
+
_d = utils_1.unpackSlotInfo;
|
|
240
|
+
_e = [this.selectedUsage.slotInfo];
|
|
241
|
+
return [4 /*yield*/, TeeOffers_1.default.getDenominator()];
|
|
242
|
+
case 2:
|
|
243
|
+
_c.slotInfo = _d.apply(void 0, _e.concat([_f.sent()]));
|
|
244
|
+
return [2 /*return*/, this.selectedUsage];
|
|
240
245
|
}
|
|
241
246
|
});
|
|
242
247
|
});
|
|
@@ -504,12 +509,12 @@ var Order = /** @class */ (function () {
|
|
|
504
509
|
/**
|
|
505
510
|
* Function for creating sub orders for current order
|
|
506
511
|
* @param subOrderInfo - order info for new subOrder
|
|
507
|
-
* @param
|
|
512
|
+
* @param blockParentOrder - is sub order blocking
|
|
508
513
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
509
|
-
* @returns
|
|
514
|
+
* @returns Promise<void> - Does not return id of created sub order!
|
|
510
515
|
*/
|
|
511
|
-
Order.prototype.createSubOrder = function (subOrderInfo,
|
|
512
|
-
if (
|
|
516
|
+
Order.prototype.createSubOrder = function (subOrderInfo, blockParentOrder, deposit, transactionOptions) {
|
|
517
|
+
if (deposit === void 0) { deposit = "0"; }
|
|
513
518
|
return __awaiter(this, void 0, void 0, function () {
|
|
514
519
|
var preparedInfo, tupleSubOrder, params;
|
|
515
520
|
return __generator(this, function (_a) {
|
|
@@ -520,8 +525,8 @@ var Order = /** @class */ (function () {
|
|
|
520
525
|
preparedInfo = __assign(__assign({}, subOrderInfo), { externalId: (0, utils_2.formatBytes32String)(subOrderInfo.externalId) });
|
|
521
526
|
tupleSubOrder = (0, utils_1.objectToTuple)(preparedInfo, Order_1.OrderInfoStructure);
|
|
522
527
|
params = {
|
|
523
|
-
blockParentOrder:
|
|
524
|
-
|
|
528
|
+
blockParentOrder: blockParentOrder,
|
|
529
|
+
deposit: deposit,
|
|
525
530
|
};
|
|
526
531
|
return [4 /*yield*/, TxManager_1.default.execute(Order.contract.methods.createSubOrder, [this.id, tupleSubOrder, params], transactionOptions)];
|
|
527
532
|
case 1:
|
|
@@ -553,7 +558,7 @@ var Order = /** @class */ (function () {
|
|
|
553
558
|
var tupleSubOrder = (0, utils_1.objectToTuple)(preparedInfo, Order_1.OrderInfoStructure);
|
|
554
559
|
var params = {
|
|
555
560
|
blockParentOrder: subOrderInfo.blocking,
|
|
556
|
-
|
|
561
|
+
deposit: subOrderInfo.deposit,
|
|
557
562
|
};
|
|
558
563
|
var request = Order.contract.methods.createSubOrder(_this.id, tupleSubOrder, params).send.request({
|
|
559
564
|
from: transactionOptions.from,
|
|
@@ -627,7 +632,7 @@ var Order = /** @class */ (function () {
|
|
|
627
632
|
], Order.prototype, "getOptionsDepositSpent", null);
|
|
628
633
|
__decorate([
|
|
629
634
|
(0, utils_1.incrementMethodCall)()
|
|
630
|
-
], Order.prototype, "
|
|
635
|
+
], Order.prototype, "getSelectedUsage", null);
|
|
631
636
|
__decorate([
|
|
632
637
|
(0, utils_1.incrementMethodCall)()
|
|
633
638
|
], Order.prototype, "calculateTotalOrderDeposit", null);
|
package/build/models/TCB.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransactionOptions } from "../types/Web3";
|
|
2
|
-
import { TcbData, TcbStatus,
|
|
2
|
+
import { TcbData, TcbStatus, TcbPublicData, TcbVerifiedStatus } from "../types/Consensus";
|
|
3
3
|
declare class TCB {
|
|
4
4
|
tcbId: string;
|
|
5
5
|
private contract;
|
|
@@ -14,7 +14,7 @@ declare class TCB {
|
|
|
14
14
|
* @param marks - list of marks
|
|
15
15
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
16
16
|
*/
|
|
17
|
-
addToSupply(pb:
|
|
17
|
+
addToSupply(pb: TcbPublicData, quote: string, marks: TcbVerifiedStatus[], transactionOptions?: TransactionOptions): Promise<void>;
|
|
18
18
|
/**
|
|
19
19
|
* Assign TCB from SuspiciousBlocks table to check
|
|
20
20
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|