The endpoint /liquidity/pairs of the indexer currently (from #36) returns an unsorted list of token pairs, but by looking up the chain-registry Asset for each token and then querying CoinGecko, we can determine the TVL of each pair and sort them correctly in descending order.
The "looking up chain registry assets" comes with several levels of "freshness":
use the npm chain-registry package
has all current registered main and testnet asset, chain, and IBC info
gets out of date quickly: as soon as a new asset or IBC channel is registered
use npm @chain-registry/client package (and chain-registry package and live chain queries)
can download new assets, chains, and IBC info dynamically
requires a list of chain names so that it can download just the relevant chain, chain-assets, and IBC connection JSONs
relevant chain names can be found by querying the live chain and looking up chain_id in chain of chain-registry
gets out of date less quickly: but will still fail to detect newly registered chains after chain-registry was installed
Either could be used, but it seems like the extra dynamic fetching of assets may not be worth the trouble because it doesn't solve the issue of how to identify assets of newly registered chains. And either of these solutions should work well if we can first resolve:
The endpoint
/liquidity/pairs
of the indexer currently (from #36) returns an unsorted list of token pairs, but by looking up the chain-registry Asset for each token and then querying CoinGecko, we can determine the TVL of each pair and sort them correctly in descending order.The "looking up chain registry assets" comes with several levels of "freshness":
chain-registry
package@chain-registry/client
package (andchain-registry
package and live chain queries)chain_id
in chain ofchain-registry
chain-registry
was installedEither could be used, but it seems like the extra dynamic fetching of assets may not be worth the trouble because it doesn't solve the issue of how to identify assets of newly registered chains. And either of these solutions should work well if we can first resolve:
39