Comment on page
Genie API
Returns the reward information of a user in a particular campaign, including the encrypted message payload required to claim from the campaign contract.
:address
: the address of the claimer or user:contract
: the contract address of the campaign
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
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
Such a response can be expected if:
- The given contract address does not correspond to a valid Genie campaign
We will now show an example flow using the following example values:
- Claimer address:
the_claimer
- Campaign contract address:
the_contract
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:{
"contractPayload": "eyJjbGFSJ9", // shortened for brevity
"rewardAssetType": "token",
"reward": {
"assetId": "uosmo",
"symbol": "OSMO",
"decimals": 6,
"totalReward": [0, 123, 456, 0]
}
}
Using the
contractPayload
field above, you can then form the wasm execute message that should be sent to the campaign contract:{
"claim": {
"payload": "eyJjbGFSJ9"
}
}
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:{
"contractPayload": "eyJjbGFSJ9", // shortened for brevity
"rewardAssetType": "token",
"reward": {
"assetId": "uosmo",
"symbol": "OSMO",
"decimals": 6,
"lootboxInfo": [3, 1]
}
}
Using the
contractPayload
field above, you can then form the wasm execute message that should be sent to the campaign contract:{
"claim": {
"payload": "eyJjbGFSJ9"
}
}
The number of opened lootboxes is stored on the campaign contract. You will need to query the contract with the following message:
{
"user_lootbox_info": {
"address": "REPLACE_CLAIMER_ADDRESS_HERE"
}
}
This will return the following message, describing the number of lootboxes that the user has opened/claimed:
{
"claimed_lootbox": [1, 0]
}
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 modified 18d ago