@super-protocol/sdk-js 0.12.8-beta.2 → 0.13.0-beta.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.
- package/build/TIIGenerator.js +16 -14
- package/build/connectors/BlockchainConnector.d.ts +1 -1
- package/build/connectors/BlockchainConnector.js +6 -4
- package/build/contracts/app.json +3581 -1393
- package/build/crypto/Crypto.d.ts +3 -3
- package/build/crypto/Crypto.js +3 -3
- package/build/crypto/nodejs/AES.d.ts +1 -1
- package/build/crypto/nodejs/AES.js +1 -1
- package/build/crypto/nodejs/ARIA.d.ts +1 -1
- package/build/crypto/nodejs/ARIA.js +1 -1
- package/build/index.d.ts +15 -15
- package/build/index.js +20 -22
- package/build/models/Offer.d.ts +47 -4
- package/build/models/Offer.js +159 -21
- package/build/models/Order.d.ts +29 -17
- package/build/models/Order.js +103 -74
- package/build/models/Provider.js +4 -2
- package/build/models/TeeOffer.d.ts +92 -11
- package/build/models/TeeOffer.js +305 -53
- package/build/providers/storage/ChunksDownloadDecorator.d.ts +0 -2
- package/build/providers/storage/ChunksDownloadDecorator.js +0 -3
- package/build/providers/storage/IStorageProvider.d.ts +0 -2
- package/build/providers/storage/StorjStorageProvider.d.ts +0 -2
- package/build/providers/storage/StorjStorageProvider.js +0 -15
- package/build/staticModels/Deposits.d.ts +71 -0
- package/build/staticModels/Deposits.js +303 -0
- package/build/staticModels/Offers.d.ts +58 -0
- package/build/staticModels/{OffersFactory.js → Offers.js} +115 -14
- package/build/staticModels/{OrdersFactory.d.ts → Orders.d.ts} +36 -43
- package/build/staticModels/{OrdersFactory.js → Orders.js} +103 -125
- package/build/staticModels/ProviderRegistry.d.ts +1 -1
- package/build/staticModels/ProviderRegistry.js +1 -1
- package/build/staticModels/Superpro.d.ts +2 -2
- package/build/staticModels/Superpro.js +1 -1
- package/build/staticModels/TeeOffers.d.ts +101 -0
- package/build/staticModels/TeeOffers.js +455 -0
- package/build/types/DepositInfo.d.ts +10 -0
- package/build/types/DepositInfo.js +9 -0
- package/build/types/Events.d.ts +0 -12
- package/build/types/HardwareInfo.d.ts +19 -0
- package/build/types/HardwareInfo.js +10 -0
- package/build/types/Offer.d.ts +0 -7
- package/build/types/Offer.js +0 -3
- package/build/types/OptionInfo.d.ts +10 -0
- package/build/types/OptionInfo.js +9 -0
- package/build/types/Order.d.ts +5 -1
- package/build/types/SlotInfo.d.ts +12 -0
- package/build/types/SlotInfo.js +10 -0
- package/build/types/SlotUsage.d.ts +16 -0
- package/build/types/SlotUsage.js +15 -0
- package/build/types/Superpro.d.ts +0 -14
- package/build/types/Superpro.js +1 -16
- package/build/types/TeeOfferInfo.d.ts +31 -0
- package/build/types/{TeeOffer.js → TeeOfferInfo.js} +2 -4
- package/build/types/TeeOfferOption.d.ts +21 -0
- package/build/types/TeeOfferOption.js +11 -0
- package/build/types/TeeOfferSlot.d.ts +22 -0
- package/build/types/TeeOfferSlot.js +11 -0
- package/build/types/ValueOfferSlot.d.ts +29 -0
- package/build/types/ValueOfferSlot.js +13 -0
- package/build/utils.d.ts +1 -0
- package/build/utils.js +5 -1
- package/package.json +1 -1
- package/build/models/Ballot.d.ts +0 -13
- package/build/models/Ballot.js +0 -70
- package/build/staticModels/OffersFactory.d.ts +0 -32
- package/build/staticModels/Staking.d.ts +0 -20
- package/build/staticModels/Staking.js +0 -116
- package/build/staticModels/TeeOffersFactory.d.ts +0 -36
- package/build/staticModels/TeeOffersFactory.js +0 -211
- package/build/staticModels/Voting.d.ts +0 -29
- package/build/staticModels/Voting.js +0 -91
- package/build/types/Ballot.d.ts +0 -75
- package/build/types/Ballot.js +0 -49
- package/build/types/Staking.d.ts +0 -27
- package/build/types/Staking.js +0 -22
- package/build/types/TeeOffer.d.ts +0 -25
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OptionInfoStructure = void 0;
|
|
4
|
+
// Order of keys and type conversion functions for this object in blockchain contract
|
|
5
|
+
exports.OptionInfoStructure = {
|
|
6
|
+
bandwidth: String,
|
|
7
|
+
traffic: String,
|
|
8
|
+
externalPort: String,
|
|
9
|
+
};
|
package/build/types/Order.d.ts
CHANGED
|
@@ -46,13 +46,17 @@ export declare const OrderInfoStructureArray: {
|
|
|
46
46
|
externalId: typeof parseBytes32String;
|
|
47
47
|
}[];
|
|
48
48
|
export type OrderInfo = {
|
|
49
|
-
|
|
49
|
+
offerId: string;
|
|
50
50
|
resultPublicKey: string;
|
|
51
51
|
encryptedRequirements: string;
|
|
52
52
|
encryptedArgs: string;
|
|
53
53
|
status: OrderStatus;
|
|
54
54
|
args: OrderArgs;
|
|
55
55
|
externalId: string;
|
|
56
|
+
slotId: string;
|
|
57
|
+
slotCount: string;
|
|
58
|
+
optionsIds: string[];
|
|
59
|
+
optionsCount: string[];
|
|
56
60
|
};
|
|
57
61
|
export type ExtendedOrderInfo = OrderInfo & {
|
|
58
62
|
blocking: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlotInfoStructure = void 0;
|
|
4
|
+
// Order of keys and type conversion functions for this object in blockchain contract
|
|
5
|
+
exports.SlotInfoStructure = {
|
|
6
|
+
cpuCores: Number,
|
|
7
|
+
ram: Number,
|
|
8
|
+
hdd: Number,
|
|
9
|
+
ssd: Number,
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum PriceType {
|
|
2
|
+
PerHour = "0",
|
|
3
|
+
Fixed = "1"
|
|
4
|
+
}
|
|
5
|
+
export declare const SlotUsageStructure: {
|
|
6
|
+
priceType: typeof PriceType;
|
|
7
|
+
price: StringConstructor;
|
|
8
|
+
minTimeMinutes: NumberConstructor;
|
|
9
|
+
maxTimeMinutes: NumberConstructor;
|
|
10
|
+
};
|
|
11
|
+
export type SlotUsage = {
|
|
12
|
+
priceType: PriceType;
|
|
13
|
+
price: string;
|
|
14
|
+
minTimeMinutes: number;
|
|
15
|
+
maxTimeMinutes: number;
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlotUsageStructure = exports.PriceType = void 0;
|
|
4
|
+
var PriceType;
|
|
5
|
+
(function (PriceType) {
|
|
6
|
+
PriceType["PerHour"] = "0";
|
|
7
|
+
PriceType["Fixed"] = "1";
|
|
8
|
+
})(PriceType = exports.PriceType || (exports.PriceType = {}));
|
|
9
|
+
// Order of keys and type conversion functions for this object in blockchain contract
|
|
10
|
+
exports.SlotUsageStructure = {
|
|
11
|
+
priceType: PriceType,
|
|
12
|
+
price: String,
|
|
13
|
+
minTimeMinutes: Number,
|
|
14
|
+
maxTimeMinutes: Number,
|
|
15
|
+
};
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
export declare enum ContractName {
|
|
2
|
-
Orders = "0",
|
|
3
|
-
ProviderRegistry = "1",
|
|
4
|
-
Staking = "2",
|
|
5
|
-
Superpro = "3",
|
|
6
|
-
TeeOffersFactory = "4",
|
|
7
|
-
Token = "5",
|
|
8
|
-
ValueOffersFactory = "6",
|
|
9
|
-
Voting = "7",
|
|
10
|
-
Consensus = "8",
|
|
11
|
-
Suspicious = "9",
|
|
12
|
-
LastBlocks = "10",
|
|
13
|
-
Epochs = "11"
|
|
14
|
-
}
|
|
15
1
|
export declare enum ParamName {
|
|
16
2
|
OrderMinimumDeposit = "0",
|
|
17
3
|
ProfitWithdrawDelaySeconds = "1",
|
package/build/types/Superpro.js
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParamName =
|
|
4
|
-
var ContractName;
|
|
5
|
-
(function (ContractName) {
|
|
6
|
-
ContractName["Orders"] = "0";
|
|
7
|
-
ContractName["ProviderRegistry"] = "1";
|
|
8
|
-
ContractName["Staking"] = "2";
|
|
9
|
-
ContractName["Superpro"] = "3";
|
|
10
|
-
ContractName["TeeOffersFactory"] = "4";
|
|
11
|
-
ContractName["Token"] = "5";
|
|
12
|
-
ContractName["ValueOffersFactory"] = "6";
|
|
13
|
-
ContractName["Voting"] = "7";
|
|
14
|
-
ContractName["Consensus"] = "8";
|
|
15
|
-
ContractName["Suspicious"] = "9";
|
|
16
|
-
ContractName["LastBlocks"] = "10";
|
|
17
|
-
ContractName["Epochs"] = "11";
|
|
18
|
-
})(ContractName = exports.ContractName || (exports.ContractName = {}));
|
|
3
|
+
exports.ParamName = void 0;
|
|
19
4
|
var ParamName;
|
|
20
5
|
(function (ParamName) {
|
|
21
6
|
ParamName["OrderMinimumDeposit"] = "0";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HardwareInfo } from "./HardwareInfo";
|
|
2
|
+
export declare const TeeOfferInfoStructure: {
|
|
3
|
+
name: StringConstructor;
|
|
4
|
+
description: StringConstructor;
|
|
5
|
+
teeType: StringConstructor;
|
|
6
|
+
properties: StringConstructor;
|
|
7
|
+
tlb: StringConstructor;
|
|
8
|
+
argsPublicKey: StringConstructor;
|
|
9
|
+
hardwareInfo: {
|
|
10
|
+
slotInfo: {
|
|
11
|
+
cpuCores: NumberConstructor;
|
|
12
|
+
ram: NumberConstructor;
|
|
13
|
+
hdd: NumberConstructor;
|
|
14
|
+
ssd: NumberConstructor;
|
|
15
|
+
};
|
|
16
|
+
optionInfo: {
|
|
17
|
+
bandwidth: StringConstructor;
|
|
18
|
+
traffic: StringConstructor;
|
|
19
|
+
externalPort: StringConstructor;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type TeeOfferInfo = {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
teeType: string;
|
|
27
|
+
properties: string;
|
|
28
|
+
tlb: string;
|
|
29
|
+
argsPublicKey: string;
|
|
30
|
+
hardwareInfo: HardwareInfo;
|
|
31
|
+
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TeeOfferInfoStructure = void 0;
|
|
4
|
+
var HardwareInfo_1 = require("./HardwareInfo");
|
|
4
5
|
// Order of keys and type conversion functions for this object in blockchain contract
|
|
5
6
|
exports.TeeOfferInfoStructure = {
|
|
6
7
|
name: String,
|
|
7
8
|
description: String,
|
|
8
9
|
teeType: String,
|
|
9
|
-
slots: Number,
|
|
10
|
-
minTimeMinutes: Number,
|
|
11
10
|
properties: String,
|
|
12
|
-
tcb: String,
|
|
13
11
|
tlb: String,
|
|
14
12
|
argsPublicKey: String,
|
|
15
|
-
|
|
13
|
+
hardwareInfo: HardwareInfo_1.HardwareInfoStructure,
|
|
16
14
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OptionInfo } from "./OptionInfo";
|
|
2
|
+
import { SlotUsage } from "./SlotUsage";
|
|
3
|
+
export declare const TeeOfferOptionStructure: {
|
|
4
|
+
id: StringConstructor;
|
|
5
|
+
info: {
|
|
6
|
+
bandwidth: StringConstructor;
|
|
7
|
+
traffic: StringConstructor;
|
|
8
|
+
externalPort: StringConstructor;
|
|
9
|
+
};
|
|
10
|
+
usage: {
|
|
11
|
+
priceType: typeof import("./SlotUsage").PriceType;
|
|
12
|
+
price: StringConstructor;
|
|
13
|
+
minTimeMinutes: NumberConstructor;
|
|
14
|
+
maxTimeMinutes: NumberConstructor;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type TeeOfferOption = {
|
|
18
|
+
id: string;
|
|
19
|
+
info: OptionInfo;
|
|
20
|
+
usage: SlotUsage;
|
|
21
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeeOfferOptionStructure = void 0;
|
|
4
|
+
var OptionInfo_1 = require("./OptionInfo");
|
|
5
|
+
var SlotUsage_1 = require("./SlotUsage");
|
|
6
|
+
// Order of keys and type conversion functions for this object in blockchain contract
|
|
7
|
+
exports.TeeOfferOptionStructure = {
|
|
8
|
+
id: String,
|
|
9
|
+
info: OptionInfo_1.OptionInfoStructure,
|
|
10
|
+
usage: SlotUsage_1.SlotUsageStructure,
|
|
11
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SlotInfo } from "./SlotInfo";
|
|
2
|
+
import { SlotUsage } from "./SlotUsage";
|
|
3
|
+
export declare const TeeOfferSlotStructure: {
|
|
4
|
+
id: StringConstructor;
|
|
5
|
+
info: {
|
|
6
|
+
cpuCores: NumberConstructor;
|
|
7
|
+
ram: NumberConstructor;
|
|
8
|
+
hdd: NumberConstructor;
|
|
9
|
+
ssd: NumberConstructor;
|
|
10
|
+
};
|
|
11
|
+
usage: {
|
|
12
|
+
priceType: typeof import("./SlotUsage").PriceType;
|
|
13
|
+
price: StringConstructor;
|
|
14
|
+
minTimeMinutes: NumberConstructor;
|
|
15
|
+
maxTimeMinutes: NumberConstructor;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type TeeOfferSlot = {
|
|
19
|
+
id: string;
|
|
20
|
+
info: SlotInfo;
|
|
21
|
+
usage: SlotUsage;
|
|
22
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeeOfferSlotStructure = void 0;
|
|
4
|
+
var SlotInfo_1 = require("./SlotInfo");
|
|
5
|
+
var SlotUsage_1 = require("./SlotUsage");
|
|
6
|
+
// Order of keys and type conversion functions for this object in blockchain contract
|
|
7
|
+
exports.TeeOfferSlotStructure = {
|
|
8
|
+
id: String,
|
|
9
|
+
info: SlotInfo_1.SlotInfoStructure,
|
|
10
|
+
usage: SlotUsage_1.SlotUsageStructure,
|
|
11
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OptionInfo } from "./OptionInfo";
|
|
2
|
+
import { SlotInfo } from "./SlotInfo";
|
|
3
|
+
import { SlotUsage } from "./SlotUsage";
|
|
4
|
+
export declare const ValueOfferSlotStructure: {
|
|
5
|
+
id: StringConstructor;
|
|
6
|
+
info: {
|
|
7
|
+
cpuCores: NumberConstructor;
|
|
8
|
+
ram: NumberConstructor;
|
|
9
|
+
hdd: NumberConstructor;
|
|
10
|
+
ssd: NumberConstructor;
|
|
11
|
+
};
|
|
12
|
+
option: {
|
|
13
|
+
bandwidth: StringConstructor;
|
|
14
|
+
traffic: StringConstructor;
|
|
15
|
+
externalPort: StringConstructor;
|
|
16
|
+
};
|
|
17
|
+
usage: {
|
|
18
|
+
priceType: typeof import("./SlotUsage").PriceType;
|
|
19
|
+
price: StringConstructor;
|
|
20
|
+
minTimeMinutes: NumberConstructor;
|
|
21
|
+
maxTimeMinutes: NumberConstructor;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type ValueOfferSlot = {
|
|
25
|
+
id: string;
|
|
26
|
+
info: SlotInfo;
|
|
27
|
+
option: OptionInfo;
|
|
28
|
+
usage: SlotUsage;
|
|
29
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueOfferSlotStructure = void 0;
|
|
4
|
+
var OptionInfo_1 = require("./OptionInfo");
|
|
5
|
+
var SlotInfo_1 = require("./SlotInfo");
|
|
6
|
+
var SlotUsage_1 = require("./SlotUsage");
|
|
7
|
+
// Order of keys and type conversion functions for this object in blockchain contract
|
|
8
|
+
exports.ValueOfferSlotStructure = {
|
|
9
|
+
id: String,
|
|
10
|
+
info: SlotInfo_1.SlotInfoStructure,
|
|
11
|
+
option: OptionInfo_1.OptionInfoStructure,
|
|
12
|
+
usage: SlotUsage_1.SlotUsageStructure,
|
|
13
|
+
};
|
package/build/utils.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ type Format = FormatItem[] | {
|
|
|
28
28
|
[key: string]: FormatItem;
|
|
29
29
|
};
|
|
30
30
|
export declare const tupleToObject: <T>(data: unknown[], format: Format) => T;
|
|
31
|
+
export declare const tupleToObjectsArray: <T>(data: unknown[], format: Format) => T[];
|
|
31
32
|
export declare const objectToTuple: (data: unknown, format: Format) => unknown[];
|
|
32
33
|
export declare function incrementMethodCall(): (_target: any, propertyName: string, propertyDescriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
33
34
|
export declare function packDevicId(hexedDeviceId: string): string;
|
package/build/utils.js
CHANGED
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.unpackDeviceId = exports.packDevicId = exports.incrementMethodCall = exports.objectToTuple = exports.tupleToObject = exports.isNodeJS = exports.createTransactionOptions = exports.getGasPrice = exports.checkForUsingExternalTxManager = exports.checkIfActionAccountInitialized = void 0;
|
|
42
|
+
exports.unpackDeviceId = exports.packDevicId = exports.incrementMethodCall = exports.objectToTuple = exports.tupleToObjectsArray = exports.tupleToObject = exports.isNodeJS = exports.createTransactionOptions = exports.getGasPrice = exports.checkForUsingExternalTxManager = exports.checkIfActionAccountInitialized = void 0;
|
|
43
43
|
var store_1 = __importDefault(require("./store"));
|
|
44
44
|
var lodash_1 = require("lodash");
|
|
45
45
|
var Monitoring_1 = require("./utils/Monitoring");
|
|
@@ -148,6 +148,10 @@ var tupleToObject = function (data, format) {
|
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
exports.tupleToObject = tupleToObject;
|
|
151
|
+
var tupleToObjectsArray = function (data, format) {
|
|
152
|
+
return data.map(function (item) { return (0, exports.tupleToObject)(item, format); });
|
|
153
|
+
};
|
|
154
|
+
exports.tupleToObjectsArray = tupleToObjectsArray;
|
|
151
155
|
var objectToTuple = function (data, format) {
|
|
152
156
|
var processItem = function (dataItem, formatItem) {
|
|
153
157
|
if (formatItem === null || formatItem === void 0 ? void 0 : formatItem.$tuple) {
|
package/package.json
CHANGED
package/build/models/Ballot.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BallotInfo } from "../types/Ballot";
|
|
2
|
-
declare class Ballot {
|
|
3
|
-
address: string;
|
|
4
|
-
private contract;
|
|
5
|
-
private logger;
|
|
6
|
-
ballotInfo?: BallotInfo;
|
|
7
|
-
constructor(address: string);
|
|
8
|
-
/**
|
|
9
|
-
* Function for fetching order info from blockchain
|
|
10
|
-
*/
|
|
11
|
-
getBallotInfo(): Promise<BallotInfo>;
|
|
12
|
-
}
|
|
13
|
-
export default Ballot;
|
package/build/models/Ballot.js
DELETED
|
@@ -1,70 +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 (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
|
-
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 Ballot_1 = require("../types/Ballot");
|
|
45
|
-
var BlockchainConnector_1 = __importDefault(require("../connectors/BlockchainConnector"));
|
|
46
|
-
var Ballot = /** @class */ (function () {
|
|
47
|
-
function Ballot(address) {
|
|
48
|
-
this.address = address;
|
|
49
|
-
this.contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
50
|
-
this.logger = logger_1.default.child({ className: "Ballot", address: address });
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Function for fetching order info from blockchain
|
|
54
|
-
*/
|
|
55
|
-
Ballot.prototype.getBallotInfo = function () {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var ballotInfoParams;
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
switch (_a.label) {
|
|
60
|
-
case 0: return [4 /*yield*/, this.contract.methods.getInfo().call()];
|
|
61
|
-
case 1:
|
|
62
|
-
ballotInfoParams = _a.sent();
|
|
63
|
-
return [2 /*return*/, (this.ballotInfo = (0, utils_1.tupleToObject)(ballotInfoParams, Ballot_1.BallotInfoStructure))];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
return Ballot;
|
|
69
|
-
}());
|
|
70
|
-
exports.default = Ballot;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { OfferInfo, OfferType } from "../types/Offer";
|
|
2
|
-
import { BlockInfo, TransactionOptions } from "../types/Web3";
|
|
3
|
-
import { OfferCreatedEvent } from "../types/Events";
|
|
4
|
-
declare class OffersFactory {
|
|
5
|
-
private static readonly logger;
|
|
6
|
-
static offers?: string[];
|
|
7
|
-
static get address(): string;
|
|
8
|
-
/**
|
|
9
|
-
* Function for fetching list of all offers ids
|
|
10
|
-
*/
|
|
11
|
-
static getAllOffers(): Promise<string[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Creates new offer
|
|
14
|
-
* @param providerAuthorityAccount - address of authority account of provider
|
|
15
|
-
* @param offerInfo - data of new offer
|
|
16
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
17
|
-
*/
|
|
18
|
-
static createOffer(providerAuthorityAccount: string, offerInfo: OfferInfo, externalId?: string, enabled?: boolean, transactionOptions?: TransactionOptions): Promise<void>;
|
|
19
|
-
static getOffer(creator: string, externalId: string): Promise<OfferCreatedEvent>;
|
|
20
|
-
/**
|
|
21
|
-
* Function for adding event listeners on offer created event in offers factory contract
|
|
22
|
-
* @param callback - function for processing created offer
|
|
23
|
-
* @return unsubscribe - unsubscribe function from event
|
|
24
|
-
*/
|
|
25
|
-
static onOfferCreated(callback: onOfferCreatedCallback): () => void;
|
|
26
|
-
static onOfferEnabled(callback: onOfferEnabledCallback): () => void;
|
|
27
|
-
static onOfferDisabled(callback: onOfferDisbledCallback): () => void;
|
|
28
|
-
}
|
|
29
|
-
export type onOfferCreatedCallback = (id: string, creator: string, externalId: string, block?: BlockInfo) => void;
|
|
30
|
-
export type onOfferEnabledCallback = (providerAuth: string, id: string, offerType: OfferType, block?: BlockInfo) => void;
|
|
31
|
-
export type onOfferDisbledCallback = (providerAuth: string, id: string, offerType: OfferType, block?: BlockInfo) => void;
|
|
32
|
-
export default OffersFactory;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { LockInfo, StakeInfo, Purpose } from "../types/Staking";
|
|
2
|
-
import { TransactionOptions } from "../types/Web3";
|
|
3
|
-
declare class Staking {
|
|
4
|
-
static get address(): string;
|
|
5
|
-
/**
|
|
6
|
-
* Fetching stake info by owner address from blockchain
|
|
7
|
-
*/
|
|
8
|
-
static getStakeInfo(ownerAddress: string): Promise<StakeInfo>;
|
|
9
|
-
/**
|
|
10
|
-
* Fetching locked tokens info by owner address and contract name from blockchain
|
|
11
|
-
*/
|
|
12
|
-
static getLockInfo(purpose: Purpose, ownerAddress: string): Promise<LockInfo>;
|
|
13
|
-
/**
|
|
14
|
-
* Stakes tokens
|
|
15
|
-
* @param amount - tokens to be staked
|
|
16
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
17
|
-
*/
|
|
18
|
-
static stake(amount: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
export default Staking;
|
|
@@ -1,116 +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 (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
|
-
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 utils_1 = require("../utils");
|
|
43
|
-
var Staking_1 = require("../types/Staking");
|
|
44
|
-
var BlockchainConnector_1 = __importDefault(require("../connectors/BlockchainConnector"));
|
|
45
|
-
var Superpro_1 = __importDefault(require("./Superpro"));
|
|
46
|
-
var TxManager_1 = __importDefault(require("../utils/TxManager"));
|
|
47
|
-
var Staking = /** @class */ (function () {
|
|
48
|
-
function Staking() {
|
|
49
|
-
}
|
|
50
|
-
Object.defineProperty(Staking, "address", {
|
|
51
|
-
get: function () {
|
|
52
|
-
return Superpro_1.default.address;
|
|
53
|
-
},
|
|
54
|
-
enumerable: false,
|
|
55
|
-
configurable: true
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* Fetching stake info by owner address from blockchain
|
|
59
|
-
*/
|
|
60
|
-
Staking.getStakeInfo = function (ownerAddress) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var contract, stakeInfoParams;
|
|
63
|
-
return __generator(this, function (_a) {
|
|
64
|
-
switch (_a.label) {
|
|
65
|
-
case 0:
|
|
66
|
-
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
67
|
-
return [4 /*yield*/, contract.methods.getStakeInfo(ownerAddress).call()];
|
|
68
|
-
case 1:
|
|
69
|
-
stakeInfoParams = _a.sent();
|
|
70
|
-
return [2 /*return*/, (0, utils_1.tupleToObject)(stakeInfoParams, Staking_1.StakeInfoStructure)];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Fetching locked tokens info by owner address and contract name from blockchain
|
|
77
|
-
*/
|
|
78
|
-
Staking.getLockInfo = function (purpose, ownerAddress) {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
var contract, lockInfoParams;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0:
|
|
84
|
-
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
85
|
-
return [4 /*yield*/, contract.methods.getLockedTokensInfo(purpose, ownerAddress).call()];
|
|
86
|
-
case 1:
|
|
87
|
-
lockInfoParams = _a.sent();
|
|
88
|
-
return [2 /*return*/, (0, utils_1.tupleToObject)(lockInfoParams, Staking_1.LockInfoStructure)];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Stakes tokens
|
|
95
|
-
* @param amount - tokens to be staked
|
|
96
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
97
|
-
*/
|
|
98
|
-
Staking.stake = function (amount, transactionOptions) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
var contract;
|
|
101
|
-
return __generator(this, function (_a) {
|
|
102
|
-
switch (_a.label) {
|
|
103
|
-
case 0:
|
|
104
|
-
contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
|
|
105
|
-
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
106
|
-
return [4 /*yield*/, TxManager_1.default.execute(contract.methods.stake, [amount], transactionOptions)];
|
|
107
|
-
case 1:
|
|
108
|
-
_a.sent();
|
|
109
|
-
return [2 /*return*/];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
return Staking;
|
|
115
|
-
}());
|
|
116
|
-
exports.default = Staking;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BlockInfo, TransactionOptions } from "../types/Web3";
|
|
2
|
-
import { TeeOfferInfo } from "../types/TeeOffer";
|
|
3
|
-
import { OfferCreatedEvent } from "../types/Events";
|
|
4
|
-
declare class TeeOffersFactory {
|
|
5
|
-
private static readonly logger;
|
|
6
|
-
static teeOffers?: string[];
|
|
7
|
-
static get address(): string;
|
|
8
|
-
/**
|
|
9
|
-
* Function for fetching list of all TEE offers addresses
|
|
10
|
-
*/
|
|
11
|
-
static getAllTeeOffers(): Promise<string[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Creates new TEE offer
|
|
14
|
-
* @param providerAuthorityAccount - address of authority account of provider
|
|
15
|
-
* @param teeOfferInfo - data of new TEE offer
|
|
16
|
-
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
17
|
-
*/
|
|
18
|
-
static createTeeOffer(providerAuthorityAccount: string, teeOfferInfo: TeeOfferInfo, externalId?: string, enabled?: boolean, transactionOptions?: TransactionOptions): Promise<void>;
|
|
19
|
-
static getOffer(creator: string, externalId: string): Promise<OfferCreatedEvent>;
|
|
20
|
-
/**
|
|
21
|
-
* Function for fetching TEE offer id by TEE deviceId
|
|
22
|
-
* @param deviceId - unque TEE device id (unparsed, from blockchain)
|
|
23
|
-
* @return TEE offer id
|
|
24
|
-
*/
|
|
25
|
-
static getByDeviceId(deviceId: string): Promise<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Function for adding event listeners on TEE offer created event in TEE offers factory contract
|
|
28
|
-
* @param callback - function for processing created TEE offer
|
|
29
|
-
* @return unsubscribe - unsubscribe function from event
|
|
30
|
-
*/
|
|
31
|
-
static onTeeOfferCreated(callback: onTeeOfferCreatedCallback): () => void;
|
|
32
|
-
static onTeeOfferViolationRateChanged(callback: onTeeOfferViolationRateChangedCallback): () => void;
|
|
33
|
-
}
|
|
34
|
-
export type onTeeOfferCreatedCallback = (offerId: string, creator: string, externalId: string, block?: BlockInfo) => void;
|
|
35
|
-
export type onTeeOfferViolationRateChangedCallback = (offerId: string, providerAuth: string, violationRate: number, block?: BlockInfo) => void;
|
|
36
|
-
export default TeeOffersFactory;
|