@santiment-network/sanr-api-js
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Sanr API JS Wrapper | wip

Documentation

Installation

You can either use npm or yarn to install it:

npm i --save @santiment-network/sanr-api-js
yarn add @santiment-network/sanr-api-js

Usage

In Sanr Participant, but in API - Issuer In Sanr Signal, but in API - Forecast

// ES Modules syntax
import Sanr from 'sanr-api-js';

// require syntax
const Sanr = require("sanr-api-js").default;

const sanr = new Sanr({
  token: "YOUR_TOKEN",
  refreshToken: "YOUR_REFRESH_TOKEN"
});

// Use api here

;(async () => {
  await api.refreshAccessToken()
  // Get stats about amount of sanr competitions
  // or sanr participants
  const worldstate: Worldstate = await api.getWorldstate()
  console.log(worldstate)
  // Get all competitions
  const competitions = await api.getCompetitions()
  const latestCompetition = competitions.data[competitions.total - 1].id
  console.log(latestCompetition);
  const issuers: SanrResponse<Issuer> = await api.getCompetition(latestCompetition)
  console.log("Participants in latest competition: " + issuers.total)
  // Show all latest forecasts
  const signals = await api.getSignals()
  console.log(signals)
})()

Package Sidebar

Install

npm i @santiment-network/sanr-api-js

Weekly Downloads

0

Version

0.1.1

License

ISC

Unpacked Size

12 kB

Total Files

13

Last publish

Collaborators

  • yordan_pavlov
  • zatsepin
  • dmitrivanguard