This helper API allows for quick access to jackpot data. It's useful for anyone adding our jackpot to their site, offering tickets as an incentive, or launching a custom jackpot in their token.
API Key
To use the Megapot API, you will need an API key. Get one by contacting us on our .
Usage
Simply attach the API key to your url params or in a request header for access to the below endpoints.
URL Params
An easy to use method which allows you to append the api key to your request URL using ?apikey=<your api key>
Example: https://api.megapot.io/api/v1/jackpot-round-stats/active?apikey=<your api key>
Request Headers
You can also add your api key to your client's request headers. This is the preferred method as it will keep the api key out of your url and most logging services.
Use the header apikey: <your api key> for these requests. See the Axios example below:
axios.get('https://api.megapot.io/api/v1/jackpot-round-stats/active', {
headers: {'apikey': 'your api key'},
});
Endpoints
Current jackpot info: Get the current Megapot prize pool, end time, and more. Highly performant.
User ticket history: Get all of a user's Megapot ticket purchases
Jackpot info: Get all info for a given jackpot contract
Jackpot history: Get all ticket purchases and wins for a given jackpot contract
Active Jackpot Stats
Retrieve stats about the active Megapot jackpot round. Highly performant since we cache this data and update it per minute.
prizeUsd: The amount in USDC of the current jackpot prize pool.
endTimestamp: At what time the jackpot is able to be run. NOTE The jackpot is ran manually through cron jobs, the exact time may differ. This time is when the contract will allow the jackpot to be processed.
oddsPerTicket: This is the odds a single ticket will win. 1 in oddsPerTicket. You can divide this number by the amount of tickets purchased to get the odds for all tickets purchased by a user.
ticketPrice: The amount in Szabo units. USDC uses 6 decimals, 1_000_000 is the same as 1 USDC.
ticketsSoldCount: Amount of tickets purchased by users so far this round.
lastTicketPurchaseBlockNumber: Block number of the latest ticket purchase.
lastTicketPurchaseCount: Amount of tickets purchased in the latest ticket purchase.
lastTicketPurchaseTimestamp: Timestamp of the latest ticket purchase.
lastTicketPurchaseTxHash: Transaction hash of the latest ticket purchase.
lpPoolTotalBps: The amount of USDC in Szabo units of the current jackpot. prizeUsd is derived from this value (prizeUsd / 10 ** 6)
userPoolTotalBps: The amount of USDC in Szabo units from ticket purchases this round.
feeBps: The amount of fees in basis points taken from each ticket sale to pay LPs/Referrers.
referralFeeBps: The amount of fees in basis points a referrer will earn per ticket sale. If a ticket purchase is referred, a value of 1000 means 10% goes to the referrer and 20% to the LPs. The LP fees is determined by the feeBps - referralFeeBps.
activeLps: The amount of LPs wallets currently active this round.
activePlayers: Unique player wallets currently active this round.
User Ticket History
Get a user's ticket purchases for the Megapot Jackpot
Get current jackpot data for a given contract address. This is slower than the active jackpot stats API, as this one fetches it live from the contract on your behalf.