From 43d158f74c00ce849b7a7ce000dea3b637639f1e Mon Sep 17 00:00:00 2001 From: Manuel Gellfart Date: Fri, 22 Nov 2024 21:47:44 +0700 Subject: [PATCH] fix: fetch safe overviews including untrusted token fiatTotal (#4495) * fix: fetch safe overviews including untrusted token fiatTotal * test: fix safeOverviews.test.ts * chore: add comment explaining why trusted needs to be false --- src/store/__tests__/safeOverviews.test.ts | 6 +++--- src/store/api/gateway/safeOverviews.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/store/__tests__/safeOverviews.test.ts b/src/store/__tests__/safeOverviews.test.ts index 45baf52bfe..dab26c3159 100644 --- a/src/store/__tests__/safeOverviews.test.ts +++ b/src/store/__tests__/safeOverviews.test.ts @@ -175,7 +175,7 @@ describe('safeOverviews', () => { ], { currency: 'usd', - trusted: true, + trusted: false, exclude_spam: true, }, ) @@ -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 }, ) }) }) diff --git a/src/store/api/gateway/safeOverviews.ts b/src/store/api/gateway/safeOverviews.ts index 852ec14a00..d781eedd0f 100644 --- a/src/store/api/gateway/safeOverviews.ts +++ b/src/store/api/gateway/safeOverviews.ts @@ -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,