mirror of
https://github.com/lux-tel/websites.git
synced 2026-10-30 20:31:36 +00:00
28 lines
719 B
TypeScript
28 lines
719 B
TypeScript
'use client';
|
|
|
|
import type { ReadContractData } from 'wagmi/query';
|
|
import type { RewardRatePoolAbi } from '../abis';
|
|
import { type ContractReadQueryProps, useContractReadQuery } from './useContractReadQuery';
|
|
import { useChain } from './useChain';
|
|
|
|
type RewardRate = ReadContractData<typeof RewardRatePoolAbi, 'rewardRate', []>;
|
|
|
|
export type RewardRateQuery = ContractReadQueryProps & {
|
|
/** The reward rate */
|
|
rewardRate: RewardRate;
|
|
};
|
|
|
|
export function useRewardRateQuery(): RewardRateQuery {
|
|
const chain = useChain();
|
|
const { data: rewardRate, ...rest } = useContractReadQuery({
|
|
contract: 'RewardRatePool',
|
|
functionName: 'rewardRate',
|
|
chain,
|
|
});
|
|
|
|
return {
|
|
rewardRate,
|
|
...rest,
|
|
};
|
|
}
|