@ocap/state 1.14.21 → 1.14.24

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.
@@ -3,6 +3,7 @@ const uniq = require('lodash/uniq');
3
3
  const flatten = require('lodash/flatten');
4
4
  const Error = require('@ocap/util/lib/error');
5
5
  const { isFromPublicKey } = require('@arcblock/did');
6
+ const { isEthereumDid, toChecksumAddress } = require('@arcblock/did/lib/type');
6
7
  const { toBase58, BN } = require('@ocap/util');
7
8
 
8
9
  const Joi = require('@arcblock/validator');
@@ -35,6 +36,8 @@ const create = (attrs, context) => {
35
36
  account.moniker = [account.address.slice(0, 6), account.address.slice(-5)].join('-');
36
37
  }
37
38
 
39
+ account.address = ensureChecksumAddress(account.address);
40
+
38
41
  return validate(account);
39
42
  };
40
43
 
@@ -85,5 +88,6 @@ const validate = (state) => {
85
88
  };
86
89
 
87
90
  const isMigrated = (state) => (state.migratedTo || []).length > 0;
91
+ const ensureChecksumAddress = (address) => (isEthereumDid(address) ? toChecksumAddress(address) : address);
88
92
 
89
- module.exports = { create, update, updateOrCreate, validate, isMigrated };
93
+ module.exports = { create, update, updateOrCreate, validate, isMigrated, ensureChecksumAddress };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.14.21",
6
+ "version": "1.14.24",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -16,12 +16,12 @@
16
16
  "coverage": "npm run test -- --coverage"
17
17
  },
18
18
  "dependencies": {
19
- "@arcblock/did": "1.14.21",
20
- "@arcblock/validator": "1.14.21",
21
- "@ocap/contract": "1.14.21",
22
- "@ocap/mcrypto": "1.14.21",
23
- "@ocap/message": "1.14.21",
24
- "@ocap/util": "1.14.21",
19
+ "@arcblock/did": "1.14.24",
20
+ "@arcblock/validator": "1.14.24",
21
+ "@ocap/contract": "1.14.24",
22
+ "@ocap/mcrypto": "1.14.24",
23
+ "@ocap/message": "1.14.24",
24
+ "@ocap/util": "1.14.24",
25
25
  "bloom-filters": "^1.3.1",
26
26
  "lodash": "^4.17.21"
27
27
  },
@@ -31,5 +31,5 @@
31
31
  "keywords": [],
32
32
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
33
33
  "license": "MIT",
34
- "gitHead": "729e2665612de2b8214cc33dc6f3b52655ca0833"
34
+ "gitHead": "83c2a3080ce30298e608d2325a534ff7e0c6f4a1"
35
35
  }