/** * Copyright (c) TonTech. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { getNftQueryOptions } from '@ton/appkit/queries'; import type { GetNftData, GetNftErrorType, GetNftQueryConfig } from '@ton/appkit/queries'; import { useAppKit } from '../../settings'; import { useQuery } from '../../../libs/query'; import type { UseQueryReturnType } from '../../../libs/query'; import { useNetwork } from '../../network'; export type UseNftParameters = GetNftQueryConfig; export type UseNftReturnType = UseQueryReturnType; /** * Hook to get a single NFT */ export const useNft = ( parameters: UseNftParameters = {}, ): UseNftReturnType => { const appKit = useAppKit(); const walletNetwork = useNetwork(); return useQuery(getNftQueryOptions(appKit, { ...parameters, network: parameters.network ?? walletNetwork })); };