@super-protocol/sdk-js 0.6.5-beta.0 → 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.
@@ -1,97 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
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 (_) 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
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var logger_1 = __importDefault(require("../logger"));
43
- // import EpochsJSON from "../contracts/Epochs.json";
44
- var utils_1 = require("../utils");
45
- var Epochs = /** @class */ (function () {
46
- function Epochs() {
47
- }
48
- /**
49
- * Checks if contract has been initialized, if not - initialize contract
50
- */
51
- Epochs.checkInit = function () {
52
- if (this.contract)
53
- return;
54
- (0, utils_1.checkIfInitialized)();
55
- // this.contract = new store.web3!.eth.Contract(<AbiItem[]>EpochsJSON.abi, this.address);
56
- this.logger = logger_1.default.child({ className: "Epochs" });
57
- };
58
- /**
59
- * Function for fetching epoch info by index
60
- */
61
- Epochs.getEpoch = function (index) {
62
- return __awaiter(this, void 0, void 0, function () {
63
- return __generator(this, function (_a) {
64
- return [2 /*return*/, {
65
- startDate: 0,
66
- endDate: 0,
67
- reward: 0,
68
- benchmark: 0,
69
- reparation: 0,
70
- reparationBenchmark: 0,
71
- }];
72
- });
73
- });
74
- };
75
- /**
76
- * Function for fetching TCB reward by epoch
77
- */
78
- Epochs.getReward = function (tcbAddress) {
79
- return __awaiter(this, void 0, void 0, function () {
80
- return __generator(this, function (_a) {
81
- return [2 /*return*/, 0];
82
- });
83
- });
84
- };
85
- /**
86
- * Function for fetching TCB last blocks list size
87
- */
88
- Epochs.count = function () {
89
- return __awaiter(this, void 0, void 0, function () {
90
- return __generator(this, function (_a) {
91
- return [2 /*return*/, 0];
92
- });
93
- });
94
- };
95
- return Epochs;
96
- }());
97
- exports.default = Epochs;
@@ -1,25 +0,0 @@
1
- import { TransactionOptions } from "../types/Web3";
2
- declare class LastBlocks {
3
- static address: string;
4
- private static contract;
5
- private static logger;
6
- /**
7
- * Checks if contract has been initialized, if not - initialize contract
8
- */
9
- private static checkInit;
10
- /**
11
- * Function generates a list of blocks to be checked in a random way
12
- * @param tcbAddress - TCB into which other TCBs are recruited from tables for verification
13
- * @param transactionOptions - object what contains alternative action account or gas limit (optional)
14
- */
15
- static getRandomL1(tcbAddress: string, transactionOptions?: TransactionOptions): Promise<void>;
16
- /**
17
- * Function for fetching TCB last blocks list
18
- */
19
- static listAll(): Promise<string[]>;
20
- /**
21
- * Function for fetching TCB last blocks list size
22
- */
23
- static count(): Promise<number>;
24
- }
25
- export default LastBlocks;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
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 (_) 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
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var logger_1 = __importDefault(require("../logger"));
43
- // import LastBlocksJSON from "../contracts/LastBlocks.json";
44
- var utils_1 = require("../utils");
45
- var LastBlocks = /** @class */ (function () {
46
- function LastBlocks() {
47
- }
48
- /**
49
- * Checks if contract has been initialized, if not - initialize contract
50
- */
51
- LastBlocks.checkInit = function (transactionOptions) {
52
- if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
53
- (0, utils_1.checkIfInitialized)();
54
- // return new transactionOptions.web3.eth.Contract(<AbiItem[]>LastBlocksJSON.abi, this.address);
55
- }
56
- if (this.contract)
57
- return this.contract;
58
- (0, utils_1.checkIfInitialized)();
59
- this.logger = logger_1.default.child({ className: "LastBlocks" });
60
- // return this.contract = new store.web3!.eth.Contract(<AbiItem[]>LastBlocksJSON.abi, this.address);
61
- };
62
- /**
63
- * Function generates a list of blocks to be checked in a random way
64
- * @param tcbAddress - TCB into which other TCBs are recruited from tables for verification
65
- * @param transactionOptions - object what contains alternative action account or gas limit (optional)
66
- */
67
- LastBlocks.getRandomL1 = function (tcbAddress, transactionOptions) {
68
- return __awaiter(this, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- return [2 /*return*/];
71
- });
72
- });
73
- };
74
- /**
75
- * Function for fetching TCB last blocks list
76
- */
77
- LastBlocks.listAll = function () {
78
- return __awaiter(this, void 0, void 0, function () {
79
- return __generator(this, function (_a) {
80
- return [2 /*return*/, []];
81
- });
82
- });
83
- };
84
- /**
85
- * Function for fetching TCB last blocks list size
86
- */
87
- LastBlocks.count = function () {
88
- return __awaiter(this, void 0, void 0, function () {
89
- return __generator(this, function (_a) {
90
- return [2 /*return*/, 0];
91
- });
92
- });
93
- };
94
- return LastBlocks;
95
- }());
96
- exports.default = LastBlocks;
@@ -1,26 +0,0 @@
1
- import { TransactionOptions } from "../types/Web3";
2
- declare class Suspicious {
3
- static address: string;
4
- private static contract;
5
- private static logger;
6
- /**
7
- * Checks if contract has been initialized, if not - initialize contract
8
- */
9
- private static checkInit;
10
- /**
11
- * Function generates a list of blocks to be checked in a random way
12
- * @param tcbAddress - TCB into which other TCBs are recruited from tables for verification
13
- * @param max - limit for getting blocks (like a batch size)
14
- * @param transactionOptions - object what contains alternative action account or gas limit (optional)
15
- */
16
- static getRandomL2(tcbAddress: string, max: number, transactionOptions?: TransactionOptions): Promise<void>;
17
- /**
18
- * Function for fetching TCB suspect list
19
- */
20
- static listAll(): Promise<string[]>;
21
- /**
22
- * Function for fetching TCB suspect list size
23
- */
24
- static count(): Promise<string[]>;
25
- }
26
- export default Suspicious;
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
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 (_) 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
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var logger_1 = __importDefault(require("../logger"));
43
- var utils_1 = require("../utils");
44
- var Suspicious = /** @class */ (function () {
45
- function Suspicious() {
46
- }
47
- /**
48
- * Checks if contract has been initialized, if not - initialize contract
49
- */
50
- Suspicious.checkInit = function (transactionOptions) {
51
- if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
52
- (0, utils_1.checkIfInitialized)();
53
- // return new transactionOptions.web3.eth.Contract(<AbiItem[]>SuspiciousJSON.abi, this.address);
54
- }
55
- if (this.contract)
56
- return this.contract;
57
- (0, utils_1.checkIfInitialized)();
58
- this.logger = logger_1.default.child({ className: "Suspicious" });
59
- // return this.contract = new store.web3!.eth.Contract(<AbiItem[]>SuspiciousJSON.abi, this.address);
60
- };
61
- /**
62
- * Function generates a list of blocks to be checked in a random way
63
- * @param tcbAddress - TCB into which other TCBs are recruited from tables for verification
64
- * @param max - limit for getting blocks (like a batch size)
65
- * @param transactionOptions - object what contains alternative action account or gas limit (optional)
66
- */
67
- Suspicious.getRandomL2 = function (tcbAddress, max, transactionOptions) {
68
- return __awaiter(this, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- return [2 /*return*/];
71
- });
72
- });
73
- };
74
- /**
75
- * Function for fetching TCB suspect list
76
- */
77
- Suspicious.listAll = function () {
78
- return __awaiter(this, void 0, void 0, function () {
79
- return __generator(this, function (_a) {
80
- // TODO: stub
81
- return [2 /*return*/, []];
82
- });
83
- });
84
- };
85
- /**
86
- * Function for fetching TCB suspect list size
87
- */
88
- // TODO: stub
89
- Suspicious.count = function () {
90
- return __awaiter(this, void 0, void 0, function () {
91
- return __generator(this, function (_a) {
92
- // TODO: stub
93
- return [2 /*return*/, []];
94
- });
95
- });
96
- };
97
- return Suspicious;
98
- }());
99
- exports.default = Suspicious;
@@ -1,21 +0,0 @@
1
- export declare const EpochStructure: {
2
- startDate: NumberConstructor;
3
- endDate: NumberConstructor;
4
- reward: NumberConstructor;
5
- benchmark: NumberConstructor;
6
- reparation: NumberConstructor;
7
- reparationBenchmark: NumberConstructor;
8
- };
9
- export declare type Epoch = {
10
- startDate: number;
11
- endDate: number;
12
- reward: number;
13
- benchmark: number;
14
- reparation: number;
15
- reparationBenchmark: number;
16
- };
17
- export declare enum TcbStatus {
18
- Inited = "0",
19
- Completed = "1",
20
- Banned = "2"
21
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TcbStatus = exports.EpochStructure = void 0;
4
- // Order of keys and type conversion functions for this object in blockchain contract
5
- exports.EpochStructure = {
6
- startDate: Number,
7
- endDate: Number,
8
- reward: Number,
9
- benchmark: Number,
10
- reparation: Number,
11
- reparationBenchmark: Number,
12
- };
13
- var TcbStatus;
14
- (function (TcbStatus) {
15
- TcbStatus["Inited"] = "0";
16
- TcbStatus["Completed"] = "1";
17
- TcbStatus["Banned"] = "2";
18
- })(TcbStatus = exports.TcbStatus || (exports.TcbStatus = {}));
@@ -1,26 +0,0 @@
1
- export declare enum LType {
2
- L1 = "0",
3
- L2 = "1"
4
- }
5
- export declare const PublicDataStructure: {
6
- teeOffer: StringConstructor;
7
- deviceID: StringConstructor;
8
- benchmark: NumberConstructor;
9
- properties: StringConstructor;
10
- };
11
- export declare type PublicData = {
12
- teeOffer: string;
13
- deviceID: string;
14
- benchmark: number;
15
- properties: string;
16
- };
17
- export declare const TcbEpochInfoStructure: {
18
- index: NumberConstructor;
19
- valid: BooleanConstructor;
20
- reparation: BooleanConstructor;
21
- };
22
- export declare type TcbEpochInfo = {
23
- index: number;
24
- valid: boolean;
25
- reparation: boolean;
26
- };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TcbEpochInfoStructure = exports.PublicDataStructure = exports.LType = void 0;
4
- var LType;
5
- (function (LType) {
6
- LType["L1"] = "0";
7
- LType["L2"] = "1";
8
- })(LType = exports.LType || (exports.LType = {}));
9
- // Order of keys and type conversion functions for this object in blockchain contract
10
- exports.PublicDataStructure = {
11
- teeOffer: String,
12
- deviceID: String,
13
- benchmark: Number,
14
- properties: String,
15
- };
16
- // Order of keys and type conversion functions for this object in blockchain contract
17
- exports.TcbEpochInfoStructure = {
18
- index: Number,
19
- valid: Boolean,
20
- reparation: Boolean,
21
- };