duality-labs / hapi-indexer

A Node.js based indexer for the Duality Cosmos chain
1 stars 0 forks source link

Sort token pairs list by decreasing TVL #38

Closed dib542 closed 1 year ago

dib542 commented 1 year ago

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":

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:

dib542 commented 1 year ago

The first level of this has been attempted with #40