Skip to content

Commit

Permalink
fix: display transactions (#1184)
Browse files Browse the repository at this point in the history
fix: display transaction
  • Loading branch information
Hemanthghs authored Mar 4, 2024
1 parent e3f17e6 commit b0eebf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const TransactionItem = ({

export const Chip = ({ msg }: { msg: string }) => {
return (
<div className="chip bg-[#26233b] text-center text-[10px] not-italic font-normal leading-3">
<div className="chip bg-[#26233b] max-h-5 text-center text-[10px] not-italic font-normal leading-3">
{msg}
</div>
);
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/utils/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ export const MsgType = (msg: string): string => {
case msgDepositTypeUrl:
return 'Deposit';
default:
return 'Todo: add type';
return msg;
}
};

/* eslint-disable @typescript-eslint/no-explicit-any */
export const serializeMsg = (
msg: any,
decimals: number,
originDenom: string
originDenom: string,
txHash: string
): string => {
if (!msg) return 'No Message';
switch (msg['@type']) {
Expand All @@ -123,7 +124,7 @@ export const serializeMsg = (
case msgDepositTypeUrl:
return serializeMsgDeposit(msg, decimals, originDenom);
default:
return `Todo: serialize message ${msg.typeUrl}`;
return txHash;
}
};

Expand Down Expand Up @@ -157,7 +158,12 @@ export const formatTransaction = (
const msgCount = msgs.length;
const isTxSuccess = tx.code === 0;
const time = getTimeDifference(tx.timestamp);
const firstMessage = serializeMsg(tx.messages[0], decimals, originDenom);
const firstMessage = serializeMsg(
tx.messages[0],
decimals,
originDenom,
tx.txhash
);
return {
showMsgs,
isTxSuccess,
Expand Down

0 comments on commit b0eebf3

Please sign in to comment.