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

Show total balance from API in account selector #1110

Closed
lukaw3d opened this issue Oct 26, 2022 · 2 comments · Fixed by #1468
Closed

Show total balance from API in account selector #1110

lukaw3d opened this issue Oct 26, 2022 · 2 comments · Fixed by #1468
Assignees
Labels
ux Usability, user experience etc.

Comments

@lukaw3d
Copy link
Member

lukaw3d commented Oct 26, 2022

Currently we only show available balance from gRPC

balance={a.balance.available} // TODO: get total balance

balance={wallet.balance.available} // TODO: get total balance

@lukaw3d lukaw3d added the ux Usability, user experience etc. label Oct 26, 2022
@csillag
Copy link
Contributor

csillag commented Nov 11, 2022

Unfortunately the problem is not merely not showing all the data; we don't even load the required data properly.
For example, look at this account:

http://localhost:3000/account/oasis1qpzregxdxcu83yj4zzvadrhysntunpe44u66s4e5

The balance is:

image

However, when we load the balance for this account, we are running:

  const account = yield* call([nic, nic.stakingAccount], {
    height: 0,
    owner: short,
  })
  console.log('Loaded account', JSON.stringify(account, null, '  '))
  const balance = parseRpcBalance(account)
  console.log('loaded balance', JSON.stringify(balance, null, '  '))
  return balance

And this gets us:

Loaded account {
  "general": {
    "nonce": 1,
    "balance": {
      "0": 2,
      "1": 84,
      "2": 11,
      "3": 228,
      "4": 0
    }
  }
}
loaded balance {
  "available": "10000000000",
  "validator": {
    "escrow": "0",
    "escrow_debonding": "0"
  }
}

... so as we can see, the staked part of the balance is missing.

(The same thing happens with both OasisScan and OasisMonitor.)

@lukaw3d
Copy link
Member Author

lukaw3d commented Nov 11, 2022

gRPC doesn't have the needed information, but APIs do

https://api.oasisscan.com/testnet/chain/account/info/oasis1qpzregxdxcu83yj4zzvadrhysntunpe44u66s4e5
https://monitor.oasis.dev/api/testnet/data/accounts/oasis1qpzregxdxcu83yj4zzvadrhysntunpe44u66s4e5

A while ago I added parsing for this from API and measured how outdated the info is: f1a2d86
That should come in useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux Usability, user experience etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants