Skip to content

feat: add account identifier + balance to neuron list.#21

Open
ielashi wants to merge 1 commit intomainfrom
ielashi/neurons-table
Open

feat: add account identifier + balance to neuron list.#21
ielashi wants to merge 1 commit intomainfrom
ielashi/neurons-table

Conversation

@ielashi
Copy link
Copy Markdown
Collaborator

@ielashi ielashi commented May 8, 2023

The command to list neurons only returned the neuron IDs. This commit extends this information to include the account identifier as well as the balance of the neuron.

The list of neurons are rendered in a table that looks like this:

npm run execute -- neuron list

╔════╤══════════════════════╤══════════════════════════════════════════════════════════════════╤═══════════════╗
║ #  │ Neuron ID            │ Account Identifier                                               │ Balance (e8s) ║
╟────┼──────────────────────┼──────────────────────────────────────────────────────────────────┼───────────────╢
║ 1  │ 123                  │ XXXXX                                                            │ 123           ║
╟────┼──────────────────────┼──────────────────────────────────────────────────────────────────┼───────────────╢
║ 2  │ 456                  │ XXXXX                                                            │ 123           ║
╚════╧══════════════════════╧══════════════════════════════════════════════════════════════════╧═══════════════╝

The command to list neurons only returned the neuron IDs. This commit
extends this information to include the account identifier as well as
the balance of the neuron.

The list of neurons are rendered in a table that looks like this:

```
npm run execute -- neuron list

╔════╤══════════════════════╤══════════════════════════════════════════════════════════════════╤═══════════════╗
║ #  │ Neuron ID            │ Account Identifier                                               │ Balance (e8s) ║
╟────┼──────────────────────┼──────────────────────────────────────────────────────────────────┼───────────────╢
║ 1  │ 123                  │ XXXXX                                                            │ 123           ║
╟────┼──────────────────────┼──────────────────────────────────────────────────────────────────┼───────────────╢
║ 2  │ 456                  │ XXXXX                                                            │ 123           ║
╚════╧══════════════════════╧══════════════════════════════════════════════════════════════════╧═══════════════╝

```
@ielashi ielashi requested a review from lmuntaner May 8, 2023 20:01
Copy link
Copy Markdown
Contributor

@lmuntaner lmuntaner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks great!

I added a comment

n.fullNeuron!.accountIdentifier
);

const balance = await ledger.accountBalance({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use cachedNeuronStake - neuronFees from the Neuron?

This way you'd avoid an extra call per neuron.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are not necessarily accurate - there's a delay between that cached number and the real value, so we might as well get the real value. The calls to the ledger are quite cheap.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But a query call is not secure. Is that still better than the information in the neuron?

Or should we do an update call certified: true?

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

Successfully merging this pull request may close these issues.

2 participants