Skip to main content

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

  • playerAddress
  • coinType
  • stake
  • side: '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.
  • metadata is optional and gets encoded into the keys and values arrays used on-chain.
  • if the client was registered with suigar({ partner: '0x...' }), partner attribution is added automatically