@ocap/asset 1.29.27 → 1.30.1

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.
package/esm/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { fromPublicKeyHash, toTypeInfo } from "@arcblock/did";
2
2
  import { toAssetAddress } from "@arcblock/did-util";
3
- import { schemas } from "@arcblock/validator";
3
+ import { schemas, vValidate } from "@arcblock/validator";
4
4
  import { proofTypes, stableStringify, verify } from "@arcblock/vc";
5
5
  import { compile, getQuota, validate } from "@ocap/contract";
6
6
  import { types } from "@ocap/mcrypto";
@@ -45,7 +45,7 @@ const isValidHook = (hook, quota, throwOnError = false) => {
45
45
  };
46
46
  const isValidFactory = (props) => {
47
47
  if (!props) throw new Error("Factory props should not be empty");
48
- const { value, error } = schemas.factorySchema.validate(props);
48
+ const { value, error } = vValidate(schemas.factorySchema, props);
49
49
  if (error) throw new Error(`Invalid factory: ${error.details.map((x) => x.message).join(", ")}`);
50
50
  if (["tokens", "assets"].every((x) => isEmpty(value.input[x])) && value.input.value <= 0) throw new Error("Factory input should contain at least one token or asset");
51
51
  if (uniqBy(value.input.tokens, "address").length !== value.input.tokens.length) throw new Error("Factory token input should not contains duplicate address");
package/lib/index.cjs CHANGED
@@ -56,7 +56,7 @@ const isValidHook = (hook, quota, throwOnError = false) => {
56
56
  };
57
57
  const isValidFactory = (props) => {
58
58
  if (!props) throw new Error("Factory props should not be empty");
59
- const { value, error } = _arcblock_validator.schemas.factorySchema.validate(props);
59
+ const { value, error } = (0, _arcblock_validator.vValidate)(_arcblock_validator.schemas.factorySchema, props);
60
60
  if (error) throw new Error(`Invalid factory: ${error.details.map((x) => x.message).join(", ")}`);
61
61
  if (["tokens", "assets"].every((x) => (0, lodash_isEmpty.default)(value.input[x])) && value.input.value <= 0) throw new Error("Factory input should contain at least one token or asset");
62
62
  if ((0, lodash_uniqBy.default)(value.input.tokens, "address").length !== value.input.tokens.length) throw new Error("Factory token input should not contains duplicate address");
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ocap/asset",
3
3
  "description": "Utility to work with asset and factory on ArcBlock blockchain",
4
4
  "type": "module",
5
- "version": "1.29.27",
5
+ "version": "1.30.1",
6
6
  "author": {
7
7
  "name": "wangshijun",
8
8
  "email": "shijun@arcblock.io",
@@ -19,19 +19,19 @@
19
19
  "wangshijun <shijun@arcblock.io> (https://github.com/wangshijun)"
20
20
  ],
21
21
  "dependencies": {
22
- "@arcblock/did": "1.29.27",
23
- "@arcblock/did-util": "1.29.27",
24
- "@arcblock/validator": "1.29.27",
25
- "@arcblock/vc": "1.29.27",
26
- "@ocap/contract": "1.29.27",
27
- "@ocap/mcrypto": "1.29.27",
28
- "@ocap/types": "1.29.27",
29
- "@ocap/util": "1.29.27",
30
- "@ocap/wallet": "1.29.27",
22
+ "@arcblock/did": "1.30.1",
23
+ "@arcblock/did-util": "1.30.1",
24
+ "@arcblock/validator": "1.30.1",
25
+ "@arcblock/vc": "1.30.1",
26
+ "@ocap/contract": "1.30.1",
27
+ "@ocap/mcrypto": "1.30.1",
28
+ "@ocap/types": "1.30.1",
29
+ "@ocap/util": "1.30.1",
30
+ "@ocap/wallet": "1.30.1",
31
31
  "debug": "^4.4.3",
32
32
  "flat": "^5.0.2",
33
33
  "is-absolute-url": "^3.0.3",
34
- "json-stable-stringify": "^1.0.1",
34
+ "fast-json-stable-stringify": "^2.1.0",
35
35
  "lodash": "^4.17.23",
36
36
  "mustache": "^4.2.0"
37
37
  },