Scorefam’s Whitepaper
  • 👋About Scorefam
  • Scorefam Ecosystem
    • PredictPro
    • X-Predict
    • Lossless Sportsbook
  • FEATURE ADDONS
    • Genius AI Agent (v1.0.0)
  • Rewards
    • ⏺️Scorefam Points
    • 🔥Daily Streak Bonus
    • 🪙Preliminary SFT ($PSFT)
  • AFFILIATE PROGRAM
    • 🧰How it works
    • Become an Icon
  • Token (SFT)
    • 📚Token Utility
    • ⚖️Tokenomics
  • 🔗Website
  • ✖️Twitter
  • 🇸🇴Telegram
  • 🛖GitHub
  • Appendix
    • Developer Integration (PredictPro SDK)
      • 🛫Welcome
      • 🛫Initialization
      • Wallet Connection
      • Fetching Fixtures and Odds
        • Fetch Filtered Fixtures
        • Fetch Odds
        • Fetch Correct Scores
        • Fetch Home, Draw & Away Odds
      • Tournaments
        • Register
        • Current Tournament ID
        • Play Game
        • Get Tournament
      • Rewards
      • Leaderboard
        • Get Leaderboard
        • Get Formatted Leaderboard
      • Operator Revenue Share
      • Example Usage
Powered by GitBook
On this page
Export as PDF
  1. Appendix
  2. Developer Integration (PredictPro SDK)

Example Usage

Complete Example: Register and Predict

This example demonstrates how to register for a tournament and make a prediction.

(async () => {
    const providerUrl = "https://mainnet.infura.io/v3/YOUR_INFURA_KEY";
    const sdk = new PredictProSDK(providerUrl, "0xPredictProAddress", predictProABI, usdbABI, {
        baseUrl: "https://api.example.com",
        apiKey: "API_KEY"
    });

    // Connect wallet
    await sdk.connectWithProvider(window.ethereum);

    // Register for a tournament
    console.log("Registering...");
    const registerTx = await sdk.register(5, "0xOperatorAddress...");
    console.log("Registration successful:", registerTx);

    // Fetch current tournament ID
    const tournamentID = await sdk.currentTournamentID();
    console.log("Current Tournament ID:", tournamentID);

    // Make a prediction
    console.log("Making a prediction...");
    const predictionTx = await sdk.playGame(
        tournamentID,
        [123, 2, 1, 1672531200, 1.5],
        {
            fixtureID: 123,
            homeOdds: 2.1,
            drawOdds: 3.2,
            awayOdds: 4.3,
            totalPotentialOdds: 1.5
        }
    );
    console.log("Prediction successful:", predictionTx);
})();

Sample Output

{
  "Registration successful": {
    "status": true,
    "transactionHash": "0x123..."
  },
  "Current Tournament ID": 1,
  "Prediction successful": {
    "status": true,
    "transactionHash": "0x456..."
  }
}

PreviousOperator Revenue Share

Last updated 3 months ago