💰
Megapot
  • Overview
    • About Megapot
    • How to play
    • How to provide liquidity
    • How to refer users
    • Earn as a liquidity provider
    • About the Team
    • Megapoints
  • Deep dive
    • Components
    • System Diagram
    • Smart Contract
    • Provably Fair
  • Developers
    • Start Here
    • Add jackpot to your site
      • Custom Integration
        • Getting Started
        • Contract Functions
        • Jackpot Page
        • LP Deposit Page
        • History Page
      • React UI Kit
        • MegapotProvider
        • Jackpot
        • useJackpot
    • Sybil-resistant incentives
    • Launch jackpot in your token
    • Developer Reference
      • Testnet & Mainnet
      • Contract Overview & Functions
      • Megapot API
      • Megapot Examples
      • How to Earn Fees
      • Brand Kit
  • Appendix
    • VIP Program
    • FAQ
    • About Megapot
  • Terms of Service
  • Privacy Policy
  • Responsible Gaming
Powered by GitBook
On this page
  • Usage
  • Parameters
  • Return type
  1. Developers
  2. Add jackpot to your site
  3. React UI Kit

useJackpot

A React hook that fetches and calculates jackpot-related information from a smart contract.

Usage

import {
  Jackpot,
  JACKPOT,
  MainnetJackpotName,
} from "@coordinationlabs/megapot-ui-kit";

const {
        isLoading,
        ticketsSold,
        endTime,
        ticketPrice,
        prizeInTokens,
        prizeInUSD,
        ticketPriceInUSD,
        totalTicket,
        error,
    }
= useJackpot({
    contract: JACKPOT[chainId][MainnetJackpotName.USDC] as JackpotInfo,
});

Parameters

Name
Type
Description

contract

Object containing contract information

tokenPrice

number

Optional override for token price

Return type

Property
Type
Description

isLoading

boolean

Indicates if the data is being loaded

ticketsSold

number

Number of tickets sold in the current round

endTime

number

Timestamp (in milliseconds) when the current round ends

ticketPrice

number

Price of one ticket in token units

prizeInTokens

number

Current prize pool size in tokens

prizeInUSD

number

Current prize pool size in USD

ticketPriceInUSD

number

Price of one ticket in USD

totalTicket

number

Maximum number of tickets that can be sold

error

any

Error information if any request fails

PreviousJackpotNextSybil-resistant incentives

Last updated 2 months ago

JackpotInfo