@ocap/tx-pipeline 1.18.103 → 1.18.105
Sign up to get free protection for your applications and to get access to all the features.
@@ -38,12 +38,12 @@ const isDelegationSufficient = (requirements, limitation) => {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
// Check tx_count exceeds
|
41
|
-
if (limit.txSent >= limit.txCount) {
|
41
|
+
if (limit.txCount > 0 && limit.txSent >= limit.txCount) {
|
42
42
|
return { sufficient: false, reason: 'tx count exceeds threshold' };
|
43
43
|
}
|
44
44
|
|
45
45
|
// Check valid_until
|
46
|
-
if (limit.validUntil && limit.validUntil < now) {
|
46
|
+
if (limit.validUntil > 0 && limit.validUntil < now) {
|
47
47
|
return { sufficient: false, reason: 'delegation expired' };
|
48
48
|
}
|
49
49
|
|
@@ -59,8 +59,8 @@ const isDelegationSufficient = (requirements, limitation) => {
|
|
59
59
|
// Check tx_allowance exceeds using BN
|
60
60
|
const requirementValue = toBN(requirement.value || '0');
|
61
61
|
const txAllowance = toBN(limit.txAllowance || '0');
|
62
|
-
const isTxAllowanceExceed = txAllowance.
|
63
|
-
if (isTxAllowanceExceed
|
62
|
+
const isTxAllowanceExceed = txAllowance.gt(ZERO) && requirementValue.gt(txAllowance);
|
63
|
+
if (isTxAllowanceExceed) {
|
64
64
|
return { sufficient: false, reason: 'token amount exceeds tx allowance' };
|
65
65
|
}
|
66
66
|
|
@@ -68,8 +68,8 @@ const isDelegationSufficient = (requirements, limitation) => {
|
|
68
68
|
const totalAllowance = toBN(limit.totalAllowance || '0');
|
69
69
|
const spentAllowance = toBN(limit.spentAllowance || '0');
|
70
70
|
const isTotalAllowanceExceed =
|
71
|
-
totalAllowance.
|
72
|
-
if (isTotalAllowanceExceed
|
71
|
+
totalAllowance.gt(ZERO) && requirementValue.add(spentAllowance).gt(totalAllowance);
|
72
|
+
if (isTotalAllowanceExceed) {
|
73
73
|
return { sufficient: false, reason: 'token amount exceeds total allowance' };
|
74
74
|
}
|
75
75
|
|
@@ -97,12 +97,12 @@ const isDelegationSufficient = (requirements, limitation) => {
|
|
97
97
|
}
|
98
98
|
|
99
99
|
// Check tx_count exceeds
|
100
|
-
if (limit.txSent >= limit.txCount) {
|
100
|
+
if (limit.txCount > 0 && limit.txSent >= limit.txCount) {
|
101
101
|
return { sufficient: false, reason: 'tx count exceeds threshold' };
|
102
102
|
}
|
103
103
|
|
104
104
|
// Check valid_until
|
105
|
-
if (limit.validUntil && limit.validUntil < now) {
|
105
|
+
if (limit.validUntil > 0 && limit.validUntil < now) {
|
106
106
|
return { sufficient: false, reason: 'delegation expired' };
|
107
107
|
}
|
108
108
|
|
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"publishConfig": {
|
4
4
|
"access": "public"
|
5
5
|
},
|
6
|
-
"version": "1.18.
|
6
|
+
"version": "1.18.105",
|
7
7
|
"description": "Pipeline runner and common pipelines to process transactions",
|
8
8
|
"main": "lib/index.js",
|
9
9
|
"files": [
|
@@ -29,16 +29,16 @@
|
|
29
29
|
"elliptic": "6.5.3"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@arcblock/did": "1.18.
|
33
|
-
"@arcblock/did-util": "1.18.
|
34
|
-
"@ocap/mcrypto": "1.18.
|
35
|
-
"@ocap/message": "1.18.
|
36
|
-
"@ocap/state": "1.18.
|
37
|
-
"@ocap/util": "1.18.
|
38
|
-
"@ocap/wallet": "1.18.
|
32
|
+
"@arcblock/did": "1.18.105",
|
33
|
+
"@arcblock/did-util": "1.18.105",
|
34
|
+
"@ocap/mcrypto": "1.18.105",
|
35
|
+
"@ocap/message": "1.18.105",
|
36
|
+
"@ocap/state": "1.18.105",
|
37
|
+
"@ocap/util": "1.18.105",
|
38
|
+
"@ocap/wallet": "1.18.105",
|
39
39
|
"debug": "^4.3.4",
|
40
40
|
"empty-value": "^1.0.1",
|
41
41
|
"lodash": "^4.17.21"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "bc90be96744b8258feccbfc3dd02e1afbe7165cc"
|
44
44
|
}
|