-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Summary
Allows different modules' connected REST APIs to output token values always as a list of StdCoin.
Problem Definition
Currently when connecting to the LCD REST APIs of the distribution and staking module, we receive token values as two different types:
- Inside the
distributionmodule they are presented as a list ofStdCoin. - Inside the
stakingmodule they are presented as strings.
This results in having to perform strange assumptions if we want to create something that puts together those data in a chain that has multiple supported coins.
As an example, let's take Regen.network that supports both seeds and trees tokens.
Now, let's take two API calls to two different endpoints.
1. Delegator rewards.
Link: https://xrn-us-east-1.regen.network/distribution/delegators/xrn:1dy39q7t3ja893qwnhr9hgllpd966npkeeyqzmt/rewards
Response
{
"rewards": [
{
"validator_address": "xrn:valoper1dy39q7t3ja893qwnhr9hgllpd966npke003uud",
"reward": [
{
"denom": "seed",
"amount": "96.114571695532999000"
},
{
"denom": "tree",
"amount": "307692.078229836368667000"
}
]
}
],
"total": [
{
"denom": "seed",
"amount": "96.114571695532999000"
},
{
"denom": "tree",
"amount": "307692.078229836368667000"
}
]
}2. Delegator's delegations
Link: https://xrn-us-east-1.regen.network/staking/delegators/xrn:1dy39q7t3ja893qwnhr9hgllpd966npkeeyqzmt/delegations
Response
[
{
"delegator_address": "xrn:1dy39q7t3ja893qwnhr9hgllpd966npkeeyqzmt",
"validator_address": "xrn:valoper1dy39q7t3ja893qwnhr9hgllpd966npke003uud",
"shares": "1007070.707070707070707070",
"balance": "997000"
}
]Now, what are those shares? And what tokens are those balance? Are those seed or tree?
Proposal
The actual proposal is quite simple: when outputting a value that represents a token, always make it as a list of StdCoin so that multiple coins chain can output the data correctly and wallets an/or explorers can show the data in a better and more significative way than the one that is currently possibile.
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned