@ape.swap/bonds-sdk 5.0.7-test.0 → 5.0.7-test.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -48734,20 +48734,20 @@ const fetchUserOwnedBills = async (chainId, account, bonds, tokenPrices, priceAp
48734
48734
  };
48735
48735
 
48736
48736
  function useTokenPrices() {
48737
- var _a, _b;
48738
- const SDKConfig = useSDKConfig();
48739
- const priceApi = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.priceApi;
48740
- const apiv2 = (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _b === void 0 ? void 0 : _b.apiV2;
48737
+ const queryClient = useQueryClient();
48741
48738
  return useQuery({
48742
48739
  queryKey: [QUERY_KEYS.TOKEN_PRICES],
48743
- queryFn: () => getTokenPrices(priceApi, apiv2),
48740
+ queryFn: () => getTokenPrices(queryClient),
48744
48741
  refetchInterval: 30000, // 30 sec
48745
48742
  refetchOnMount: false,
48746
48743
  refetchOnWindowFocus: false,
48747
48744
  enabled: typeof window !== 'undefined',
48748
48745
  });
48749
48746
  }
48750
- const getTokenPrices = async (priceApi, apiv2) => {
48747
+ const getTokenPrices = async (queryClient) => {
48748
+ const { urls } = queryClient === null || queryClient === void 0 ? void 0 : queryClient.getQueryData([QUERY_KEYS.SDK_CONFIG]);
48749
+ const apiv2 = urls['apiV2'];
48750
+ const priceApi = urls['priceApi'];
48751
48751
  try {
48752
48752
  const response = await axios.get(`${priceApi}/realtime/prices`);
48753
48753
  return response.data;
@@ -1,4 +1,4 @@
1
- import { UseQueryResult } from '@tanstack/react-query';
1
+ import { QueryClient, UseQueryResult } from '@tanstack/react-query';
2
2
  import { ChainId } from '@ape.swap/apeswap-lists';
3
3
  export interface TokenPrices {
4
4
  chainId: ChainId;
@@ -12,4 +12,4 @@ export interface TokenPrices {
12
12
  secondsAgoUpdated: number;
13
13
  }
14
14
  export default function useTokenPrices(): UseQueryResult<Partial<Record<ChainId, TokenPrices[]>>>;
15
- export declare const getTokenPrices: (priceApi: string, apiv2: string) => Promise<Partial<Record<ChainId, TokenPrices[]>>>;
15
+ export declare const getTokenPrices: (queryClient: QueryClient) => Promise<Partial<Record<ChainId, TokenPrices[]>>>;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "5.0.7-test.0",
6
+ "version": "5.0.7-test.2",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",