@ocap/resolver 1.18.113 → 1.18.115

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 +5 -3
  2. package/package.json +12 -12
package/lib/index.js CHANGED
@@ -16,7 +16,7 @@ const { types } = require('@ocap/mcrypto');
16
16
  const { fromTypeUrl } = require('@ocap/message');
17
17
  const { toStakeAddress } = require('@arcblock/did-util');
18
18
  const { fromPublicKey, toTypeInfo, isValid: isValidDid } = require('@arcblock/did');
19
- const { BN, toBN, fromTokenToUnit } = require('@ocap/util');
19
+ const { BN, toBN, fromTokenToUnit, toAddress } = require('@ocap/util');
20
20
  const { DEFAULT_TOKEN_DECIMAL } = require('@ocap/util/lib/constant');
21
21
  const { createExecutor } = require('@ocap/tx-protocols');
22
22
  const { decodeAnySafe } = require('@ocap/tx-protocols/lib/util');
@@ -689,7 +689,8 @@ module.exports = class OCAPResolver {
689
689
 
690
690
  const entitiesByDid = ['account', 'asset', 'delegation', 'factory', 'token', 'stake', 'rollup'];
691
691
  if (isValidDid(args.keyword)) {
692
- const results = await Promise.all(entitiesByDid.map((type) => doSearch(type, args.keyword)));
692
+ const keyword = toAddress(args.keyword);
693
+ const results = await Promise.all(entitiesByDid.map((type) => doSearch(type, keyword)));
693
694
  return { results: results.filter(Boolean) };
694
695
  }
695
696
 
@@ -867,7 +868,8 @@ module.exports = class OCAPResolver {
867
868
  throw new CustomError('INVALID_REQUEST', `Missing required parameter to read ${table} state`);
868
869
  }
869
870
 
870
- const state = await this.runAsLambda((txn) => this.statedb[table].get(id, { txn, ...extraParams }));
871
+ const unified = isValidDid(id) ? toAddress(id) : id;
872
+ const state = await this.runAsLambda((txn) => this.statedb[table].get(unified, { txn, ...extraParams }));
871
873
  if (state) {
872
874
  if (dataKey) {
873
875
  set(state, dataKey, formatData(get(state, dataKey)));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.18.113",
6
+ "version": "1.18.115",
7
7
  "description": "GraphQL resolver built upon ocap statedb and GQL layer",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -22,18 +22,18 @@
22
22
  "jest": "^27.5.1"
23
23
  },
24
24
  "dependencies": {
25
- "@arcblock/did": "1.18.113",
26
- "@arcblock/did-util": "1.18.113",
27
- "@arcblock/validator": "1.18.113",
28
- "@ocap/config": "1.18.113",
29
- "@ocap/indexdb": "1.18.113",
30
- "@ocap/mcrypto": "1.18.113",
31
- "@ocap/message": "1.18.113",
32
- "@ocap/state": "1.18.113",
33
- "@ocap/tx-protocols": "1.18.113",
34
- "@ocap/util": "1.18.113",
25
+ "@arcblock/did": "1.18.115",
26
+ "@arcblock/did-util": "1.18.115",
27
+ "@arcblock/validator": "1.18.115",
28
+ "@ocap/config": "1.18.115",
29
+ "@ocap/indexdb": "1.18.115",
30
+ "@ocap/mcrypto": "1.18.115",
31
+ "@ocap/message": "1.18.115",
32
+ "@ocap/state": "1.18.115",
33
+ "@ocap/tx-protocols": "1.18.115",
34
+ "@ocap/util": "1.18.115",
35
35
  "debug": "^4.3.4",
36
36
  "lodash": "^4.17.21"
37
37
  },
38
- "gitHead": "658f9e820479ce9ee2280f524a4e471d58cde39f"
38
+ "gitHead": "aba7f4c4ec81a37b0977da9ea7b80c9504e8d4e1"
39
39
  }