Please refer to the documentation website for a thorough guide on all Envio indexer features
pnpm dev
pnpm codegen
Envio's hosted service is tightly integrated with github. To deploy this indexer:
- Login to envio.dev/app/login
- Add your github organisation
- Connect your repo (likely a fork of this repo)
- Configure the indexer settings
- Select your plan and follow stripe payment instructions
- Push to deploy based on your specified branch
For a more detailed guide on how to deploy an indexer, please refer to the documentation website.
Visit http://localhost:8080 to see the GraphQL Playground, local password is testing
.
query MyQuery {
Trade {
tradeType
amount
ethAmount
id
token
trader
}
}
query MyQuery {
Monster {
id
name
symbol
marketCap
price
supply
experiencePoints
isInBattle
activeOpponent
}
}
query MyQuery {
Trader {
id
numberOfTrades
holdings {
balance
monster
}
}
}
query MyQuery {
Trader {
points
}
}
query MyQuery {
Trader {
id
trades {
tradeType
amount
token
}
}
}
query MyQuery {
Monster(where: {id: {_eq: "0xEcE0d869b88fb1Daf726609990C8244d2b9A400D"}}) {
id
marketCap
}
}
query MyQuery {
MarketCapSnapshot(where: {monster: {_eq: "0xEcE0d869b88fb1Daf726609990C8244d2b9A400D"}, _and: {timestamp: {_lte: "$timestampOf24HoursAgo"}}}, limit: 1, order_by: {timestamp: desc}) {
marketCap
}
}
query MyQuery {
Monster(where: {id: {_eq: "0xEcE0d869b88fb1Daf726609990C8244d2b9A400D"}}) {
id
totalVolumeTraded
}
}
query MyQuery {
TotalVolumeTradedSnapshot(where: {monster: {_eq: "0xEcE0d869b88fb1Daf726609990C8244d2b9A400D"}, _and: {timestamp: {_lte: "$timestampOf24HoursAgo"}}}, limit: 1, order_by: {timestamp: desc}) {
totalVolumeTraded
}
}
query MyQuery {
Monster(where: {id: {_eq: "0xEcE0d869b88fb1Daf726609990C8244d2b9A400D"}}) {
id
winLoseRatio
}
}
- Current market cap: For each monster get the current price & multiply by traders current holdings balance
query MyQuery {
Monster {
id
price
}
}
query MyQuery {
Trader {
id
holdings {
monster {
id
}
balance
}
}
}
- 24 Hours ago market cap: For each monster sum the marketCap
query MyQuery {
Monster {
id
}
}
query MyQuery {
Trader(where: {id: {_eq: "0x8c0686723804A0B7201151852C94Bd17DD043C21"}}) {
id
holdingsSnapshots(where: {timestamp: {_lte: 1741371238}, _and: {monster_id: {_eq: "0xEcE0d869b88fb1Daf726609990C8244d2b9A400D"}}}, limit: 1, order_by: {timestamp: desc}) {
marketCap
monster {
id
}
}
}
}
Where absolute profit = total holdings sales value - (total holdings cost value - current holdings value) Where absolute profit = totalHoldingsSales - (totalHoldingsCost - marketCap) A negative value indicating a loss
query MyQuery {
Trader {
id
holdings {
totalHoldingsCost
totalHoldingsSales
marketCap
}
}
}
Take the sum of the ethAmountPurchased for all the whitelistPurchaseSnapshots where the timestamp is greater than the current timestamp minus 24 hours
Note: In the rare case the user has done > 1000 whitelist purchases in the last 24 hour period, this query will need to be paginated ie set offset and limit and fetch data in 1000 data points per request. Since this is a very odd occurrence, you could inaccurately assume that if a user has done > 1000 whitelist purchases in the last 24 hours that they have exceeded the 0.1 eth limit.
query MyQuery {
WhitelistPurchaseSnapshot(where: {trader: {_eq: "0x8c0686723804A0B7201151852C94Bd17DD043C21"}, _and: {monster_id: {_eq: "0x8Bd6e4fa6D9cc89656dC20A3F092C03BD9543FB7"}, _and: {timestamp: {_gt: $nowLess24Hours}}}}) {
ethAmountPurchased
trader
monster_id
}
}