From 65b990accd14fc2e615e1483f7b9eeba09456d41 Mon Sep 17 00:00:00 2001 From: aramalipoor Date: Sun, 2 Oct 2022 22:29:02 +0200 Subject: [PATCH] fix: correctly deserialize bignumber --- packages/react/src/common/providers/CommonProvider.tsx | 5 ++++- .../react/src/modules/tiered-sales/hooks/useSaleTiers.ts | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/react/src/common/providers/CommonProvider.tsx b/packages/react/src/common/providers/CommonProvider.tsx index 54c4b4242..2bd2059e3 100644 --- a/packages/react/src/common/providers/CommonProvider.tsx +++ b/packages/react/src/common/providers/CommonProvider.tsx @@ -1,12 +1,15 @@ import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { persistQueryClient } from '@tanstack/react-query-persist-client'; +import { deserialize, serialize } from 'wagmi'; const localStoragePersister = typeof window !== 'undefined' ? createSyncStoragePersister({ key: 'flair.cache', storage: window.localStorage, + serialize, + deserialize, }) : undefined; @@ -15,7 +18,7 @@ const queryClient = new QueryClient({ queries: { cacheTime: 1_000 * 60 * 60 * 24, staleTime: 1_000 * 60 * 60 * 2, - // networkMode: 'offlineFirst', + networkMode: 'offlineFirst', refetchOnWindowFocus: false, refetchOnMount: false, refetchOnReconnect: false, diff --git a/packages/react/src/modules/tiered-sales/hooks/useSaleTiers.ts b/packages/react/src/modules/tiered-sales/hooks/useSaleTiers.ts index 39487031b..2662cf1a8 100644 --- a/packages/react/src/modules/tiered-sales/hooks/useSaleTiers.ts +++ b/packages/react/src/modules/tiered-sales/hooks/useSaleTiers.ts @@ -118,8 +118,10 @@ export const useSaleTiers = ({ isActive, hasAllowlist, isAllowlisted, - eligibleAmount, - remainingSupply, + eligibleAmount: eligibleAmount ? eligibleAmount.toString() : undefined, + remainingSupply: remainingSupply + ? remainingSupply.toString() + : undefined, isEligible: eligibleAmount !== undefined ? BigNumber.from(eligibleAmount).gt(0)