For Game Developers

Step-by-Step Guide:

  1. Install the SDK

    bashSalinEditnpm install @g3x/sdk
  2. Initialize the Client

    jsSalinEditimport { G3XClient } from '@g3x/sdk';
    
    const client = new G3XClient({
      nodeUrl: 'https://node.g3x.network',
      walletProvider: window.ethereum,
    });
  3. Sync Game State (Off-Chain)

    jsSalinEditclient.syncGameState({
      playerId: '0x123...',
      action: 'move',
      data: { x: 10, y: 5 },
    });
  4. Finalize Match (On-Chain)

    jsSalinEditclient.finalizeMatch({
      matchId: 'match-123',
      winner: '0xabc...',
      rewards: ['NFT', 'Token'],
    });
  5. Integrate Smart Contracts Use Solidity contracts to handle XP, rewards, NFTs, etc. Example: rewardXP(address player, uint256 amount)

Last updated