HomeCoinsSynthetix Network Token (SNX)Major Subgraph Improvements

Major Subgraph Improvements

- Advertisement -


Major Subgraph Improvements

We’re excited to announce that we’ve recently released a major update to our subgraphs. This will allow for easier and more accurate queries of data from the Synthetix protocol via The Graph. If you’re a developer who would like to start using them right away, head over to the synthetix-subgraph repository on GitHub.

This is the culmination of work over the last few months which includes data quality improvements, tooling updates for a superior developer experience, and infrastructure modifications that will streamline our support and maintenance.

All the data in one place

Previously, due to the scale and complexity of the Synthetix protocol, we’ve deployed multiple subgraphs to separate endpoints. This made it easier to manage modular updates and improved subgraph sync times, but it increased complexity for end users and internal maintenance. [1]

Now, we deploy a single subgraph that consolidates all of the indexed data into one endpoint per network. These are available on The Graph’s hosted service for mainnet, kovan, optimism, and optimism-kovan.

The subgraph that indexes mainnet can also found be on The Graph’s decentralized network. We plan to migrate the official dapps to rely on the network once it supports subgraph sets and Optimism.

There are a couple important caveats to keep in mind:

  • The subgraphs on the hosted service may be subject to breaking changes, as they don’t currently support pinning versions.
  • Some of the data from the Optimism networks is incomplete due to the regenesis which occurred on November 11th, 2021.

In the past, we’ve provided a package @synthetixio/data (and it’s predecessor, synthetix-data) as a convenience for accessing data from the subgraphs in frontend applications and scripts. These are now both deprecated in favor of codegen-graph-ts and @synthetixio/queries.

codegen-graph-ts generates a TypeScript (or JavaScript) file with functions that query the data provided by the The Graph. In addition to providing types for the returned data, the generated functions automatically paginate requests. This library is not built specifically for Synthetix; you can use it with any subgraph endpoint available on the The Graph.

For example, you can use the following code snippet to generate a synthetix-subgraph.ts file:

npm i --save codegen-graph-ts
npx codegen-graph-ts gen -u https://api.thegraph.com/subgraphs/name/synthetixio-team/mainnet-main -o synthetix-subgraph.ts

@synthetixio/queries wraps Synthetix’s output from the codegen and adds some additional functionality for front-end applications built with React, including the ability to subscribe to real-time data updates. Our core and ecosystem applications are being migrated to rely on this library.

Improved data structures

We’ve added some new fields and filters to the subgraphs. These additions include:

  • Total.newExchanger field, which tracks a count of first-time users.
  • Hour, week, month, quarter, and year aggregations for the Total entity, in addition to the existing daily and fifteen minute aggregations.
  • Filters for synth exchanges and their aggregations, including which synth is being exchanged (SynthExchange_filter.toSynth and SynthExchange_filter.fromSynth) and the magnitude of the trade (Exchanger_filter.bucketMagnitude and Total_filter.bucketMagnitude).
  • SNXHolder.balanceOf field, which stores user balances.

Visit the playground in The Graph’s web application to explore the data provided by the Synthetix subgraph.

More to come

We’re excited to improve our core and ecosystem apps with this release, while making it easier for partners and external developers to access Synthetix’s data. We have more improvements on the horizon as well, including new subgraph entities, fields, and filters.

If you have any questions or feedback about our subgraphs, reach out in the #dev-portal channel on the Synthetix Discord server or open an issue in the synthetix-subgraph repository.

Footnotes

[1] We will still maintain the ability to deploy individual subgraph modules for development and test purposes, but these deployments will not be recommended for official use.



Source link

- Advertisement -
Mr Bitcointehttps://www.bitcointe.com/
“Fact You Need To Know About Cryptocurrency - The first Bitcoin purchase was for pizza.” ― Mohsin Jameel
462FansLike
76FollowersFollow
4,567FollowersFollow
5,261FollowersFollow
1,561FollowersFollow
2,230SubscribersSubscribe

Most Popular

bitcoin
Bitcoin (BTC) $ 42,327.00
ethereum
Ethereum (ETH) $ 3,157.78
tether
Tether (USDT) $ 0.999677
bitcoin-cash
Bitcoin Cash (BCH) $ 383.04
litecoin
Litecoin (LTC) $ 140.91
eos
EOS (EOS) $ 2.85
okb
OKB (OKB) $ 25.43
tezos
Tezos (XTZ) $ 4.09
leo-token
LEO Token (LEO) $ 3.68
cardano
Cardano (ADA) $ 1.50
monero
Monero (XMR) $ 203.59
stellar
Stellar (XLM) $ 0.255379
chainlink
Chainlink (LINK) $ 23.03
huobi-token
Huobi Token (HT) $ 9.85
tron
TRON (TRX) $ 0.06834
usd-coin
USD Coin (USDC) $ 0.999791
dash
Dash (DASH) $ 131.00
neo
NEO (NEO) $ 25.84
iota
IOTA (MIOTA) $ 1.09
nem
NEM (XEM) $ 0.113902
zcash
Zcash (ZEC) $ 131.20
maker
Maker (MKR) $ 2,058.01
paxos-standard
Pax Dollar (USDP) $ 1.00
ethereum-classic
Ethereum Classic (ETC) $ 34.38
vechain
VeChain (VET) $ 0.074301
true-usd
TrueUSD (TUSD) $ 0.998433
ftx-token
FTX Token (FTT) $ 44.92
kucoin-shares
KuCoin Token (KCS) $ 20.28
waves
Waves (WAVES) $ 13.65