From bf9e37df9240e5d7aa75f6f64e9d3706e7358118 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Sat, 28 Oct 2023 15:50:51 +0100 Subject: [PATCH] Properly handle expired grants --- src/components/Grants.js | 3 ++- src/utils/Wallet.mjs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Grants.js b/src/components/Grants.js index 06bba053..d426b3cd 100644 --- a/src/components/Grants.js +++ b/src/components/Grants.js @@ -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 ( @@ -156,7 +157,7 @@ function Grants(props) { {renderGrantData(grant)} - + {expiration} diff --git a/src/utils/Wallet.mjs b/src/utils/Wallet.mjs index 24f29798..cc3d4b14 100644 --- a/src/utils/Wallet.mjs +++ b/src/utils/Wallet.mjs @@ -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 })