diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d641970e..f536c731e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#522](https://github.com/alleslabs/celatone-frontend/pull/522) Fix to support undefined execute msg - [#520](https://github.com/alleslabs/celatone-frontend/pull/520) Fix update instantiated info height data and handle genesis height case - [#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 diff --git a/src/lib/components/ContractCmdButton.tsx b/src/lib/components/ContractCmdButton.tsx index 5d1153244..4b6b36d68 100644 --- a/src/lib/components/ContractCmdButton.tsx +++ b/src/lib/components/ContractCmdButton.tsx @@ -15,7 +15,8 @@ export const ContractCmdButton = ({ borderRadius="16px" fontWeight={400} onClick={onClickCmd} + color={cmd ? "text.main" : "text.disabled"} > - {cmd} + {cmd || "undefined"} ); diff --git a/src/lib/components/action-msg/SingleMsg.tsx b/src/lib/components/action-msg/SingleMsg.tsx index 5616aaaab..c7bfbadd3 100644 --- a/src/lib/components/action-msg/SingleMsg.tsx +++ b/src/lib/components/action-msg/SingleMsg.tsx @@ -24,7 +24,7 @@ export interface SingleMsgProps { type: string; text1?: string; tokens?: Token[]; - tags?: string[]; + tags?: Option[]; length?: number; text2?: string; link1?: LinkElement; @@ -64,9 +64,14 @@ export const SingleMsg = ({ /> ))} {/* Tags */} - {tags?.map((tag: string, index: number) => ( - - {snakeCase(tag) || tag} + {tags?.map((tag, index: number) => ( + + {tag ? snakeCase(tag) : "undefined"} ))} {/* Tag left over */} diff --git a/src/lib/hooks/useExecuteCmds.ts b/src/lib/hooks/useExecuteCmds.ts index a7de7f29f..4ca91b76e 100644 --- a/src/lib/hooks/useExecuteCmds.ts +++ b/src/lib/hooks/useExecuteCmds.ts @@ -28,12 +28,14 @@ export const useExecuteCmds = (contractAddress: ContractAddr) => { onError: (e) => { if (e.message.includes("contract: ")) { setExecCmds([]); - } else { + } else if (e.message.includes("Error parsing into type")) { const executeCmds: string[] = []; Array.from(e.message?.matchAll(/`(.*?)`/g) || []) .slice(1) .forEach((match) => executeCmds.push(match[1])); setExecCmds(executeCmds.map((cmd) => [cmd, `{"${cmd}": {}}`])); + } else { + setExecCmds([["", "{}"]]); } }, }); diff --git a/src/lib/styles/theme/components/button.ts b/src/lib/styles/theme/components/button.ts index 818a55058..f9a0e8e3a 100644 --- a/src/lib/styles/theme/components/button.ts +++ b/src/lib/styles/theme/components/button.ts @@ -13,7 +13,7 @@ const primaryBg = "primary.background"; const accentBg = "accent.background"; const accentMain = "accent.main"; const accentDarker = "accent.darker"; -const borderDefualt = "1px solid"; +const borderDefault = "1px solid"; const errorDark = "error.dark"; const secondaryBg = "secondary.background"; @@ -133,7 +133,7 @@ export const Button: ComponentStyleConfig = { "outline-primary": CURR_THEME.button?.outlinePrimary ? generateStyle({ basic: { - border: borderDefualt, + border: borderDefault, borderColor: CURR_THEME.button.outlinePrimary.borderColor, color: CURR_THEME.button.outlinePrimary.color, "> div": { @@ -144,7 +144,7 @@ export const Button: ComponentStyleConfig = { }, }, disabled: { - border: borderDefualt, + border: borderDefault, borderColor: CURR_THEME.button.outlinePrimary.disabledBorderColor, color: CURR_THEME.button.outlinePrimary.disabledColor, "& span": { @@ -156,7 +156,7 @@ export const Button: ComponentStyleConfig = { }) : generateStyle({ basic: { - border: borderDefualt, + border: borderDefault, borderColor: primaryLight, color: primaryLight, "> div": { @@ -167,7 +167,7 @@ export const Button: ComponentStyleConfig = { }, }, disabled: { - border: borderDefualt, + border: borderDefault, borderColor: gray700, color: gray600, "> svg": { @@ -179,7 +179,7 @@ export const Button: ComponentStyleConfig = { }), "outline-gray": generateStyle({ basic: { - border: borderDefualt, + border: borderDefault, borderColor: gray600, color: "text.dark", "> svg": { @@ -187,7 +187,7 @@ export const Button: ComponentStyleConfig = { }, }, disabled: { - border: borderDefualt, + border: borderDefault, borderColor: gray700, color: gray600, "> svg": { @@ -199,7 +199,7 @@ export const Button: ComponentStyleConfig = { }), "outline-accent": generateStyle({ basic: { - border: borderDefualt, + border: borderDefault, borderColor: accentBg, color: accentMain, "> svg": { @@ -218,7 +218,7 @@ export const Button: ComponentStyleConfig = { }), "command-button": generateStyle({ basic: { - border: borderDefualt, + border: borderDefault, borderColor: accentDarker, color: "text.main", }, diff --git a/src/lib/utils/executeTags.ts b/src/lib/utils/executeTags.ts index 349b3c226..f0c9c4746 100644 --- a/src/lib/utils/executeTags.ts +++ b/src/lib/utils/executeTags.ts @@ -1,4 +1,4 @@ -import type { DetailExecute, Message } from "lib/types"; +import type { DetailExecute, Message, Option } from "lib/types"; /** * Returns execute tags to be displayed. @@ -14,11 +14,11 @@ import type { DetailExecute, Message } from "lib/types"; export const getExecuteMsgTags = ( messages: Message[], max: number -): string[] => { +): Option[] => { const executeMessages = messages.filter( (message) => message.type === "/cosmwasm.wasm.v1.MsgExecuteContract" ); - const tags = []; + const tags: Option[] = []; for (let i = 0; i < max; i += 1) { if (executeMessages[i]) { const msg = executeMessages[i].detail as DetailExecute;