hiCity-nft/src/views/Board/hooks/useHarvestBoard.ts

16 lines
439 B
TypeScript

import { useCallback } from 'react'
import { harvestBoard } from 'utils/calls'
import { useBoardchef } from 'hooks/useContract'
const useHarvestBoard = (boardPid: number) => {
const boardChefContract = useBoardchef(boardPid)
const handleHarvest = useCallback(async () => {
await harvestBoard(boardChefContract, boardPid)
}, [boardPid, boardChefContract])
return { onReward: handleHarvest }
}
export default useHarvestBoard