Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-organize balance information in cosmos accounts API #174

Closed
ackratos opened this issue Oct 17, 2018 · 2 comments
Closed

re-organize balance information in cosmos accounts API #174

ackratos opened this issue Oct 17, 2018 · 2 comments

Comments

@ackratos
Copy link
Contributor

ackratos commented Oct 17, 2018

asked by @xzjcool . The motivation of this change is response from cosmos accounts API is hard to process (it doesn't consider lock and freeze token). /balances API only return balance information but no sequence number, account number stuff. Frontend developer has to interact with 2 APIs.

We need re-organize balance information (free, locked, frozen) returned by /accounts API:

{  
   type:"bnbchain/Account",
   value:{  
      base:{  
         address:"cosmosaccaddr1hy2e872rqtd675sn72ny87cyyaaanmqeuvwrpc",
         coins:[  
            {  
               denom:"BNB",
               amount:"18394110677945000"
            },
            {  
               denom:"NNB",
               amount:"1793247661328058"
            },
            {  
               denom:"ZCB",
               amount:"1911910581967676"
            }
         ],
         public_key:{  
            type:"tendermint/PubKeySecp256k1",
            value:"A58TeSbC3MRQ1ig5heN/XPinu9kjZrK4gp60DD7czU8J"
         },
         account_number:"0",
         sequence:"227155"
      },
      name:"node2",
      frozen:null,
      locked:[  
         {  
            denom:"NNB",
            amount:"30262100000000"
         },
         {  
            denom:"ZCB",
            amount:"12610100000000"
         }
      ]
   }
}

INTO:

balances:[  
   {  
      symbol:"BNB",
      free:"183834168.27545000",
      locked:"0.00000000",
      frozen:"0.00000000"
   },
   {  
      symbol:"NNB",
      free:"17945178.61328058",
      locked:"302837.00000000",
      frozen:"0.00000000"
   },
   {  
      symbol:"ZCB",
      free:"19125212.81967676",
      locked:"125933.00000000",
      frozen:"0.00000000"
   }
]

While keep the other fields (public-key, account_number, sequence, name)

This JIRA is blocked by cosmos upgrade #134

@xzjcool
Copy link

xzjcool commented Oct 17, 2018

right,

@ackratos ackratos changed the title account_number and sequence should be included in response of balance API re-organize balance information in accounts API Oct 19, 2018
@ackratos ackratos changed the title re-organize balance information in accounts API re-organize balance information in cosmos accounts API Oct 19, 2018
@notatestuser
Copy link
Contributor

@ackratos @xzjcool you are right that that the balances API does return free, frozen and locked. Please see #194 for the adjustment to the accounts API to include these fields.

@notatestuser notatestuser self-assigned this Oct 23, 2018
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
forcodedancing pushed a commit that referenced this issue May 19, 2022
* api: added an account api satisfying the swagger spec

* account api: using balances api balances output, no more coins

closes #174
closes #194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants