@super-protocol/sdk-js 0.6.1 → 0.7.0-beta.3
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/BlockchainConnector.d.ts +6 -0
- package/build/BlockchainConnector.js +17 -0
- package/build/contracts/Consensus.json +580 -0
- package/build/index.d.ts +1 -8
- package/build/index.js +2 -12
- package/build/models/Offer.d.ts +12 -0
- package/build/models/Offer.js +44 -0
- package/build/models/Provider.d.ts +3 -0
- package/build/models/Provider.js +27 -1
- package/build/models/TCB.d.ts +36 -50
- package/build/models/TCB.js +105 -148
- package/build/staticModels/Consensus.d.ts +13 -44
- package/build/staticModels/Consensus.js +87 -255
- package/build/staticModels/ProviderRegistry.d.ts +1 -0
- package/build/staticModels/ProviderRegistry.js +12 -0
- package/build/staticModels/SuperproToken.d.ts +4 -0
- package/build/staticModels/SuperproToken.js +20 -2
- package/build/types/Consensus.d.ts +55 -0
- package/build/types/Consensus.js +38 -0
- package/build/utils/NonceTracker.d.ts +1 -0
- package/build/utils/NonceTracker.js +9 -0
- package/build/utils.d.ts +1 -1
- package/build/utils.js +1 -1
- package/package.json +9 -8
- package/build/staticModels/Epochs.d.ts +0 -23
- package/build/staticModels/Epochs.js +0 -97
- package/build/staticModels/LastBlocks.d.ts +0 -25
- package/build/staticModels/LastBlocks.js +0 -96
- package/build/staticModels/Suspicious.d.ts +0 -26
- package/build/staticModels/Suspicious.js +0 -99
- package/build/types/Epoch.d.ts +0 -21
- package/build/types/Epoch.js +0 -18
- package/build/types/TcbData.d.ts +0 -26
- package/build/types/TcbData.js +0 -21
package/build/models/TCB.js
CHANGED
|
@@ -40,176 +40,153 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var logger_1 = __importDefault(require("../logger"));
|
|
43
|
-
|
|
44
|
-
var Offers_json_1 = __importDefault(require("../contracts/Offers.json"));
|
|
43
|
+
var Consensus_json_1 = __importDefault(require("../contracts/Consensus.json"));
|
|
45
44
|
var store_1 = __importDefault(require("../store"));
|
|
46
|
-
var TcbData_1 = require("../types/TcbData");
|
|
47
45
|
var utils_1 = require("../utils");
|
|
48
|
-
var Suspicious_1 = __importDefault(require("../staticModels/Suspicious"));
|
|
49
|
-
var LastBlocks_1 = __importDefault(require("../staticModels/LastBlocks"));
|
|
50
46
|
var utils_2 = require("ethers/lib/utils");
|
|
51
47
|
var Superpro_1 = __importDefault(require("../staticModels/Superpro"));
|
|
52
48
|
var TxManager_1 = __importDefault(require("../utils/TxManager"));
|
|
49
|
+
var Consensus_1 = require("../types/Consensus");
|
|
53
50
|
var TCB = /** @class */ (function () {
|
|
54
51
|
function TCB(tcbId) {
|
|
55
52
|
(0, utils_1.checkIfInitialized)();
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.
|
|
53
|
+
this.logger = logger_1.default.child({
|
|
54
|
+
className: "TCB",
|
|
55
|
+
tcbId: tcbId,
|
|
56
|
+
});
|
|
57
|
+
this.tcbId = tcbId;
|
|
58
|
+
this.contract = new store_1.default.web3.eth.Contract(Consensus_json_1.default.abi, Superpro_1.default.address);
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
TCB.prototype.checkInitTcb = function (transactionOptions) {
|
|
61
|
+
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
62
|
+
(0, utils_1.checkIfInitialized)();
|
|
63
|
+
return new transactionOptions.web3.eth.Contract(Consensus_json_1.default.abi, Superpro_1.default.address);
|
|
64
|
+
}
|
|
65
|
+
return this.contract;
|
|
66
|
+
};
|
|
67
|
+
TCB.prototype.applyTcbMarks = function (marks, transactionOptions) {
|
|
66
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var lbtSzie, l1Completed;
|
|
68
69
|
return __generator(this, function (_a) {
|
|
69
70
|
switch (_a.label) {
|
|
70
|
-
case 0: return [4 /*yield*/,
|
|
71
|
+
case 0: return [4 /*yield*/, TxManager_1.default.execute(this.contract.methods.applyTcbMarks, [marks, this.tcbId], transactionOptions)];
|
|
71
72
|
case 1:
|
|
72
|
-
|
|
73
|
-
return [
|
|
74
|
-
case 2:
|
|
75
|
-
l1Completed = _a.sent();
|
|
76
|
-
return [2 /*return*/, l1Completed];
|
|
73
|
+
_a.sent();
|
|
74
|
+
return [2 /*return*/];
|
|
77
75
|
}
|
|
78
76
|
});
|
|
79
77
|
});
|
|
80
78
|
};
|
|
81
|
-
|
|
82
|
-
* Function for fetching number of TCB's to request for verifying from SuspiciousBlocksTable
|
|
83
|
-
*/
|
|
84
|
-
TCB.prototype.needL2toCompleted = function () {
|
|
79
|
+
TCB.prototype.setTcbData = function (pb, quote, transactionOptions) {
|
|
85
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
var
|
|
81
|
+
var fromattedDeviceId;
|
|
87
82
|
return __generator(this, function (_a) {
|
|
88
83
|
switch (_a.label) {
|
|
89
|
-
case 0: return [4 /*yield*/, Suspicious_1.default.count()];
|
|
90
|
-
case 1:
|
|
91
|
-
sbtSize = _a.sent();
|
|
92
|
-
return [4 /*yield*/, this.contract.methods.needL2toCompleted(sbtSize).call()];
|
|
93
|
-
case 2:
|
|
94
|
-
l2Completed = _a.sent();
|
|
95
|
-
return [2 /*return*/, l2Completed];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Function for fetching list of TCBs from LastBlocksTable formed for veirifying
|
|
102
|
-
*/
|
|
103
|
-
TCB.prototype.getL1 = function () {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
var _a;
|
|
106
|
-
return __generator(this, function (_b) {
|
|
107
|
-
switch (_b.label) {
|
|
108
|
-
case 0:
|
|
109
|
-
_a = this;
|
|
110
|
-
return [4 /*yield*/, this.contract.methods.getL1().call()];
|
|
111
|
-
case 1:
|
|
112
|
-
_a.L1 = _b.sent();
|
|
113
|
-
return [2 /*return*/, this.L1];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Function for fetching list of TCBs from SuspiciousBlocksTable formed for veirifying
|
|
120
|
-
*/
|
|
121
|
-
TCB.prototype.getL2 = function () {
|
|
122
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
-
var _a;
|
|
124
|
-
return __generator(this, function (_b) {
|
|
125
|
-
switch (_b.label) {
|
|
126
84
|
case 0:
|
|
127
|
-
|
|
128
|
-
|
|
85
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
86
|
+
fromattedDeviceId = (0, utils_2.formatBytes32String)(Buffer.from(pb.deviceID, "hex").toString("base64"));
|
|
87
|
+
return [4 /*yield*/, TxManager_1.default.execute(this.contract.methods.setTcbData, [this.tcbId, pb.benchmark, pb.properties, fromattedDeviceId, quote], transactionOptions)];
|
|
129
88
|
case 1:
|
|
130
|
-
_a.
|
|
131
|
-
return [2 /*return
|
|
89
|
+
_a.sent();
|
|
90
|
+
return [2 /*return*/];
|
|
132
91
|
}
|
|
133
92
|
});
|
|
134
93
|
});
|
|
135
94
|
};
|
|
136
95
|
/**
|
|
137
|
-
*
|
|
96
|
+
* Add data to TeeConfirmationBlock and push it to Consensus
|
|
97
|
+
* @param pb - struct of 'processed' data
|
|
98
|
+
* @param quote - data generated from Enclave
|
|
99
|
+
* @param marks - list of marks
|
|
100
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
138
101
|
*/
|
|
139
|
-
TCB.prototype.
|
|
102
|
+
TCB.prototype.addToSupply = function (pb, quote, marks, transactionOptions) {
|
|
140
103
|
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
switch (_b.label) {
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
144
106
|
case 0:
|
|
145
|
-
|
|
146
|
-
return [4 /*yield*/, this.
|
|
107
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
108
|
+
return [4 /*yield*/, this.setTcbData(pb, quote, transactionOptions)];
|
|
147
109
|
case 1:
|
|
148
|
-
_a.
|
|
149
|
-
return [
|
|
110
|
+
_a.sent();
|
|
111
|
+
return [4 /*yield*/, this.applyTcbMarks(marks, transactionOptions)];
|
|
112
|
+
case 2:
|
|
113
|
+
_a.sent();
|
|
114
|
+
return [4 /*yield*/, TxManager_1.default.execute(this.contract.methods.addTcbToSupply, [this.tcbId], transactionOptions)];
|
|
115
|
+
case 3:
|
|
116
|
+
_a.sent();
|
|
117
|
+
return [2 /*return*/];
|
|
150
118
|
}
|
|
151
119
|
});
|
|
152
120
|
});
|
|
153
121
|
};
|
|
154
122
|
/**
|
|
155
|
-
*
|
|
123
|
+
* Assign TCB from SuspiciousBlocks table to check
|
|
124
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
156
125
|
*/
|
|
157
|
-
TCB.prototype.
|
|
126
|
+
TCB.prototype.assignSuspiciousBlocksToCheck = function (transactionOptions) {
|
|
158
127
|
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
case 0:
|
|
163
|
-
_a = this;
|
|
164
|
-
return [4 /*yield*/, this.contract.methods.getL2Marks().call()];
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
switch (_a.label) {
|
|
130
|
+
case 0: return [4 /*yield*/, TxManager_1.default.execute(this.contract.methods.assignSuspiciousBlocksToCheck, [this.tcbId], transactionOptions)];
|
|
165
131
|
case 1:
|
|
166
|
-
_a.
|
|
167
|
-
return [2 /*return
|
|
132
|
+
_a.sent();
|
|
133
|
+
return [2 /*return*/];
|
|
168
134
|
}
|
|
169
135
|
});
|
|
170
136
|
});
|
|
171
137
|
};
|
|
172
138
|
/**
|
|
173
|
-
*
|
|
139
|
+
* Assign TCB from LastBlocks table to check
|
|
140
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
174
141
|
*/
|
|
175
|
-
TCB.prototype.
|
|
142
|
+
TCB.prototype.assignLastBlocksToCheck = function (transactionOptions) {
|
|
176
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
177
144
|
return __generator(this, function (_a) {
|
|
178
145
|
switch (_a.label) {
|
|
179
|
-
case 0: return [4 /*yield*/, this.contract.methods.
|
|
180
|
-
case 1:
|
|
146
|
+
case 0: return [4 /*yield*/, TxManager_1.default.execute(this.contract.methods.assignLastBlocksToCheck, [this.tcbId], transactionOptions)];
|
|
147
|
+
case 1:
|
|
148
|
+
_a.sent();
|
|
149
|
+
return [2 /*return*/];
|
|
181
150
|
}
|
|
182
151
|
});
|
|
183
152
|
});
|
|
184
153
|
};
|
|
185
154
|
/**
|
|
186
|
-
* Function
|
|
155
|
+
* Function stake and lock TCB's reward
|
|
156
|
+
* @param tcbId - TEE Offer's completed and valid TCB contract
|
|
157
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
187
158
|
*/
|
|
188
|
-
TCB.prototype.
|
|
159
|
+
TCB.prototype.claimRewards = function (tcbId, transactionOptions) {
|
|
189
160
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
+
var contract;
|
|
190
162
|
return __generator(this, function (_a) {
|
|
191
163
|
switch (_a.label) {
|
|
192
|
-
case 0:
|
|
193
|
-
|
|
164
|
+
case 0:
|
|
165
|
+
contract = this.checkInitTcb(transactionOptions);
|
|
166
|
+
(0, utils_1.checkIfActionAccountInitialized)();
|
|
167
|
+
return [4 /*yield*/, TxManager_1.default.execute(contract.methods.claimRewards, [tcbId], transactionOptions)];
|
|
168
|
+
case 1:
|
|
169
|
+
_a.sent();
|
|
170
|
+
return [2 /*return*/];
|
|
194
171
|
}
|
|
195
172
|
});
|
|
196
173
|
});
|
|
197
174
|
};
|
|
198
175
|
/**
|
|
199
|
-
*
|
|
200
|
-
* @param
|
|
201
|
-
* @param
|
|
176
|
+
* Function unlock previously locked TCB rewards (by claimRewards)
|
|
177
|
+
* @param tcbId - TCB contract address
|
|
178
|
+
* @param unlockAmount - amount of tokens to unlock, max available amount = TeeOffer.getLockInfo(tcbAddress)
|
|
202
179
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
203
180
|
*/
|
|
204
|
-
TCB.prototype.
|
|
181
|
+
TCB.prototype.unlockRewards = function (tcbId, unlockAmount, transactionOptions) {
|
|
205
182
|
return __awaiter(this, void 0, void 0, function () {
|
|
206
|
-
var
|
|
183
|
+
var contract;
|
|
207
184
|
return __generator(this, function (_a) {
|
|
208
185
|
switch (_a.label) {
|
|
209
186
|
case 0:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return [4 /*yield*/, TxManager_1.default.execute(
|
|
187
|
+
contract = this.checkInitTcb(transactionOptions);
|
|
188
|
+
(0, utils_1.checkIfActionAccountInitialized)();
|
|
189
|
+
return [4 /*yield*/, TxManager_1.default.execute(contract.methods.unlockRewards, [tcbId, unlockAmount], transactionOptions)];
|
|
213
190
|
case 1:
|
|
214
191
|
_a.sent();
|
|
215
192
|
return [2 /*return*/];
|
|
@@ -217,36 +194,30 @@ var TCB = /** @class */ (function () {
|
|
|
217
194
|
});
|
|
218
195
|
});
|
|
219
196
|
};
|
|
220
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Function for fetching all TCB data
|
|
199
|
+
*/
|
|
200
|
+
TCB.prototype.get = function () {
|
|
221
201
|
return __awaiter(this, void 0, void 0, function () {
|
|
222
|
-
var epoch;
|
|
223
202
|
return __generator(this, function (_a) {
|
|
224
|
-
|
|
225
|
-
case 0: return [4 /*yield*/, this.contract.methods.getEpochInfo().call()];
|
|
226
|
-
case 1:
|
|
227
|
-
epoch = _a.sent();
|
|
228
|
-
this.epoch = (0, utils_1.tupleToObject)(epoch, TcbData_1.TcbEpochInfoStructure);
|
|
229
|
-
return [2 /*return*/, this.epoch];
|
|
230
|
-
}
|
|
203
|
+
return [2 /*return*/, this.contract.methods.getTcbById(this.tcbId).call()];
|
|
231
204
|
});
|
|
232
205
|
});
|
|
233
206
|
};
|
|
234
207
|
/**
|
|
235
|
-
* Function for fetching marks
|
|
208
|
+
* Function for fetching the given marks for recruited TCBs from the Tables of Consensus
|
|
236
209
|
*/
|
|
237
|
-
TCB.prototype.
|
|
210
|
+
TCB.prototype.getCheckingBlocksMarks = function () {
|
|
238
211
|
return __awaiter(this, void 0, void 0, function () {
|
|
239
|
-
var
|
|
240
|
-
return __generator(this, function (
|
|
241
|
-
switch (
|
|
242
|
-
case 0: return [4 /*yield*/, this.contract.methods.
|
|
212
|
+
var tcb;
|
|
213
|
+
return __generator(this, function (_a) {
|
|
214
|
+
switch (_a.label) {
|
|
215
|
+
case 0: return [4 /*yield*/, this.contract.methods.getTcbById(this.tcbId).call()];
|
|
243
216
|
case 1:
|
|
244
|
-
|
|
245
|
-
this.positive = positive;
|
|
246
|
-
this.negative = negative;
|
|
217
|
+
tcb = _a.sent();
|
|
247
218
|
return [2 /*return*/, {
|
|
248
|
-
|
|
249
|
-
|
|
219
|
+
blocksIds: tcb.utilData.checkingBlocks,
|
|
220
|
+
marks: tcb.utilData.checkingBlockMarks,
|
|
250
221
|
}];
|
|
251
222
|
}
|
|
252
223
|
});
|
|
@@ -263,49 +234,35 @@ var TCB = /** @class */ (function () {
|
|
|
263
234
|
case 0: return [4 /*yield*/, this.contract.methods.getPublicData().call()];
|
|
264
235
|
case 1:
|
|
265
236
|
publicDataParams = _a.sent();
|
|
266
|
-
publicData = (0, utils_1.tupleToObject)(publicDataParams,
|
|
267
|
-
publicData.deviceID =
|
|
237
|
+
publicData = (0, utils_1.tupleToObject)(publicDataParams, Consensus_1.PublicDataStructure);
|
|
238
|
+
publicData.deviceID = Buffer.from((0, utils_2.parseBytes32String)(publicData.deviceID), "base64").toString("hex");
|
|
268
239
|
return [2 /*return*/, publicData];
|
|
269
240
|
}
|
|
270
241
|
});
|
|
271
242
|
});
|
|
272
243
|
};
|
|
273
244
|
/**
|
|
274
|
-
* Function for fetching
|
|
245
|
+
* Function for fetching TCB status
|
|
275
246
|
*/
|
|
276
|
-
TCB.prototype.
|
|
247
|
+
TCB.prototype.getStatus = function () {
|
|
277
248
|
return __awaiter(this, void 0, void 0, function () {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
switch (_b.label) {
|
|
281
|
-
case 0:
|
|
282
|
-
_a = this;
|
|
283
|
-
return [4 /*yield*/, this.contract.methods.getQuote().call()];
|
|
284
|
-
case 1:
|
|
285
|
-
_a.quote = _b.sent();
|
|
286
|
-
return [2 /*return*/, this.quote];
|
|
287
|
-
}
|
|
249
|
+
return __generator(this, function (_a) {
|
|
250
|
+
return [2 /*return*/, this.contract.methods.getTcbStatus().call()];
|
|
288
251
|
});
|
|
289
252
|
});
|
|
290
253
|
};
|
|
291
254
|
/**
|
|
292
|
-
*
|
|
293
|
-
* @param lType - type of appending marks
|
|
294
|
-
* @param marks - list of marks
|
|
295
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
255
|
+
* Function for fetching TCB status
|
|
296
256
|
*/
|
|
297
|
-
TCB.prototype.
|
|
257
|
+
TCB.prototype.getEpochInfo = function () {
|
|
298
258
|
return __awaiter(this, void 0, void 0, function () {
|
|
259
|
+
var epoch;
|
|
299
260
|
return __generator(this, function (_a) {
|
|
300
261
|
switch (_a.label) {
|
|
301
|
-
case 0:
|
|
302
|
-
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
303
|
-
if (!(marks.length > 0)) return [3 /*break*/, 2];
|
|
304
|
-
return [4 /*yield*/, TxManager_1.default.execute(this.contract.methods.addMarks, [lType, marks], transactionOptions)];
|
|
262
|
+
case 0: return [4 /*yield*/, this.contract.methods.getEpochInfo().call()];
|
|
305
263
|
case 1:
|
|
306
|
-
_a.sent();
|
|
307
|
-
|
|
308
|
-
case 2: return [2 /*return*/];
|
|
264
|
+
epoch = _a.sent();
|
|
265
|
+
return [2 /*return*/, (0, utils_1.tupleToObject)(epoch, Consensus_1.TcbEpochInfoStructure)];
|
|
309
266
|
}
|
|
310
267
|
});
|
|
311
268
|
});
|
|
@@ -1,63 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PublicData } from "../types/TcbData";
|
|
1
|
+
import { CheckingTcbData } from "../types/Consensus";
|
|
3
2
|
import { TransactionOptions } from "../types/Web3";
|
|
4
3
|
declare class Consensus {
|
|
5
4
|
static address: string;
|
|
6
5
|
private static contract;
|
|
7
6
|
private static logger;
|
|
8
|
-
static LEnough: (tcb: TCB) => Promise<boolean>;
|
|
9
|
-
static offers?: string[];
|
|
10
7
|
/**
|
|
11
8
|
* Checks if contract has been initialized, if not - initialize contract
|
|
12
9
|
*/
|
|
13
10
|
private static checkInit;
|
|
14
|
-
private static
|
|
15
|
-
private static addToSupply;
|
|
16
|
-
private static addMarks;
|
|
11
|
+
private static initializeTcb;
|
|
17
12
|
/**
|
|
18
|
-
* Function initialize TCB and returns
|
|
19
|
-
* @param teeOfferId
|
|
13
|
+
* Function initialize TCB and returns list of anothers' TCB for their checking
|
|
14
|
+
* @param teeOfferId - id of TEE offer
|
|
20
15
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
21
|
-
* @returns
|
|
16
|
+
* @returns tcbId and lists of anothers' TCB for their checking
|
|
22
17
|
*/
|
|
23
18
|
static getListsForVerification(teeOfferId: string, transactionOptions?: TransactionOptions): Promise<{
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
tcbId: string;
|
|
20
|
+
checkingTcbData: CheckingTcbData[];
|
|
26
21
|
}>;
|
|
27
|
-
/**
|
|
28
|
-
* Add data to TeeConfirmationBlock and push it to Consensus
|
|
29
|
-
* @param teeOfferId - TCB's device offer, as key
|
|
30
|
-
* @param L1Marks - marks of LastBlocks
|
|
31
|
-
* @param L2Marks - marks of SuspiciousBlocks
|
|
32
|
-
* @param tcbData - TEE generated
|
|
33
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
34
|
-
*/
|
|
35
|
-
static addTCB(teeOfferId: string, L1Marks: number[], L2Marks: number[], tcbData: {
|
|
36
|
-
publicData: PublicData;
|
|
37
|
-
quote: string;
|
|
38
|
-
}, transactionOptions?: TransactionOptions): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Function stake and lock TCB's reward
|
|
41
|
-
* @param tcbId - TEE Offer's completed and valid TCB contract
|
|
42
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
43
|
-
*/
|
|
44
|
-
static claimRewards(tcbId: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Function unlock previously locked TCB rewards (by claimRewards)
|
|
47
|
-
* @param tcbId - TCB id
|
|
48
|
-
* @param unlockAmount - amount of tokens to unlock, max available amount = TeeOffer.getLockInfo(tcbId)
|
|
49
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
50
|
-
*/
|
|
51
|
-
static unlockRewards(tcbId: string, unlockAmount: number, transactionOptions?: TransactionOptions): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Function return last inited TCB of TEE offer
|
|
54
|
-
* @param teeOfferId
|
|
55
|
-
* */
|
|
56
|
-
static getInitedTcb(teeOfferId: string): Promise<string>;
|
|
57
22
|
/**
|
|
58
23
|
* Function return last inited TCB of TEE offer
|
|
59
|
-
* @param teeOfferId
|
|
24
|
+
* @param teeOfferId - id of TEE offer
|
|
60
25
|
* */
|
|
61
|
-
static
|
|
26
|
+
static getInitializedTcbId(teeOfferId: string): Promise<string>;
|
|
27
|
+
static getEpochIndex(): Promise<number>;
|
|
28
|
+
static getActualTcbId(teeOfferId: string): Promise<string>;
|
|
29
|
+
static getSuspiciousBlockTable(): Promise<string[]>;
|
|
30
|
+
static getLastBlockTable(): Promise<string[]>;
|
|
62
31
|
}
|
|
63
32
|
export default Consensus;
|