Description:
We want to improve the LCD staking endpoints:
Consider #879
I can work on this too @faboweb
Current state:
query delegation /stake/{delegator}/delegation/{validator}
query undonding delegations /stake/{delegator}/ubd/{validator}
query redelegations /stake/{delegator}/red/{validator_src}/{validator_dst}
query candidates /stake/validators
post bonding/unbdonding/redelegation tx /stake/delegations
GET Not necessary/stake/delegators/{addr}/txs/{id} // Get a specific tx from a delegator
GET Deleting since we would have to change the keys/stake/validators/{addr}/delegators
/stake/delegators/{addr} // Get delegation (i.e delegation and undelegation) information from a delegator/stake/delegators/{addr}/txs // Get all txs from a delegator/stake/delegators/{addr}/validators // Query all validators that a delegator is bonded to/stake/delegators/{addr}/validators/{addr} // Query a validator info that a delegator is bonded to/stake/delegators/{addr}/validators/{addr}/txs ///stake/validators/[x] GET /stake/validators/{addr}
[x] POST /stake/delegators/{addr}/txs // Submit a tx
a Tx can be of type: Bond, Unbond or Redelegate, so you should be able to query according to type:
GET /stake/delegators/{addr}/validators/{addr}/txs?type=<bond/unbond/redelegate>
Validator params:
addressdescriptionrevokedstatustokensdelegatorShares // Tokens that delegated by several delegatorsbondHeighttotalStake (_i.e_ stakedCoins + delegatedCoins)stakedCoinslooseTokens // Tokens that are not stakedcommissioncommissionMaxcommissionChangeRatecommissionChangeTodaylastBondedTokens (????)monikerwebsitekeybase-sig Stretch goal could be implementing this in Voyager (should be handled in a new issue)
@faboweb Just had a quick talk with Ismail and we agreed on taking out the /stake word from the beginning of the endpoint. Please also check this article for API best practices. I'd like to get your thoughts on this
Also, TxRedelegation would be seen to both ValidatorFrom and ValidatorTo addresses by doing GET /stake/delegators/{addr}/validators/{ValidatorFrom}/txs?type=redelegate and GET /stake/delegators/{addr}/validators/{ValidatorTo}/txs?type=redelegate respectively
go test ./client/lcd -run TestProvider/stake/validators is returning a Content-Type of text/plain; charset=utf-8 but should be returning application/json. The other end points may be making the same mistake.@fedekunze
we agreed on taking out the /stake word from the beginning of the endpoint
Can you add some reasoning?
@faboweb because it's not actually needed and it doesn't add much value to the endpoint (as the article says). If we want to get the module an endpoint is coming from we could for example add Tags in the Results with module equal to stake (as in this case)
This is not about mapping the results but about namespacing the endpoints coming from different modules (stake module, gov module) to not conflict endpoints. I read the article and it doesn't handle this case. As this is not the case for the bank module or the auth module we should decide on a convention. I am fine with having no namespacing, but let's contact the SDK team if we want to change this convention (pulling in @cwgoes ).
One more thought: Requesting data and only after receiving it getting to know what data I requested sounds impractical.
I am fine with having no namespacing, but let's contact the SDK team if we want to change this convention (pulling in @cwgoes ).
Hmm I understand the desire to simplify but I think this will lead to problems. We want standard REST endpoints for not only our module set within Gaia but any conceivable other SDK apps which use our standard modules - those apps may use their own modules too, which might have conflicting endpoint names. If we prefix all routes by the name of the module, downstream usage is much easier.
I will close this issue, as this has been merged on the SDK side.
Most helpful comment
I can work on this too @faboweb