Dice
Properties:
interface TemplateWithWeb3Props extends BaseGameProps {
options: DiceTemplateOptions;
minWager?: number;
maxWager?: number;
hideBetHistory?: boolean;
onAnimationStep?: (step: number) => void;
onAnimationCompleted?: (result: DiceGameResult[]) => void;
}Example:
'use client';
import { useModalsStore, useToast } from '@winrlabs/ui';
import { DiceGame } from '@winrlabs/web3-games';
import { GameType } from '@winrlabs/games';
export default function DicePage() {
const { toast } = useToast();
const { checkProgressChanges } = useProgressCheck();
const { openModal } = useModalsStore();
const { minWager, maxWager } = useGetWagerInfo(GameType.RANGE);
return (
<>
<DiceGame
options={{
scene: {
background: 'url(/images/game-assets/coin-flip/coin-flip-bg.png)',
},
}}
onAnimationCompleted={() => {
checkProgressChanges();
refetchHistory();
}}
onError={(e) => {
toast({
title: 'Error',
description: e || 'An error occurred',
});
}}
onLogin={() => openModal('login')}
minWager={minWager}
maxWager={maxWager}
/>
</>
);
}