/** * 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 { getStakedBalanceQueryOptions } from '@ton/appkit/queries'; import type { GetStakedBalanceData, GetStakedBalanceErrorType, GetStakedBalanceQueryConfig } 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 UseStakedBalanceParameters = GetStakedBalanceQueryConfig; export type UseStakedBalanceReturnType = UseQueryReturnType< selectData, GetStakedBalanceErrorType >; /** * Hook to get user's staked balance */ export const useStakedBalance = ( parameters: UseStakedBalanceParameters = {}, ): UseStakedBalanceReturnType => { const appKit = useAppKit(); const walletNetwork = useNetwork(); return useQuery( getStakedBalanceQueryOptions(appKit, { ...parameters, network: parameters.network ?? walletNetwork }), ); };