@super-protocol/sdk-js 0.7.0-beta.4 → 0.7.1-beta.2
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 +4 -4
- package/build/BlockchainConnector.js +31 -4
- package/build/constants.d.ts +1 -0
- package/build/constants.js +2 -1
- package/build/contracts/app.json +8671 -0
- package/build/models/Ballot.js +2 -5
- package/build/models/Offer.js +3 -3
- package/build/models/Order.js +4 -4
- package/build/models/Provider.d.ts +0 -1
- package/build/models/Provider.js +6 -10
- package/build/models/TCB.js +3 -3
- package/build/models/TeeOffer.js +3 -3
- package/build/staticModels/ActiveOffers.js +3 -3
- package/build/staticModels/ActiveOrders.js +3 -3
- package/build/staticModels/Consensus.js +3 -3
- package/build/staticModels/Marks.js +3 -3
- package/build/staticModels/OffersFactory.js +3 -3
- package/build/staticModels/OrdersFactory.d.ts +16 -0
- package/build/staticModels/OrdersFactory.js +56 -3
- package/build/staticModels/ProviderRegistry.js +5 -6
- package/build/staticModels/Staking.js +3 -3
- package/build/staticModels/Superpro.js +2 -2
- package/build/staticModels/SuperproToken.js +3 -3
- package/build/staticModels/TeeOffersFactory.js +3 -3
- package/build/staticModels/Voting.js +3 -3
- package/build/types/Events.d.ts +6 -0
- package/build/types/Order.d.ts +1 -0
- package/build/types/Order.js +3 -1
- package/build/types/Web3.d.ts +5 -0
- package/package.json +5 -4
- package/build/contracts/ActiveOffersList.json +0 -131
- package/build/contracts/ActiveOrdersList.json +0 -169
- package/build/contracts/Consensus.json +0 -580
- package/build/contracts/Marks.json +0 -79
- package/build/contracts/Offers.json +0 -1018
- package/build/contracts/Orders.json +0 -984
- package/build/contracts/Providers.json +0 -421
- package/build/contracts/ProvidersOffers.json +0 -254
- package/build/contracts/Staking.json +0 -323
- package/build/contracts/Superpro.json +0 -197
- package/build/contracts/SuperproToken.json +0 -356
package/build/models/Ballot.js
CHANGED
|
@@ -40,8 +40,7 @@ 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 app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
44
|
var store_1 = __importDefault(require("../store"));
|
|
46
45
|
var utils_1 = require("../utils");
|
|
47
46
|
var Ballot_1 = require("../types/Ballot");
|
|
@@ -50,9 +49,7 @@ var Ballot = /** @class */ (function () {
|
|
|
50
49
|
function Ballot(address) {
|
|
51
50
|
(0, utils_1.checkIfInitialized)();
|
|
52
51
|
this.address = address;
|
|
53
|
-
|
|
54
|
-
// TODO: stub
|
|
55
|
-
this.contract = new store_1.default.web3.eth.Contract(Offers_json_1.default.abi, Superpro_1.default.address);
|
|
52
|
+
this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
56
53
|
this.logger = logger_1.default.child({ className: "Ballot", address: address });
|
|
57
54
|
}
|
|
58
55
|
/**
|
package/build/models/Offer.js
CHANGED
|
@@ -40,7 +40,7 @@ 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
|
-
var
|
|
43
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
44
44
|
var store_1 = __importDefault(require("../store"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var Offer_1 = require("../types/Offer");
|
|
@@ -52,7 +52,7 @@ var Offer = /** @class */ (function () {
|
|
|
52
52
|
(0, utils_1.checkIfInitialized)();
|
|
53
53
|
this.id = offerId;
|
|
54
54
|
if (!Offer.contract) {
|
|
55
|
-
Offer.contract = new store_1.default.web3.eth.Contract(
|
|
55
|
+
Offer.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
56
56
|
}
|
|
57
57
|
this.logger = logger_1.default.child({ className: "Offer", offerId: this.id });
|
|
58
58
|
}
|
|
@@ -62,7 +62,7 @@ var Offer = /** @class */ (function () {
|
|
|
62
62
|
Offer.prototype.checkInitOffer = function (transactionOptions) {
|
|
63
63
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
64
64
|
(0, utils_1.checkIfInitialized)();
|
|
65
|
-
return new transactionOptions.web3.eth.Contract(
|
|
65
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
/**
|
package/build/models/Order.js
CHANGED
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var Order_1 = require("../types/Order");
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
45
|
var store_1 = __importDefault(require("../store"));
|
|
46
46
|
var utils_1 = require("../utils");
|
|
47
47
|
var Origins_1 = require("../types/Origins");
|
|
@@ -53,7 +53,7 @@ var Order = /** @class */ (function () {
|
|
|
53
53
|
(0, utils_1.checkIfInitialized)();
|
|
54
54
|
this.id = orderId;
|
|
55
55
|
if (!Order.contract) {
|
|
56
|
-
Order.contract = new store_1.default.web3.eth.Contract(
|
|
56
|
+
Order.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
57
57
|
}
|
|
58
58
|
this.logger = logger_1.default.child({ className: "Order", orderId: this.id });
|
|
59
59
|
}
|
|
@@ -63,7 +63,7 @@ var Order = /** @class */ (function () {
|
|
|
63
63
|
Order.prototype.checkInitOrder = function (transactionOptions) {
|
|
64
64
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
65
65
|
(0, utils_1.checkIfInitialized)();
|
|
66
|
-
return new transactionOptions.web3.eth.Contract(
|
|
66
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
@@ -120,7 +120,7 @@ var Order = /** @class */ (function () {
|
|
|
120
120
|
case 0: return [4 /*yield*/, Order.contract.methods.getOrder(this.id).call()];
|
|
121
121
|
case 1:
|
|
122
122
|
orderInfoParams = _a.sent();
|
|
123
|
-
result = [
|
|
123
|
+
result = ["", "", orderInfoParams[2][1]];
|
|
124
124
|
if (orderInfoParams[1][4] === Order_1.OrderStatus.Error)
|
|
125
125
|
result[1] = orderInfoParams[2][0];
|
|
126
126
|
else
|
|
@@ -3,7 +3,6 @@ import { Origins } from "../types/Origins";
|
|
|
3
3
|
import { TransactionOptions } from "../types/Web3";
|
|
4
4
|
declare class Provider {
|
|
5
5
|
private static contractProviders;
|
|
6
|
-
private static contractProvidersOffers;
|
|
7
6
|
private logger;
|
|
8
7
|
providerInfo?: ProviderInfo;
|
|
9
8
|
violationRate?: number;
|
package/build/models/Provider.js
CHANGED
|
@@ -40,8 +40,7 @@ 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
|
-
var
|
|
44
|
-
var ProvidersOffers_json_1 = __importDefault(require("../contracts/ProvidersOffers.json"));
|
|
43
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
44
|
var store_1 = __importDefault(require("../store"));
|
|
46
45
|
var utils_1 = require("../utils");
|
|
47
46
|
var Provider_1 = require("../types/Provider");
|
|
@@ -52,9 +51,8 @@ var Provider = /** @class */ (function () {
|
|
|
52
51
|
function Provider(providerId) {
|
|
53
52
|
(0, utils_1.checkIfInitialized)();
|
|
54
53
|
this.providerId = providerId;
|
|
55
|
-
if (!Provider.contractProviders
|
|
56
|
-
Provider.contractProviders = new store_1.default.web3.eth.Contract(
|
|
57
|
-
Provider.contractProvidersOffers = new store_1.default.web3.eth.Contract(ProvidersOffers_json_1.default.abi, Superpro_1.default.address);
|
|
54
|
+
if (!Provider.contractProviders) {
|
|
55
|
+
Provider.contractProviders = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
58
56
|
}
|
|
59
57
|
this.logger = logger_1.default.child({
|
|
60
58
|
className: "Provider",
|
|
@@ -64,7 +62,7 @@ var Provider = /** @class */ (function () {
|
|
|
64
62
|
Provider.prototype.checkInitProvider = function (transactionOptions) {
|
|
65
63
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
66
64
|
(0, utils_1.checkIfInitialized)();
|
|
67
|
-
return new transactionOptions.web3.eth.Contract(
|
|
65
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
68
66
|
}
|
|
69
67
|
};
|
|
70
68
|
Provider.prototype.modify = function (providerInfo, transactionOptions) {
|
|
@@ -121,9 +119,7 @@ var Provider = /** @class */ (function () {
|
|
|
121
119
|
switch (_b.label) {
|
|
122
120
|
case 0:
|
|
123
121
|
_a = this;
|
|
124
|
-
return [4 /*yield*/, Provider.
|
|
125
|
-
.getProviderValueOffers(this.providerId)
|
|
126
|
-
.call()];
|
|
122
|
+
return [4 /*yield*/, Provider.contractProviders.methods.getProviderValueOffers(this.providerId).call()];
|
|
127
123
|
case 1:
|
|
128
124
|
_a.valueOffers = _b.sent();
|
|
129
125
|
return [2 /*return*/, this.valueOffers];
|
|
@@ -141,7 +137,7 @@ var Provider = /** @class */ (function () {
|
|
|
141
137
|
switch (_b.label) {
|
|
142
138
|
case 0:
|
|
143
139
|
_a = this;
|
|
144
|
-
return [4 /*yield*/, Provider.
|
|
140
|
+
return [4 /*yield*/, Provider.contractProviders.methods.getProviderTeeOffers(this.providerId).call()];
|
|
145
141
|
case 1:
|
|
146
142
|
_a.teeOffers = _b.sent();
|
|
147
143
|
return [2 /*return*/, this.teeOffers];
|
package/build/models/TCB.js
CHANGED
|
@@ -40,7 +40,7 @@ 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
|
-
var
|
|
43
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
44
44
|
var store_1 = __importDefault(require("../store"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var utils_2 = require("ethers/lib/utils");
|
|
@@ -55,12 +55,12 @@ var TCB = /** @class */ (function () {
|
|
|
55
55
|
tcbId: tcbId,
|
|
56
56
|
});
|
|
57
57
|
this.tcbId = tcbId;
|
|
58
|
-
this.contract = new store_1.default.web3.eth.Contract(
|
|
58
|
+
this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
59
59
|
}
|
|
60
60
|
TCB.prototype.checkInitTcb = function (transactionOptions) {
|
|
61
61
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
62
62
|
(0, utils_1.checkIfInitialized)();
|
|
63
|
-
return new transactionOptions.web3.eth.Contract(
|
|
63
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
64
64
|
}
|
|
65
65
|
return this.contract;
|
|
66
66
|
};
|
package/build/models/TeeOffer.js
CHANGED
|
@@ -40,7 +40,7 @@ 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
|
-
var
|
|
43
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
44
44
|
var store_1 = __importDefault(require("../store"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var TeeOffer_1 = require("../types/TeeOffer");
|
|
@@ -52,7 +52,7 @@ var TeeOffer = /** @class */ (function () {
|
|
|
52
52
|
(0, utils_1.checkIfInitialized)();
|
|
53
53
|
this.id = offerId;
|
|
54
54
|
if (!TeeOffer.contract) {
|
|
55
|
-
TeeOffer.contract = new store_1.default.web3.eth.Contract(
|
|
55
|
+
TeeOffer.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
56
56
|
}
|
|
57
57
|
this.logger = logger_1.default.child({ className: "TeeOffer" });
|
|
58
58
|
}
|
|
@@ -80,7 +80,7 @@ var TeeOffer = /** @class */ (function () {
|
|
|
80
80
|
TeeOffer.prototype.checkInitTeeOffer = function (transactionOptions) {
|
|
81
81
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
82
82
|
(0, utils_1.checkIfInitialized)();
|
|
83
|
-
return new transactionOptions.web3.eth.Contract(
|
|
83
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var Superpro_1 = __importDefault(require("./Superpro"));
|
|
47
47
|
var TxManager_1 = __importDefault(require("../utils/TxManager"));
|
|
@@ -61,13 +61,13 @@ var ActiveOffers = /** @class */ (function () {
|
|
|
61
61
|
ActiveOffers.checkInit = function (transactionOptions) {
|
|
62
62
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
63
63
|
(0, utils_1.checkIfInitialized)();
|
|
64
|
-
return new transactionOptions.web3.eth.Contract(
|
|
64
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
65
65
|
}
|
|
66
66
|
if (this.contract)
|
|
67
67
|
return this.contract;
|
|
68
68
|
(0, utils_1.checkIfInitialized)();
|
|
69
69
|
this.logger = logger_1.default.child({ className: "ActiveOffers" });
|
|
70
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
70
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
71
71
|
};
|
|
72
72
|
ActiveOffers.getListOfActiveOffersSize = function () {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var Superpro_1 = __importDefault(require("./Superpro"));
|
|
47
47
|
var ActiveOrders = /** @class */ (function () {
|
|
@@ -60,7 +60,7 @@ var ActiveOrders = /** @class */ (function () {
|
|
|
60
60
|
ActiveOrders.checkInit = function (transactionOptions) {
|
|
61
61
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
62
62
|
(0, utils_1.checkIfInitialized)();
|
|
63
|
-
return new transactionOptions.web3.eth.Contract(
|
|
63
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
64
64
|
}
|
|
65
65
|
if (this.contract)
|
|
66
66
|
return this.contract;
|
|
@@ -69,7 +69,7 @@ var ActiveOrders = /** @class */ (function () {
|
|
|
69
69
|
className: "ActiveOrder",
|
|
70
70
|
address: Superpro_1.default.address,
|
|
71
71
|
});
|
|
72
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
72
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
75
|
* Function returns amount of active orders
|
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
45
|
var TCB_1 = __importDefault(require("../models/TCB"));
|
|
46
46
|
var utils_1 = require("../utils");
|
|
47
47
|
var constants_1 = require("../constants");
|
|
@@ -56,13 +56,13 @@ var Consensus = /** @class */ (function () {
|
|
|
56
56
|
Consensus.checkInit = function (transactionOptions) {
|
|
57
57
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
58
58
|
(0, utils_1.checkIfInitialized)();
|
|
59
|
-
return new transactionOptions.web3.eth.Contract(
|
|
59
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, this.address);
|
|
60
60
|
}
|
|
61
61
|
if (this.contract)
|
|
62
62
|
return this.contract;
|
|
63
63
|
(0, utils_1.checkIfInitialized)();
|
|
64
64
|
this.logger = logger_1.default.child({ className: "Consensus" });
|
|
65
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
65
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
66
66
|
};
|
|
67
67
|
Consensus.initializeTcb = function (teeOfferId, transactionOptions) {
|
|
68
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -42,7 +42,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var utils_1 = require("../utils");
|
|
44
44
|
var Superpro_1 = __importDefault(require("./Superpro"));
|
|
45
|
-
var
|
|
45
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
46
46
|
var Marks = /** @class */ (function () {
|
|
47
47
|
function Marks() {
|
|
48
48
|
}
|
|
@@ -59,12 +59,12 @@ var Marks = /** @class */ (function () {
|
|
|
59
59
|
Marks.checkInit = function (transactionOptions) {
|
|
60
60
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
61
61
|
(0, utils_1.checkIfInitialized)();
|
|
62
|
-
return new transactionOptions.web3.eth.Contract(
|
|
62
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
63
63
|
}
|
|
64
64
|
if (this.contract)
|
|
65
65
|
return this.contract;
|
|
66
66
|
(0, utils_1.checkIfInitialized)();
|
|
67
|
-
return this.contract = new store_1.default.web3.eth.Contract(
|
|
67
|
+
return this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
68
68
|
};
|
|
69
69
|
Marks.getProviderMarks = function (providerAddress) {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var Offer_1 = require("../types/Offer");
|
|
47
47
|
var utils_2 = require("ethers/lib/utils");
|
|
@@ -63,13 +63,13 @@ var OffersFactory = /** @class */ (function () {
|
|
|
63
63
|
OffersFactory.checkInit = function (transactionOptions) {
|
|
64
64
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
65
65
|
(0, utils_1.checkIfInitialized)();
|
|
66
|
-
return new transactionOptions.web3.eth.Contract(
|
|
66
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
67
67
|
}
|
|
68
68
|
if (this.contract)
|
|
69
69
|
return this.contract;
|
|
70
70
|
(0, utils_1.checkIfInitialized)();
|
|
71
71
|
this.logger = logger_1.default.child({ className: "OffersFactory" });
|
|
72
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
72
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
75
|
* Function for fetching list of all offers ids
|
|
@@ -34,6 +34,15 @@ declare class OrdersFactory {
|
|
|
34
34
|
*/
|
|
35
35
|
static createOrder(orderInfo: OrderInfo, holdDeposit?: string, suspended?: boolean, externalId?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
36
36
|
static getOrder(consumer: string, externalId: string): Promise<OrderCreatedEvent>;
|
|
37
|
+
/**
|
|
38
|
+
* Function for create workflow
|
|
39
|
+
* @param parentOrderInfo - order info for new order
|
|
40
|
+
* @param subOrdersInfo - array of sub orders infos
|
|
41
|
+
* @param externalId - external id
|
|
42
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
43
|
+
* @returns {Promise<void>} - Does not return id of created order!
|
|
44
|
+
*/
|
|
45
|
+
static createWorkflow(perentOrderInfo: OrderInfo, subOrdersInfo: OrderInfo[], externalId?: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
37
46
|
/**
|
|
38
47
|
* Function for refilling order deposit
|
|
39
48
|
* @param orderId - order id
|
|
@@ -41,6 +50,12 @@ declare class OrdersFactory {
|
|
|
41
50
|
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
42
51
|
*/
|
|
43
52
|
static refillOrderDeposit(orderId: string, amount: string, transactionOptions?: TransactionOptions): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Function for adding event listeners on order created event in orders factory contract
|
|
55
|
+
* @param callback - function for processing created order
|
|
56
|
+
* @returns unsubscribe - unsubscribe function from event
|
|
57
|
+
*/
|
|
58
|
+
static onWorkflowCreated(callback: onWorkflowCreatedCallback): () => void;
|
|
44
59
|
/**
|
|
45
60
|
* Function for adding event listeners on order created event in orders factory contract
|
|
46
61
|
* @param callback - function for processing created order
|
|
@@ -134,4 +149,5 @@ export declare type onOrderProfitWithdrawnCallback = (orderId: string, tokenRece
|
|
|
134
149
|
export declare type onOrderDepositSpentChangedCallback = (orderId: string, consumer: string, spent: string) => void;
|
|
135
150
|
export declare type onOrderAwaitingPaymentChangedCallback = (orderId: string, consumer: string, awaitingPaymentFlag: boolean) => void;
|
|
136
151
|
export declare type onOrderEncryptedResultUpdatedCallback = (orderId: string, consumer: string, encryptedResult: string) => void;
|
|
152
|
+
export declare type onWorkflowCreatedCallback = (consumer: string, externalId: string, offerId: string, orderId: string) => void;
|
|
137
153
|
export default OrdersFactory;
|
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var Order_1 = require("../types/Order");
|
|
47
47
|
var utils_2 = require("ethers/lib/utils");
|
|
@@ -63,7 +63,7 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
63
63
|
OrdersFactory.checkInit = function (transactionOptions) {
|
|
64
64
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
65
65
|
(0, utils_1.checkIfInitialized)();
|
|
66
|
-
return new transactionOptions.web3.eth.Contract(
|
|
66
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
67
67
|
}
|
|
68
68
|
if (this.contract)
|
|
69
69
|
return this.contract;
|
|
@@ -72,7 +72,7 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
72
72
|
className: "OrdersFactory",
|
|
73
73
|
address: Superpro_1.default.address,
|
|
74
74
|
});
|
|
75
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
75
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
76
76
|
};
|
|
77
77
|
/**
|
|
78
78
|
* Function for fetching list of all orders ids
|
|
@@ -187,6 +187,34 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* Function for create workflow
|
|
192
|
+
* @param parentOrderInfo - order info for new order
|
|
193
|
+
* @param subOrdersInfo - array of sub orders infos
|
|
194
|
+
* @param externalId - external id
|
|
195
|
+
* @param transactionOptions - object what contains alternative action account or gas limit (optional)
|
|
196
|
+
* @returns {Promise<void>} - Does not return id of created order!
|
|
197
|
+
*/
|
|
198
|
+
OrdersFactory.createWorkflow = function (perentOrderInfo, subOrdersInfo, externalId, transactionOptions) {
|
|
199
|
+
if (externalId === void 0) { externalId = "default"; }
|
|
200
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
201
|
+
var contract, perentOrderInfoArgs, formattedExternalId, subOrdersInfoArgs;
|
|
202
|
+
return __generator(this, function (_a) {
|
|
203
|
+
switch (_a.label) {
|
|
204
|
+
case 0:
|
|
205
|
+
contract = this.checkInit(transactionOptions);
|
|
206
|
+
(0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
|
|
207
|
+
perentOrderInfoArgs = (0, utils_1.objectToTuple)(perentOrderInfo, Order_1.OrderInfoStructure);
|
|
208
|
+
formattedExternalId = (0, utils_2.formatBytes32String)(externalId);
|
|
209
|
+
subOrdersInfoArgs = (0, utils_1.objectToTuple)(subOrdersInfo, Order_1.OrderInfoStructureArray);
|
|
210
|
+
return [4 /*yield*/, TxManager_1.default.execute(contract.methods.createWorkflow, [perentOrderInfoArgs, formattedExternalId, subOrdersInfoArgs], transactionOptions)];
|
|
211
|
+
case 1:
|
|
212
|
+
_a.sent();
|
|
213
|
+
return [2 /*return*/];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
};
|
|
190
218
|
/**
|
|
191
219
|
* Function for refilling order deposit
|
|
192
220
|
* @param orderId - order id
|
|
@@ -209,6 +237,31 @@ var OrdersFactory = /** @class */ (function () {
|
|
|
209
237
|
});
|
|
210
238
|
});
|
|
211
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Function for adding event listeners on order created event in orders factory contract
|
|
242
|
+
* @param callback - function for processing created order
|
|
243
|
+
* @returns unsubscribe - unsubscribe function from event
|
|
244
|
+
*/
|
|
245
|
+
OrdersFactory.onWorkflowCreated = function (callback) {
|
|
246
|
+
var _this = this;
|
|
247
|
+
this.checkInit();
|
|
248
|
+
var logger = this.logger.child({ method: "onWorkflowCreated" });
|
|
249
|
+
var subscription = this.contract.events
|
|
250
|
+
.WorkflowCreated()
|
|
251
|
+
.on("data", function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
252
|
+
return __generator(this, function (_a) {
|
|
253
|
+
//consumer: string, externalId: string, offerId: string, orderId: string
|
|
254
|
+
callback(event.returnValues.consumer, (0, utils_2.parseBytes32String)(event.returnValues.externalId), event.returnValues.offerId, event.returnValues.orderId);
|
|
255
|
+
return [2 /*return*/];
|
|
256
|
+
});
|
|
257
|
+
}); })
|
|
258
|
+
.on("error", function (error, receipt) {
|
|
259
|
+
if (receipt)
|
|
260
|
+
return; // Used to avoid logging of transaction rejected
|
|
261
|
+
logger.warn(error);
|
|
262
|
+
});
|
|
263
|
+
return function () { return subscription.unsubscribe(); };
|
|
264
|
+
};
|
|
212
265
|
/**
|
|
213
266
|
* Function for adding event listeners on order created event in orders factory contract
|
|
214
267
|
* @param callback - function for processing created order
|
|
@@ -41,8 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
45
|
-
var ProvidersOffers_json_1 = __importDefault(require("../contracts/ProvidersOffers.json"));
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
46
45
|
var utils_1 = require("../utils");
|
|
47
46
|
var Provider_1 = require("../types/Provider");
|
|
48
47
|
var Superpro_1 = __importDefault(require("./Superpro"));
|
|
@@ -56,24 +55,24 @@ var ProviderRegistry = /** @class */ (function () {
|
|
|
56
55
|
ProviderRegistry.checkInitProviders = function (transactionOptions) {
|
|
57
56
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
58
57
|
(0, utils_1.checkIfInitialized)();
|
|
59
|
-
return new transactionOptions.web3.eth.Contract(
|
|
58
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
60
59
|
}
|
|
61
60
|
if (this.contract)
|
|
62
61
|
return this.contract;
|
|
63
62
|
(0, utils_1.checkIfInitialized)();
|
|
64
63
|
this.logger = logger_1.default.child({ className: "Providers" });
|
|
65
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
64
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
66
65
|
};
|
|
67
66
|
ProviderRegistry.checkInitProvidersOffers = function (transactionOptions) {
|
|
68
67
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
69
68
|
(0, utils_1.checkIfInitialized)();
|
|
70
|
-
return new transactionOptions.web3.eth.Contract(
|
|
69
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
71
70
|
}
|
|
72
71
|
if (this.contract)
|
|
73
72
|
return this.contract;
|
|
74
73
|
(0, utils_1.checkIfInitialized)();
|
|
75
74
|
this.logger = logger_1.default.child({ className: "ProvidersOffers" });
|
|
76
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
75
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
77
76
|
};
|
|
78
77
|
/**
|
|
79
78
|
* Function for fetching list of all providers addresses
|
|
@@ -40,7 +40,7 @@ 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
|
-
var
|
|
43
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
44
44
|
var store_1 = __importDefault(require("../store"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var Staking_1 = require("../types/Staking");
|
|
@@ -62,13 +62,13 @@ var Staking = /** @class */ (function () {
|
|
|
62
62
|
Staking.checkInit = function (transactionOptions) {
|
|
63
63
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
64
64
|
(0, utils_1.checkIfInitialized)();
|
|
65
|
-
return new transactionOptions.web3.eth.Contract(
|
|
65
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
66
66
|
}
|
|
67
67
|
if (this.contract)
|
|
68
68
|
return this.contract;
|
|
69
69
|
(0, utils_1.checkIfInitialized)();
|
|
70
70
|
this.logger = logger_1.default.child({ className: "Staking" });
|
|
71
|
-
return this.contract = new store_1.default.web3.eth.Contract(
|
|
71
|
+
return this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
74
|
* Fetching stake info by owner address from blockchain
|
|
@@ -40,7 +40,7 @@ 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
|
-
var
|
|
43
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
44
44
|
var store_1 = __importDefault(require("../store"));
|
|
45
45
|
var Superpro = /** @class */ (function () {
|
|
46
46
|
function Superpro() {
|
|
@@ -53,7 +53,7 @@ var Superpro = /** @class */ (function () {
|
|
|
53
53
|
return;
|
|
54
54
|
if (!this.address || !store_1.default.web3)
|
|
55
55
|
throw new Error("BlockchainConnector is not initialized, needs to run 'await BlockchainConnector.init(CONFIG)' first");
|
|
56
|
-
this.contract = new store_1.default.web3.eth.Contract(
|
|
56
|
+
this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, this.address);
|
|
57
57
|
this.logger = logger_1.default.child({ className: "Superpro", address: this.address });
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
@@ -40,7 +40,7 @@ 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
|
-
var
|
|
43
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
44
44
|
var store_1 = __importDefault(require("../store"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var TxManager_1 = __importDefault(require("../utils/TxManager"));
|
|
@@ -53,7 +53,7 @@ var SuperproToken = /** @class */ (function () {
|
|
|
53
53
|
SuperproToken.checkInit = function (transactionOptions) {
|
|
54
54
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
55
55
|
(0, utils_1.checkIfInitialized)();
|
|
56
|
-
return new transactionOptions.web3.eth.Contract(
|
|
56
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, this.address);
|
|
57
57
|
}
|
|
58
58
|
if (this.contract)
|
|
59
59
|
return this.contract;
|
|
@@ -62,7 +62,7 @@ var SuperproToken = /** @class */ (function () {
|
|
|
62
62
|
className: "SuperproToken",
|
|
63
63
|
address: this.address,
|
|
64
64
|
});
|
|
65
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
65
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, this.address));
|
|
66
66
|
};
|
|
67
67
|
/**
|
|
68
68
|
* Fetching balance of SuperProtocol tokens on address
|
|
@@ -41,7 +41,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = __importDefault(require("../store"));
|
|
43
43
|
var logger_1 = __importDefault(require("../logger"));
|
|
44
|
-
var
|
|
44
|
+
var app_json_1 = __importDefault(require("../contracts/app.json"));
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var utils_2 = require("ethers/lib/utils");
|
|
47
47
|
var TeeOffer_1 = require("../types/TeeOffer");
|
|
@@ -64,13 +64,13 @@ var TeeOffersFactory = /** @class */ (function () {
|
|
|
64
64
|
TeeOffersFactory.checkInit = function (transactionOptions) {
|
|
65
65
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
66
66
|
(0, utils_1.checkIfInitialized)();
|
|
67
|
-
return new transactionOptions.web3.eth.Contract(
|
|
67
|
+
return new transactionOptions.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address);
|
|
68
68
|
}
|
|
69
69
|
if (this.contract)
|
|
70
70
|
return this.contract;
|
|
71
71
|
(0, utils_1.checkIfInitialized)();
|
|
72
72
|
this.logger = logger_1.default.child({ className: "TeeOffersFactory" });
|
|
73
|
-
return (this.contract = new store_1.default.web3.eth.Contract(
|
|
73
|
+
return (this.contract = new store_1.default.web3.eth.Contract(app_json_1.default.abi, Superpro_1.default.address));
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
76
76
|
* Function for fetching list of all TEE offers addresses
|
|
@@ -40,7 +40,7 @@ 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
|
-
// import
|
|
43
|
+
// import appJSON from "../contracts/app.json";
|
|
44
44
|
var utils_1 = require("../utils");
|
|
45
45
|
var Voting = /** @class */ (function () {
|
|
46
46
|
function Voting() {
|
|
@@ -51,13 +51,13 @@ var Voting = /** @class */ (function () {
|
|
|
51
51
|
Voting.checkInit = function (transactionOptions) {
|
|
52
52
|
if (transactionOptions === null || transactionOptions === void 0 ? void 0 : transactionOptions.web3) {
|
|
53
53
|
(0, utils_1.checkIfInitialized)();
|
|
54
|
-
// return new transactionOptions.web3.eth.Contract(<AbiItem[]>
|
|
54
|
+
// return new transactionOptions.web3.eth.Contract(<AbiItem[]>appJSON.abi, this.address);
|
|
55
55
|
}
|
|
56
56
|
if (this.contract)
|
|
57
57
|
return this.contract;
|
|
58
58
|
(0, utils_1.checkIfInitialized)();
|
|
59
59
|
this.logger = logger_1.default.child({ className: "Voting" });
|
|
60
|
-
// return this.contract = new store.web3!.eth.Contract(<AbiItem[]>
|
|
60
|
+
// return this.contract = new store.web3!.eth.Contract(<AbiItem[]>appJSON.abi, this.address);
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* Creates ballot for replacing contract (updating address of contract in main config contract)
|
package/build/types/Events.d.ts
CHANGED