2.0.11 • Published 3 months ago

@polkawatch/ddp-client v2.0.11

Weekly downloads
-
License
Unlicense
Repository
-
Last release
3 months ago

About this API Client

This API allows accessing Polkawatch Analytics and using them in your project.

Polkawatch DDP implements its API using the openapi v3 standard. The specification is bundled as ddp-api-spec.json.

This client has been generated using openapi generator with the typescript axios generator.

Note that you can also use ddp-api-spec.json and use the same tool to produce another API client in any of the many other available languages including rust, c++, java, go, python, etc.

About Typescript Axios generated client

This generator creates TypeScript/JavaScript client that utilizes axios. The generated Node module can be used in the following environments:

Environment

  • Node.js
  • Webpack
  • Browserify

Language level

  • ES5 - you must have a Promises/A+ library installed
  • ES6

Module system

  • CommonJS
  • ES6 module system

It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via package.json. (Reference)

Client API Documentation

The documentation is packaged with the specification, as such the generated code is self-documented and readable. IDEs like IntelliJ will do a great job with autocompletion as you code with the API.

Typedoc generated documentation can be browsed here.

Basic Example

The following example shows how to configure the API and make a request to retrieve the decentralizaiton data of one Validator node.

import {
  Configuration,
  PolkawatchApi,
} from '@polkawatch/ddp-client';

const apiVersion = "v2";
const chain = "polkadot";
const basePath = `https://${chain}-${apiVersion}-api.polkawatch.app`;

const api = new PolkawatchApi(new Configuration({basePath}));

async function main(){

  // Retrieves decentralization about a Validator

  const response = await api.ddpIpfsValidatorDetail({
    lastDays: 60,
    validator: '14hM4oLJCK6wtS7gNfwTDhthRjy5QJ1t3NAcoPjEepo9AH67',
    validationType: 'public',
  });

  console.log(response.data);

}

main();

Save this example as test.mjs and run with node test.mjs

Example React DAPP

An example React DAPP using this API to display UI components/charts can be found in this Repository.

2.0.11

3 months ago

2.0.7

10 months ago

2.0.9

8 months ago

2.0.10

6 months ago

2.0.8

10 months ago

2.0.3

12 months ago

2.0.5

12 months ago

2.0.4

12 months ago

2.0.6

11 months ago

1.2.16

1 year ago

1.2.17

1 year ago

1.2.15

1 year ago

1.2.13

1 year ago

1.2.14

1 year ago

1.2.12

1 year ago

1.2.11

1 year ago

1.2.10

2 years ago

1.2.9

2 years ago

1.2.5

2 years ago