@ocap/state 1.19.15 → 1.19.17

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018-2019 ArcBlock
1
+ Copyright 2018-2025 ArcBlock
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -11,8 +11,8 @@ const { create: createStateContext, update: updateStateContext } = require('../c
11
11
 
12
12
  const schema = Joi.object({
13
13
  address: Joi.DID().prefix().required(),
14
- pk: Joi.string().allow(''),
15
- issuer: Joi.DID().prefix().allow(''),
14
+ pk: Joi.string().allow(null).allow(''),
15
+ issuer: Joi.DID().prefix().allow(null).allow(''),
16
16
  moniker: Joi.string()
17
17
  .regex(/^[a-zA-Z0-9][-a-zA-Z0-9_]{2,128}$/)
18
18
  .allow(''),
@@ -21,7 +21,7 @@ const schema = Joi.object({
21
21
  migratedTo: Joi.array().items(Joi.DID().prefix()).default([]),
22
22
  migratedFrom: Joi.array().items(Joi.DID().prefix()).default([]),
23
23
  context: schemas.context,
24
- data: Joi.any().optional(),
24
+ data: Joi.any().optional().allow(null),
25
25
  }).options({ stripUnknown: true, noDefaults: false });
26
26
 
27
27
  const create = (attrs, context) => {
@@ -92,4 +92,4 @@ const validate = (state) => {
92
92
  const isMigrated = (state) => (state.migratedTo || []).length > 0;
93
93
  const ensureChecksumAddress = (address) => (isEthereumDid(address) ? toChecksumAddress(address) : address);
94
94
 
95
- module.exports = { create, update, updateOrCreate, validate, isMigrated, ensureChecksumAddress };
95
+ module.exports = { create, update, updateOrCreate, validate, isMigrated, ensureChecksumAddress, schema };
@@ -7,7 +7,7 @@ const { create: createStateContext } = require('../contexts/state');
7
7
  const schema = Joi.object({
8
8
  hash: Joi.string().regex(patterns.txHash).required(),
9
9
  context: schemas.context,
10
- data: Joi.any().optional(),
10
+ data: Joi.any().optional().allow(null),
11
11
  }).options({ stripUnknown: true, noDefaults: false });
12
12
 
13
13
  const create = (attrs, context) => {
@@ -10,7 +10,7 @@ const schema = Joi.object({
10
10
  merkleRoot: Joi.string().regex(patterns.txHash).required(),
11
11
  previousHash: Joi.string().when('height', {
12
12
  is: 1,
13
- then: Joi.string().optional().allow(''),
13
+ then: Joi.string().optional().allow(null).allow(''),
14
14
  otherwise: Joi.string().regex(patterns.txHash).required(),
15
15
  }),
16
16
  txsHash: Joi.string().regex(patterns.txHash).required(),
@@ -21,16 +21,16 @@ const schema = Joi.object({
21
21
 
22
22
  rollup: Joi.DID().prefix().role('ROLE_ROLLUP').required(),
23
23
 
24
- mintedAmount: Joi.BN().min(0).optional().default('0'),
25
- burnedAmount: Joi.BN().min(0).optional().default('0'),
26
- rewardAmount: Joi.BN().min(0).optional().default('0'),
24
+ mintedAmount: Joi.BN().min(0).optional().allow(null).default('0'),
25
+ burnedAmount: Joi.BN().min(0).optional().allow(null).default('0'),
26
+ rewardAmount: Joi.BN().min(0).optional().allow(null).default('0'),
27
27
 
28
28
  minReward: Joi.BN().min(0).required(),
29
29
 
30
30
  governance: Joi.boolean().default(false),
31
31
 
32
32
  context: schemas.context,
33
- data: Joi.any().optional(),
33
+ data: Joi.any().optional().allow(null),
34
34
  }).options({ stripUnknown: true, noDefaults: false });
35
35
 
36
36
  const create = (attrs, context) => {
@@ -18,7 +18,7 @@ const schema = Joi.object({
18
18
  address: Joi.DID().prefix().role('ROLE_ROLLUP').required(),
19
19
  tokenAddress: Joi.DID().prefix().role('ROLE_TOKEN').required(),
20
20
  contractAddress: Joi.DID().prefix().wallet('ethereum').required(),
21
- vaultAddress: Joi.DID().wallet('ethereum').optional().allow(''), // FIXME: this should be enforced
21
+ vaultAddress: Joi.DID().wallet('ethereum').optional().allow(null).allow(''), // FIXME: this should be enforced
22
22
  migrateHistory: Joi.array().items(Joi.DID().prefix().wallet('ethereum')).default([]),
23
23
  vaultHistory: Joi.array().items(Joi.DID().prefix().wallet('ethereum')).default([]),
24
24
  paused: Joi.boolean().default(false),
@@ -61,15 +61,15 @@ const schema = Joi.object({
61
61
  maxWithdrawFee: Joi.BN().min(Joi.ref('minWithdrawFee')).required(),
62
62
 
63
63
  blockHeight: Joi.number().integer().min(0).required(),
64
- blockHash: Joi.string().regex(patterns.txHash).optional().allow(''),
65
- issuer: Joi.DID().prefix().optional(),
64
+ blockHash: Joi.string().regex(patterns.txHash).optional().allow(null).allow(''),
65
+ issuer: Joi.DID().prefix().optional().allow(null),
66
66
 
67
67
  leaveWaitingPeriod: Joi.number().integer().min(Joi.ref('minBlockInterval')).default(0),
68
68
  publishWaitingPeriod: Joi.number().integer().min(Joi.ref('minBlockInterval')).default(0),
69
69
  publishSlashRate: Joi.number().integer().min(1).max(10000).required(),
70
70
 
71
71
  context: schemas.context,
72
- data: Joi.any().optional(),
72
+ data: Joi.any().optional().allow(null),
73
73
  }).options({ stripUnknown: true, noDefaults: false });
74
74
 
75
75
  const create = (attrs, context) => {
@@ -18,8 +18,8 @@ const schema = Joi.object({
18
18
  revokedTokens: Joi.object({}).pattern(Joi.DID().prefix().role('ROLE_TOKEN'), Joi.BN().min(0)).default({}),
19
19
  revokedAssets: Joi.array().items(Joi.DID().prefix().role('ROLE_ASSET')).default([]),
20
20
  context: schemas.context,
21
- data: Joi.any().optional(),
22
- nonce: Joi.string().trim().min(1).max(256).allow('').optional(),
21
+ data: Joi.any().optional().allow(null),
22
+ nonce: Joi.string().trim().min(1).max(256).allow('').allow(null).optional(),
23
23
  }).options({ stripUnknown: true, noDefaults: false });
24
24
 
25
25
  const create = (attrs, context) => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.19.15",
6
+ "version": "1.19.17",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,13 +18,13 @@
18
18
  "coverage": "start-server-and-test start http://127.0.0.1:4001 test:ci"
19
19
  },
20
20
  "dependencies": {
21
- "@arcblock/did": "1.19.15",
22
- "@arcblock/validator": "1.19.15",
23
- "@ocap/contract": "1.19.15",
24
- "@ocap/mcrypto": "1.19.15",
25
- "@ocap/message": "1.19.15",
26
- "@ocap/util": "1.19.15",
27
- "@ocap/wallet": "1.19.15",
21
+ "@arcblock/did": "1.19.17",
22
+ "@arcblock/validator": "1.19.17",
23
+ "@ocap/contract": "1.19.17",
24
+ "@ocap/mcrypto": "1.19.17",
25
+ "@ocap/message": "1.19.17",
26
+ "@ocap/util": "1.19.17",
27
+ "@ocap/wallet": "1.19.17",
28
28
  "bloom-filters": "^1.3.9",
29
29
  "lodash": "^4.17.21"
30
30
  },
@@ -35,5 +35,5 @@
35
35
  "keywords": [],
36
36
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
37
37
  "license": "MIT",
38
- "gitHead": "ab6cd19ab8633c815ab0235b7ab5d80fc071de15"
38
+ "gitHead": "d25d8b52053b0e3254a28c3b44ea5e447ce1c08a"
39
39
  }