diff --git a/src/components/InnerTransactionCard.tsx b/src/components/InnerTransactionCard.tsx index 54110a3..cbae25c 100644 --- a/src/components/InnerTransactionCard.tsx +++ b/src/components/InnerTransactionCard.tsx @@ -4,6 +4,7 @@ import { Data } from "./Data"; import { Hash } from "./Hash"; import { TransactionDetailsData } from "./TransactionDetailsData"; import { TransactionStatusBadge } from "./TransactionStatusBadge"; +import { decodeHexAscii } from "../utils/transactions"; type InnerTransactionCardProps = { innerTransaction: InnerTransaction; @@ -38,7 +39,7 @@ export const InnerTransactionCard = ({ } /> - + ); diff --git a/src/utils/transactions.ts b/src/utils/transactions.ts index 7a38d00..beef0ae 100644 --- a/src/utils/transactions.ts +++ b/src/utils/transactions.ts @@ -3,3 +3,16 @@ import type { AccountResponse } from "../types"; export const checkForNotEmptyWallet = (tx: AccountResponse) => { return tx.some((el) => el.minDenomAmount !== "0"); }; + +export function decodeHexAscii(hex: string): string { + if (hex.length % 2 !== 0) { + throw new Error("Invalid hex string"); + } + + const bytes = new Uint8Array(hex.length / 2); + for (let i = 0; i < hex.length; i += 2) { + bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16); + } + + return new TextDecoder().decode(bytes); +}; \ No newline at end of file