@ocap/tx-pipeline 1.13.82 → 1.13.86
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/index.js +2 -0
- package/lib/pipes/verify-service-fee.js +15 -0
- package/package.json +9 -9
package/lib/index.js
CHANGED
@@ -13,6 +13,7 @@ const VerifyListSize = require('./pipes/verify-list-size');
|
|
13
13
|
const VerifyMultiSig = require('./pipes/verify-multisig');
|
14
14
|
const VerifyMultiSigV2 = require('./pipes/verify-multisig-v2');
|
15
15
|
const VerifySender = require('./pipes/verify-sender');
|
16
|
+
const VerifyServiceFee = require('./pipes/verify-service-fee');
|
16
17
|
const VerifySignature = require('./pipes/verify-signature');
|
17
18
|
const VerifySigner = require('./pipes/verify-signer');
|
18
19
|
const VerifyTransferrable = require('./pipes/verify-transferrable');
|
@@ -40,6 +41,7 @@ module.exports = {
|
|
40
41
|
VerifyMultiSigV2,
|
41
42
|
VerifyUpdater,
|
42
43
|
VerifySender,
|
44
|
+
VerifyServiceFee,
|
43
45
|
VerifySignature,
|
44
46
|
VerifySigner,
|
45
47
|
VerifyTransferrable,
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const Error = require('@ocap/util/lib/error');
|
2
|
+
const { BN, fromTokenToUnit } = require('@ocap/util');
|
3
|
+
|
4
|
+
module.exports = function VerifyServiceFee(context, next) {
|
5
|
+
const { tx, config, txType } = context;
|
6
|
+
const fee = config.transaction.txFee[txType] || 0;
|
7
|
+
const expected = fromTokenToUnit(fee, config.token.decimal);
|
8
|
+
const actual = new BN(tx.serviceFee || 0);
|
9
|
+
|
10
|
+
if (actual.eq(expected) === false) {
|
11
|
+
return next(new Error('INVALID_SERVICE_FEE', 'Service fee for tx does not match chain config'));
|
12
|
+
}
|
13
|
+
|
14
|
+
next();
|
15
|
+
};
|
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"publishConfig": {
|
4
4
|
"access": "public"
|
5
5
|
},
|
6
|
-
"version": "1.13.
|
6
|
+
"version": "1.13.86",
|
7
7
|
"description": "Pipeline runner and common pipelines to process transactions",
|
8
8
|
"main": "lib/index.js",
|
9
9
|
"files": [
|
@@ -26,16 +26,16 @@
|
|
26
26
|
"elliptic": "6.5.3"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@arcblock/did": "1.13.
|
30
|
-
"@arcblock/did-util": "1.13.
|
31
|
-
"@ocap/mcrypto": "1.13.
|
32
|
-
"@ocap/message": "1.13.
|
33
|
-
"@ocap/state": "1.13.
|
34
|
-
"@ocap/util": "1.13.
|
35
|
-
"@ocap/wallet": "1.13.
|
29
|
+
"@arcblock/did": "1.13.86",
|
30
|
+
"@arcblock/did-util": "1.13.86",
|
31
|
+
"@ocap/mcrypto": "1.13.86",
|
32
|
+
"@ocap/message": "1.13.86",
|
33
|
+
"@ocap/state": "1.13.86",
|
34
|
+
"@ocap/util": "1.13.86",
|
35
|
+
"@ocap/wallet": "1.13.86",
|
36
36
|
"debug": "^4.3.2",
|
37
37
|
"empty-value": "^1.0.1",
|
38
38
|
"lodash": "^4.17.21"
|
39
39
|
},
|
40
|
-
"gitHead": "
|
40
|
+
"gitHead": "c13c697b2019329f04f1dc54d3ab9172c67f1ae7"
|
41
41
|
}
|