feat: change design of get coins endpoint #51
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After a discussion with @pkudinov, we came up to the conclusion that we need to change the Coins interface a bit.
We constantly think about the changes that we need to do in the future. In particular, we need to keep in mind that we have Multi Tokens, and we should be able to show multiple balances for one contract.
Initially, we decided to have several items in the response for Multi Tokens.
That gives us the problem with the pagination: we need to create the solution for the case when MT is cut in the middle between 2 pages.
Here, we need to make a step back and remind the nature of MT. I can imagine a few use cases: swapping pools/exchanges, liquidity pools, gaming. For all of them, it makes no sense to show only 1 MT balance. The users (I mean wallet creators) will want to group them. In this case, let's just group them on our side.
With all the advantages of this approach, I see 1 disadvantage - for the majority of use cases, there will be the balances list with just one item inside. And
balances
looks weird when you ask for native/FT balance (why I can get more than 1 balance there). It looks like overengineering to me. But, I anyway vote for these changes.