Skip to content

Commit

Permalink
utils: Helpers: Support non-expiring grants
Browse files Browse the repository at this point in the history
  • Loading branch information
vchong committed Sep 1, 2023
1 parent daf955d commit d467691
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/utils/Helpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ export function parseGrants(grants, grantee, granter) {
el.authorization.msg ===
"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward")
) {
return Date.parse(el.expiration) > new Date();
if (el.expiration === null) {
timeStamp("claimGrant does NOT expire!")
return true;
} else if (Date.parse(el.expiration) > new Date()) {
return true;
} else {
timeStamp("claimGrant expired!")
return false;
}
} else {
return false;
}
Expand All @@ -90,7 +98,15 @@ export function parseGrants(grants, grantee, granter) {
"/cosmos.staking.v1beta1.MsgDelegate"
))
) {
return Date.parse(el.expiration) > new Date();
if (el.expiration === null) {
timeStamp("stakeGrant does NOT expire!")
return true;
} else if (Date.parse(el.expiration) > new Date()) {
return true;
} else {
timeStamp("stakeGrant expired!")
return false;
}
} else {
return false;
}
Expand Down

0 comments on commit d467691

Please sign in to comment.