placeBet is the core SDK action. It encrypts the user’s stake and chosen outcome using Arcium’s x25519 + RescueCipher scheme, bundles the deposit and MPC queue instructions into a single transaction, waits for the Arcium callback to finalize entry odds, then returns the result.
TypeScript
Parameters
Transaction fee payer and rent payer. Usually the connected wallet public key.
The bettor whose position PDA is created. The position is keyed on
user, not payer - in relay flows these can differ. Usually user === payer.Numeric market ID (the
marketId field on MarketAccount).Outcome index to bet on.
Gross bet in micro-USDC (6 decimal places).
1_000_000n = $1.00. The SDK deducts protocol and LP fees and encrypts the net amount.Pre-generated x25519 keypair. If omitted, the SDK generates one via
createUserKeypair(). Pass one only if you created and stored it before calling placeBet (e.g., for a pre-flight UX that shows the keypair to the user first).Arcium computation slot offset. Random by default. Override for testing or retry correlation.
Milliseconds to wait for the Arcium callback. Defaults to the SDK global (
60_000). Set higher for slow network conditions.Called at each stage of the flow. Useful for driving a live status UI.See the progress stages table below.
Return value
Base58 transaction signature of the bet + queue transaction.
The x25519 keypair used to encrypt the bet.
privateKey is a Uint8Array - persist it immediately.The position index assigned to this bet. Users who place multiple bets on the same market get incrementing indices (
0n, 1n, 2n, …). Pass this to saveSecret, claimPayout, and claimRefund.The position account refetched after the callback ran.
null on very rare RPC slowness - the funds are always safe.Raw Arcium computation result. Contains
computationOffset and callback slot info. Useful for debugging.The Arcium computation slot offset used for this bet.
Progress stages
TheonProgress callback fires at each of these stages:
Persisting the private key
The bet position is fully encrypted on-chain. The only way to display the bet side or stake in your UI later is to re-derive the RescueCipher using the original private key. Store it using the same key format the website uses:TypeScript
Multi-bet support
Each user can hold multiple positions per market. The SDK auto-readsuser_state.next_bet_index before each bet and retries up to 3 times on concurrent-bet conflicts. You do not need to track betIndex yourself before calling placeBet.
TypeScript