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

Last updated