@super-protocol/sdk-js 0.13.3 → 0.13.4

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.
@@ -2224,6 +2224,29 @@
2224
2224
  "stateMutability": "nonpayable",
2225
2225
  "type": "function"
2226
2226
  },
2227
+ {
2228
+ "inputs": [
2229
+ {
2230
+ "internalType": "address",
2231
+ "name": "funder",
2232
+ "type": "address"
2233
+ },
2234
+ {
2235
+ "internalType": "address",
2236
+ "name": "beneficiary",
2237
+ "type": "address"
2238
+ },
2239
+ {
2240
+ "internalType": "uint256",
2241
+ "name": "amount",
2242
+ "type": "uint256"
2243
+ }
2244
+ ],
2245
+ "name": "replenishForByApp",
2246
+ "outputs": [],
2247
+ "stateMutability": "nonpayable",
2248
+ "type": "function"
2249
+ },
2227
2250
  {
2228
2251
  "inputs": [
2229
2252
  {
@@ -4730,6 +4753,30 @@
4730
4753
  "name": "OrderProfitUnlocked",
4731
4754
  "type": "event"
4732
4755
  },
4756
+ {
4757
+ "inputs": [
4758
+ {
4759
+ "internalType": "uint256",
4760
+ "name": "orderId",
4761
+ "type": "uint256"
4762
+ }
4763
+ ],
4764
+ "name": "isOrderProfitAvailable",
4765
+ "outputs": [
4766
+ {
4767
+ "internalType": "bool",
4768
+ "name": "available",
4769
+ "type": "bool"
4770
+ },
4771
+ {
4772
+ "internalType": "uint256",
4773
+ "name": "profit",
4774
+ "type": "uint256"
4775
+ }
4776
+ ],
4777
+ "stateMutability": "view",
4778
+ "type": "function"
4779
+ },
4733
4780
  {
4734
4781
  "inputs": [
4735
4782
  {
@@ -6047,6 +6094,24 @@
6047
6094
  "stateMutability": "nonpayable",
6048
6095
  "type": "function"
6049
6096
  },
6097
+ {
6098
+ "inputs": [
6099
+ {
6100
+ "internalType": "address",
6101
+ "name": "providerAuth",
6102
+ "type": "address"
6103
+ },
6104
+ {
6105
+ "internalType": "uint256",
6106
+ "name": "amount",
6107
+ "type": "uint256"
6108
+ }
6109
+ ],
6110
+ "name": "refillProviderSecurityDepoFor",
6111
+ "outputs": [],
6112
+ "stateMutability": "nonpayable",
6113
+ "type": "function"
6114
+ },
6050
6115
  {
6051
6116
  "inputs": [
6052
6117
  {
@@ -9530,6 +9595,29 @@
9530
9595
  "stateMutability": "nonpayable",
9531
9596
  "type": "function"
9532
9597
  },
9598
+ {
9599
+ "inputs": [
9600
+ {
9601
+ "internalType": "address",
9602
+ "name": "funder",
9603
+ "type": "address"
9604
+ },
9605
+ {
9606
+ "internalType": "address",
9607
+ "name": "depositOwner",
9608
+ "type": "address"
9609
+ },
9610
+ {
9611
+ "internalType": "uint256",
9612
+ "name": "amount",
9613
+ "type": "uint256"
9614
+ }
9615
+ ],
9616
+ "name": "replenishForByApp",
9617
+ "outputs": [],
9618
+ "stateMutability": "nonpayable",
9619
+ "type": "function"
9620
+ },
9533
9621
  {
9534
9622
  "inputs": [
9535
9623
  {
@@ -26,6 +26,10 @@ declare class Order {
26
26
  * Check if order is in `processing` state
27
27
  */
28
28
  isOrderProcessing(): Promise<boolean>;
29
+ /**
30
+ * Function for fetching avaliable for unlock order profit.
31
+ */
32
+ isOrderProfitAvailable(): Promise<string>;
29
33
  /**
30
34
  * Function for fetching order price
31
35
  */
@@ -110,6 +110,22 @@ var Order = /** @class */ (function () {
110
110
  });
111
111
  });
112
112
  };
113
+ /**
114
+ * Function for fetching avaliable for unlock order profit.
115
+ */
116
+ Order.prototype.isOrderProfitAvailable = function () {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ var _a, profit;
119
+ return __generator(this, function (_b) {
120
+ switch (_b.label) {
121
+ case 0: return [4 /*yield*/, Order.contract.methods.isOrderProfitAvailable(this.id).call()];
122
+ case 1:
123
+ _a = _b.sent(), profit = _a[1];
124
+ return [2 /*return*/, profit];
125
+ }
126
+ });
127
+ });
128
+ };
113
129
  /**
114
130
  * Function for fetching order price
115
131
  */
@@ -1,5 +1,5 @@
1
1
  import { TransactionOptions } from "../types/Web3";
2
- import { TcbData, TcbStatus, TcbPublicData, TcbVerifiedStatus } from "../types/Consensus";
2
+ import { TcbData, TcbPublicData, TcbVerifiedStatus } from "../types/Consensus";
3
3
  declare class TCB {
4
4
  tcbId: string;
5
5
  private contract;
@@ -30,14 +30,14 @@ declare class TCB {
30
30
  * @param tcbId - TEE Offer's completed and valid TCB contract
31
31
  * @param transactionOptions - object what contains alternative action account or gas limit (optional)
32
32
  */
33
- claimRewards(tcbId: string, transactionOptions?: TransactionOptions): Promise<void>;
33
+ claimRewards(transactionOptions?: TransactionOptions): Promise<void>;
34
34
  /**
35
35
  * Function unlock previously locked TCB rewards (by claimRewards)
36
36
  * @param tcbId - TCB contract address
37
37
  * @param unlockAmount - amount of tokens to unlock, max available amount = TeeOffer.getLockInfo(tcbAddress)
38
38
  * @param transactionOptions - object what contains alternative action account or gas limit (optional)
39
39
  */
40
- unlockRewards(tcbId: string, unlockAmount: number, transactionOptions?: TransactionOptions): Promise<void>;
40
+ unlockRewards(transactionOptions?: TransactionOptions): Promise<void>;
41
41
  /**
42
42
  * Function for fetching all TCB data
43
43
  */
@@ -50,8 +50,8 @@ declare class TCB {
50
50
  marks: TcbVerifiedStatus[];
51
51
  }>;
52
52
  /**
53
- * Function for fetching TCB status
53
+ * Function for fetching TCB avaliable reward
54
54
  */
55
- getStatus(): Promise<TcbStatus>;
55
+ getRewardAmount(): Promise<string>;
56
56
  }
57
57
  export default TCB;
@@ -148,7 +148,7 @@ var TCB = /** @class */ (function () {
148
148
  * @param tcbId - TEE Offer's completed and valid TCB contract
149
149
  * @param transactionOptions - object what contains alternative action account or gas limit (optional)
150
150
  */
151
- TCB.prototype.claimRewards = function (tcbId, transactionOptions) {
151
+ TCB.prototype.claimRewards = function (transactionOptions) {
152
152
  return __awaiter(this, void 0, void 0, function () {
153
153
  var contract;
154
154
  return __generator(this, function (_a) {
@@ -156,7 +156,7 @@ var TCB = /** @class */ (function () {
156
156
  case 0:
157
157
  contract = this.checkInitTcb(transactionOptions);
158
158
  (0, utils_1.checkIfActionAccountInitialized)();
159
- return [4 /*yield*/, TxManager_1.default.execute(contract.methods.claimRewards, [tcbId], transactionOptions)];
159
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.claimRewards, [this.tcbId], transactionOptions)];
160
160
  case 1:
161
161
  _a.sent();
162
162
  return [2 /*return*/];
@@ -170,7 +170,7 @@ var TCB = /** @class */ (function () {
170
170
  * @param unlockAmount - amount of tokens to unlock, max available amount = TeeOffer.getLockInfo(tcbAddress)
171
171
  * @param transactionOptions - object what contains alternative action account or gas limit (optional)
172
172
  */
173
- TCB.prototype.unlockRewards = function (tcbId, unlockAmount, transactionOptions) {
173
+ TCB.prototype.unlockRewards = function (transactionOptions) {
174
174
  return __awaiter(this, void 0, void 0, function () {
175
175
  var contract;
176
176
  return __generator(this, function (_a) {
@@ -178,7 +178,7 @@ var TCB = /** @class */ (function () {
178
178
  case 0:
179
179
  contract = this.checkInitTcb(transactionOptions);
180
180
  (0, utils_1.checkIfActionAccountInitialized)();
181
- return [4 /*yield*/, TxManager_1.default.execute(contract.methods.unlockRewards, [tcbId, unlockAmount], transactionOptions)];
181
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.unlockTcbReward, [this.tcbId], transactionOptions)];
182
182
  case 1:
183
183
  _a.sent();
184
184
  return [2 /*return*/];
@@ -224,12 +224,12 @@ var TCB = /** @class */ (function () {
224
224
  });
225
225
  };
226
226
  /**
227
- * Function for fetching TCB status
227
+ * Function for fetching TCB avaliable reward
228
228
  */
229
- TCB.prototype.getStatus = function () {
229
+ TCB.prototype.getRewardAmount = function () {
230
230
  return __awaiter(this, void 0, void 0, function () {
231
231
  return __generator(this, function (_a) {
232
- return [2 /*return*/, this.contract.methods.getTcbStatus().call()];
232
+ return [2 /*return*/, this.contract.methods.getTcbReward(this.tcbId).call()];
233
233
  });
234
234
  });
235
235
  };
@@ -17,6 +17,14 @@ declare class ProviderRegistry {
17
17
  */
18
18
  static getSecurityDeposit(providerAuthority: string): Promise<string>;
19
19
  static isProviderRegistered(providerAuthority: string): Promise<boolean>;
20
+ /**
21
+ * Refills security provider deposit
22
+ * Call this function with provider authority account (in transactionOptions)
23
+ * @param amount - amount of additional tokens
24
+ * @param recipient - target provider authority address
25
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
26
+ */
27
+ static refillSecurityDepositFor(amount: string, recipient: string, transactionOptions?: TransactionOptions): Promise<void>;
20
28
  /**
21
29
  * Reg new provider
22
30
  * @param providerInfo - data of new provider
@@ -106,6 +106,29 @@ var ProviderRegistry = /** @class */ (function () {
106
106
  });
107
107
  });
108
108
  };
109
+ /**
110
+ * Refills security provider deposit
111
+ * Call this function with provider authority account (in transactionOptions)
112
+ * @param amount - amount of additional tokens
113
+ * @param recipient - target provider authority address
114
+ * @param transactionOptions - object what contains alternative action account or gas limit (optional)
115
+ */
116
+ ProviderRegistry.refillSecurityDepositFor = function (amount, recipient, transactionOptions) {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ var contract;
119
+ return __generator(this, function (_a) {
120
+ switch (_a.label) {
121
+ case 0:
122
+ contract = BlockchainConnector_1.default.getInstance().getContract(transactionOptions);
123
+ (0, utils_1.checkIfActionAccountInitialized)(transactionOptions);
124
+ return [4 /*yield*/, TxManager_1.default.execute(contract.methods.refillProviderSecurityDepo, [amount, recipient], transactionOptions)];
125
+ case 1:
126
+ _a.sent();
127
+ return [2 /*return*/];
128
+ }
129
+ });
130
+ });
131
+ };
109
132
  /**
110
133
  * Reg new provider
111
134
  * @param providerInfo - data of new provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-protocol/sdk-js",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "main": "build/index.js",
5
5
  "license": "MIT",
6
6
  "files": [