theta-data
TypeScript icon, indicating that this package has built-in type declarations

0.1.63 • Public • Published

NPM

Theta Data is a Data Analytics Tool for The Theta Network. It collects data from Guardian Node, performs analysis and provides data and analysis result through convenient Graphql interfaces. Users can access the data with simple statements and queries.

Features

  • Sqlite database support
  • Modular data analysis services
  • Nft Data
  • Stake Data
  • Market Data
  • Wallet Data
  • Transactions Data
  • Blocks Data And more...

User Interface

img

We provide a simple GUI for basic queries. With box checking, you can look up the relevant data of your own interest. History queries will be saved so that you do not need to rewrite the statements.

Why choose Theta Data

Unlike traditional interface, Theta Data provides an efficient and concise way to retrieve on-chain data.

The below example shows the difference between a traditional interface and Theta Data API when you are collecting the block height, staking amount and the circulating supply of Theta token/Theta Fuel

Example of traditional data interface

  1. Get the latest block height with js sdk
const provider = new thetajs.providers.HttpProvider()
const blockHeight = await provider.getBlockNumber()
  1. Get Theta staking amount through browser interface
// Request
curl https://explorer.thetatoken.org:8443/api/stake/totalAmount

// Result
{
  "type":"stakeTotalAmout",
  "body":{
    "totalAmount":"644011157483502419243726104",
    "totalNodes":3457,
    "type":"theta"
    }
}
  1. Get the supply and circulation of Theta with explorer api
// Request
curl https://explorer.thetatoken.org:8443/api/supply/theta

// Result
{
   "total_supply":1000000000,
   "circulation_supply":1000000000
}
  1. Call explorer api again to get the supply and circulation of theta fuel
// Request
curl https://explorer.thetatoken.org:8443/api/supply/tfuel

// Result
{
   "circulation_supply":5000000000
}

We can see from above, in order to get the basic data, we need to call 4 different APIs. These APIs are from different source, which makes them difficult to maintain in our own program.

Example of Theta Data API

With Theta Data, all the data above can be retrieve with one single Graphql statement and one request.

Request:

{
  MarketInformation {
    Theta {
      circulating_supply
      total_supply
    }
    ThetaFuel {
      circulating_supply
      total_supply
    }
  }
  StakeStatistics {
    total_validator_node_number
    total_guardian_node_number
    total_elite_edge_node_number
  }
  ThetaRpc {
    GetStatus {
      current_height
    }
  }
}

Response:

{
  "data": {
    "MarketInformation": {
      "theta": {
        "circulating_supply": 1000000000,
        "total_supply": 1000000000
      },
      "theta_fuel": {
        "circulating_supply": 5301214400,
        "total_supply": 5301214400
      }
    },
    "StakeStatistics": {
      "total_validator_node_number": 16,
      "total_guardian_node_number": 3441,
      "total_elite_edge_node_number": 8436
    },
    "ThetaRpc": {
      "GetStatus": {
        "current_height": "12806717"
      }
    }
  }
}

It is also worth mentioning that Theta Data only returns the data you specify in the query statement. No redundant fields will be returned.

Run Theta Data

Install

npm i theta-data

Runnning Analyse Server

const thetaData = require("theta-data");
thetaData.analyse();

Running The Graphql Api Server

const thetaData = require("theta-data");
thetaData.serve();

PlayGround

After running the graphql api server.You can then open your web browser and navigate to http://localhost:3000 (host and port may vary depending on your configuration). You will then see the GraphQL playground.

avatar

Links

Contact

contact@thetadata.io

License

Theta Data is licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i theta-data

Weekly Downloads

3

Version

0.1.63

License

MIT

Unpacked Size

8.23 MB

Total Files

513

Last publish

Collaborators

  • larryluo