@ocap/tx-protocols 1.17.14 → 1.17.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.
|
@@ -8,7 +8,7 @@ const { Runner, pipes } = require('@ocap/tx-pipeline');
|
|
|
8
8
|
const { account, asset, factory } = require('@ocap/state');
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line global-require
|
|
11
|
-
const debug = require('debug')(`${require('../../../package.json').name}:acquire-asset-
|
|
11
|
+
const debug = require('debug')(`${require('../../../package.json').name}:acquire-asset-v3`);
|
|
12
12
|
|
|
13
13
|
const { applyTokenUpdates } = require('../../util');
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ runner.use(pipes.VerifyMultiSig(0));
|
|
|
16
16
|
// Verify itx
|
|
17
17
|
const schema = Joi.object({
|
|
18
18
|
address: Joi.DID().role('ROLE_ASSET').required(),
|
|
19
|
-
moniker: Joi.string().min(2).max(255).
|
|
19
|
+
moniker: Joi.string().min(2).max(255).optional().allow(''),
|
|
20
20
|
data: Joi.any().optional(),
|
|
21
21
|
}).options({ stripUnknown: true, noDefaults: false });
|
|
22
22
|
runner.use((context, next) => {
|
|
@@ -25,6 +25,9 @@ runner.use((context, next) => {
|
|
|
25
25
|
if (error) {
|
|
26
26
|
return next(new Error('INVALID_TX', `Invalid itx: ${error.message}`));
|
|
27
27
|
}
|
|
28
|
+
if (!itx.moniker && !itx.data) {
|
|
29
|
+
return next(new Error('INVALID_TX', 'itx.moniker and itx.data can not be empty at the same time'));
|
|
30
|
+
}
|
|
28
31
|
|
|
29
32
|
context.newData = decodeAnySafe(itx.data);
|
|
30
33
|
return next();
|
|
@@ -87,7 +90,11 @@ runner.use(
|
|
|
87
90
|
// update asset state
|
|
88
91
|
statedb.asset.update(
|
|
89
92
|
itx.address,
|
|
90
|
-
asset.update(
|
|
93
|
+
asset.update(
|
|
94
|
+
assetState,
|
|
95
|
+
{ moniker: itx.moniker || assetState.moniker, data: newData || assetState.data },
|
|
96
|
+
context
|
|
97
|
+
),
|
|
91
98
|
context
|
|
92
99
|
),
|
|
93
100
|
]);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.
|
|
6
|
+
"version": "1.17.17",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@arcblock/did": "1.17.
|
|
25
|
-
"@arcblock/did-util": "1.17.
|
|
26
|
-
"@arcblock/validator": "1.17.
|
|
27
|
-
"@ocap/asset": "1.17.
|
|
28
|
-
"@ocap/mcrypto": "1.17.
|
|
29
|
-
"@ocap/merkle-tree": "1.17.
|
|
30
|
-
"@ocap/message": "1.17.
|
|
31
|
-
"@ocap/state": "1.17.
|
|
32
|
-
"@ocap/tx-pipeline": "1.17.
|
|
33
|
-
"@ocap/util": "1.17.
|
|
34
|
-
"@ocap/wallet": "1.17.
|
|
24
|
+
"@arcblock/did": "1.17.17",
|
|
25
|
+
"@arcblock/did-util": "1.17.17",
|
|
26
|
+
"@arcblock/validator": "1.17.17",
|
|
27
|
+
"@ocap/asset": "1.17.17",
|
|
28
|
+
"@ocap/mcrypto": "1.17.17",
|
|
29
|
+
"@ocap/merkle-tree": "1.17.17",
|
|
30
|
+
"@ocap/message": "1.17.17",
|
|
31
|
+
"@ocap/state": "1.17.17",
|
|
32
|
+
"@ocap/tx-pipeline": "1.17.17",
|
|
33
|
+
"@ocap/util": "1.17.17",
|
|
34
|
+
"@ocap/wallet": "1.17.17",
|
|
35
35
|
"debug": "^4.3.4",
|
|
36
36
|
"deep-diff": "^1.0.2",
|
|
37
37
|
"empty-value": "^1.0.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"jest": "^27.5.1",
|
|
47
47
|
"start-server-and-test": "^1.14.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "6f26710f90588ab9511f88640053ed925c5531f5"
|
|
50
50
|
}
|