1.0.3 • Published 2 years ago

spirals-protocol-sdk v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Spirals SDK

Welcome to the spirals SDK!

This simple SDK allows you to query the impact of your projects.

How to Use

  1. Download the Spirals SDK NPM Package
yarn add spirals-protocol-sdk
  1. Install all dependencies
yarn install
  1. Set the Spirals API key as an environment variable.
SPIRALS_API_KEY = 'your api key'
  1. Use the SDK by importing Spirals into your code.
import spirals from 'spirals'

Documentation

After importing the spirals object from the package, you can call:

// fetchImpact is an async function that accepts an address and calls the SPIRALS API
const impactMetrics = await spirals.fetchImpact(address);

The following is an example of the returned object from fetchImpact

{
    "currentStakedTotalUSD": 70.6646583268667,
    "currentYieldUSD": 0.2845293739158833,
    "projectedYieldUSD": 3.7261689908257094,
    "potentialYieldUSD": 7.788032629564851,
    "numUniqueChains": 3,
    "numUniqueTokens": 5
}

Example Snippet

import spirals from 'spirals-protocol-sdk';

const address = '0x64beA9B3960A928758A8708078CB57405C75343f'
const impactMetrics = await spirals.fetchImpact(address);
console.log("totalStakedUSD", impactMetrics.currentStakedTotalUSD);
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago