@super-protocol/sdk-js 0.13.4 → 0.13.5
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.
|
@@ -12,5 +12,10 @@ declare class ActiveOrders {
|
|
|
12
12
|
* @returns {Promise<string[]>}
|
|
13
13
|
*/
|
|
14
14
|
static getListOfActiveOrdersRange(begin?: BigNumber | number, end?: BigNumber | number): Promise<string[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Function returns ids of active orders by offers
|
|
17
|
+
* @returns {Promise<string[]>}
|
|
18
|
+
*/
|
|
19
|
+
static getActiveOrdersRangeByOffers(offerIds: string[], begin?: BigNumber | number, end?: BigNumber | number): Promise<string[]>;
|
|
15
20
|
}
|
|
16
21
|
export default ActiveOrders;
|
|
@@ -104,6 +104,44 @@ var ActiveOrders = /** @class */ (function () {
|
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Function returns ids of active orders by offers
|
|
109
|
+
* @returns {Promise<string[]>}
|
|
110
|
+
*/
|
|
111
|
+
ActiveOrders.getActiveOrdersRangeByOffers = function (offerIds, begin, end) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
+
var contract, response, _a, _b, _c, _i, offerId, _d, _e;
|
|
114
|
+
return __generator(this, function (_f) {
|
|
115
|
+
switch (_f.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
contract = BlockchainConnector_1.default.getInstance().getContract();
|
|
118
|
+
response = [];
|
|
119
|
+
begin = begin !== null && begin !== void 0 ? begin : 0;
|
|
120
|
+
end = end !== null && end !== void 0 ? end : 999; // max active orders for one offer
|
|
121
|
+
_a = offerIds;
|
|
122
|
+
_b = [];
|
|
123
|
+
for (_c in _a)
|
|
124
|
+
_b.push(_c);
|
|
125
|
+
_i = 0;
|
|
126
|
+
_f.label = 1;
|
|
127
|
+
case 1:
|
|
128
|
+
if (!(_i < _b.length)) return [3 /*break*/, 4];
|
|
129
|
+
_c = _b[_i];
|
|
130
|
+
if (!(_c in _a)) return [3 /*break*/, 3];
|
|
131
|
+
offerId = _c;
|
|
132
|
+
_e = (_d = response).push;
|
|
133
|
+
return [4 /*yield*/, contract.methods.getOfferActiveOrdersRange(offerId, begin, end)];
|
|
134
|
+
case 2:
|
|
135
|
+
_e.apply(_d, [_f.sent()]);
|
|
136
|
+
_f.label = 3;
|
|
137
|
+
case 3:
|
|
138
|
+
_i++;
|
|
139
|
+
return [3 /*break*/, 1];
|
|
140
|
+
case 4: return [2 /*return*/, response];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
};
|
|
107
145
|
ActiveOrders.logger = logger_1.default.child({ className: "ActiveOrders" });
|
|
108
146
|
__decorate([
|
|
109
147
|
(0, utils_1.incrementMethodCall)()
|
|
@@ -111,6 +149,9 @@ var ActiveOrders = /** @class */ (function () {
|
|
|
111
149
|
__decorate([
|
|
112
150
|
(0, utils_1.incrementMethodCall)()
|
|
113
151
|
], ActiveOrders, "getListOfActiveOrdersRange", null);
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, utils_1.incrementMethodCall)()
|
|
154
|
+
], ActiveOrders, "getActiveOrdersRangeByOffers", null);
|
|
114
155
|
return ActiveOrders;
|
|
115
156
|
}());
|
|
116
157
|
exports.default = ActiveOrders;
|