TERNOA Documentation
Learn Build
  • What is Ternoa Chain ?
  • SPECS
    • Polygon CDK zkEVM
    • Polygon AggLayer
    • Avail DA
    • Trusted Execution Environments 
  • BUILD
    • Wallets
    • RPC
    • API
    • Explorer
  • Tools
    • Staking
    • Ternoa Safe
    • TIP
  • Community
    • Ternoa.com
    • Github
    • Discord
    • Twitter
    • Medium
Powered by GitBook
On this page
  1. GETTING STARTED
  2. Javascript SDK
  3. Ternoa indexer
  4. Dictionary

Add the dictionary to the indexer

Last updated 1 year ago

You can improve the performance of the indexation part by using a dictionary endpoint instead of targeting directly the blockchain to get data. Under the hood, the Dictionary provides a list of relevant block heights containing the specific events and extrinsics.

Example: If you look at a createNft event, not every block will contain this event since it depends on users' usage of the Ternoa chain. When looking at events, the dictionary will provide the list that contains the createNft event we are looking for instead of every event of each block.

  • You can see in what is the dictionary endpoint and how to add it.

Code snippet example: look at line 7

...
  schema:
    file: ./schema.graphql
  network:
    genesisHash: '0x6859c81ca95ef624c9dfe4dc6e3381c33e5d6509e35e147092bfbc780f777c4e'
    endpoint: wss://mainnet.ternoa.network
    dictionary: https://dictionary-mainnet.ternoa.dev/
  dataSources:
    - kind: substrate/Runtime
      startBlock: 1
      mapping:
        file: "./dist/index.js"
        handlers:
          - handler: handleEvent
            kind: substrate/EventHandler
            filter:
              module: balances
              method: Transfer
...
our repository