@super-protocol/sdk-js 0.15.0 → 0.15.1
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 +129 -239
- package/build/connectors/BaseConnector.js +17 -47
- package/build/connectors/BlockchainConnector.js +222 -348
- package/build/connectors/BlockchainEventsListener.js +38 -92
- package/build/contracts/app.json +466 -35
- package/build/crypto/Crypto.js +63 -135
- package/build/crypto/index.js +1 -1
- package/build/crypto/nodejs/AES.js +62 -119
- package/build/crypto/nodejs/ARIA.js +61 -118
- package/build/crypto/nodejs/ECIES.js +51 -87
- package/build/crypto/nodejs/NativeCrypto.js +64 -118
- package/build/crypto/nodejs/RSA-Hybrid.js +54 -113
- package/build/index.d.ts +5 -0
- package/build/index.js +14 -2
- package/build/logger.d.ts +3 -1
- package/build/logger.js +2 -2
- package/build/models/EtlModel.js +65 -114
- package/build/models/Offer.js +227 -462
- package/build/models/Order.d.ts +4 -0
- package/build/models/Order.js +326 -559
- package/build/models/Provider.d.ts +2 -0
- package/build/models/Provider.js +74 -153
- package/build/models/TCB.js +67 -171
- package/build/models/TeeOffer.d.ts +1 -0
- package/build/models/TeeOffer.js +389 -731
- package/build/proto/Compression.js +20 -21
- package/build/proto/TRI.js +46 -50
- package/build/proto/TeeProperties.js +60 -66
- package/build/providers/storage/ChunksDownloadDecorator.js +125 -235
- package/build/providers/storage/S3StorageProvider.js +173 -298
- package/build/providers/storage/StorageAdapter.d.ts +60 -0
- package/build/providers/storage/StorageAdapter.js +317 -0
- package/build/providers/storage/StorageContentWriter.d.ts +39 -0
- package/build/providers/storage/StorageContentWriter.js +181 -0
- package/build/providers/storage/StorageKeyValueAdapter.d.ts +20 -0
- package/build/providers/storage/StorageKeyValueAdapter.js +152 -0
- package/build/providers/storage/StorageMetadataReader.d.ts +19 -0
- package/build/providers/storage/StorageMetadataReader.js +65 -0
- package/build/providers/storage/StorjAdapter.d.ts +19 -0
- package/build/providers/storage/StorjAdapter.js +62 -0
- package/build/providers/storage/StorjStorageProvider.js +138 -315
- package/build/providers/storage/getStorageProvider.js +7 -7
- package/build/providers/storage/types.d.ts +7 -0
- package/build/providers/storage/types.js +2 -0
- package/build/staticModels/ActiveOffers.js +32 -100
- package/build/staticModels/ActiveOrders.js +42 -120
- package/build/staticModels/BaseStaticModel.js +7 -10
- package/build/staticModels/Consensus.d.ts +4 -1
- package/build/staticModels/Consensus.js +164 -220
- package/build/staticModels/Deposits.js +109 -201
- package/build/staticModels/Marks.js +21 -82
- package/build/staticModels/ModelPackager.js +34 -84
- package/build/staticModels/Offers.js +140 -266
- package/build/staticModels/Orders.d.ts +1 -0
- package/build/staticModels/Orders.js +286 -429
- package/build/staticModels/ProviderRegistry.js +114 -225
- package/build/staticModels/Superpro.js +17 -63
- package/build/staticModels/SuperproToken.js +90 -169
- package/build/staticModels/TeeOffers.js +220 -416
- package/build/store.js +2 -2
- package/build/types/HardwareInfo.js +2 -2
- package/build/types/Order.js +4 -4
- package/build/types/Provider.js +1 -1
- package/build/types/TeeOfferInfo.js +1 -1
- package/build/types/TeeOfferOption.js +2 -2
- package/build/types/TeeOfferSlot.js +2 -2
- package/build/types/ValueOfferSlot.js +3 -3
- package/build/utils/Monitoring.js +24 -28
- package/build/utils/NonceTracker.js +56 -121
- package/build/utils/PubSub.d.ts +9 -0
- package/build/utils/PubSub.js +36 -0
- package/build/utils/TxManager.js +121 -215
- package/build/utils/compressors/GzipCompressor.js +13 -50
- package/build/utils/compressors/UncompressedCompressor.js +10 -13
- package/build/utils/helpers/tryWithInterval.js +34 -78
- package/build/utils/resourceLoaders/BaseResourceLoader.js +26 -78
- package/build/utils/resourceLoaders/StorageProviderLoader.js +33 -97
- package/build/utils/resourceLoaders/UrlResourceLoader.js +29 -93
- package/build/utils/resourceLoaders/getResourceLoader.js +6 -6
- package/build/utils.js +60 -105
- package/package.json +4 -1
|
@@ -14,111 +14,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
19
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
-
function step(op) {
|
|
22
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
-
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;
|
|
25
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
-
switch (op[0]) {
|
|
27
|
-
case 0: case 1: t = op; break;
|
|
28
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
-
default:
|
|
32
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
-
if (t[2]) _.ops.pop();
|
|
37
|
-
_.trys.pop(); continue;
|
|
38
|
-
}
|
|
39
|
-
op = body.call(thisArg, _);
|
|
40
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
19
|
};
|
|
47
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
21
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
22
|
+
const utils_1 = require("../utils");
|
|
23
|
+
const Superpro_1 = __importDefault(require("./Superpro"));
|
|
24
|
+
const TxManager_1 = __importDefault(require("../utils/TxManager"));
|
|
25
|
+
const BlockchainConnector_1 = __importDefault(require("../connectors/BlockchainConnector"));
|
|
26
|
+
const BlockchainEventsListener_1 = __importDefault(require("../connectors/BlockchainEventsListener"));
|
|
27
|
+
const DepositInfo_1 = require("../types/DepositInfo");
|
|
28
|
+
class Deposits {
|
|
29
|
+
static get address() {
|
|
30
|
+
return Superpro_1.default.address;
|
|
57
31
|
}
|
|
58
|
-
Object.defineProperty(Deposits, "address", {
|
|
59
|
-
get: function () {
|
|
60
|
-
return Superpro_1.default.address;
|
|
61
|
-
},
|
|
62
|
-
enumerable: false,
|
|
63
|
-
configurable: true
|
|
64
|
-
});
|
|
65
32
|
/**
|
|
66
33
|
* Function for fetching deposit info
|
|
67
34
|
* @param depositOwner - Deposit owner
|
|
68
35
|
*/
|
|
69
|
-
|
|
70
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
switch (_b.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
76
|
-
_a = utils_1.tupleToObject;
|
|
77
|
-
return [4 /*yield*/, contract.methods.getDepositInfo(depositOwner).call()];
|
|
78
|
-
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), DepositInfo_1.DepositInfoStructure])];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
36
|
+
static getDepositInfo(depositOwner) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
39
|
+
return (0, utils_1.tupleToObject)(yield contract.methods.getDepositInfo(depositOwner).call(), DepositInfo_1.DepositInfoStructure);
|
|
81
40
|
});
|
|
82
|
-
}
|
|
41
|
+
}
|
|
83
42
|
/**
|
|
84
43
|
* Function for fetching amount of locked tokens
|
|
85
44
|
* @param depositOwner - Deposit owner
|
|
86
45
|
*/
|
|
87
|
-
|
|
88
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
|
|
90
|
-
return
|
|
91
|
-
switch (_a.label) {
|
|
92
|
-
case 0:
|
|
93
|
-
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
94
|
-
return [4 /*yield*/, contract.methods.getLockedTokensAmount(depositOwner).call()];
|
|
95
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
46
|
+
static getLockedTokensAmount(depositOwner) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
49
|
+
return yield contract.methods.getLockedTokensAmount(depositOwner).call();
|
|
98
50
|
});
|
|
99
|
-
}
|
|
51
|
+
}
|
|
100
52
|
/**
|
|
101
53
|
* Function for replenish deposit
|
|
102
54
|
* @param amount - replenish amount
|
|
103
55
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
104
56
|
* @returns {Promise<void>} - Does not return id of created order!
|
|
105
57
|
*/
|
|
106
|
-
|
|
107
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
case 0:
|
|
112
|
-
contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
|
|
113
|
-
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
114
|
-
return [4 /*yield*/, TxManager_1.default.execute(contract.methods.replenish, [amount], transactionOptions)];
|
|
115
|
-
case 1:
|
|
116
|
-
_a.sent();
|
|
117
|
-
return [2 /*return*/];
|
|
118
|
-
}
|
|
119
|
-
});
|
|
58
|
+
static replenish(amount, transactionOptions) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
|
|
61
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
62
|
+
yield TxManager_1.default.execute(contract.methods.replenish, [amount], transactionOptions);
|
|
120
63
|
});
|
|
121
|
-
}
|
|
64
|
+
}
|
|
122
65
|
/**
|
|
123
66
|
* Function for replenish deposit of given account
|
|
124
67
|
* @param beneficiary - account
|
|
@@ -126,178 +69,143 @@ var Deposits = /** @class */ (function () {
|
|
|
126
69
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
127
70
|
* @returns {Promise<void>} - Does not return id of created order!
|
|
128
71
|
*/
|
|
129
|
-
|
|
130
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
case 0:
|
|
135
|
-
contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
|
|
136
|
-
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
137
|
-
return [4 /*yield*/, TxManager_1.default.execute(contract.methods.replenishFor, [beneficiary, amount], transactionOptions)];
|
|
138
|
-
case 1:
|
|
139
|
-
_a.sent();
|
|
140
|
-
return [2 /*return*/];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
72
|
+
static replenishFor(beneficiary, amount, transactionOptions) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
|
|
75
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
76
|
+
yield TxManager_1.default.execute(contract.methods.replenishFor, [beneficiary, amount], transactionOptions);
|
|
143
77
|
});
|
|
144
|
-
}
|
|
78
|
+
}
|
|
145
79
|
/**
|
|
146
80
|
* Function for withdraw deposit
|
|
147
81
|
* @param amount - withdraw amount
|
|
148
82
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
149
83
|
* @returns {Promise<void>} - Does not return id of created order!
|
|
150
84
|
*/
|
|
151
|
-
|
|
152
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
case 0:
|
|
157
|
-
contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
|
|
158
|
-
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
159
|
-
return [4 /*yield*/, TxManager_1.default.execute(contract.methods.withdraw, [amount], transactionOptions)];
|
|
160
|
-
case 1:
|
|
161
|
-
_a.sent();
|
|
162
|
-
return [2 /*return*/];
|
|
163
|
-
}
|
|
164
|
-
});
|
|
85
|
+
static withdraw(amount, transactionOptions) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
|
|
88
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
89
|
+
yield TxManager_1.default.execute(contract.methods.withdraw, [amount], transactionOptions);
|
|
165
90
|
});
|
|
166
|
-
}
|
|
91
|
+
}
|
|
167
92
|
/**
|
|
168
93
|
* Function for adding event listeners on DepositReplenished event in contract
|
|
169
94
|
* @param owner - owner address
|
|
170
95
|
* @param callback - function for processing created order
|
|
171
96
|
* @returns unsubscribe - unsubscribe function from event
|
|
172
97
|
*/
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var subscription = contract.events
|
|
98
|
+
static onDepositReplenished(callback, owner) {
|
|
99
|
+
const contract = BlockchainEventsListener_1.default.getInstance().getContract();
|
|
100
|
+
const logger = this.logger.child({ method: "onDepositReplenished" });
|
|
101
|
+
const subscription = contract.events
|
|
178
102
|
.DepositReplenished()
|
|
179
|
-
.on("data",
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
hash: event.blockHash,
|
|
187
|
-
});
|
|
188
|
-
return [2 /*return*/];
|
|
103
|
+
.on("data", (event) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
if (owner && event.returnValues.owner != owner) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
callback(event.returnValues.owner, event.returnValues.amount, event.returnValues.totalLocked, {
|
|
108
|
+
index: event.blockNumber,
|
|
109
|
+
hash: event.blockHash,
|
|
189
110
|
});
|
|
190
|
-
})
|
|
191
|
-
.on("error",
|
|
111
|
+
}))
|
|
112
|
+
.on("error", (error, receipt) => {
|
|
192
113
|
if (receipt)
|
|
193
114
|
return;
|
|
194
115
|
logger.warn(error);
|
|
195
116
|
});
|
|
196
|
-
return
|
|
197
|
-
}
|
|
117
|
+
return () => subscription.unsubscribe();
|
|
118
|
+
}
|
|
198
119
|
/**
|
|
199
120
|
* Function for adding event listeners on DepositWithdrawn event in contract
|
|
200
121
|
* @param owner - owner address
|
|
201
122
|
* @param callback - function for processing created order
|
|
202
123
|
* @returns unsubscribe - unsubscribe function from event
|
|
203
124
|
*/
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
var subscription = contract.events
|
|
125
|
+
static onDepositWithdrawn(callback, owner) {
|
|
126
|
+
const contract = BlockchainEventsListener_1.default.getInstance().getContract();
|
|
127
|
+
const logger = this.logger.child({ method: "onDepositWithdrawn" });
|
|
128
|
+
const subscription = contract.events
|
|
209
129
|
.DepositWithdrawn()
|
|
210
|
-
.on("data",
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
hash: event.blockHash,
|
|
218
|
-
});
|
|
219
|
-
return [2 /*return*/];
|
|
130
|
+
.on("data", (event) => __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (owner && event.returnValues.owner != owner) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
callback(event.returnValues.owner, event.returnValues.amount, event.returnValues.totalLocked, {
|
|
135
|
+
index: event.blockNumber,
|
|
136
|
+
hash: event.blockHash,
|
|
220
137
|
});
|
|
221
|
-
})
|
|
222
|
-
.on("error",
|
|
138
|
+
}))
|
|
139
|
+
.on("error", (error, receipt) => {
|
|
223
140
|
if (receipt)
|
|
224
141
|
return;
|
|
225
142
|
logger.warn(error);
|
|
226
143
|
});
|
|
227
|
-
return
|
|
228
|
-
}
|
|
144
|
+
return () => subscription.unsubscribe();
|
|
145
|
+
}
|
|
229
146
|
/**
|
|
230
147
|
* Function for adding event listeners on DepositPartLocked event in contract
|
|
231
148
|
* @param owner - owner address
|
|
232
149
|
* @param callback - function for processing created order
|
|
233
150
|
* @returns unsubscribe - unsubscribe function from event
|
|
234
151
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
var subscription = contract.events
|
|
152
|
+
static onDepositPartLocked(callback, owner) {
|
|
153
|
+
const contract = BlockchainEventsListener_1.default.getInstance().getContract();
|
|
154
|
+
const logger = this.logger.child({ method: "onDepositPartLocked" });
|
|
155
|
+
const subscription = contract.events
|
|
240
156
|
.DepositPartLocked()
|
|
241
|
-
.on("data",
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
hash: event.blockHash,
|
|
249
|
-
});
|
|
250
|
-
return [2 /*return*/];
|
|
157
|
+
.on("data", (event) => __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
if (owner && event.returnValues.owner != owner) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
callback(event.returnValues.owner, event.returnValues.amount, event.returnValues.totalLocked, {
|
|
162
|
+
index: event.blockNumber,
|
|
163
|
+
hash: event.blockHash,
|
|
251
164
|
});
|
|
252
|
-
})
|
|
253
|
-
.on("error",
|
|
165
|
+
}))
|
|
166
|
+
.on("error", (error, receipt) => {
|
|
254
167
|
if (receipt)
|
|
255
168
|
return;
|
|
256
169
|
logger.warn(error);
|
|
257
170
|
});
|
|
258
|
-
return
|
|
259
|
-
}
|
|
171
|
+
return () => subscription.unsubscribe();
|
|
172
|
+
}
|
|
260
173
|
/**
|
|
261
174
|
* Function for adding event listeners on DepositPartUnlocked event in contract
|
|
262
175
|
* @param owner - owner address
|
|
263
176
|
* @param callback - function for processing created order
|
|
264
177
|
* @returns unsubscribe - unsubscribe function from event
|
|
265
178
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var subscription = contract.events
|
|
179
|
+
static onDepositPartUnlocked(callback, owner) {
|
|
180
|
+
const contract = BlockchainEventsListener_1.default.getInstance().getContract();
|
|
181
|
+
const logger = this.logger.child({ method: "onDepositPartUnlocked" });
|
|
182
|
+
const subscription = contract.events
|
|
271
183
|
.DepositPartUnlocked()
|
|
272
|
-
.on("data",
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
hash: event.blockHash,
|
|
280
|
-
});
|
|
281
|
-
return [2 /*return*/];
|
|
184
|
+
.on("data", (event) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
if (owner && event.returnValues.owner != owner) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
callback(event.returnValues.owner, event.returnValues.amount, event.returnValues.totalLocked, {
|
|
189
|
+
index: event.blockNumber,
|
|
190
|
+
hash: event.blockHash,
|
|
282
191
|
});
|
|
283
|
-
})
|
|
284
|
-
.on("error",
|
|
192
|
+
}))
|
|
193
|
+
.on("error", (error, receipt) => {
|
|
285
194
|
if (receipt)
|
|
286
195
|
return;
|
|
287
196
|
logger.warn(error);
|
|
288
197
|
});
|
|
289
|
-
return
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}());
|
|
198
|
+
return () => subscription.unsubscribe();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
Deposits.logger = logger_1.default.child({ className: "Deposits" });
|
|
202
|
+
__decorate([
|
|
203
|
+
(0, utils_1.incrementMethodCall)()
|
|
204
|
+
], Deposits, "replenish", null);
|
|
205
|
+
__decorate([
|
|
206
|
+
(0, utils_1.incrementMethodCall)()
|
|
207
|
+
], Deposits, "replenishFor", null);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, utils_1.incrementMethodCall)()
|
|
210
|
+
], Deposits, "withdraw", null);
|
|
303
211
|
exports.default = Deposits;
|
|
@@ -8,94 +8,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
13
|
};
|
|
41
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
const BlockchainConnector_1 = __importDefault(require("../connectors/BlockchainConnector"));
|
|
16
|
+
const Superpro_1 = __importDefault(require("./Superpro"));
|
|
17
|
+
class Marks {
|
|
18
|
+
static get address() {
|
|
19
|
+
return Superpro_1.default.address;
|
|
46
20
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
enumerable: false,
|
|
52
|
-
configurable: true
|
|
53
|
-
});
|
|
54
|
-
Marks.getProviderMarks = function (providerAddress) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
var contract;
|
|
57
|
-
return __generator(this, function (_a) {
|
|
58
|
-
switch (_a.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
61
|
-
return [4 /*yield*/, contract.methods.getProviderMarks(providerAddress).call()];
|
|
62
|
-
case 1:
|
|
63
|
-
_a.sent();
|
|
64
|
-
return [2 /*return*/];
|
|
65
|
-
}
|
|
66
|
-
});
|
|
21
|
+
static getProviderMarks(providerAddress) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
24
|
+
yield contract.methods.getProviderMarks(providerAddress).call();
|
|
67
25
|
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
switch (_a.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
76
|
-
return [4 /*yield*/, contract.methods.getOrderMark(orderId).call()];
|
|
77
|
-
case 1:
|
|
78
|
-
_a.sent();
|
|
79
|
-
return [2 /*return*/];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
26
|
+
}
|
|
27
|
+
static getOrderMark(orderId) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
30
|
+
yield contract.methods.getOrderMark(orderId).call();
|
|
82
31
|
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
switch (_a.label) {
|
|
89
|
-
case 0:
|
|
90
|
-
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
91
|
-
return [4 /*yield*/, contract.methods.setOrderMark(orderId, mark).call()];
|
|
92
|
-
case 1:
|
|
93
|
-
_a.sent();
|
|
94
|
-
return [2 /*return*/];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
32
|
+
}
|
|
33
|
+
static setOrderMark(orderId, mark) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
36
|
+
yield contract.methods.setOrderMark(orderId, mark).call();
|
|
97
37
|
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
}());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
101
40
|
exports.default = Marks;
|