import { CASINO_GAME_TYPE } from "@betswirl/sdk-core"; import { useWaitForTransactionReceipt, useWriteContract } from "wagmi"; import { IBetStrategy } from "../types/betStrategy"; import { BetStatus, GameChoice, GameDefinition, GameResult, TokenWithImage } from "../types/types"; export interface IUsePlaceBetReturn { placeBet: (betAmount: bigint, choice: T) => Promise; betStatus: BetStatus; isWaiting: boolean; isError: unknown; gameResult: GameResult | null; resetBetState: () => void; vrfFees: bigint; gasPrice: bigint; formattedVrfFees: number; wagerWriteHook: ReturnType; wagerWaitingHook: ReturnType; } /** * Handles the complete bet placement flow from transaction to result. * Manages transaction submission, VRF fee estimation, and result monitoring. * * @internal This is a low-level hook used internally by useGameLogic. * For most use cases, use useGameLogic instead which handles strategy creation automatically. * * @param game - Type of casino game being played * @param token - Token being used for the bet (for display and balance purposes) * @param refetchBalance - Callback to refresh user balance after bet * @param gameDefinition - Game-specific configuration and encoding logic * @param strategy - Strategy object that handles bet transaction preparation * @returns Bet placement functions and state including status, VRF fees, and results * * @example * ```ts * // This hook is used internally by useGameLogic * // For typical usage, see useGameLogic documentation * * const betStrategy = useMemo(() => { * if (!address) return undefined * * return createPaidBetStrategy({ * token, * affiliate: getAffiliateForChain(chainId), * connectedAddress: address, * chainId * }) * }, [token, address, chainId]) * * const { placeBet, betStatus, gameResult } = usePlaceBet( * CASINO_GAME_TYPE.DICE, * token, * refetchBalance, * gameDefinition, * betStrategy * ) * * await placeBet(parseEther('0.1'), 3) * * if (betStatus === 'success') { * console.log('You', gameResult.isWin ? 'won' : 'lost') * } * ``` */ export declare function usePlaceBet(game: CASINO_GAME_TYPE | undefined, token: TokenWithImage | undefined, refetchBalance: () => void, gameDefinition?: GameDefinition, strategy?: IBetStrategy): IUsePlaceBetReturn;