-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use market data service for STX balances
- Loading branch information
1 parent
8bb0059
commit 25bc879
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
apps/mobile/src/queries/market-data/stx-market-data.query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { QueryFunctionContext, useQuery } from '@tanstack/react-query'; | ||
|
||
import { getMarketDataService } from '@leather.io/services'; | ||
import { oneMinInMs } from '@leather.io/utils'; | ||
|
||
export function createStxMarketDataQueryOptions() { | ||
return { | ||
queryKey: ['market-data-service-get-stx-market-data'], | ||
queryFn: ({ signal }: QueryFunctionContext) => getMarketDataService().getStxMarketData(signal), | ||
refetchOnReconnect: false, | ||
refetchOnWindowFocus: false, | ||
refetchOnMount: false, | ||
retryOnMount: false, | ||
staleTime: oneMinInMs, | ||
gcTime: oneMinInMs, | ||
} as const; | ||
} | ||
|
||
export function useStxMarketDataQuery() { | ||
return useQuery(createStxMarketDataQueryOptions()); | ||
} |