import React from "react"; import AddressDisp from "src/components/Misc/Disp/AddressDisp/AddressDisp"; import { qaToZil, hexAddrToZilAddr, isValidAddr } from "src/utils/Utils"; import { TransitionEntry } from "@zilliqa-js/core/src/types"; interface IProps { transitions: TransitionEntry[]; } const TransitionsTab: React.FC = ({ transitions }) => { return (
{transitions .map((transition: TransitionEntry, index: number) => ( <>
Tag {transition.msg._tag === "" ? "-" : transition.msg._tag}
Contract Address
Accepts $ZIL {transition.accepted === undefined ? "-" : `${transition.accepted}`}
Depth {transition.depth}
Amount {qaToZil(transition.msg._amount)}
Recipient
{transition.msg.params.length > 0 && ( <>
{transition.msg.params.map((param, index) => ( ))}
Variable Value
{param.vname} {typeof param.value === "object" ? (
                                {JSON.stringify(param.value, null, "\t")}
                              
) : Array.isArray(param.value) ? ( param.value.toString() ) : isValidAddr(param.value.toString()) ? ( ) : ( param.value )}
)} )) .reduce( (acc: React.ReactNode | null, x) => acc === null ? ( x ) : ( <> {acc}
{x} ), null )}
); }; export default TransitionsTab;