Coinflip
Use Coinflip when you want to build a standard heads-or-tails wager.
What the builder does
createBetTransaction('coinflip', options) builds the Move call for Suigar Coinflip and sends the reward object back to playerAddress.
Required options
playerAddresscoinTypestakeside:'heads' | 'tails'
Example
const tx = client.suigar.tx.createBetTransaction('coinflip', {
playerAddress: '0x123',
coinType: '0x2::sui::SUI',
stake: 1_000_000_000n,
side: 'tails',
});
Notes
side: 'tails'is converted by the SDK into the boolean expected by the contract call.metadatais optional and gets encoded into thekeysandvaluesarrays used on-chain.- if the client was registered with
suigar({ partner: '0x...' }), partner attribution is added automatically