From 88e8e7be6a6515b246fbe03cf032bd1dc45963fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20C=2E=20Morency?= <1102868+fmorency@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:01:48 -0500 Subject: [PATCH] feat: add memo field to tx detail (#145) --- components/bank/components/historyBox.tsx | 1 + components/bank/modals/txInfo.tsx | 3 +++ hooks/useQueries.ts | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/components/bank/components/historyBox.tsx b/components/bank/components/historyBox.tsx index a21caac6..4df65b0d 100644 --- a/components/bank/components/historyBox.tsx +++ b/components/bank/components/historyBox.tsx @@ -19,6 +19,7 @@ export interface TransactionGroup { tx_hash: string; block_number: number; formatted_date: string; + memo?: string; data: Transaction; } diff --git a/components/bank/modals/txInfo.tsx b/components/bank/modals/txInfo.tsx index c6bd6c8f..63a2f2df 100644 --- a/components/bank/modals/txInfo.tsx +++ b/components/bank/modals/txInfo.tsx @@ -90,6 +90,9 @@ export default function TxInfoModal({ tx, modalId }: TxInfoModalProps) { +
+ +
diff --git a/hooks/useQueries.ts b/hooks/useQueries.ts index 77016e87..f4719e81 100644 --- a/hooks/useQueries.ts +++ b/hooks/useQueries.ts @@ -784,6 +784,8 @@ const _formatMessage = ( const transformTransactions = (tx: any, address: string) => { let messages: TransactionGroup[] = []; + let memo = tx.data.tx.body.memo ? { memo: tx.data.tx.body.memo } : {}; + for (const message of tx.data.tx.body.messages) { if (message['@type'] === '/cosmos.group.v1.MsgSubmitProposal') { for (const nestedMessage of message.messages) { @@ -799,6 +801,7 @@ const transformTransactions = (tx: any, address: string) => { tx_hash: tx.id, block_number: parseInt(tx.data.txResponse.height), formatted_date: tx.data.txResponse.timestamp, + ...memo, ...formattedMessage, }); } @@ -811,6 +814,7 @@ const transformTransactions = (tx: any, address: string) => { tx_hash: tx.id, block_number: parseInt(tx.data.txResponse.height), formatted_date: tx.data.txResponse.timestamp, + ...memo, ...formattedMessage, }); }