@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/TIIGenerator.js
CHANGED
|
@@ -74,10 +74,12 @@ var TIIGenerator = /** @class */ (function () {
|
|
|
74
74
|
return [4 /*yield*/, teeOffer.getInfo()];
|
|
75
75
|
case 1:
|
|
76
76
|
teeOfferInfo = _g.sent();
|
|
77
|
-
linkage = linkageString
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
linkage = linkageString
|
|
78
|
+
? JSON.parse(linkageString)
|
|
79
|
+
: {
|
|
80
|
+
encoding: dto_js_1.Encoding.base64,
|
|
81
|
+
mrenclave: "",
|
|
82
|
+
};
|
|
81
83
|
tlb = new tee_lib_1.TLBlockSerializerV1().unserializeTlb(Buffer.from(teeOfferInfo.tlb, "base64"));
|
|
82
84
|
mac = encryption.authTag || encryption.mac;
|
|
83
85
|
rawTri = {
|
|
@@ -86,8 +88,10 @@ var TIIGenerator = /** @class */ (function () {
|
|
|
86
88
|
hash: Buffer.from(hash.hash, hash.encoding),
|
|
87
89
|
}); }),
|
|
88
90
|
mrenclave: Buffer.from(linkage.mrenclave, linkage.encoding),
|
|
89
|
-
args: JSON.stringify(args ||
|
|
90
|
-
encryption: __assign(__assign({}, encryption), { ciphertext: encryption.ciphertext ? Buffer.from(encryption.ciphertext, encryption.encoding) : undefined, key: encryption.key ? Buffer.from(encryption.key, encryption.encoding) : undefined, iv: encryption.iv
|
|
91
|
+
args: JSON.stringify(args || ""),
|
|
92
|
+
encryption: __assign(__assign({}, encryption), { ciphertext: encryption.ciphertext ? Buffer.from(encryption.ciphertext, encryption.encoding) : undefined, key: encryption.key ? Buffer.from(encryption.key, encryption.encoding) : undefined, iv: encryption.iv
|
|
93
|
+
? Buffer.from(encryption.iv, encryption.encoding)
|
|
94
|
+
: undefined, mac: mac ? Buffer.from(mac, encryption.encoding) : undefined }),
|
|
91
95
|
};
|
|
92
96
|
tri = TRI_1.TRI.encode(rawTri).finish();
|
|
93
97
|
_b = (_a = Compression_1.Compression).encode;
|
|
@@ -130,7 +134,7 @@ var TIIGenerator = /** @class */ (function () {
|
|
|
130
134
|
return [4 /*yield*/, this.getSolutionHashesAndLinkage(parentOrderInfo.args.inputOffers)];
|
|
131
135
|
case 3:
|
|
132
136
|
_a = _b.sent(), hashes = _a.hashes, linkage = _a.linkage;
|
|
133
|
-
return [2 /*return*/, this.generateByOffer(parentOrderInfo.
|
|
137
|
+
return [2 /*return*/, this.generateByOffer(parentOrderInfo.offerId, hashes, linkage, resource, args, encryption)];
|
|
134
138
|
}
|
|
135
139
|
});
|
|
136
140
|
});
|
|
@@ -155,9 +159,7 @@ var TIIGenerator = /** @class */ (function () {
|
|
|
155
159
|
if (offerInfo.hash) {
|
|
156
160
|
solutionHashes.push(JSON.parse(offerInfo.hash));
|
|
157
161
|
}
|
|
158
|
-
restrictions = lodash_1.default
|
|
159
|
-
.intersection(offerInfo.restrictions.offers, inputOffers)
|
|
160
|
-
.filter(function (restrictedOfferId) { return restrictedOfferId !== offer.id; });
|
|
162
|
+
restrictions = lodash_1.default.intersection(offerInfo.restrictions.offers, inputOffers).filter(function (restrictedOfferId) { return restrictedOfferId !== offer.id; });
|
|
161
163
|
if (restrictions.length) {
|
|
162
164
|
solutionLinkage = offerInfo.linkage;
|
|
163
165
|
}
|
|
@@ -199,7 +201,7 @@ var TIIGenerator = /** @class */ (function () {
|
|
|
199
201
|
case 3:
|
|
200
202
|
decompressed = _b.sent();
|
|
201
203
|
return [3 /*break*/, 5];
|
|
202
|
-
case 4: throw Error(
|
|
204
|
+
case 4: throw Error("Unknown compression method");
|
|
203
205
|
case 5:
|
|
204
206
|
decoded = TRI_1.TRI.decode(decompressed);
|
|
205
207
|
return [2 /*return*/, {
|
|
@@ -218,9 +220,9 @@ var TIIGenerator = /** @class */ (function () {
|
|
|
218
220
|
cipher: decoded.encryption.cipher,
|
|
219
221
|
encoding: dto_js_1.Encoding.base64,
|
|
220
222
|
key: Buffer.from(decoded.encryption.key).toString(dto_js_1.Encoding.base64),
|
|
221
|
-
iv:
|
|
222
|
-
mac:
|
|
223
|
-
}
|
|
223
|
+
iv: decoded.encryption.iv && Buffer.from(decoded.encryption.iv).toString(dto_js_1.Encoding.base64),
|
|
224
|
+
mac: decoded.encryption.mac && Buffer.from(decoded.encryption.mac).toString(dto_js_1.Encoding.base64),
|
|
225
|
+
},
|
|
224
226
|
}];
|
|
225
227
|
}
|
|
226
228
|
});
|
|
@@ -33,7 +33,7 @@ declare class BlockchainConnector extends BaseConnector {
|
|
|
33
33
|
/**
|
|
34
34
|
* Function for adding event listeners on TEE offer created event in TEE offers factory contract
|
|
35
35
|
* @param callback - function for processing created TEE offer
|
|
36
|
-
* @
|
|
36
|
+
* @returns unsubscribe - unsubscribe function from event
|
|
37
37
|
*/
|
|
38
38
|
getLastBlockInfo(): Promise<BlockInfo>;
|
|
39
39
|
/**
|
|
@@ -244,7 +244,7 @@ var BlockchainConnector = /** @class */ (function (_super) {
|
|
|
244
244
|
/**
|
|
245
245
|
* Function for adding event listeners on TEE offer created event in TEE offers factory contract
|
|
246
246
|
* @param callback - function for processing created TEE offer
|
|
247
|
-
* @
|
|
247
|
+
* @returns unsubscribe - unsubscribe function from event
|
|
248
248
|
*/
|
|
249
249
|
BlockchainConnector.prototype.getLastBlockInfo = function () {
|
|
250
250
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -328,9 +328,11 @@ var BlockchainConnector = /** @class */ (function (_super) {
|
|
|
328
328
|
if (error)
|
|
329
329
|
return reject(error);
|
|
330
330
|
results = results || [];
|
|
331
|
-
var response = requests
|
|
331
|
+
var response = requests
|
|
332
|
+
.map(function (request, index) {
|
|
332
333
|
return results[index] || {};
|
|
333
|
-
})
|
|
334
|
+
})
|
|
335
|
+
.map(function (result, index) {
|
|
334
336
|
if (result && result.error) {
|
|
335
337
|
return web3_core_helpers_1.errors.ErrorResponse(result);
|
|
336
338
|
}
|
|
@@ -389,7 +391,7 @@ var BlockchainConnector = /** @class */ (function (_super) {
|
|
|
389
391
|
}
|
|
390
392
|
return [4 /*yield*/, this.executeBatchAsync(batch)];
|
|
391
393
|
case 3:
|
|
392
|
-
blocks = _a.sent();
|
|
394
|
+
blocks = (_a.sent());
|
|
393
395
|
blocks.forEach(function (block) {
|
|
394
396
|
if (!(block === null || block === void 0 ? void 0 : block.transactions))
|
|
395
397
|
return;
|