(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72059],{82719:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/en/build/indexer",function(){return i(25834)}])},25834:function(e,n,i){"use strict";i.r(n),i.d(n,{useTOC:function(){return c}});var t=i(31549),r=i(31305),s=i(40352),a=i(62654),d=i(48605),o=i(94726);function c(e){return[{value:"Indexer API",id:"indexer-api",depth:2},{value:"Using the Indexer API",id:"using-the-indexer-api",depth:2},{value:"Example Queries",id:"example-queries",depth:3},{value:"Indexer SDK",id:"indexer-sdk",depth:2},{value:"Transaction Stream Service",id:"transaction-stream-service",depth:2},{value:"Legacy Indexer",id:"legacy-indexer",depth:2}]}function l(e,n){throw Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}n.default=(0,r.c)(function(e){let{toc:n=c(e)}=e,i={a:"a",h1:"h1",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",...(0,a.a)(),...e.components};return d.Zb||l("Card",!1),d.Zb.Description||l("Card.Description",!0),d.Zb.Title||l("Card.Title",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.h1,{children:"Indexer"}),"\n",(0,t.jsx)(i.p,{children:"We have several offerings for getting indexed data from the Aptos blockchain."}),"\n",(0,t.jsxs)(i.ol,{children:["\n",(0,t.jsxs)(i.li,{children:["Query the ",(0,t.jsx)(i.a,{href:"indexer/indexer-api",children:"Indexer API"})," to get basic data about transactions, fungible assets, and tokens"]}),"\n",(0,t.jsxs)(i.li,{children:["Index your custom contract with the ",(0,t.jsx)(i.a,{href:"indexer/indexer-sdk",children:"Indexer SDK"})]}),"\n",(0,t.jsxs)(i.li,{children:["Stream raw transactions from ",(0,t.jsx)(i.a,{href:"indexer/txn-stream",children:"Transaction Stream Service"})," to your processor or service"]}),"\n"]}),"\n",(0,t.jsx)(i.h2,{id:n[0].id,children:n[0].value}),"\n",(0,t.jsx)(i.p,{children:"The Aptos Indexer is an API you can use to get:"}),"\n",(0,t.jsxs)(i.ol,{children:["\n",(0,t.jsx)(i.li,{children:"Aggregate data (ex. How many NFTs exist?)"}),"\n",(0,t.jsx)(i.li,{children:"Historical data (ex. What transactions has this account submitted?)"}),"\n",(0,t.jsxs)(i.li,{children:["Data that is hard to get from the simpler ",(0,t.jsx)(i.a,{href:"apis/fullnode-rest-api",children:"Aptos Node API"})," (ex. What account owns a token named “ExampleToken”?)."]}),"\n"]}),"\n",(0,t.jsx)(i.p,{children:"For example, you can use the Indexer API to look up the fungible asset balances of any account like so:"}),"\n",(0,t.jsx)(d.NR,{query:"query GetFungibleAssetBalances($address: String, $offset: Int) {\ncurrent_fungible_asset_balances(\n  where: {owner_address: {_eq: $address}},\n  offset: $offset,\n  limit: 100,\n  order_by: {amount: desc}\n) {\n  asset_type\n  amount\n  __typename\n}\n}",variables:'{\n"address": "0x0000000000000000000000000000000000000000000000000000000000000001",\n"offset": 0\n}'}),"\n",(0,t.jsx)(o.U,{type:"info",children:(0,t.jsx)(i.p,{children:"The Indexer tracks every transaction that happens on-chain, then exposes that data through a GraphQL API."})}),"\n",(0,t.jsx)(i.h2,{id:n[1].id,children:n[1].value}),"\n",(0,t.jsx)(i.p,{children:"Learn how to use the Indexer API, what each table represents, and the architecture."}),"\n",(0,t.jsxs)(d.oy,{children:[(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api",children:[(0,t.jsx)(d.Zb.Title,{children:"Accessing the API"}),(0,t.jsx)(d.Zb.Description,{children:"Learn how to query the Indexer API."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/indexer-reference",children:[(0,t.jsx)(d.Zb.Title,{children:"Indexer Table Reference"}),(0,t.jsx)(d.Zb.Description,{children:"Detailed reference for Indexer tables and their schemas."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/architecture",children:[(0,t.jsx)(d.Zb.Title,{children:"Architecture"}),(0,t.jsx)(d.Zb.Description,{children:"Detailed layout of the Indexer’s architecture."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/self-hosted",children:[(0,t.jsx)(d.Zb.Title,{children:"Self-hosted Indexer API"}),(0,t.jsx)(d.Zb.Description,{children:"Host your own Indexer API"})]})]}),"\n",(0,t.jsx)(i.h3,{id:n[2].id,children:n[2].value}),"\n",(0,t.jsx)(i.p,{children:"To help get you started, here are the most common queries the Indexer is used for."}),"\n",(0,t.jsxs)(d.oy,{children:[(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/fungible-asset-balances",children:[(0,t.jsx)(d.Zb.Title,{children:"Get Fungible Asset Balances"}),(0,t.jsx)(d.Zb.Description,{children:"Get all fungible assets an account currently owns."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/account-transactions",children:[(0,t.jsx)(d.Zb.Title,{children:"Get Account Transactions"}),(0,t.jsx)(d.Zb.Description,{children:"Get all transactions impacting an account."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/ans-lookup",children:[(0,t.jsx)(d.Zb.Title,{children:"Get Aptos Name"}),(0,t.jsx)(d.Zb.Description,{children:"Retrieve the Aptos name associated with an account (via the ANS)."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/fungible-asset-info",children:[(0,t.jsx)(d.Zb.Title,{children:"Get Fungible Asset Info"}),(0,t.jsx)(d.Zb.Description,{children:"Get detailed information about a specific fungible asset."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/get-nft-collections",children:[(0,t.jsx)(d.Zb.Title,{children:"Get NFT Collections"}),(0,t.jsx)(d.Zb.Description,{children:"Retrieve NFT collections owned by a specific account."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/get-nfts",children:[(0,t.jsx)(d.Zb.Title,{children:"Get NFTs"}),(0,t.jsx)(d.Zb.Description,{children:"Retrieve individual NFTs owned by a specific account."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/token-metadata",children:[(0,t.jsx)(d.Zb.Title,{children:"Get Token Metadata"}),(0,t.jsx)(d.Zb.Description,{children:"Get metadata information for a specific token."})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-api/get-delegators",children:[(0,t.jsx)(d.Zb.Title,{children:"Count Delegators in Staking Pool"}),(0,t.jsx)(d.Zb.Description,{children:"Retrieve the number of active delegators in a staking pool."})]})]}),"\n",(0,t.jsx)(i.h2,{id:n[3].id,children:n[3].value}),"\n",(0,t.jsxs)(i.p,{children:["If the hosted Indexer API is not enough or if you want to index your custom contract, you can create a processor with the ",(0,t.jsx)(i.a,{href:"./indexer/indexer-sdk",children:"Indexer SDK"}),"."]}),"\n",(0,t.jsxs)(d.oy,{children:[(0,t.jsxs)(d.Zb,{href:"indexer/indexer-sdk/quickstart",children:[(0,t.jsx)(d.Zb.Title,{children:"Quickstart Guide"}),(0,t.jsx)(d.Zb.Description,{children:"Get started with the Indexer SDK"})]}),(0,t.jsxs)(d.Zb,{href:"indexer/indexer-sdk/documentation",children:[(0,t.jsx)(d.Zb.Title,{children:"Documentation"}),(0,t.jsx)(d.Zb.Description,{children:"Read documentation about the Indexer SDK"})]})]}),"\n",(0,t.jsx)(i.h2,{id:n[4].id,children:n[4].value}),"\n",(0,t.jsx)(i.p,{children:"Transaction Stream Service is a GRPC service that streams raw transactions to your processor or service.\nIf you’re using the Indexer SDK, you’ll need an authorization token to connect to Transaction Stream Service."}),"\n",(0,t.jsx)(d.oy,{children:(0,t.jsxs)(d.Zb,{href:"indexer/txn-stream/aptos-hosted-txn-stream",children:[(0,t.jsx)(d.Zb.Title,{children:"Aptos-Hosted Transaction Stream Service"}),(0,t.jsx)(d.Zb.Description,{children:"Get access to the Aptos-hosted Transaction Stream Service"})]})}),"\n",(0,t.jsx)(i.h2,{id:n[5].id,children:n[5].value}),"\n",(0,t.jsxs)(i.p,{children:["Find information about the legacy indexer ",(0,t.jsx)(i.a,{href:"indexer/legacy",children:"here"}),"."]})]})},"/en/build/indexer",{filePath:"pages/en/build/indexer.mdx",timestamp:1741112622e3,pageMap:s.v,frontMatter:{title:"Indexer"},title:"Indexer"},"undefined"==typeof RemoteContent?c:RemoteContent.useTOC)},31305:function(e,n,i){"use strict";i.d(n,{c:function(){return o}});var t=i(31549),r=i(58199),s=i(27353),a=i(28361),d=i(62654);function o(e,n,i,t){let s=globalThis[r.ud];return s.route=n,s.pageMap=i.pageMap,s.context[n]={Content:e,pageOpts:i,useTOC:t},c}function c({__nextra_pageMap:e=[],__nextra_dynamic_opts:n,...i}){let d=globalThis[r.ud],{Layout:o,themeConfig:c}=d,{route:h,locale:x}=(0,s.t)(),u=d.context[h];if(!u)throw Error(`No content found for the "${h}" route. Please report it as a bug.`);let{pageOpts:p,useTOC:f,Content:j}=u;if(h.startsWith("/["))p.pageMap=e;else for(let{route:n,children:i}of e){let e=n.split("/").slice(x?2:1);(function e(n,[i,...t]){for(let r of n)if("children"in r&&i===r.name)return t.length?e(r.children,t):r})(p.pageMap,e).children=i}if(n){let{title:e,frontMatter:i}=n;p={...p,title:e,frontMatter:i}}return(0,t.jsx)(o,{themeConfig:c,pageOpts:p,pageProps:i,children:(0,t.jsx)(a.F,{value:i,children:(0,t.jsx)(l,{useTOC:f,children:(0,t.jsx)(j,{...i})})})})}function l({children:e,useTOC:n}){let{wrapper:i}=(0,d.a)();return(0,t.jsx)(h,{useTOC:n,wrapper:i,children:e})}function h({children:e,useTOC:n,wrapper:i,...r}){let s=n(r);return i?(0,t.jsx)(i,{toc:s,children:e}):e}}},function(e){e.O(0,[49774,78950,93277,49822,62009,71188,78082,61110,80045,40352,48605,92888,40179],function(){return e(e.s=82719)}),_N_E=e.O()}]);