Loading
GraphQL Playground
{"version":"1.7.42","title":"Flair Indexing API","tabs":[{"name":"NFTs by Contract","endpoint":"https://graph.flair.dev","query":"# Example query to fetch all NFTs for a given contract\nquery {\n nfts(\n filter: {\n chainId: 1\n contractAddress: \"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"\n }\n pageSize: 10\n pageStartKey: \"\"\n ) {\n pageInfo {\n nextPageStartKey\n }\n nodes {\n chainId\n contract { address }\n tokenId\n standard\n erc721 {\n ownership {\n owner\n }\n }\n erc1155 {\n totalSupply\n totalOwners\n ownerships {\n nodes {\n owner\n amount\n }\n }\n }\n metadata {\n uri\n content\n lastUpdateAt\n }\n }\n }\n} \n","headers":{"X-API-Key":"DEMO"}},{"name":"NFTs of Owner","endpoint":"https://graph.flair.dev","query":"# Example query to fetch all NFTs for an address\nquery {\n nfts(\n filter: {\n # chainId: 1\n owner: \"0xDBfD76AF2157Dc15eE4e57F3f942bB45Ba84aF24\"\n }\n pageSize: 10\n pageStartKey: \"\"\n ) {\n pageInfo {\n nextPageStartKey\n }\n nodes {\n chainId\n contract { address }\n tokenId\n erc721 {\n mintedBlockNumber\n burnedBlockNumber\n ownership {\n owner\n }\n }\n erc1155 {\n totalSupply\n totalOwners\n ownerships {\n nodes {\n owner\n amount\n }\n }\n }\n metadata {\n uri\n content\n lastUpdateAt\n }\n }\n }\n} \n","headers":{"X-API-Key":"DEMO"}},{"name":"Single NFT","endpoint":"https://graph.flair.dev","query":"# Fetch single NFT of a given contract\nquery {\n nft(\n chainId: 1\n contractAddress: \"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"\n tokenId: \"6839\"\n ) {\n chainId\n contract { address }\n tokenId\n erc721 {\n ownership {\n owner\n }\n }\n metadata {\n uri\n content\n }\n }\n}\n","headers":{"X-API-Key":"DEMO"}},{"name":"Events of Contract","endpoint":"https://graph.flair.dev","query":"# Fetch specific events of a given contract\nquery {\n events(\n filter: {\n chainId: 1\n contractAddress: \"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"\n # Transfer(address,address,uint256):\n signatureHex: \"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n }\n pageSize: 10\n sortDirection: DESC\n ) {\n pageInfo {\n nextPageStartKey\n }\n nodes {\n chainId\n contractAddress\n blockNumber\n transactionHash\n logIndex\n signatureHex\n topic1\n topic2\n topic3\n data\n }\n }\n}"},{"name":"Transfers of Owner","endpoint":"https://graph.flair.dev","query":"# Fetch all transfers of an owner across all chains\nquery {\n transfers(\n filter: { owner: \"0x6e0c6bf243232bcfef85a88eb61062626ffc1e2a\" }\n pageSize: 10\n pageStartKey: \"\"\n sortDirection: DESC\n ) {\n nodes {\n chainId\n contractAddress\n type\n from\n to\n asset {\n ... on Nft {\n tokenId\n }\n }\n amount\n transactionHash\n blockNumber\n transactionIndex\n logIndex\n }\n }\n} \n"},{"name":"Transfers by Blocks","endpoint":"https://graph.flair.dev","query":"# Fetch transfers between block ranges\nquery {\n transfers(\n filter: {\n contractAddress: \"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"\n fromBlock: \"16520000\"\n toBlock: \"16520100\"\n }\n pageSize: 3\n pageStartKey: \"\"\n sortDirection: DESC\n ) {\n nodes {\n chainId\n contractAddress\n type\n from\n to\n asset {\n ... on Nft {\n tokenId\n }\n }\n amount\n transactionHash\n blockNumber\n transactionIndex\n logIndex\n }\n }\n}\n"},{"name":"Single Contract","endpoint":"https://graph.flair.dev","query":"# Fetch one contract by address (and NFTs total supply)\nquery {\n contract(\n chainId: 1\n address: \"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"\n ) {\n chainId\n address\n interfaces\n\n ownership {\n owner\n lastUpdateBlockNumber\n }\n\n nfts(pageSize: 2) {\n totalSupply\n totalOwners\n nodes {\n tokenId\n }\n }\n }\n}\n","headers":{"X-API-Key":"DEMO"}},{"name":"Contracts by Chain","endpoint":"https://graph.flair.dev","query":"# Example query to fetch all contracts for a given chain\nquery {\n contracts(\n filter: { chainId: 1 }\n pageSize: 10\n pageStartKey: \"\"\n ) {\n nodes {\n chainId\n address\n interfaces\n\n ownership {\n owner\n lastUpdateBlockNumber\n }\n\n nfts(pageSize: 2) {\n totalSupply\n nodes {\n tokenId\n }\n }\n }\n }\n}\n","headers":{"X-API-Key":"DEMO"}},{"name":"Import Contracts","endpoint":"https://graph.flair.dev","query":"# Import a contract with deployment and ownership information\nmutation {\n importContract(\n idempotencyKey: \"import-bored-ape-club-attempt-1\"\n chainId: 1\n contractAddresses: [\"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"]\n ) {\n id\n \n type\n request\n type\n createdAt\n \n orchestrationState\n orchestrationError\n \n actualStartBlock\n actualEndBlock\n \n blocksAttempts\n blocksScans\n blocksIngests\n blocksFailures\n transactionsScans\n transactionsIngests\n transactionsFailures\n logsScans\n logsIngests\n logsFailures\n \n contractsPuts\n contractsVisits\n contractsUpdates\n contractsFailures\n \n ownershipEventsVisits\n ownershipEventsPuts\n ownershipEventsUpdates\n ownershipEventsFailures\n \n ownershipsVisits\n ownershipsPuts\n ownershipsUpdates\n ownershipsFailures\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Backfill Contracts","endpoint":"https://graph.flair.dev","query":"# Backfill a contract from deployment time to current block\n# This operation will process all events, transfers, NFTs, etc\nmutation {\n backfillContract(\n idempotencyKey: \"backfill-bored-ape-club-attempt-1\"\n chainId: 1\n contractAddresses: [\"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"]\n matchLogCategories: [NFT, ACCESS]\n ) {\n id\n \n type\n request\n type\n createdAt\n \n orchestrationState\n orchestrationError\n \n actualStartBlock\n actualEndBlock\n \n blocksAttempts\n blocksScans\n blocksIngests\n blocksFailures\n transactionsScans\n transactionsIngests\n transactionsFailures\n logsScans\n logsIngests\n logsFailures\n \n contractsPuts\n contractsVisits\n contractsUpdates\n contractsFailures\n \n ownershipEventsVisits\n ownershipEventsPuts\n ownershipEventsUpdates\n ownershipEventsFailures\n \n ownershipsVisits\n ownershipsPuts\n ownershipsUpdates\n ownershipsFailures\n \n nftsVisits\n nftsPuts\n nftsUpdates\n nftsFailures\n \n nftsEnrichAttempts\n \n nftsMetadataVisits\n nftsMetadataUpdates\n nftsMetadataFailures\n \n mediaVisits\n mediaIngests\n mediaFailures\n\n\t\tenrichAttempts\n\t\tenrichVisits\n\t\tenrichSuccesses\n\t\tenrichFailures\n\n processorTransactionsVisits\n processorLogsIngestions\n processorHandlerSuccesses\n processorHandlerFailures\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Refresh NFT Metadata","endpoint":"https://graph.flair.dev","query":"# Refresh NFT metadata of multiple contracts and/or tokens\nmutation {\n refreshNftMetadata(\n idempotencyKey: \"metadata-refresh-bored-ape-club-attempt-1\"\n chainId: 1\n contractAddresses: [\"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"]\n skipMediaIngestion: false\n ) {\n id\n \n type\n request\n type\n createdAt\n \n orchestrationState\n orchestrationError\n \n nftsEnrichAttempts\n \n nftsMetadataVisits\n nftsMetadataUpdates\n nftsMetadataFailures\n \n mediaVisits\n mediaIngests\n mediaFailures\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Re-ingest NFT Media","endpoint":"https://graph.flair.dev","query":"# Re-download and ingest NFT media (images, animations, models) of multiple contracts and/or tokens\nmutation {\n refreshNftMedia(\n idempotencyKey: \"media-ingest-bored-ape-club-attempt-1\"\n chainId: 1\n contractAddresses: [\"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"]\n ) {\n id\n \n type\n request\n type\n createdAt\n \n orchestrationState\n orchestrationError\n \n nftsEnrichAttempts\n \n nftsMetadataVisits\n nftsMetadataUpdates\n nftsMetadataFailures\n \n mediaVisits\n mediaIngests\n mediaFailures\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Track Contract","endpoint":"https://graph.flair.dev","query":"# Add one or more contracts to filter group so the events are being tracked\nmutation {\n upsertContractsToFilterGroup(\n chainId: 5,\n contractAddresses: [\"0xbdcf4b6693e344115b951c4796e8622a66cdb728\"],\n groupId: \"my-test-group\"\n ) {\n groupId\n type\n mode\n details {\n chainId\n address\n topic\n \n anyChain\n anyAddress\n anyTopic\n }\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Un-track Contract","endpoint":"https://graph.flair.dev","query":"# Remove one or more contracts to filter group so the events are not tracked anymore\nmutation {\n removeContractsFromFilterGroup(\n chainId: 5,\n contractAddresses: [\"0xbdcf4b6693e344115b951c4796e8622a66cdb728\"],\n groupId: \"my-test-group\"\n ) {\n groupId\n type\n mode\n details {\n chainId\n address\n topic\n \n anyChain\n anyAddress\n anyTopic\n }\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Get Custom Entities","endpoint":"https://graph.flair.dev","query":"# Get entities of a specific namespace (e.g your custom processors)\nquery {\n entities(\n filter: {\n namespace: \"fuji-finance\"\n type: \"Deposit\"\n data: {\n contractAddress: \"0xd08b093b4804dec9af22f70bc35e8e132106b5c2\"\n owner: \"0xf1d62526f913b3922f198695f703fdeb76aae4f7\"\n }\n fromBlock: \"8121060\"\n toBlock: \"8121065\"\n }\n ) {\n pageInfo {\n nextPageStartKey\n }\n nodes {\n id\n type\n namespace\n horizon {\n blockNumber\n logIndex\n }\n data\n }\n }\n}\n","headers":{"X-API-Key":"DEMO"}},{"name":"SQL Query Custom Entities","endpoint":"https://graph.flair.dev","query":"# Run arbitrary SQL query on custom entities\nquery {\n sql(\n query: \"\"\"\n SELECT\n chainId,\n contractAddress,\n owner,\n MAX(horizon) as highestHorizon,\n SUM(IF(entityType = 'Deposit', 1, 0)) as totalDeposits,\n SUM(IF(entityType = 'Withdraw', 1, 0)) as totalWithdraws,\n TRY_CAST(\n (\n SUM(IF(entityType = 'Deposit', TRY_CAST(shares as u256), TRY_CAST(0 as u256))) -\n SUM(IF(entityType = 'Withdraw', TRY_CAST(shares as u256), TRY_CAST(0 as u256)))\n ) as string\n ) as totalShares\n FROM\n entities\n WHERE\n namespace = 'fuji-finance' AND\n (entityType = 'Deposit' OR entityType = 'Withdraw')\n GROUP BY\n chainId, contractAddress, owner\n ORDER BY totalShares DESC\n LIMIT 100\n \"\"\"\n ) {\n stats {\n elapsedMs\n }\n rows\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Get ABIs of Contracts","endpoint":"https://graph.flair.dev","query":"# Get ABIs of multiple contracts by address on a specific chain\nquery {\n abis(\n chainId: 42161\n contractAddresses: [\n \"0x6325439389e0797ab35752b4f43a14c004f22a9c\"\n \"0x06ce20880b7cd258125908c0e8a3ee177568a769\"\n ]\n eventsOnly: false\n combineAbis: false\n prefixEventNames: None\n ) {\n nodes {\n chainId\n contractAddress\n contractName\n topics\n abi\n }\n }\n} \n","headers":{"X-API-Key":"DEMO"}}],"settings":{"prettier.useTabs":true},"canSaveConfig":false}