@ocap/tx-protocols 1.14.6 → 1.14.7
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.
|
@@ -24,6 +24,19 @@ const runner = new Runner();
|
|
|
24
24
|
runner.use(pipes.VerifyMultiSig(0));
|
|
25
25
|
runner.use(verifyAcquireParams('acquire-v2'));
|
|
26
26
|
|
|
27
|
+
// ensure asset not exist
|
|
28
|
+
runner.use(pipes.ExtractState({ from: 'itx.address', to: 'duplicateAsset', status: 'OK', table: 'asset' }));
|
|
29
|
+
runner.use(
|
|
30
|
+
pipes.VerifyInfo([
|
|
31
|
+
{
|
|
32
|
+
error: 'FORBIDDEN',
|
|
33
|
+
message: 'Asset with same address already exists',
|
|
34
|
+
fn: ({ duplicateAsset }) => !duplicateAsset,
|
|
35
|
+
persist: true,
|
|
36
|
+
},
|
|
37
|
+
])
|
|
38
|
+
);
|
|
39
|
+
|
|
27
40
|
runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'INVALID_SENDER_STATE', table: 'account' })); // prettier-ignore
|
|
28
41
|
runner.use(pipes.VerifyAccountMigration({ senderKey: 'senderState' }));
|
|
29
42
|
|
|
@@ -27,6 +27,19 @@ const runner = new Runner();
|
|
|
27
27
|
|
|
28
28
|
// 1. extract & verify itx input
|
|
29
29
|
runner.use(verifyAcquireParams('acquire-v3'));
|
|
30
|
+
|
|
31
|
+
// ensure asset not exist
|
|
32
|
+
runner.use(pipes.ExtractState({ from: 'itx.address', to: 'duplicateAsset', status: 'OK', table: 'asset' }));
|
|
33
|
+
runner.use(
|
|
34
|
+
pipes.VerifyInfo([
|
|
35
|
+
{
|
|
36
|
+
error: 'FORBIDDEN',
|
|
37
|
+
message: 'Asset with same address already exists',
|
|
38
|
+
fn: ({ duplicateAsset }) => !duplicateAsset,
|
|
39
|
+
persist: true,
|
|
40
|
+
},
|
|
41
|
+
])
|
|
42
|
+
);
|
|
30
43
|
runner.use(
|
|
31
44
|
pipes.VerifyTxInput({
|
|
32
45
|
fieldKey: 'itx.inputs',
|
|
@@ -16,6 +16,19 @@ const runner = new Runner();
|
|
|
16
16
|
runner.use(pipes.VerifyMultiSig(0));
|
|
17
17
|
runner.use(verifyAcquireParams('mint'));
|
|
18
18
|
|
|
19
|
+
// ensure asset not exist
|
|
20
|
+
runner.use(pipes.ExtractState({ from: 'itx.address', to: 'duplicateAsset', status: 'OK', table: 'asset' }));
|
|
21
|
+
runner.use(
|
|
22
|
+
pipes.VerifyInfo([
|
|
23
|
+
{
|
|
24
|
+
error: 'FORBIDDEN',
|
|
25
|
+
message: 'Asset with same address already exists',
|
|
26
|
+
fn: ({ duplicateAsset }) => !duplicateAsset,
|
|
27
|
+
persist: true,
|
|
28
|
+
},
|
|
29
|
+
])
|
|
30
|
+
);
|
|
31
|
+
|
|
19
32
|
// Ensure sender exist
|
|
20
33
|
runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'INVALID_SENDER_STATE', table: 'account' })); // prettier-ignore
|
|
21
34
|
runner.use(pipes.VerifyAccountMigration({ senderKey: 'senderState' }));
|
|
@@ -10,8 +10,14 @@ module.exports = (context, next) => {
|
|
|
10
10
|
acc[x.name] = x.value;
|
|
11
11
|
return acc;
|
|
12
12
|
}, {});
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const missingVariables = variables.filter((x) => x.required && !factoryInputs[x.name]);
|
|
14
|
+
if (missingVariables.length) {
|
|
15
|
+
return next(
|
|
16
|
+
new Error(
|
|
17
|
+
'INVALID_FACTORY_INPUT',
|
|
18
|
+
`Invalid itx.variables: missing required input variable: ${missingVariables.map((x) => x.name).join(', ')}`
|
|
19
|
+
)
|
|
20
|
+
);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
context.factoryInputs = factoryInputs;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.14.
|
|
6
|
+
"version": "1.14.7",
|
|
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.14.
|
|
25
|
-
"@arcblock/did-util": "1.14.
|
|
26
|
-
"@ocap/asset": "1.14.
|
|
27
|
-
"@ocap/mcrypto": "1.14.
|
|
28
|
-
"@ocap/merkle-tree": "1.14.
|
|
29
|
-
"@ocap/message": "1.14.
|
|
30
|
-
"@ocap/state": "1.14.
|
|
31
|
-
"@ocap/tx-pipeline": "1.14.
|
|
32
|
-
"@ocap/util": "1.14.
|
|
33
|
-
"@ocap/validator": "1.14.
|
|
34
|
-
"@ocap/wallet": "1.14.
|
|
24
|
+
"@arcblock/did": "1.14.7",
|
|
25
|
+
"@arcblock/did-util": "1.14.7",
|
|
26
|
+
"@ocap/asset": "1.14.7",
|
|
27
|
+
"@ocap/mcrypto": "1.14.7",
|
|
28
|
+
"@ocap/merkle-tree": "1.14.7",
|
|
29
|
+
"@ocap/message": "1.14.7",
|
|
30
|
+
"@ocap/state": "1.14.7",
|
|
31
|
+
"@ocap/tx-pipeline": "1.14.7",
|
|
32
|
+
"@ocap/util": "1.14.7",
|
|
33
|
+
"@ocap/validator": "1.14.7",
|
|
34
|
+
"@ocap/wallet": "1.14.7",
|
|
35
35
|
"debug": "^4.3.2",
|
|
36
36
|
"empty-value": "^1.0.1",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"jest": "^27.3.1",
|
|
46
46
|
"start-server-and-test": "^1.14.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "54d1d67b4c1902652083f4143a089da40489cf8d"
|
|
49
49
|
}
|