/** * 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 { getStakingQuoteQueryOptions } from '@ton/appkit/queries'; import type { GetStakingQuoteData, GetStakingQuoteErrorType, GetStakingQuoteQueryConfig } 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 UseStakingQuoteParameters = GetStakingQuoteQueryConfig; export type UseStakingQuoteReturnType = UseQueryReturnType< selectData, GetStakingQuoteErrorType >; /** * Hook to get staking/unstaking quote */ export const useStakingQuote = ( parameters: UseStakingQuoteParameters = {}, ): UseStakingQuoteReturnType => { const appKit = useAppKit(); const walletNetwork = useNetwork(); return useQuery( getStakingQuoteQueryOptions(appKit, { ...parameters, network: parameters.network ?? walletNetwork }), ); };