🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@soulswap/soul-data

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soulswap/soul-data

🕯 Query utility for SoulSwap-related data.

latest
npmnpm
Version
2.0.0
Version published
Maintainers
2
Created
Source

Soul Data

🕯 Query utility for SoulSwap-related data.

This is a collection of utilities to query SoulSwap data from Fantom. This data has been indexed by the Graph via the subgraph the SoulSwap team maintains.

Supported Queries

The below all return a Promise that resolves with the requested results.

  • soul.priceUSD({¹}) Gets USD price of Soul.
  • soul.priceETH({¹}) Gets ETH price of Soul.
  • blocks.latestBlock() Gets the latest block.
  • blocks.getBlock({¹}) Gets data for the specified block.
  • charts.factory() Gets data for the SoulSwap factory broken down daily + weekly.
  • charts.tokenHourly({token_address, startTime?}) Gets data for specified token broken down hourly.
  • charts.tokenDaily({token_address}) Gets data for specified token broken down daily.
  • charts.pairHourly({pair_address, startTime?}) Gets data for specified pair broken down hourly.
  • charts.pairDaily({pair_address}) Gets data for specified pair broken down daily.
  • exchange.token({¹, token_address}) Gets data for specified token.
  • exchange.token24h({¹, token_address}) Gets 24h data for specified token.
  • exchange.tokenHourData({², token_address}) Gets hourly data for specified token.
  • exchange.tokenDayData({², token_address}) Gets daily data for specified token.
  • exchange.tokens({¹}) Gets data for all tokens.
  • exchange.tokens24h({¹}) Gets 24h data for all tokens.
  • exchange.pair({¹, pair_address}) Gets data for specified pair.
  • exchange.pair24h({¹, pair_address}) Gets 24h data for specified pair.
  • exchange.pairHourData({², pair_address}) Gets hourly data for specified pair.
  • exchange.pairDayData({{², pair_address}) Gets daily data for specified pair.
  • exchange.pairs({¹, [pair_addresses]?}) Gets data for all / specified pairs.
  • exchange.pairs24h({¹}) Gets 24h data for all pairs.
  • exchange.ethPrice({¹}) Gets USD price of ETH.
  • exchange.ethPriceHourly({²}) Gets USD price of ETH broken down hourly.
  • exchange.factory({¹}) Gets all data for the SoulSwap factory.
  • exchange.dayData({²}) Gets data for the SoulSwap factory broken down by day.
  • exchange.twentyFourHourData({¹}) Gets 24h data for the SoulSwap factory.
  • summoner.info({¹}) Gets SoulSummoner contract info.
  • summoner.pool({¹, pool_id, pool_address}) Gets pool info, either by pool id or by pool address.
  • summoner.pools({¹}) Gets pool info for all pools in SoulSummoner.
  • summoner.user({¹, user_address}) Gets user's data for all of the user's pools.
  • summoner.users({¹}) Gets all users and data for all of the users' pools.
  • summoner.apys({¹}) Gets pool info for all pools in SoulSummoner including APYs.
  • summoner.apys24h({¹}) Gets 24h pool info for all pools in SoulSummoner including APYs.
  • exchange.stakedValue({¹, token_address}) Get pricing info for SoulSummoner pool.
  • reaper.info({¹}) Gets SoulReaper contract info.
  • reaper.servings({²}) Gets past servings to the circle.
  • reaper.servers({¹}) Gets servers that have served Soul to the circle.
  • reaper.pendingServings({¹}) Gets data on the servings ready to be served to the circle.
  • timelock.queuedTxs({²}) Gets queued Timelock transactions.
  • timelock.canceledTxs({²}) Gets canceled Timelock transactions.
  • timelock.executedTxs({²}) Gets executed Timelock transactions.
  • timelock.allTxs({²}) Gets all Timelock transactions.
  • lockup.user({¹, user_address}) Gets lockup data for specified user.

¹ {block, timestamp} Supports fetching at a specific block / UNIX timestamp.
² {minBlock, maxBlock, minTimestamp, maxTimestamp} Supports fetching in a specific timeframe.

Supported Subscriptions

The below all return an Observable that when subscribed to with an object.

  • soul.observePriceETH() Gets an observable of the current ETH price of Soul.
  • blocks.observeLatestBlock() Gets an observable of the latest block.
  • exchange.observeToken({token_address}) Gets an observable for specified token.
  • exchange.observeTokens() Gets an observable for the top 1000 tokens (by volume in USD).
  • exchange.observePair({pair_address}) Gets an observable for specified pair.
  • exchange.observePairs() Gets an observable for the top 1000 pairs (by liquidity in USD).
  • exchange.observeEthPrice() Gets an observable for the current USD price of ETH.
  • exchange.observeFactory() Gets an observable for the SoulSwap factory.
  • reaper.observePendingServings() Gets an observable for pending servings.

Timeseries

soulData.timeseries({blocks = [], timestamps = [], target = targetFunction}, {targetArguments}) Returns an array of queries. Blocks / timestamps are arrays of the blocks / timestamps to query (choose one). The target is the target function, the target arguments are the arguments for the target. See example below

Example

const soulData = require('@soulswap/soul-data'); // common js
// or
import soulData from '@soulswap/soul-data'; // es modules

// query and log resolved results
soulData.summoner
  .pools({block: 17337870}) // 25 AUG
  .then(pools => console.log(pools))

// soulData.timelock
//   .allTxs({minTimestamp: 1605239738, maxTimestamp: 1608239738})
//   .then(txs => console.log(txs))

// soulData.seance
//   .user({user_address: '0x6684977bbed67e101bb80fc07fccfba655c0a64f'})
//   .then(user => console.log(user))

soulData.exchange
  .observePairs()
  .subscribe({next: (pairs) => console.log(pairs), error: (err) => console.log(err)})

soulData
  .timeseries({blocks: [11407623, 11507623, 11607623], target: soulData.exchange.pair}, {pair_address: "0xa2527Af9DABf3E3B4979d7E0493b5e2C6e63dC57"}) // SOUL-WFTM // 25 AUG

FAQs

Package last updated on 25 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts