cosmos-sdk icon indicating copy to clipboard operation
cosmos-sdk copied to clipboard

Normalize account response

Open faboweb opened this issue 5 years ago • 4 comments

Summary

The response for vesting accounts has nested the parent struct "BaseVestingAccount".

Problem Definition

This is harder to parse as we need to switch if an account is a vesting account or a normal account.

Proposal

Let's just normalize the response ala:

{  
   "type":"auth/DelayedVestingAccount",
   "value":{  
            "address":"xxx",
            "coins":[  
               {  
                  "denom":"uatom",
                  "amount":""
               }
            ],
            "public_key":{  
               "type":"tendermint/PubKeySecp256k1",
               "value":""
            },
            "account_number":"",
            "sequence":"",
         "original_vesting":[  
            {  
               "denom":"uatom",
               "amount":""
            }
         ],
         "delegated_free":null,
         "delegated_vesting":[  
            {  
               "denom":"uatom",
               "amount":""
            }
         ],
         "end_time":""
}

For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned

faboweb avatar Mar 14 '19 10:03 faboweb

Hmm. What would you like to parse - all the fields at the top level?

cwgoes avatar Mar 14 '19 13:03 cwgoes

yes, as the standard auth/Account has all the fields on the top level as well. "top level" means ".value".

faboweb avatar Mar 14 '19 14:03 faboweb

This can be done if we just implement the json encoding interfaces for these accounts using the vanilla json marshaller and not Amino.

alexanderbez avatar Mar 14 '19 17:03 alexanderbez

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 17 '20 00:07 github-actions[bot]

closing, reopen if still applicable

tac0turtle avatar Sep 02 '22 13:09 tac0turtle