SDK
The Suigar SDK is the TypeScript package that helps integrators build valid Suigar v2 game transactions on Sui without manually assembling each Move call.
GitHub: Suigar SDK repository Playground: playground.suigar.com
Partner integrations
If you are a Suigar partner, this is the setup to follow.
Register the SDK with your partner wallet address before building any transaction:
import { SuiGrpcClient } from '@mysten/sui/grpc';
import { suigar } from '@suigar/sdk';
const client = new SuiGrpcClient({
baseUrl: 'https://fullnode.mainnet.sui.io:443',
network: 'mainnet',
}).$extend(
suigar({
partner: '0xpartner_wallet_address',
}),
);
Partner rule:
- always configure
partnerduring extension registration - always pass the partner wallet address
- never pass a slug, project name, or display label
- never try to inject partner attribution manually in each builder call
Why this is the recommended setup:
- partner attribution is injected automatically into supported onchain metadata
- the same partner configuration is reused for standard and PvP flows
- reserved metadata keys such as
partnerandreferrerare ignored when passed manually
What has shipped so far
The current SDK project already includes:
- network-aware config for
mainnetandtestnet - standard game builders for Coinflip, Limbo, Plinko, Range, and Wheel
- PvP Coinflip create, join, cancel, and unresolved-lobby lookup helpers
- public
@suigar/sdk/gamesexports for shared game option types - public
@suigar/sdk/utilsexports for parser and numeric helpers - generated BCS event parsers for standard and PvP game flows
- automatic partner metadata injection when the extension is registered with a partner wallet
- a live integration example and playground flow you can test at playground.suigar.com
What the SDK does
- Registers a Suigar extension on top of a Sui client.
- Resolves the right Suigar package ids for
mainnetandtestnet. - Resolves supported coin types and matching price info object ids.
- Builds ready-to-send
Transactionobjects for Suigar games. - Encodes optional metadata into the byte arrays expected by the contracts.
- Exposes BCS event structs for decoding game result events.
- Can serialize built transactions to base64 when a wallet or backend expects that format.
What you get at runtime
After registering the extension, the main runtime surface is:
client.suigar.getConfig()client.suigar.serializeTransactionToBase64(transaction, options?)client.suigar.getPvPCoinflipGames(options?)client.suigar.resolvePvPConflipGame(gameId, options?)client.suigar.bcsclient.suigar.tx
Supported game flows
Standard bet builders:
PvP flow:
Integration flow
- Install the SDK and Sui peer dependencies.
- Create a Sui client on
mainnetortestnet. - If you are a partner, register the extension with
suigar({ partner: '0xpartner_wallet_address' })before building anything. - Build a game transaction with
client.suigar.tx. - Sign and execute the transaction, or serialize it to base64 for another signer.
Continue with the full integration guide.