From 70d9a42ab92ba10cd32544927239ae16dc607279 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Tue, 12 Sep 2023 12:41:48 -0400 Subject: [PATCH] allowance type in table --- .../src/components/settings/AllowanceIssuedRow.tsx | 3 ++- deploy-web/src/utils/grants.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 deploy-web/src/utils/grants.ts diff --git a/deploy-web/src/components/settings/AllowanceIssuedRow.tsx b/deploy-web/src/components/settings/AllowanceIssuedRow.tsx index dd50d6730..9d15f8617 100644 --- a/deploy-web/src/components/settings/AllowanceIssuedRow.tsx +++ b/deploy-web/src/components/settings/AllowanceIssuedRow.tsx @@ -8,6 +8,7 @@ import DeleteIcon from "@mui/icons-material/Delete"; import { AllowanceType } from "@src/types/grant"; import { AKTAmount } from "../shared/AKTAmount"; import { coinToUDenom } from "@src/utils/priceUtils"; +import { getAllowanceTitleByType } from "@src/utils/grants"; type Props = { allowance: AllowanceType; @@ -21,7 +22,7 @@ export const AllowanceIssuedRow: React.FunctionComponent = ({ allowance, return ( - {allowance.allowance["@type"]} + {getAllowanceTitleByType(allowance)}
diff --git a/deploy-web/src/utils/grants.ts b/deploy-web/src/utils/grants.ts new file mode 100644 index 000000000..68c894965 --- /dev/null +++ b/deploy-web/src/utils/grants.ts @@ -0,0 +1,13 @@ +import { AllowanceType } from "@src/types/grant"; + +export const getAllowanceTitleByType = (allowance: AllowanceType) => { + switch (allowance.allowance["@type"]) { + case "/cosmos.feegrant.v1beta1.BasicAllowance": + return "Basic"; + case "/cosmos.feegrant.v1beta1.PeriodicAllowance": + return "Periodic"; + + default: + return "Unknown"; + } +};