Skip to content

Commit

Permalink
fix: fetch safe overviews including untrusted token fiatTotal (#4495)
Browse files Browse the repository at this point in the history
* fix: fetch safe overviews including untrusted token fiatTotal

* test: fix safeOverviews.test.ts

* chore: add comment explaining why trusted needs to be false
  • Loading branch information
schmanu authored Nov 22, 2024
1 parent 74a7e24 commit 43d158f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/store/__tests__/safeOverviews.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('safeOverviews', () => {
],
{
currency: 'usd',
trusted: true,
trusted: false,
exclude_spam: true,
},
)
Expand Down Expand Up @@ -344,12 +344,12 @@ describe('safeOverviews', () => {
expect(mockedGetSafeOverviews).toHaveBeenCalledTimes(2)
expect(mockedGetSafeOverviews).toHaveBeenCalledWith(
request.safes.slice(0, 10).map((safe) => `1:${safe.address}`),
{ currency: 'usd', exclude_spam: true, trusted: true },
{ currency: 'usd', exclude_spam: true, trusted: false },
)

expect(mockedGetSafeOverviews).toHaveBeenCalledWith(
request.safes.slice(10).map((safe) => `1:${safe.address}`),
{ currency: 'usd', exclude_spam: true, trusted: true },
{ currency: 'usd', exclude_spam: true, trusted: false },
)
})
})
Expand Down
6 changes: 5 additions & 1 deletion src/store/api/gateway/safeOverviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ class SafeOverviewFetcher {
currency: string
}) {
return await getSafeOverviews(safeIds, {
trusted: true,
/**
* This flag can only be set once for all cross chain `safeIds`.
* If we set `trusted` to `true` we will get 0 as `fiatTotal` for all Safes on networks without Default tokenlists.
*/
trusted: false,
exclude_spam: true,
currency,
wallet_address: walletAddress,
Expand Down

0 comments on commit 43d158f

Please sign in to comment.