@ocap/resolver 1.13.60 → 1.13.64

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/index.js +17 -12
  2. package/package.json +11 -11
package/lib/index.js CHANGED
@@ -311,11 +311,6 @@ module.exports = class OCAPResolver {
311
311
  const tokens = await this.formatTokenMap({ [state.tokenAddress]: '0' });
312
312
  state.tokenInfo = tokens.find((x) => x.address === state.tokenAddress);
313
313
  state.foreignToken = state.tokenInfo.foreignToken;
314
-
315
- // TODO: deprecate following 3 fields
316
- state.erc20TokenAddress = state.foreignToken.contractAddress;
317
- state.foreignChainType = state.foreignToken.chainType;
318
- state.foreignChainId = state.foreignToken.chainName;
319
314
  }
320
315
 
321
316
  return state;
@@ -396,11 +391,6 @@ module.exports = class OCAPResolver {
396
391
  if (typeof state.decimal === 'undefined') {
397
392
  state.decimal = DEFAULT_TOKEN_DECIMAL;
398
393
  }
399
-
400
- // TODO: deprecate this
401
- if (state.foreignToken) {
402
- state.erc20ContractAddress = state.foreignToken.contractAddress;
403
- }
404
394
  }
405
395
 
406
396
  return state;
@@ -911,7 +901,14 @@ module.exports = class OCAPResolver {
911
901
  return [];
912
902
  }
913
903
 
914
- const rollupTxs = ['DepositTokenV2Tx', 'WithdrawTokenV2Tx', 'JoinRollupTx', 'LeaveRollupTx', 'CreateRollupBlockTx'];
904
+ const rollupTxs = [
905
+ 'DepositTokenV2Tx',
906
+ 'WithdrawTokenV2Tx',
907
+ 'JoinRollupTx',
908
+ 'LeaveRollupTx',
909
+ 'CreateRollupBlockTx',
910
+ 'ClaimBlockRewardTx',
911
+ ];
915
912
  const typeUrl = formatTxType(tx.tx.itxJson._type);
916
913
  const tokens = [];
917
914
 
@@ -934,13 +931,21 @@ module.exports = class OCAPResolver {
934
931
  'address'
935
932
  ).filter((x) => x.address)
936
933
  );
937
- } else if (['RevokeStakeTx'].includes(typeUrl)) {
934
+ } else if (typeUrl === 'RevokeStakeTx') {
938
935
  tokens.push(
939
936
  ...uniqBy(
940
937
  tx.tx.itxJson.outputs.reduce((acc, x) => acc.concat(x.tokens), []),
941
938
  'address'
942
939
  ).filter((x) => x.address)
943
940
  );
941
+ } else if (typeUrl === 'ClaimStakeTx') {
942
+ const revokeTx = await this.indexdb.tx.get(tx.tx.itxJson.evidence.hash);
943
+ tokens.push(
944
+ ...uniqBy(
945
+ revokeTx.tx.itxJson.outputs.reduce((acc, x) => acc.concat(x.tokens), []),
946
+ 'address'
947
+ ).filter((x) => x.address)
948
+ );
944
949
  } else if (rollupTxs.includes(typeUrl)) {
945
950
  const rollup = await this.indexdb.rollup.get(tx.tx.itxJson.rollup);
946
951
  tokens.push({ address: rollup.tokenAddress, value: '0' });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.13.60",
6
+ "version": "1.13.64",
7
7
  "description": "GraphQL resolver built upon ocap statedb and GQL layer",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -22,17 +22,17 @@
22
22
  "jest": "^27.3.1"
23
23
  },
24
24
  "dependencies": {
25
- "@arcblock/did": "1.13.60",
26
- "@arcblock/did-util": "1.13.60",
27
- "@ocap/config": "1.13.60",
28
- "@ocap/indexdb": "1.13.60",
29
- "@ocap/mcrypto": "1.13.60",
30
- "@ocap/message": "1.13.60",
31
- "@ocap/state": "1.13.60",
32
- "@ocap/tx-protocols": "1.13.60",
33
- "@ocap/util": "1.13.60",
25
+ "@arcblock/did": "1.13.64",
26
+ "@arcblock/did-util": "1.13.64",
27
+ "@ocap/config": "1.13.64",
28
+ "@ocap/indexdb": "1.13.64",
29
+ "@ocap/mcrypto": "1.13.64",
30
+ "@ocap/message": "1.13.64",
31
+ "@ocap/state": "1.13.64",
32
+ "@ocap/tx-protocols": "1.13.64",
33
+ "@ocap/util": "1.13.64",
34
34
  "debug": "^4.3.2",
35
35
  "lodash": "^4.17.21"
36
36
  },
37
- "gitHead": "2afb4dd279effb31bd28a2024789d50631819789"
37
+ "gitHead": "49c94d9fd5f12ec63c34ad609d041a92f68322a8"
38
38
  }