@super-protocol/sdk-js 0.12.2-beta.1 → 0.12.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/models/Order.js +6 -1
- package/build/utils.js +2 -2
- package/package.json +1 -1
package/build/models/Order.js
CHANGED
|
@@ -104,8 +104,13 @@ var Order = /** @class */ (function () {
|
|
|
104
104
|
var orderInfoParams;
|
|
105
105
|
return __generator(this, function (_a) {
|
|
106
106
|
switch (_a.label) {
|
|
107
|
-
case 0: return [4 /*yield*/,
|
|
107
|
+
case 0: return [4 /*yield*/, this.isExist()];
|
|
108
108
|
case 1:
|
|
109
|
+
if (!(_a.sent())) {
|
|
110
|
+
throw Error("Order ".concat(this.id, " does not exist"));
|
|
111
|
+
}
|
|
112
|
+
return [4 /*yield*/, Order.contract.methods.getOrder(this.id).call()];
|
|
113
|
+
case 2:
|
|
109
114
|
orderInfoParams = _a.sent();
|
|
110
115
|
return [2 /*return*/, (this.orderInfo = (0, utils_1.tupleToObject)(orderInfoParams[1], Order_1.OrderInfoStructure))];
|
|
111
116
|
}
|
package/build/utils.js
CHANGED
|
@@ -192,7 +192,7 @@ function incrementMethodCall() {
|
|
|
192
192
|
exports.incrementMethodCall = incrementMethodCall;
|
|
193
193
|
var hexRegex = /^[0-9a-fA-F]+$/;
|
|
194
194
|
function packDevicId(hexedDeviceId) {
|
|
195
|
-
if (hexedDeviceId.length
|
|
195
|
+
if (hexedDeviceId.length !== 64) {
|
|
196
196
|
throw new Error("DeviceId must be equal 64 hex symbols");
|
|
197
197
|
}
|
|
198
198
|
if (!hexRegex.test(hexedDeviceId)) {
|
|
@@ -202,7 +202,7 @@ function packDevicId(hexedDeviceId) {
|
|
|
202
202
|
}
|
|
203
203
|
exports.packDevicId = packDevicId;
|
|
204
204
|
function unpackDeviceId(bytes32) {
|
|
205
|
-
if (bytes32.length
|
|
205
|
+
if (bytes32.length !== 66) {
|
|
206
206
|
throw new Error("DeviceId bytes must be equal 66 symbols");
|
|
207
207
|
}
|
|
208
208
|
return bytes32.slice(0, 64);
|