@ocap/tx-protocols 1.13.76 → 1.13.77
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/util.js +14 -8
- package/package.json +13 -13
package/lib/util.js
CHANGED
|
@@ -201,17 +201,18 @@ const ensureBlockReward = (rollupState, minReward, txStates) => {
|
|
|
201
201
|
const changes = { stake: [], account: [] };
|
|
202
202
|
dynamicFeeTxs.forEach((x) => {
|
|
203
203
|
const maxFee = new BN(x.tx.itxJson.maxFee);
|
|
204
|
+
const defaults = getTxFee({
|
|
205
|
+
amount: x.tx.itxJson.token.value,
|
|
206
|
+
feeRate: withdrawFeeRate,
|
|
207
|
+
maxFee: maxWithdrawFee,
|
|
208
|
+
minFee: minWithdrawFee,
|
|
209
|
+
stringify: false,
|
|
210
|
+
});
|
|
211
|
+
|
|
204
212
|
let actualFee = new BN(0);
|
|
205
213
|
// If totalMissingFee is less than 0, then the tx will be charged for fixedFee
|
|
206
214
|
if (totalMissingFee.lt(ZERO)) {
|
|
207
|
-
|
|
208
|
-
amount: x.tx.itxJson.token.value,
|
|
209
|
-
feeRate: withdrawFeeRate,
|
|
210
|
-
maxFee: maxWithdrawFee,
|
|
211
|
-
minFee: minWithdrawFee,
|
|
212
|
-
stringify: false,
|
|
213
|
-
});
|
|
214
|
-
actualFee = fee.reward;
|
|
215
|
+
actualFee = defaults.reward;
|
|
215
216
|
} else {
|
|
216
217
|
// Else the tx is charged for a portion of totalMissingFee
|
|
217
218
|
actualFee = totalMissingFee.mul(maxFee).div(totalDynamicFee);
|
|
@@ -221,6 +222,11 @@ const ensureBlockReward = (rollupState, minReward, txStates) => {
|
|
|
221
222
|
throw new Error('NEGATIVE_ACTUAL_FEE', 'Got negative actualFee for tx, abort!');
|
|
222
223
|
}
|
|
223
224
|
|
|
225
|
+
// If the actualFee is less than default fee, user will be charged the default fee
|
|
226
|
+
if (actualFee.lt(defaults.reward)) {
|
|
227
|
+
actualFee = defaults.reward;
|
|
228
|
+
}
|
|
229
|
+
|
|
224
230
|
// If the actualFee is less than minTxFee, user will be charged the minTxFee
|
|
225
231
|
if (actualFee.lt(minTxFee)) {
|
|
226
232
|
actualFee = minTxFee;
|
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.77",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@arcblock/did": "1.13.
|
|
23
|
-
"@arcblock/did-util": "1.13.
|
|
24
|
-
"@ocap/asset": "1.13.
|
|
25
|
-
"@ocap/mcrypto": "1.13.
|
|
26
|
-
"@ocap/merkle-tree": "1.13.
|
|
27
|
-
"@ocap/message": "1.13.
|
|
28
|
-
"@ocap/state": "1.13.
|
|
29
|
-
"@ocap/tx-pipeline": "1.13.
|
|
30
|
-
"@ocap/util": "1.13.
|
|
31
|
-
"@ocap/validator": "1.13.
|
|
32
|
-
"@ocap/wallet": "1.13.
|
|
22
|
+
"@arcblock/did": "1.13.77",
|
|
23
|
+
"@arcblock/did-util": "1.13.77",
|
|
24
|
+
"@ocap/asset": "1.13.77",
|
|
25
|
+
"@ocap/mcrypto": "1.13.77",
|
|
26
|
+
"@ocap/merkle-tree": "1.13.77",
|
|
27
|
+
"@ocap/message": "1.13.77",
|
|
28
|
+
"@ocap/state": "1.13.77",
|
|
29
|
+
"@ocap/tx-pipeline": "1.13.77",
|
|
30
|
+
"@ocap/util": "1.13.77",
|
|
31
|
+
"@ocap/validator": "1.13.77",
|
|
32
|
+
"@ocap/wallet": "1.13.77",
|
|
33
33
|
"debug": "^4.3.2",
|
|
34
34
|
"empty-value": "^1.0.1",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"jest": "^27.3.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "84967780822cbcb5a30e809ea4d39a84020d3e31"
|
|
46
46
|
}
|