Skip to content

Commit

Permalink
Merge pull request #61 from eco-stake/handle-expired-grants
Browse files Browse the repository at this point in the history
Properly handle expired grants
  • Loading branch information
tombeynon authored Nov 15, 2023
2 parents 7a927a1 + bf9e37d commit 60a405c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Grants.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function Grants(props) {
const validator = filter.group === 'granter' && validatorForGrantAddress(grant.grantee)
const favourite = props.favouriteAddresses && props.favouriteAddresses.find(el => el.address === (filter.group === 'granter' ? grantee : granter))
const grantId = `${granter}-${grantee}-${authorization['@type']}-${authorization.msg}`
const expired = expiration && Date.parse(expiration) < Date.now()
return (
<tr key={grantId}>
<td className="text-break">
Expand All @@ -156,7 +157,7 @@ function Grants(props) {
<td className="d-none d-lg-table-cell">
{renderGrantData(grant)}
</td>
<td className="d-none d-md-table-cell">
<td className={`d-none d-md-table-cell ${expired && 'text-danger'}`}>
<Moment format="LLL">
{expiration}
</Moment>
Expand Down
1 change: 1 addition & 0 deletions src/utils/Wallet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Wallet {
message = message || action
return this.grants.some(grant => {
return grant.granter === address &&
(!grant.expiration || Date.parse(grant.expiration) > Date.now()) &&
grant.authorization["@type"] === "/cosmos.authz.v1beta1.GenericAuthorization" &&
grant.authorization.msg === message
})
Expand Down

0 comments on commit 60a405c

Please sign in to comment.