Genie API
To use this API, you must be whitelisted by the team. Please reach out to us on Telegram (https://t.me/coinhall_org) for more information.
Get Reward Information
GET
https://api.seer.coinhall.org/api/genie/v2/claimers/:address/claims/:contract
Returns the reward information of a user in a particular campaign, including the encrypted message payload required to claim from the campaign contract.
Request Path Parameters
:address
: the address of the claimer or user:contract
: the contract address of the campaign
Responses
Success (200 OK)
Returns a JSON with the following fields:
contractPayload
: the payload that the user should pass to the campaign contract when executing the claim txrewardAssetType
: can be eithertoken
orlootbox
and determines the return type of thereward
fieldreward
: an object containing the following fields:assetId
: the contract address or denom of the reward assetsymbol
: the symbol/ticker of the reward assetdecimals
: the number of decimals of the reward assettotalReward
[only present ifrewardAssetType
istoken
]: an array where each number represents the unclaimed rewards for each missionlootboxInfo
[only present ifrewardsAssetType
islootbox
]: an array where each number represents the total number of lootboxes earned for each mission
Error (401 Unauthorized)
Such a response can be expected if:
This API is called outside of the campaign's claim period
The claimer is not eligible for the campaign
The claimer does not have any pending rewards to claim
Error (401 Unauthorized)
Such a response can be expected if:
The given contract address does not correspond to a valid Genie campaign
Examples
We will now show an example flow using the following example values:
Claimer address:
the_claimer
Campaign contract address:
the_contract
Claiming Tokens
Firstly, make a GET request to the endpoint: https://api.seer.coinhall.org/api/genie/v2/claimers/the_claimer/claims/the_contract
. If successful, you will receive the following example response:
Using the contractPayload
field above, you can then form the wasm execute message that should be sent to the campaign contract:
Claiming Lootboxes
Firstly, make a GET request to the endpoint: https://api.seer.coinhall.org/api/genie/v2/claimers/the_claimer/claims/the_contract
. If successful, you will receive the following example response:
Using the contractPayload
field above, you can then form the wasm execute message that should be sent to the campaign contract:
FAQs
Since the API returns the total number of lootboxes that the user has earned, how do I get the number of unopened lootboxes that the user currently has?
The number of opened lootboxes is stored on the campaign contract. You will need to query the contract with the following message:
This will return the following message, describing the number of lootboxes that the user has opened/claimed:
Subtract the total number of lootboxes from the API with the result we just queried from the contract to get the number of pending lootboxes that the user can claim. For example, if the reward.lootboxInfo
from the API is [3, 1]
, then the result will be [3, 1] - [1, 0] = [2, 1]
, where there is two unopened lootboxes for mission 1 and one unopened lootbox for mission 2.
Last updated