diff --git a/components/dataViews/TransactionInfo/TxMsgCreateVestingAccountDetails.tsx b/components/dataViews/TransactionInfo/TxMsgCreateVestingAccountDetails.tsx new file mode 100644 index 0000000..62ad5e7 --- /dev/null +++ b/components/dataViews/TransactionInfo/TxMsgCreateVestingAccountDetails.tsx @@ -0,0 +1,80 @@ +import { useAppContext } from "../../../context/AppContext"; +import { printableCoins } from "../../../lib/displayHelpers"; +import { TxMsgCreateVestingAccount } from "../../../types/txMsg"; +import HashView from "../HashView"; + +interface TxMsgCreateVestingAccountDetailsProps { + readonly msg: TxMsgCreateVestingAccount; +} + +const TxMsgCreateVestingAccountDetails = ({ msg }: TxMsgCreateVestingAccountDetailsProps) => { + const { state } = useAppContext(); + const endTimeDateObj = new Date(msg.value.endTime * 1000); + const endTimeDate = endTimeDateObj.toLocaleDateString(); + const endTimeHours = endTimeDateObj.toLocaleTimeString().slice(0, -3); + + return ( + <> +
  • +

    MsgCreateVestingAccount

    +
  • +
  • + +
    {printableCoins(msg.value.amount, state.chain)}
    +
  • +
  • + +
    + +
    +
  • +
  • + +
    + +
    +
  • +
  • + +
    +

    + {endTimeDate} {endTimeHours} +

    +
    +
  • +
  • + +
    +

    {msg.value.delayed ? "Yes" : "No"}

    +
    +
  • + + + ); +}; + +export default TxMsgCreateVestingAccountDetails; diff --git a/components/dataViews/TransactionInfo/index.tsx b/components/dataViews/TransactionInfo/index.tsx index f517302..1da85d5 100644 --- a/components/dataViews/TransactionInfo/index.tsx +++ b/components/dataViews/TransactionInfo/index.tsx @@ -2,6 +2,7 @@ import { useAppContext } from "../../../context/AppContext"; import { printableCoins } from "../../../lib/displayHelpers"; import { isTxMsgClaimRewards, + isTxMsgCreateVestingAccount, isTxMsgDelegate, isTxMsgRedelegate, isTxMsgSend, @@ -11,6 +12,7 @@ import { import { DbTransaction } from "../../../types"; import StackableContainer from "../../layout/StackableContainer"; import TxMsgClaimRewardsDetails from "./TxMsgClaimRewardsDetails"; +import TxMsgCreateVestingAccountDetails from "./TxMsgCreateVestingAccountDetails"; import TxMsgDelegateDetails from "./TxMsgDelegateDetails"; import TxMsgRedelegateDetails from "./TxMsgRedelegateDetails"; import TxMsgSendDetails from "./TxMsgSendDetails"; @@ -59,6 +61,9 @@ const TransactionInfo = ({ tx }: Props) => { {isTxMsgSetWithdrawAddress(msg) ? ( ) : null} + {isTxMsgCreateVestingAccount(msg) ? ( + + ) : null} ))}