Skip to content

Commit

Permalink
Merge pull request #866 from makerdao/master
Browse files Browse the repository at this point in the history
master > develop
  • Loading branch information
tyler17 authored Apr 10, 2024
2 parents b872a78 + f076f62 commit 192e875
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pages/api/address/[address]/delegated-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ export default withApiHandler(
delegatedTo = await fetchDelegatedTo(address, network);
}

// filter out duplicate txs
// filter out duplicate txs for the same address
const txHashes = {};
const filtered = delegatedTo.filter(historyItem => {
let duplicateFound = false;
historyItem.events.forEach(event => {
if (txHashes[event.hash]) duplicateFound = true;
txHashes[event.hash] = true;
const uniqueKey = `${event.hash}-${historyItem.address}`;
if (txHashes[uniqueKey]) duplicateFound = true;
txHashes[uniqueKey] = true;
});
return !duplicateFound;
});
Expand Down

0 comments on commit 192e875

Please sign in to comment.