Skip to content

Commit

Permalink
fix: only show successful tx in history
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency committed Jan 8, 2025
1 parent 4108223 commit 25d1d60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions components/bank/components/historyBox.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React, { useMemo, useState, useEffect } from 'react';
import React, { useState } from 'react';
import { TruncatedAddressWithCopy } from '@/components/react/addressCopy';
import TxInfoModal from '../modals/txInfo';
import { shiftDigits, truncateString } from '@/utils';
import { shiftDigits } from '@/utils';
import { BurnIcon, DenomImage, formatDenom, MintIcon } from '@/components';
import { HistoryTxType, useTokenFactoryDenomsMetadata } from '@/hooks';
import { ReceiveIcon, SendIcon } from '@/components/icons';

import useIsMobile from '@/hooks/useIsMobile';

interface Transaction {
tx_type: HistoryTxType;
from_address: string;
Expand Down
6 changes: 5 additions & 1 deletion hooks/useQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ const transformTransactions = (tx: any, address: string) => {
let messages: TransactionGroup[] = [];
let memo = tx.data.tx.body.memo ? { memo: tx.data.tx.body.memo } : {};

// Skip the transaction if it's not successful
if (tx.data.txResponse.code && tx.data.txResponse.code !== 0) {
return messages;
}

for (const message of tx.data.tx.body.messages) {
if (message['@type'] === '/cosmos.group.v1.MsgSubmitProposal') {
for (const nestedMessage of message.messages) {
Expand Down Expand Up @@ -863,7 +868,6 @@ export const useGetFilteredTxAndSuccessfulProposals = (
const transactions = dataResponse.data
.flatMap((tx: any) => transformTransactions(tx, address))
.filter((tx: any) => tx !== null)
// Add secondary JS sort
.sort((a: any, b: any) => {
// Sort by timestamp descending (newest first)
const dateComparison =
Expand Down

0 comments on commit 25d1d60

Please sign in to comment.