Skip to content

Commit

Permalink
feat: add memo field to tx detail
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency committed Dec 9, 2024
1 parent 5d12e77 commit 8f5c942
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/bank/components/historyBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface TransactionGroup {
tx_hash: string;
block_number: number;
formatted_date: string;
memo?: string;
data: Transaction;
}

Expand Down
3 changes: 3 additions & 0 deletions components/bank/modals/txInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ export default function TxInfoModal({ tx, modalId }: TxInfoModalProps) {
</div>
</div>
</div>
<div>
<InfoItem label="MEMO" explorerUrl={explorerUrl} value={tx?.memo ?? 'N/A'} />
</div>
</div>
<form method="dialog" className="modal-backdrop">
<button>close</button>
Expand Down
4 changes: 4 additions & 0 deletions hooks/useQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,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) {
Expand All @@ -954,6 +956,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,
});
}
Expand All @@ -966,6 +969,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,
});
}
Expand Down

0 comments on commit 8f5c942

Please sign in to comment.