Skip to content

Commit

Permalink
allowance type in table
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 committed Sep 12, 2023
1 parent f6337a4 commit 70d9a42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deploy-web/src/components/settings/AllowanceIssuedRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +22,7 @@ export const AllowanceIssuedRow: React.FunctionComponent<Props> = ({ allowance,

return (
<CustomTableRow>
<TableCell>{allowance.allowance["@type"]}</TableCell>
<TableCell>{getAllowanceTitleByType(allowance)}</TableCell>
<TableCell>
<Address address={allowance.grantee} isCopyable />
</TableCell>
Expand Down
13 changes: 13 additions & 0 deletions deploy-web/src/utils/grants.ts
Original file line number Diff line number Diff line change
@@ -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";
}
};

0 comments on commit 70d9a42

Please sign in to comment.