@ocap/resolver 1.27.1 → 1.27.3

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 +13 -1
  2. package/package.json +16 -16
package/lib/index.js CHANGED
@@ -888,6 +888,18 @@ module.exports = class OCAPResolver {
888
888
  const result = await tokenDB.create(this.tokenItx.address, state, { txn });
889
889
  tokenDB.emit('create', result, { txn });
890
890
  this.logger.debug('create token state', { address: result?.address });
891
+ } else {
892
+ // update token state if metadata are changed
893
+ const changedKeys = ['icon', 'website', 'metadata'];
894
+ const pickStateToken = pick(existToken, changedKeys);
895
+ const pickConfigToken = pick(this.tokenItx, changedKeys);
896
+
897
+ if (!isEqual(pickStateToken, pickConfigToken)) {
898
+ const state = tokenState.update(existToken, pickConfigToken, context);
899
+ const result = await tokenDB.update(this.tokenItx.address, state, { txn });
900
+ tokenDB.emit('update', result, { txn });
901
+ this.logger.info('update token state', { result });
902
+ }
891
903
  }
892
904
  },
893
905
  { commitMessage: 'initialize token' }
@@ -908,7 +920,7 @@ module.exports = class OCAPResolver {
908
920
  );
909
921
  const result = await accountDB.create(address, state, { txn });
910
922
  accountDB.emit('create', result, { txn });
911
- this.logger.debug('create account done', { address });
923
+ this.logger.info('create account done', { address });
912
924
  }
913
925
  } catch (err) {
914
926
  this.logger.error('Failed to initialize initial token holders', err);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.27.1",
6
+ "version": "1.27.3",
7
7
  "description": "GraphQL resolver built upon ocap statedb and GQL layer",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -14,9 +14,9 @@
14
14
  "license": "MIT",
15
15
  "devDependencies": {
16
16
  "jest": "^29.7.0",
17
- "@arcblock/jwt": "1.27.1",
18
- "@ocap/indexdb-memory": "1.27.1",
19
- "@ocap/statedb-memory": "1.27.1"
17
+ "@arcblock/jwt": "1.27.3",
18
+ "@ocap/indexdb-memory": "1.27.3",
19
+ "@ocap/statedb-memory": "1.27.3"
20
20
  },
21
21
  "dependencies": {
22
22
  "@arcblock/nft-display": "^3.1.54",
@@ -24,18 +24,18 @@
24
24
  "express": "^4.19.2",
25
25
  "lodash": "^4.17.21",
26
26
  "queue": "^6",
27
- "@arcblock/did": "1.27.1",
28
- "@arcblock/did-ext": "1.27.1",
29
- "@arcblock/did-util": "1.27.1",
30
- "@arcblock/validator": "1.27.1",
31
- "@ocap/config": "1.27.1",
32
- "@ocap/indexdb": "1.27.1",
33
- "@ocap/mcrypto": "1.27.1",
34
- "@ocap/message": "1.27.1",
35
- "@ocap/state": "1.27.1",
36
- "@ocap/tx-protocols": "1.27.1",
37
- "@ocap/util": "1.27.1",
38
- "@ocap/wallet": "1.27.1"
27
+ "@arcblock/did": "1.27.3",
28
+ "@arcblock/did-ext": "1.27.3",
29
+ "@arcblock/validator": "1.27.3",
30
+ "@arcblock/did-util": "1.27.3",
31
+ "@ocap/indexdb": "1.27.3",
32
+ "@ocap/mcrypto": "1.27.3",
33
+ "@ocap/message": "1.27.3",
34
+ "@ocap/state": "1.27.3",
35
+ "@ocap/tx-protocols": "1.27.3",
36
+ "@ocap/util": "1.27.3",
37
+ "@ocap/wallet": "1.27.3",
38
+ "@ocap/config": "1.27.3"
39
39
  },
40
40
  "scripts": {
41
41
  "lint": "eslint tests lib",