From 46b3e9a306ca34dfcc95292b12817338656f9747 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:06:17 +0700 Subject: [PATCH] fix: contract migration --- CHANGELOG.md | 1 + .../components/tables/migration/MigrationRow.tsx | 15 ++++----------- src/lib/types/contract.ts | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb8d425d0..339859451 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#518](https://github.com/alleslabs/celatone-frontend/pull/518) Fix contract migration remark data - [#511](https://github.com/alleslabs/celatone-frontend/pull/511) Fix tx relation selector incorrect option - [#499](https://github.com/alleslabs/celatone-frontend/pull/499) Fix responsive for icns and add cl pool icon - [#506](https://github.com/alleslabs/celatone-frontend/pull/506) Fix simulation bugs diff --git a/src/lib/pages/contract-details/components/tables/migration/MigrationRow.tsx b/src/lib/pages/contract-details/components/tables/migration/MigrationRow.tsx index 639e6cd74..658a1fd80 100644 --- a/src/lib/pages/contract-details/components/tables/migration/MigrationRow.tsx +++ b/src/lib/pages/contract-details/components/tables/migration/MigrationRow.tsx @@ -1,11 +1,11 @@ import type { GridProps } from "@chakra-ui/react"; import { Flex, Grid, Text } from "@chakra-ui/react"; +import { capitalize } from "lodash"; import { useGetAddressType } from "lib/app-provider"; import { ExplorerLink } from "lib/components/ExplorerLink"; import { TableRow, CodeNameCell } from "lib/components/table"; import type { ContractMigrationHistory } from "lib/types"; -import { RemarkOperation } from "lib/types"; import { dateFromNow, formatUTC, getCw2Info } from "lib/utils"; interface MigrationRowProps { @@ -19,17 +19,10 @@ export const RemarkRender = ({ remark: ContractMigrationHistory["remark"]; }) => { const { operation, type, value } = remark; - const isGovernance = type === "governance"; - if ( - operation === RemarkOperation.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS - ) - return Genesis; - - const prefix = - operation === RemarkOperation.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT - ? "Instantiate" - : "Migrate"; + if (type === "genesis") return Genesis; + const isGovernance = type === "governance"; + const prefix = capitalize(operation.split("_").pop()); const textFormat = isGovernance ? "normal" : "truncate"; return (