Skip to content

Commit d467691

Browse files
committed
utils: Helpers: Support non-expiring grants
Fixes: eco-stake#692
1 parent daf955d commit d467691

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/utils/Helpers.mjs

+18-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,15 @@ export function parseGrants(grants, grantee, granter) {
7272
el.authorization.msg ===
7373
"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward")
7474
) {
75-
return Date.parse(el.expiration) > new Date();
75+
if (el.expiration === null) {
76+
timeStamp("claimGrant does NOT expire!")
77+
return true;
78+
} else if (Date.parse(el.expiration) > new Date()) {
79+
return true;
80+
} else {
81+
timeStamp("claimGrant expired!")
82+
return false;
83+
}
7684
} else {
7785
return false;
7886
}
@@ -90,7 +98,15 @@ export function parseGrants(grants, grantee, granter) {
9098
"/cosmos.staking.v1beta1.MsgDelegate"
9199
))
92100
) {
93-
return Date.parse(el.expiration) > new Date();
101+
if (el.expiration === null) {
102+
timeStamp("stakeGrant does NOT expire!")
103+
return true;
104+
} else if (Date.parse(el.expiration) > new Date()) {
105+
return true;
106+
} else {
107+
timeStamp("stakeGrant expired!")
108+
return false;
109+
}
94110
} else {
95111
return false;
96112
}

0 commit comments

Comments
 (0)