goswap-data
v0.0.10
Published
This is a collection of utilities to query SushiSwap data from Ethereum. This data has been indexed by the Graph via the subgraph the SushiSwap team maintains.
Downloads
4
Readme
sushi-data
This is a collection of utilities to query SushiSwap data from Ethereum. This data has been indexed by the Graph via the subgraph the SushiSwap team maintains.
Supported Queries
The below all return a Promise that resolves with the requested results.
weth.price()
Gets current USDC price of WETH.sushi.info(block)
Get sushi ETH price and total supply.
Optional: can use block number to fetch data at a specific block.masterchef.info()
Get MasterChef Contract Info.masterchef.pools(identifier)
Get all pool info for pools in MasterChef.
Optional: can use identifier as argument - either pool id or pair address.masterchef.stakedValue()
Get pricing info for MasterChef pools.timelock.queuedTxs()
Get all queued Timelock txs.timelock.canceledTxs()
Get all canceled Timelock txs.timelock.executedTxs()
Get all executed Timelock txs.timelock.txs()
Get all queued/executed/canceled Timelock txs.bar.info()
Get all SushiBar contract info.bar.user({ user: "address"})
Get sushi bar data for specific address.maker.info()
Get SushiMaker contract infomaker.servings()
Get all past servings to the bar.maker.servers()
Get all addresses that have served sushi to the bar.maker.pendingServings()
Get all data on all of the servings that are ready to be served to the bar.exchange.tokens(token_address)
Get data for all tokens under the SushiSwap factory.
Optional: can use token address to fetch data for specific token.exchange.pairs(pair_address)
Get data for all pairs under the SushiSwap factory.
Optional: can use pair address to fetch data for specific pair.exchange.ethPrice()
Get current ETH price in USD.exchange.factory()
Get all data for the SushiSwap factory.exchange.dayData(days)
Get all data for the SushiSwap factory broken down by day.
Optional: can use number of days to fetch data for a specific number of days (1 for today's data only, 2 for today and yesterday).
Supported Subscriptions
The below all return an Observable that when subscribed to with an object.
exchanges.observeTokens(token_address)
Get an observable to subscribe to that will next all token data updates in real time.
Optional: can use token address to observe data for specific token.
Example
const sushiData = require('@sushiswap/sushi-data'); // common js
// or
import sushiData from '@sushiswap/sushi-data'; // es modules
// query and log resolved results
sushiData.masterchef
.Pools()
.then(pools => console.log(pools))
sushiData.masterchef
.TimeLocks()
.then(timelocks => console.log(timelocks))
sushiData.bar
.User({user: '0x6684977bbed67e101bb80fc07fccfba655c0a64f'})
.then(user => console.log(user))