@super-protocol/sdk-js 0.8.0-beta.9 → 0.8.1-beta.2
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.
|
@@ -183,12 +183,11 @@ exports.downloadChunkMethod = downloadChunkMethod;
|
|
|
183
183
|
var createDownloadChunkMethodWithRetry = function (downloadChunkMethod, _a) {
|
|
184
184
|
var _b = _a === void 0 ? {} : _a, _c = _b.retryMaxCount, retryMaxCount = _c === void 0 ? 3 : _c, _d = _b.retryWaitTimeFactory, retryWaitTimeFactory = _d === void 0 ? function () { return function () { return 1000; }; } : _d, onRetry = _b.onRetry;
|
|
185
185
|
return function (provider, objectPath, chunk) { return __awaiter(void 0, void 0, void 0, function () {
|
|
186
|
-
var retryWaitTime,
|
|
186
|
+
var retryWaitTime, retryCount, error_1;
|
|
187
187
|
return __generator(this, function (_a) {
|
|
188
188
|
switch (_a.label) {
|
|
189
189
|
case 0:
|
|
190
190
|
retryWaitTime = retryWaitTimeFactory();
|
|
191
|
-
lastError = null;
|
|
192
191
|
retryCount = retryMaxCount;
|
|
193
192
|
_a.label = 1;
|
|
194
193
|
case 1:
|
|
@@ -200,12 +199,11 @@ var createDownloadChunkMethodWithRetry = function (downloadChunkMethod, _a) {
|
|
|
200
199
|
case 3: return [2 /*return*/, _a.sent()];
|
|
201
200
|
case 4:
|
|
202
201
|
error_1 = _a.sent();
|
|
203
|
-
lastError = error_1;
|
|
204
202
|
return [3 /*break*/, 5];
|
|
205
203
|
case 5:
|
|
206
204
|
retryCount--;
|
|
207
205
|
if (onRetry) {
|
|
208
|
-
onRetry(
|
|
206
|
+
onRetry(null, chunk, retryCount);
|
|
209
207
|
}
|
|
210
208
|
if (!(retryCount !== 0)) return [3 /*break*/, 7];
|
|
211
209
|
return [4 /*yield*/, new Promise(function (resolve, reject) { return setTimeout(resolve, retryWaitTime()); })];
|
|
@@ -215,7 +213,7 @@ var createDownloadChunkMethodWithRetry = function (downloadChunkMethod, _a) {
|
|
|
215
213
|
case 7: return [3 /*break*/, 1];
|
|
216
214
|
case 8: throw new Error("Max retry attempts was reached for object path ".concat(objectPath, ", offset ").concat(chunk.offset, ", length ").concat(chunk.length
|
|
217
215
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
218
|
-
|
|
216
|
+
));
|
|
219
217
|
}
|
|
220
218
|
});
|
|
221
219
|
}); };
|
|
@@ -23,6 +23,12 @@ declare class TeeOffersFactory {
|
|
|
23
23
|
*/
|
|
24
24
|
static createTeeOffer(providerAuthorityAccount: string, teeOfferInfo: TeeOfferInfo, externalId?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
25
25
|
static getOffer(creator: string, externalId: string): Promise<OfferCreatedEvent>;
|
|
26
|
+
/**
|
|
27
|
+
* Function for fetching TEE offer id by TEE deviceId
|
|
28
|
+
* @param deviceId - unque TEE device id (unparsed, from blockchain)
|
|
29
|
+
* @return TEE offer id
|
|
30
|
+
*/
|
|
31
|
+
static getByDeviceId(deviceId: string): Promise<string>;
|
|
26
32
|
/**
|
|
27
33
|
* Function for adding event listeners on TEE offer created event in TEE offers factory contract
|
|
28
34
|
* @param callback - function for processing created TEE offer
|
|
@@ -158,6 +158,15 @@ var TeeOffersFactory = /** @class */ (function () {
|
|
|
158
158
|
});
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* Function for fetching TEE offer id by TEE deviceId
|
|
163
|
+
* @param deviceId - unque TEE device id (unparsed, from blockchain)
|
|
164
|
+
* @return TEE offer id
|
|
165
|
+
*/
|
|
166
|
+
TeeOffersFactory.getByDeviceId = function (deviceId) {
|
|
167
|
+
var contract = this.checkInit();
|
|
168
|
+
return contract.methods.getTeeOfferByDeviceId(deviceId);
|
|
169
|
+
};
|
|
161
170
|
/**
|
|
162
171
|
* Function for adding event listeners on TEE offer created event in TEE offers factory contract
|
|
163
172
|
* @param callback - function for processing created TEE offer
|