npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mistswapdex/mist-data

v0.0.1

Published

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

Downloads

2

Readme

mist-data

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

Supported Queries

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

  1. sushi.priceUSD({¹}) Gets USD price of Mist.
  2. sushi.priceETH({¹}) Gets ETH price of Mist.
  3. blocks.latestBlock() Gets the latest block.
  4. blocks.getBlock({¹}) Gets data for the specified block.
  5. charts.factory() Gets data for the MistSwap factory broken down daily + weekly.
  6. charts.tokenHourly({token_address, startTime?}) Gets data for specified token broken down hourly.
  7. charts.tokenDaily({token_address}) Gets data for specified token broken down daily.
  8. charts.pairHourly({pair_address, startTime?}) Gets data for specified pair broken down hourly.
  9. charts.pairDaily({pair_address}) Gets data for specified pair broken down daily.
  10. exchange.token({¹, token_address}) Gets data for specified token.
  11. exchange.token24h({¹, token_address}) Gets 24h data for specified token.
  12. exchange.tokenHourData({², token_address}) Gets hourly data for specified token.
  13. exchange.tokenDayData({², token_address}) Gets daily data for specified token.
  14. exchange.tokens({¹}) Gets data for all tokens.
  15. exchange.tokens24h({¹}) Gets 24h data for all tokens.
  16. exchange.pair({¹, pair_address}) Gets data for specified pair.
  17. exchange.pair24h({¹, pair_address}) Gets 24h data for specified pair.
  18. exchange.pairHourData({², pair_address}) Gets hourly data for specified pair.
  19. exchange.pairDayData({{², pair_address}) Gets daily data for specified pair.
  20. exchange.pairs({¹, [pair_addresses]?}) Gets data for all / specified pairs.
  21. exchange.pairs24h({¹}) Gets 24h data for all pairs.
  22. exchange.ethPrice({¹}) Gets USD price of ETH.
  23. exchange.ethPriceHourly({²}) Gets USD price of ETH broken down hourly.
  24. exchange.factory({¹}) Gets all data for the MistSwap factory.
  25. exchange.dayData({²}) Gets data for the MistSwap factory broken down by day.
  26. exchange.twentyFourHourData({¹}) Gets 24h data for the MistSwap factory.
  1. masterchef.info({¹}) Gets MasterChef contract info.
  2. masterchef.pool({¹, pool_id, pool_address}) Gets pool info, either by pool id or by pool address.
  3. masterchef.pools({¹}) Gets pool info for all pools in MasterChef.
  4. masterchef.user({¹, user_address}) Gets user's data for all of the user's pools.
  5. masterchef.users({¹}) Gets all users and data for all of the users' pools.
  6. masterchef.apys({¹}) Gets pool info for all pools in MasterChef including APYs.
  7. masterchef.apys24h({¹}) Gets 24h pool info for all pools in MasterChef including APYs.
  8. exchange.stakedValue({¹, token_address}) Get pricing info for MasterChef pool.
  9. bar.info({¹}) Gets MistBar contract info.
  10. bar.user({¹, user_address}) Gets MistBar 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.

  1. sushi.observePriceETH() Gets an observable of the current ETH price of Mist.
  2. blocks.observeLatestBlock() Gets an observable of the latest block.
  3. exchange.observeToken({token_address}) Gets an observable for specified token.
  4. exchange.observeTokens() Gets an observable for the top 1000 tokens (by volume in USD).
  5. exchange.observePair({pair_address}) Gets an observable for specified pair.
  6. exchange.observePairs() Gets an observable for the top 1000 pairs (by liquidity in USD).
  7. exchange.observeEthPrice() Gets an observable for the current USD price of ETH.
  8. exchange.observeFactory() Gets an observable for the MistSwap factory.
  9. bar.observeInfo() Gets an observable for MistBar contract info.

Timeseries

mistData.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 mistData = require('@mistswapdex/mist-data'); // common js
// or
import mistData from '@mistswapdex/mist-data'; // es modules

// query and log resolved results
mistData.masterchef
  .pools({block: 1782402})
  .then(pools => console.log(pools))

mistData.bar
  .user({user_address: '0xFDF3b46D029b61F4f257745DFdD99092e272Bf60'})
  .then(user => console.log(user))

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

mistData
  .timeseries({blocks: [1762402, 1772402, 1782402], target: mistData.exchange.pair}, {pair_address: "0x674A71E69fe8D5cCff6fdcF9F1Fa4262Aa14b154"})