@ocap/tx-protocols 1.22.1 → 1.22.3
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/lib/protocols/token-factory/create.js +15 -11
- package/package.json +16 -16
|
@@ -48,9 +48,9 @@ runner.use((context, next) => {
|
|
|
48
48
|
return next();
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
// Ensure factory and token address is valid
|
|
52
51
|
runner.use(
|
|
53
52
|
pipes.VerifyInfo([
|
|
53
|
+
// verify token address is valid
|
|
54
54
|
{
|
|
55
55
|
error: 'INVALID_TOKEN',
|
|
56
56
|
message: 'Token address is not valid',
|
|
@@ -58,6 +58,7 @@ runner.use(
|
|
|
58
58
|
return toTokenAddress({ ...context.itx.token, address: '' }) === context.itx.token.address;
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
|
+
// verify token factory address is valid
|
|
61
62
|
{
|
|
62
63
|
error: 'INVALID_TOKEN_FACTORY',
|
|
63
64
|
message: 'Token factory address is not valid',
|
|
@@ -69,12 +70,7 @@ runner.use(
|
|
|
69
70
|
return toTokenFactoryAddress(itx) === context.itx.address;
|
|
70
71
|
},
|
|
71
72
|
},
|
|
72
|
-
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// Ensure reserve address is config.token.address
|
|
76
|
-
runner.use(
|
|
77
|
-
pipes.VerifyInfo([
|
|
73
|
+
// verify reserve address is config.token.address
|
|
78
74
|
{
|
|
79
75
|
error: 'INVALID_RESERVE_ADDRESS',
|
|
80
76
|
message: 'Reserve address is not valid',
|
|
@@ -83,6 +79,18 @@ runner.use(
|
|
|
83
79
|
])
|
|
84
80
|
);
|
|
85
81
|
|
|
82
|
+
// Ensure symbol is not internal
|
|
83
|
+
runner.use((context, next) => {
|
|
84
|
+
const { internalSymbols } = context.config;
|
|
85
|
+
const { symbol } = context.itx.token;
|
|
86
|
+
|
|
87
|
+
if (internalSymbols.includes(symbol.toUpperCase())) {
|
|
88
|
+
return next(new Error('INVALID_SYMBOL', `Token symbol can not be ${symbol}`));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return next();
|
|
92
|
+
});
|
|
93
|
+
|
|
86
94
|
// Ensure token factory not exist
|
|
87
95
|
runner.use(pipes.ExtractState({ from: 'itx.address', to: 'tokenFactoryState', table: 'tokenFactory', status: 'OK' }));
|
|
88
96
|
runner.use(
|
|
@@ -116,11 +124,7 @@ runner.use(pipes.VerifyBlocked({ stateKeys: ['senderState'] }));
|
|
|
116
124
|
// Ensure uniqueness of token symbol
|
|
117
125
|
runner.use(
|
|
118
126
|
async function EnsureTokenSymbol(context, next) {
|
|
119
|
-
const { symbol } = context.config.token;
|
|
120
127
|
const itxToken = context.itx.token;
|
|
121
|
-
if (symbol.toLowerCase() === itxToken.symbol.toLowerCase()) {
|
|
122
|
-
return next(new Error('DUPLICATE_SYMBOL', `Token symbol can not be ${symbol}`));
|
|
123
|
-
}
|
|
124
128
|
|
|
125
129
|
const exist = await context.statedb.token.existBySymbol(itxToken.symbol, context);
|
|
126
130
|
if (exist) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.22.
|
|
6
|
+
"version": "1.22.3",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
"empty-value": "^1.0.1",
|
|
19
19
|
"lodash": "^4.17.21",
|
|
20
20
|
"url-join": "^4.0.1",
|
|
21
|
-
"@arcblock/did": "1.22.
|
|
22
|
-
"@arcblock/did-util": "1.22.
|
|
23
|
-
"@arcblock/jwt": "1.22.
|
|
24
|
-
"@arcblock/validator": "1.22.
|
|
25
|
-
"@ocap/
|
|
26
|
-
"@ocap/
|
|
27
|
-
"@ocap/
|
|
28
|
-
"@ocap/
|
|
29
|
-
"@ocap/message": "1.22.
|
|
30
|
-
"@ocap/state": "1.22.
|
|
31
|
-
"@ocap/tx-pipeline": "1.22.
|
|
32
|
-
"@ocap/util": "1.22.
|
|
33
|
-
"@ocap/wallet": "1.22.
|
|
21
|
+
"@arcblock/did": "1.22.3",
|
|
22
|
+
"@arcblock/did-util": "1.22.3",
|
|
23
|
+
"@arcblock/jwt": "1.22.3",
|
|
24
|
+
"@arcblock/validator": "1.22.3",
|
|
25
|
+
"@ocap/asset": "1.22.3",
|
|
26
|
+
"@ocap/client": "1.22.3",
|
|
27
|
+
"@ocap/merkle-tree": "1.22.3",
|
|
28
|
+
"@ocap/mcrypto": "1.22.3",
|
|
29
|
+
"@ocap/message": "1.22.3",
|
|
30
|
+
"@ocap/state": "1.22.3",
|
|
31
|
+
"@ocap/tx-pipeline": "1.22.3",
|
|
32
|
+
"@ocap/util": "1.22.3",
|
|
33
|
+
"@ocap/wallet": "1.22.3"
|
|
34
34
|
},
|
|
35
35
|
"resolutions": {
|
|
36
36
|
"bn.js": "5.2.1",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"jest": "^29.7.0",
|
|
41
41
|
"start-server-and-test": "^1.14.0",
|
|
42
|
-
"@ocap/e2e-test": "1.22.
|
|
43
|
-
"@ocap/statedb-memory": "1.22.
|
|
42
|
+
"@ocap/e2e-test": "1.22.3",
|
|
43
|
+
"@ocap/statedb-memory": "1.22.3"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"lint": "eslint tests lib",
|