@ocap/state 1.18.144 → 1.18.146

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.
Files changed (2) hide show
  1. package/lib/states/tx.js +16 -0
  2. package/package.json +9 -9
package/lib/states/tx.js CHANGED
@@ -313,6 +313,20 @@ const getRetrieveSwapReceipts = (tx) => [
313
313
  ].filter(Boolean),
314
314
  },
315
315
  ];
316
+ const getRevokeWithdrawReceipts = (tx, { withdrawTx }) => {
317
+ const receipt = withdrawTx.receipts?.find((x) => x.address === withdrawTx.tx.from);
318
+ const change = receipt?.changes?.find((x) => x.action === 'burn');
319
+
320
+ if (!change) return [];
321
+ if (tx.itxJson?.withdraw_tx_hash !== withdrawTx.hash) return [];
322
+
323
+ return [
324
+ {
325
+ address: withdrawTx.tx.from,
326
+ changes: [{ target: change.target, action: 'mint', value: new BN(change.value).abs().toString() }],
327
+ },
328
+ ];
329
+ };
316
330
 
317
331
  const mergeTxReceipts = (receipts) => {
318
332
  const merged = [];
@@ -480,6 +494,8 @@ const getTxReceipts = ({ tx, code }, ctx = {}) => {
480
494
  receipts = receipts.concat(getClaimStakeReceipts(tx, ctx, 'slash'));
481
495
  } else if (['ReturnStakeTx'].includes(typeUrl)) {
482
496
  receipts = receipts.concat(getClaimStakeReceipts(tx, ctx, 'stake'));
497
+ } else if (['RevokeWithdrawTx'].includes(typeUrl)) {
498
+ receipts = receipts.concat(getRevokeWithdrawReceipts(tx, ctx));
483
499
  }
484
500
 
485
501
  receipts = receipts.concat(getReceiptsFromContext(ctx));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.18.144",
6
+ "version": "1.18.146",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,13 +18,13 @@
18
18
  "coverage": "start-server-and-test start http://127.0.0.1:4001 test:ci"
19
19
  },
20
20
  "dependencies": {
21
- "@arcblock/did": "1.18.144",
22
- "@arcblock/validator": "1.18.144",
23
- "@ocap/contract": "1.18.144",
24
- "@ocap/mcrypto": "1.18.144",
25
- "@ocap/message": "1.18.144",
26
- "@ocap/util": "1.18.144",
27
- "@ocap/wallet": "1.18.144",
21
+ "@arcblock/did": "1.18.146",
22
+ "@arcblock/validator": "1.18.146",
23
+ "@ocap/contract": "1.18.146",
24
+ "@ocap/mcrypto": "1.18.146",
25
+ "@ocap/message": "1.18.146",
26
+ "@ocap/util": "1.18.146",
27
+ "@ocap/wallet": "1.18.146",
28
28
  "bloom-filters": "^1.3.9",
29
29
  "lodash": "^4.17.21"
30
30
  },
@@ -35,5 +35,5 @@
35
35
  "keywords": [],
36
36
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
37
37
  "license": "MIT",
38
- "gitHead": "541c65e8f06b20c6182d335a7f2ed6e09c1e289d"
38
+ "gitHead": "ea7f3d1ad606f277b89c390364f20bf295d9e4f9"
39
39
  }