@super-protocol/sdk-js 0.10.7-beta.0 → 0.11.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.
@@ -4148,6 +4148,25 @@
4148
4148
  "stateMutability": "nonpayable",
4149
4149
  "type": "function"
4150
4150
  },
4151
+ {
4152
+ "inputs": [
4153
+ {
4154
+ "internalType": "uint256",
4155
+ "name": "orderId",
4156
+ "type": "uint256"
4157
+ }
4158
+ ],
4159
+ "name": "calculateOrderOutputReserve",
4160
+ "outputs": [
4161
+ {
4162
+ "internalType": "uint256",
4163
+ "name": "reservedForOutput",
4164
+ "type": "uint256"
4165
+ }
4166
+ ],
4167
+ "stateMutability": "view",
4168
+ "type": "function"
4169
+ },
4151
4170
  {
4152
4171
  "inputs": [
4153
4172
  {
@@ -8003,6 +8022,25 @@
8003
8022
  "stateMutability": "nonpayable",
8004
8023
  "type": "function"
8005
8024
  },
8025
+ {
8026
+ "inputs": [
8027
+ {
8028
+ "internalType": "uint256",
8029
+ "name": "orderId",
8030
+ "type": "uint256"
8031
+ }
8032
+ ],
8033
+ "name": "calculateOrderOutputReserve",
8034
+ "outputs": [
8035
+ {
8036
+ "internalType": "uint256",
8037
+ "name": "",
8038
+ "type": "uint256"
8039
+ }
8040
+ ],
8041
+ "stateMutability": "view",
8042
+ "type": "function"
8043
+ },
8006
8044
  {
8007
8045
  "inputs": [
8008
8046
  {
@@ -47,6 +47,10 @@ declare class Order {
47
47
  * Function for fetching hold deposits sum of the order and its suborders
48
48
  */
49
49
  calculateTotalHoldDeposit(): Promise<string>;
50
+ /**
51
+ * Function for fetching reserve for output order
52
+ */
53
+ calculateOrderOutputReserve(): Promise<string>;
50
54
  /**
51
55
  * Function for fetching spent deposits sum of the order and its suborders
52
56
  */
@@ -98,8 +102,7 @@ declare class Order {
98
102
  /**
99
103
  * Completes order
100
104
  */
101
- complete(status: OrderStatus, encryptedResult?: string, encryptedError?: string, // for SDK compatibility
102
- transactionOptions?: TransactionOptions): Promise<void>;
105
+ complete(status: OrderStatus, encryptedResult?: string, transactionOptions?: TransactionOptions): Promise<void>;
103
106
  /**
104
107
  * Function for creating sub orders for current order
105
108
  * @param subOrderInfo - order info for new subOrder
@@ -126,18 +126,13 @@ var Order = /** @class */ (function () {
126
126
  */
127
127
  Order.prototype.getOrderResult = function () {
128
128
  return __awaiter(this, void 0, void 0, function () {
129
- var orderInfoParams, result;
129
+ var orderInfoParams;
130
130
  return __generator(this, function (_a) {
131
131
  switch (_a.label) {
132
132
  case 0: return [4 /*yield*/, Order.contract.methods.getOrder(this.id).call()];
133
133
  case 1:
134
134
  orderInfoParams = _a.sent();
135
- result = ["", "", orderInfoParams[2][1]];
136
- if (orderInfoParams[1][4] === Order_1.OrderStatus.Error)
137
- result[1] = orderInfoParams[2][0];
138
- else
139
- result[0] = orderInfoParams[2][0];
140
- return [2 /*return*/, (this.orderResult = (0, utils_1.tupleToObject)(result, Order_1.OrderResultStructure))];
135
+ return [2 /*return*/, (this.orderResult = (0, utils_1.tupleToObject)([orderInfoParams[2][0], orderInfoParams[2][1]], Order_1.OrderResultStructure))];
141
136
  }
142
137
  });
143
138
  });
@@ -198,6 +193,16 @@ var Order = /** @class */ (function () {
198
193
  });
199
194
  });
200
195
  };
196
+ /**
197
+ * Function for fetching reserve for output order
198
+ */
199
+ Order.prototype.calculateOrderOutputReserve = function () {
200
+ return __awaiter(this, void 0, void 0, function () {
201
+ return __generator(this, function (_a) {
202
+ return [2 /*return*/, Order.contract.methods.calculateOrderOutputReserve(this.id).call()];
203
+ });
204
+ });
205
+ };
201
206
  /**
202
207
  * Function for fetching spent deposits sum of the order and its suborders
203
208
  */
@@ -394,17 +399,15 @@ var Order = /** @class */ (function () {
394
399
  /**
395
400
  * Completes order
396
401
  */
397
- Order.prototype.complete = function (status, encryptedResult, encryptedError, // for SDK compatibility
398
- transactionOptions) {
402
+ Order.prototype.complete = function (status, encryptedResult, transactionOptions) {
399
403
  if (encryptedResult === void 0) { encryptedResult = ""; }
400
- if (encryptedError === void 0) { encryptedError = ""; }
401
404
  return __awaiter(this, void 0, void 0, function () {
402
405
  return __generator(this, function (_a) {
403
406
  switch (_a.label) {
404
407
  case 0:
405
408
  transactionOptions !== null && transactionOptions !== void 0 ? transactionOptions : this.checkInitOrder(transactionOptions);
406
409
  (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
407
- return [4 /*yield*/, TxManager_1.default.execute(Order.contract.methods.completeOrder, [this.id, status, status === Order_1.OrderStatus.Error ? encryptedError : encryptedResult], transactionOptions)];
410
+ return [4 /*yield*/, TxManager_1.default.execute(Order.contract.methods.completeOrder, [this.id, status, encryptedResult], transactionOptions)];
408
411
  case 1:
409
412
  _a.sent();
410
413
  return [2 /*return*/];
@@ -61,12 +61,10 @@ export declare type ExtendedOrderInfo = OrderInfo & {
61
61
  };
62
62
  export declare const OrderResultStructure: {
63
63
  encryptedResult: StringConstructor;
64
- encryptedError: StringConstructor;
65
64
  orderPrice: StringConstructor;
66
65
  };
67
66
  export declare type OrderResult = {
68
67
  encryptedResult: string;
69
- encryptedError: string;
70
68
  orderPrice: string;
71
69
  };
72
70
  export declare type SubOrderParams = {
@@ -35,6 +35,5 @@ exports.OrderInfoStructureArray = [exports.OrderInfoStructure];
35
35
  // Order of keys and type conversion functions for this object in blockchain contract
36
36
  exports.OrderResultStructure = {
37
37
  encryptedResult: String,
38
- encryptedError: String,
39
38
  orderPrice: String,
40
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-protocol/sdk-js",
3
- "version": "0.10.7-beta.0",
3
+ "version": "0.11.0-beta.0",
4
4
  "main": "build/index.js",
5
5
  "license": "MIT",
6
6
  "files": [