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

20 lines
487 B
TypeScript

import { useCallback } from 'react'
import { stakeBoard } from 'utils/calls'
import { useBoardchef } from 'hooks/useContract'
const useStakeBoard = (pid: number) => {
const boardChefContract = useBoardchef(pid)
const handleStake = useCallback(
async (amount: string) => {
const txHash = await stakeBoard(boardChefContract, pid, amount)
console.info(txHash)
},
[boardChefContract, pid],
)
return { onStake: handleStake }
}
export default useStakeBoard