spirals-protocol-sdk
v1.0.3
Published
Spirals SDK to query impact of projects
Downloads
2
Readme
Spirals SDK
Welcome to the spirals SDK!
This simple SDK allows you to query the impact of your projects.
How to Use
- Download the Spirals SDK NPM Package
yarn add spirals-protocol-sdk
- Install all dependencies
yarn install
- Set the Spirals API key as an environment variable.
SPIRALS_API_KEY = 'your api key'
- 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);