@super-protocol/sdk-js 0.6.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 (132) hide show
  1. package/build/BlockchainConnector.d.ts +48 -0
  2. package/build/BlockchainConnector.js +259 -0
  3. package/build/TIIGenerator.d.ts +21 -0
  4. package/build/TIIGenerator.js +251 -0
  5. package/build/constants.d.ts +7 -0
  6. package/build/constants.js +10 -0
  7. package/build/contracts/ActiveOffersList.json +131 -0
  8. package/build/contracts/ActiveOrdersList.json +74 -0
  9. package/build/contracts/Marks.json +79 -0
  10. package/build/contracts/Offers.json +999 -0
  11. package/build/contracts/Orders.json +984 -0
  12. package/build/contracts/Providers.json +440 -0
  13. package/build/contracts/ProvidersOffers.json +254 -0
  14. package/build/contracts/Staking.json +323 -0
  15. package/build/contracts/Superpro.json +197 -0
  16. package/build/contracts/SuperproToken.json +356 -0
  17. package/build/crypto/Crypto.d.ts +37 -0
  18. package/build/crypto/Crypto.js +181 -0
  19. package/build/crypto/index.d.ts +2 -0
  20. package/build/crypto/index.js +7 -0
  21. package/build/crypto/nodejs/AES.d.ts +24 -0
  22. package/build/crypto/nodejs/AES.js +152 -0
  23. package/build/crypto/nodejs/ARIA.d.ts +24 -0
  24. package/build/crypto/nodejs/ARIA.js +151 -0
  25. package/build/crypto/nodejs/ECIES.d.ts +6 -0
  26. package/build/crypto/nodejs/ECIES.js +94 -0
  27. package/build/crypto/nodejs/NativeCrypto.d.ts +54 -0
  28. package/build/crypto/nodejs/NativeCrypto.js +214 -0
  29. package/build/crypto/nodejs/RSA-Hybrid.d.ts +15 -0
  30. package/build/crypto/nodejs/RSA-Hybrid.js +153 -0
  31. package/build/index.d.ts +65 -0
  32. package/build/index.js +117 -0
  33. package/build/logger.d.ts +4 -0
  34. package/build/logger.js +8 -0
  35. package/build/models/Ballot.d.ts +13 -0
  36. package/build/models/Ballot.js +76 -0
  37. package/build/models/Offer.d.ts +70 -0
  38. package/build/models/Offer.js +273 -0
  39. package/build/models/Order.d.ts +125 -0
  40. package/build/models/Order.js +540 -0
  41. package/build/models/Provider.d.ts +40 -0
  42. package/build/models/Provider.js +167 -0
  43. package/build/models/TCB.d.ts +80 -0
  44. package/build/models/TCB.js +315 -0
  45. package/build/models/TeeOffer.d.ts +118 -0
  46. package/build/models/TeeOffer.js +436 -0
  47. package/build/proto/Compression.d.ts +33 -0
  48. package/build/proto/Compression.js +146 -0
  49. package/build/proto/TRI.d.ts +122 -0
  50. package/build/proto/TRI.js +316 -0
  51. package/build/providers/storage/ChunksDownloadDecorator.d.ts +38 -0
  52. package/build/providers/storage/ChunksDownloadDecorator.js +284 -0
  53. package/build/providers/storage/IStorageProvider.d.ts +17 -0
  54. package/build/providers/storage/IStorageProvider.js +2 -0
  55. package/build/providers/storage/StorjStorageProvider.d.ts +26 -0
  56. package/build/providers/storage/StorjStorageProvider.js +389 -0
  57. package/build/providers/storage/getStorageProvider.d.ts +4 -0
  58. package/build/providers/storage/getStorageProvider.js +16 -0
  59. package/build/staticModels/ActiveOffers.d.ts +29 -0
  60. package/build/staticModels/ActiveOffers.js +144 -0
  61. package/build/staticModels/ActiveOrders.d.ts +21 -0
  62. package/build/staticModels/ActiveOrders.js +120 -0
  63. package/build/staticModels/Consensus.d.ts +63 -0
  64. package/build/staticModels/Consensus.js +373 -0
  65. package/build/staticModels/Epochs.d.ts +23 -0
  66. package/build/staticModels/Epochs.js +97 -0
  67. package/build/staticModels/LastBlocks.d.ts +25 -0
  68. package/build/staticModels/LastBlocks.js +96 -0
  69. package/build/staticModels/Marks.d.ts +13 -0
  70. package/build/staticModels/Marks.js +113 -0
  71. package/build/staticModels/OffersFactory.d.ts +37 -0
  72. package/build/staticModels/OffersFactory.js +227 -0
  73. package/build/staticModels/OrdersFactory.d.ts +137 -0
  74. package/build/staticModels/OrdersFactory.js +539 -0
  75. package/build/staticModels/ProviderRegistry.d.ts +81 -0
  76. package/build/staticModels/ProviderRegistry.js +311 -0
  77. package/build/staticModels/Staking.d.ts +26 -0
  78. package/build/staticModels/Staking.js +132 -0
  79. package/build/staticModels/Superpro.d.ts +20 -0
  80. package/build/staticModels/Superpro.js +99 -0
  81. package/build/staticModels/SuperproToken.d.ts +30 -0
  82. package/build/staticModels/SuperproToken.js +125 -0
  83. package/build/staticModels/Suspicious.d.ts +26 -0
  84. package/build/staticModels/Suspicious.js +99 -0
  85. package/build/staticModels/TeeOffersFactory.d.ts +36 -0
  86. package/build/staticModels/TeeOffersFactory.js +206 -0
  87. package/build/staticModels/Voting.d.ts +35 -0
  88. package/build/staticModels/Voting.js +111 -0
  89. package/build/store.d.ts +12 -0
  90. package/build/store.js +13 -0
  91. package/build/types/Ballot.d.ts +75 -0
  92. package/build/types/Ballot.js +49 -0
  93. package/build/types/Epoch.d.ts +21 -0
  94. package/build/types/Epoch.js +18 -0
  95. package/build/types/Events.d.ts +18 -0
  96. package/build/types/Events.js +2 -0
  97. package/build/types/Marks.d.ts +5 -0
  98. package/build/types/Marks.js +9 -0
  99. package/build/types/Offer.d.ts +63 -0
  100. package/build/types/Offer.js +41 -0
  101. package/build/types/Order.d.ts +61 -0
  102. package/build/types/Order.js +36 -0
  103. package/build/types/Origins.d.ts +12 -0
  104. package/build/types/Origins.js +10 -0
  105. package/build/types/Provider.d.ts +25 -0
  106. package/build/types/Provider.js +19 -0
  107. package/build/types/Staking.d.ts +27 -0
  108. package/build/types/Staking.js +22 -0
  109. package/build/types/Superpro.d.ts +24 -0
  110. package/build/types/Superpro.js +29 -0
  111. package/build/types/TcbData.d.ts +26 -0
  112. package/build/types/TcbData.js +21 -0
  113. package/build/types/TeeOffer.d.ts +22 -0
  114. package/build/types/TeeOffer.js +15 -0
  115. package/build/types/Web3.d.ts +26 -0
  116. package/build/types/Web3.js +2 -0
  117. package/build/types/blockchainConnector/StorageAccess.d.ts +8 -0
  118. package/build/types/blockchainConnector/StorageAccess.js +2 -0
  119. package/build/types/storage/StorageAccess.d.ts +6 -0
  120. package/build/types/storage/StorageAccess.js +2 -0
  121. package/build/types/storage/StorageFileAccess.d.ts +5 -0
  122. package/build/types/storage/StorageFileAccess.js +2 -0
  123. package/build/types/storage/StorageObject.d.ts +8 -0
  124. package/build/types/storage/StorageObject.js +2 -0
  125. package/build/utils/NonceTracker.d.ts +12 -0
  126. package/build/utils/NonceTracker.js +84 -0
  127. package/build/utils/TxManager.d.ts +21 -0
  128. package/build/utils/TxManager.js +159 -0
  129. package/build/utils.d.ts +38 -0
  130. package/build/utils.js +195 -0
  131. package/package.json +68 -0
  132. package/readme.md +40 -0
@@ -0,0 +1,284 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
54
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
55
+ var m = o[Symbol.asyncIterator], i;
56
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
57
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
58
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
59
+ };
60
+ Object.defineProperty(exports, "__esModule", { value: true });
61
+ exports.DownloadDecorator = exports.createDownloadChunkMethodWithRetry = exports.downloadChunkMethod = void 0;
62
+ var stream_1 = require("stream");
63
+ function generateChunks(dataSize, chunkSize, startOffset) {
64
+ var chunk, offset;
65
+ if (startOffset === void 0) { startOffset = BigInt(0); }
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ chunk = 0;
70
+ offset = startOffset;
71
+ _a.label = 1;
72
+ case 1:
73
+ if (!(dataSize > offset)) return [3 /*break*/, 3];
74
+ return [4 /*yield*/, {
75
+ offset: offset,
76
+ length: chunkSize > dataSize - offset ? Number(dataSize - offset) : chunkSize,
77
+ dataSize: dataSize,
78
+ chunk: chunk++,
79
+ chunksCount: Math.ceil(Number(dataSize / BigInt(chunkSize))),
80
+ }];
81
+ case 2:
82
+ _a.sent();
83
+ offset += BigInt(chunkSize);
84
+ return [3 /*break*/, 1];
85
+ case 3: return [2 /*return*/];
86
+ }
87
+ });
88
+ }
89
+ var ChunkedReadableTransform = /** @class */ (function (_super) {
90
+ __extends(ChunkedReadableTransform, _super);
91
+ function ChunkedReadableTransform(downloadChunk, params) {
92
+ var _this = _super.call(this, {
93
+ objectMode: true,
94
+ highWaterMark: params.concurrency,
95
+ }) || this;
96
+ _this.downloadChunk = downloadChunk;
97
+ return _this;
98
+ }
99
+ ChunkedReadableTransform.prototype._transform = function (chunk, encoding, callback) {
100
+ var resultPromise = this.downloadChunk(chunk);
101
+ callback(null, {
102
+ resultPromise: resultPromise,
103
+ chunk: chunk,
104
+ });
105
+ };
106
+ return ChunkedReadableTransform;
107
+ }(stream_1.Transform));
108
+ var ChainedChunksReadableTransform = /** @class */ (function (_super) {
109
+ __extends(ChainedChunksReadableTransform, _super);
110
+ function ChainedChunksReadableTransform(progressListener) {
111
+ var _this = _super.call(this, {
112
+ objectMode: true,
113
+ highWaterMark: 1,
114
+ }) || this;
115
+ _this.progressListener = progressListener;
116
+ return _this;
117
+ }
118
+ ChainedChunksReadableTransform.prototype._transform = function (obj, encoding, callback) {
119
+ var _this = this;
120
+ obj.resultPromise.then(function (data) {
121
+ callback(null, data);
122
+ if (_this.progressListener) {
123
+ _this.progressListener(Number(obj.chunk.dataSize), Number(obj.chunk.offset) + obj.chunk.length);
124
+ }
125
+ }, function (err) {
126
+ callback(err);
127
+ });
128
+ };
129
+ return ChainedChunksReadableTransform;
130
+ }(stream_1.Transform));
131
+ var downloadChunkMethod = function (provider, objectPath, chunk) { return __awaiter(void 0, void 0, void 0, function () {
132
+ var position, buffer, dataStream, dataStream_1, dataStream_1_1, data, e_1_1;
133
+ var e_1, _a;
134
+ return __generator(this, function (_b) {
135
+ switch (_b.label) {
136
+ case 0:
137
+ position = 0;
138
+ buffer = Buffer.alloc(chunk.length);
139
+ return [4 /*yield*/, provider.downloadFile(objectPath, {
140
+ offset: Number(chunk.offset),
141
+ length: chunk.length,
142
+ })];
143
+ case 1:
144
+ dataStream = _b.sent();
145
+ _b.label = 2;
146
+ case 2:
147
+ _b.trys.push([2, 7, 8, 13]);
148
+ dataStream_1 = __asyncValues(dataStream);
149
+ _b.label = 3;
150
+ case 3: return [4 /*yield*/, dataStream_1.next()];
151
+ case 4:
152
+ if (!(dataStream_1_1 = _b.sent(), !dataStream_1_1.done)) return [3 /*break*/, 6];
153
+ data = dataStream_1_1.value;
154
+ data.copy(buffer, position);
155
+ position += data.length;
156
+ if (position > chunk.length) {
157
+ throw new Error("Chunk buffer is overflow, read data is more than requested for chunk");
158
+ }
159
+ _b.label = 5;
160
+ case 5: return [3 /*break*/, 3];
161
+ case 6: return [3 /*break*/, 13];
162
+ case 7:
163
+ e_1_1 = _b.sent();
164
+ e_1 = { error: e_1_1 };
165
+ return [3 /*break*/, 13];
166
+ case 8:
167
+ _b.trys.push([8, , 11, 12]);
168
+ if (!(dataStream_1_1 && !dataStream_1_1.done && (_a = dataStream_1.return))) return [3 /*break*/, 10];
169
+ return [4 /*yield*/, _a.call(dataStream_1)];
170
+ case 9:
171
+ _b.sent();
172
+ _b.label = 10;
173
+ case 10: return [3 /*break*/, 12];
174
+ case 11:
175
+ if (e_1) throw e_1.error;
176
+ return [7 /*endfinally*/];
177
+ case 12: return [7 /*endfinally*/];
178
+ case 13: return [2 /*return*/, buffer];
179
+ }
180
+ });
181
+ }); };
182
+ exports.downloadChunkMethod = downloadChunkMethod;
183
+ var createDownloadChunkMethodWithRetry = function (downloadChunkMethod, _a) {
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
+ return function (provider, objectPath, chunk) { return __awaiter(void 0, void 0, void 0, function () {
186
+ var retryWaitTime, lastError, retryCount, error_1;
187
+ return __generator(this, function (_a) {
188
+ switch (_a.label) {
189
+ case 0:
190
+ retryWaitTime = retryWaitTimeFactory();
191
+ lastError = null;
192
+ retryCount = retryMaxCount;
193
+ _a.label = 1;
194
+ case 1:
195
+ if (!(retryCount > 0)) return [3 /*break*/, 8];
196
+ _a.label = 2;
197
+ case 2:
198
+ _a.trys.push([2, 4, , 5]);
199
+ return [4 /*yield*/, downloadChunkMethod(provider, objectPath, chunk)];
200
+ case 3: return [2 /*return*/, _a.sent()];
201
+ case 4:
202
+ error_1 = _a.sent();
203
+ lastError = error_1;
204
+ return [3 /*break*/, 5];
205
+ case 5:
206
+ retryCount--;
207
+ if (onRetry) {
208
+ onRetry(lastError, chunk, retryCount);
209
+ }
210
+ if (!(retryCount !== 0)) return [3 /*break*/, 7];
211
+ return [4 /*yield*/, new Promise(function (resolve, reject) { return setTimeout(resolve, retryWaitTime()); })];
212
+ case 6:
213
+ _a.sent();
214
+ _a.label = 7;
215
+ case 7: return [3 /*break*/, 1];
216
+ case 8: throw new Error("Max retry attempts was reached for object path ".concat(objectPath, ", offset ").concat(chunk.offset, ", length ").concat(chunk.length
217
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
218
+ , ": ").concat(lastError, " ").concat(lastError === null || lastError === void 0 ? void 0 : lastError.details));
219
+ }
220
+ });
221
+ }); };
222
+ };
223
+ exports.createDownloadChunkMethodWithRetry = createDownloadChunkMethodWithRetry;
224
+ var DownloadDecorator = /** @class */ (function () {
225
+ function DownloadDecorator(provider, chunkDownloaderMethod, options) {
226
+ this.provider = provider;
227
+ this.chunkDownloaderMethod = chunkDownloaderMethod;
228
+ this.options = options;
229
+ }
230
+ DownloadDecorator.prototype.uploadFile = function (inputStream, remotePath, contentLength, progressListener) {
231
+ return this.provider.uploadFile(inputStream, remotePath, contentLength, progressListener);
232
+ };
233
+ DownloadDecorator.prototype.downloadFile = function (remotePath, config, progressListener) {
234
+ var _a;
235
+ return __awaiter(this, void 0, void 0, function () {
236
+ var offset, objectSize, chunksStream, downloadStream, chainedStream;
237
+ var _this = this;
238
+ return __generator(this, function (_b) {
239
+ switch (_b.label) {
240
+ case 0:
241
+ if (config === null || config === void 0 ? void 0 : config.length) {
242
+ return [2 /*return*/, this.provider.downloadFile(remotePath, config, progressListener)];
243
+ }
244
+ offset = BigInt((_a = this.options.offset) !== null && _a !== void 0 ? _a : 0);
245
+ return [4 /*yield*/, this.provider.getObjectSize(remotePath)];
246
+ case 1:
247
+ objectSize = _b.sent();
248
+ chunksStream = stream_1.Readable.from(generateChunks(BigInt(objectSize), this.options.chunkSize, offset));
249
+ downloadStream = new ChunkedReadableTransform(function (chunk) { return __awaiter(_this, void 0, void 0, function () {
250
+ return __generator(this, function (_a) {
251
+ return [2 /*return*/, this.chunkDownloaderMethod(this.provider, remotePath, chunk)];
252
+ });
253
+ }); }, {
254
+ concurrency: this.options.concurrency,
255
+ });
256
+ chainedStream = new ChainedChunksReadableTransform(progressListener);
257
+ return [2 /*return*/, chunksStream
258
+ .pipe(downloadStream)
259
+ .on("error", function (error) {
260
+ chainedStream.emit("error", error);
261
+ })
262
+ .pipe(chainedStream)];
263
+ }
264
+ });
265
+ });
266
+ };
267
+ DownloadDecorator.prototype.deleteObject = function (remotePath) {
268
+ return this.provider.deleteObject(remotePath);
269
+ };
270
+ DownloadDecorator.prototype.listObjects = function (remotePath) {
271
+ return this.provider.listObjects(remotePath);
272
+ };
273
+ DownloadDecorator.prototype.getObjectSize = function (remotePath) {
274
+ return this.provider.getObjectSize(remotePath);
275
+ };
276
+ DownloadDecorator.prototype.getLastModified = function (remotePath) {
277
+ return this.provider.getLastModified(remotePath);
278
+ };
279
+ DownloadDecorator.prototype.calculateStorageDeposit = function (offer, sizeMb, hours) {
280
+ return this.provider.calculateStorageDeposit(offer, sizeMb, hours);
281
+ };
282
+ return DownloadDecorator;
283
+ }());
284
+ exports.DownloadDecorator = DownloadDecorator;
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ import Offer from "../../models/Offer";
3
+ import StorageObject from "../../types/storage/StorageObject";
4
+ import stream from "stream";
5
+ export declare type DownloadConfig = {
6
+ offset?: number;
7
+ length?: number;
8
+ };
9
+ export default interface IStorageProvider {
10
+ uploadFile(inputStream: stream.Readable, remotePath: string, contentLength: number, progressListener?: (total: number, current: number) => void): Promise<void>;
11
+ downloadFile(remotePath: string, config: DownloadConfig, progressListener?: (total: number, current: number) => void): Promise<stream.Readable>;
12
+ deleteObject(remotePath: string): Promise<void>;
13
+ listObjects(remotePath: string): Promise<StorageObject[]>;
14
+ getObjectSize(remotePath: string): Promise<number>;
15
+ getLastModified(remotePath: string): Promise<Date>;
16
+ calculateStorageDeposit(offer: Offer, sizeMb: number, hours: number): Promise<string>;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import IStorageProvider, { DownloadConfig } from "./IStorageProvider";
3
+ import Offer from "../../models/Offer";
4
+ import StorageObject from "../../types/storage/StorageObject";
5
+ import stream from "stream";
6
+ export default class StorJStorageProvider implements IStorageProvider {
7
+ static DOWNLOAD_BUFFER_SIZE: number;
8
+ private logger;
9
+ private bucket;
10
+ private prefix;
11
+ private accessToken;
12
+ private _access?;
13
+ private _project?;
14
+ private _storj?;
15
+ constructor(credentials: any);
16
+ calculateStorageDeposit(offer: Offer, sizeMb: number, hours: number): Promise<string>;
17
+ uploadFile(inputStream: stream.Readable, remotePath: string, contentLength: number, progressListener?: (total: number, current: number) => void): Promise<void>;
18
+ downloadFile(remotePath: string, config: DownloadConfig, progressListener?: (total: number, current: number) => void): Promise<stream.Readable>;
19
+ deleteObject(remotePath: string): Promise<void>;
20
+ listObjects(remotePath: string): Promise<StorageObject[]>;
21
+ getObjectSize(remotePath: string): Promise<number>;
22
+ getLastModified(remotePath: string): Promise<Date>;
23
+ private lazyStorj;
24
+ private lazyAccess;
25
+ private lazyProject;
26
+ }