lightning-browser-extension
lightning-browser-extension copied to clipboard
Enhancement: Include id and balance for each account in Accounts page
Is your feature request related to a problem? Please describe
On the Account page, it may be helpful to show the unique id & balance of an account rather than just the default, since names are sometimes defaulted and can be duplicated, such as below. This makes it difficult to know which account you are editing or deleting.

Describe the solution you'd like
Display showing the (editable) name
, node_id
, and amount
, such as is given for the currently selected node in the account menu:
This is closely related to #966.
Are you working on this?
Not currently, but happy to give this a shot if we decide to pursue it!
@thebrandonlucas what do you think about this? 👇 The unique id and account balance has been added to each account to show users the balances directly
@theewiz It looks good to me! In this design we'd be able to tell the difference between four accounts even if they were all Alby/lndhub accounts.
We currently have a technical problem there and we can not load the balances of each account in parallel. There currently is only one active "connector" that is used to do calls to the node. This is because some connectors need some time to initialize. for example to talk to a node behind Tor we first have to initialize Tor and this takes a few seconds. There can also only be one Tor connection open and currently this is handled on the connector level - so before we do a call with another connector that requires Tor we have to "unload" the first one, wait and then initialize the second one.
This takes too long and is too complex currently to iterate through all accounts and show balances on one page.
@bumi you think it would be helpful to display the node id?
@bumi Personally, I don't think the balances of each are absolutely crucial on this page as long as we have some way to distinguish the different accounts (i.e. for editing/deletion purposes), such as via the node id as @escapedcat mentioned
It is more practical to display a Account alias in the account list and switching account I found that the two imported account aliases are different ${authAccount?.alias}
It is more practical to display a Account alias in the account list and switching account I found that the two imported account aliases are different ${authAccount?.alias}
Not exactly sure what you mean, can you link to code or explain in detail?
When switching accounts, I think it's OK to remind that this account is different from other accounts
in components/AccountMenu/index.tsx
authAccount data
{
"alias": "alby-testnet-lnd2",
"balance": 3316718,
"id": "3a6a8a14-129f-4151-aa3d-e3476e97c496",
"name": "LND"
}
accounts data
[{
"config": "U2Fs*******AET/o",
"connector": "lnd",
"id": "3a6a8a14-129f-4151-aa3d-e3476e97c496",
"name": "LND"
}]
I think we can add alias attribute to the accounts data,different accounts may have different aliases
Here's what I'm curious about
Those who are used to using the btc eth wallet will generally look at their wallet address And these are account information, but there is no lightning network address(public key of the destination node), If there is a public key, the public key can also be used to distinguish different accounts
public key can be used in webln.keysend
await webln.enable(); const result = await webln.keysend({ destination: "03006fcf3312dae8d068ea297f58e2bd00ec1ffe214b793eda46966b6294a53ce6", amount: "1", customRecords: { "34349334": "HELLO AMBOSS" } });
In metamask, each account is given an added ID. I think it is easy to partition different accounts in this way. In alby the current account names are the same, which is easy to mistake for a bug
Adding the alias or balance or similar is problematic right now because that requires a call to the node. This is only possible with the current active account (because credentials are encrypted and some connections require some time to initialize (e.g. Tor))
Adding a number is a very good idea and I think this should be possible. We probably could count the existing accounts in here and add the number to the name? https://github.com/getAlby/lightning-browser-extension/blob/master/src/extension/background-script/actions/accounts/add.ts
@bumi @escapedcat
This adds the number, do you need to implement it to see the effect?
This adds the number
What's "this"?
Adding a number is a very good idea and I think this should be possible. We probably could count the existing accounts in here and add the number to the name? https://github.com/getAlby/lightning-browser-extension/blob/master/src/extension/background-script/actions/accounts/add.ts
@escapedcat
The advantage of this method is that it works for newly registered accounts
But it doesn't work for 2 cases
1 old account
2 Register a new account, the account number is 1, then delete the account, and register a new account, the account number is still 1
Other methods can also be used, such as processing account information to generate a corresponding small picture. Different pictures corresponding to user accounts can also easily distinguish account information with exactly the same name, and this is work for all accounts.
cc @reneaaron what do you think about identicons?
Can't we cache the alias and color inside the account and update it the next time they load that account (in the rare? case it does change later)?
This probably wouldn't work for the balance since it can be easily changed outside of the extension, but I think the more static data is OK?
The alias is exactly what we need, it's not a great UX to have to manually update it if you add 2 LND nodes for example, each which are already identifiable by their alias
The alias does not work for all the connectors (basically only LND+CLN). look how the data is loaded. (frontend => background script => connector => node) We don't have any caching there. Try it out, but I dont' think all the complexity (as I see it) is worth it.
if we really want a different name there, then maybe we set the name in the connect screen when adding the account: https://github.com/getAlby/lightning-browser-extension/blob/master/src/app/screens/connectors/ConnectLnd/index.tsx#L63
The validation (which we can not always call (because Tor)) we have the info and the alias.
This is the default name filed: https://github.com/getAlby/lightning-browser-extension/blob/master/src/app/screens/connectors/ConnectLnd/index.tsx#L49 - to be changed here.
I personally like the identicon idea as they might give you some additional thing that can easily be scanned in a longer list. (without having to read all the different account names)
@bumi thanks for a pointer where to look. I guess there is a workaround by manually editing the account name but I still feel like this would be a nice improvement for the text-part (I am not sure identicons solve the whole issue)
So the idea here is to add some unique information to the default name then? (e.g. node id?) I'll create a separate issue to add identicons (the basis for our profile pictures).
if we want the alias in there we can add the alias when adding the account. (- I did not mean to do this manually)
metamask use @metamask/jazzicon
https://github.com/MetaMask/metamask-extension/blob/245c32a99e05a770df2f3bacd9d2ce8ca3f6a879/ui/components/ui/identicon/identicon.component.js#L100-L112
{
"alias": "alby-testnet-lnd2",
"balance": 3316718,
"id": "3a6a8a14-129f-4151-aa3d-e3476e97c496",
"name": "LND"
}
Is the id in this json now unique or not? @reneaaron
@qqqzhch not sure if we still need this. Avatars have just been merged with #1992
Maybe it's not needed anymore, I think I need to look at more issues and pr instead of just focusing on a few issues @escapedcat
Should we close this @reneaaron @rolznz ?
@escapedcat I think now they can be visually identified by different icons, but my connections will all still say "LND". I think it would be still good to add the alias when adding the account. Sorry, I haven't got around to making a PR for this yet.
Different accounts of the same type, the difference is not very obvious
Polkadot-js has similar implementations, but they are all based on different addresses and display different icons
https://polkadot.js.org/docs/ui-identicon/react
Quite a few link methods on the lightning network don't have an address, should we try a nickname generated from the id? The same id generates the same nickname
This is better than colourful images to distinguish between。
for example, nodes for blockchain testing. During local initialisation, 10 addresses are generated, each with a nickname,This also makes it easy to distinguish between the 10 addresses
With the alias added to the name of the account also the avatars will be different.
For now you can just manually rename them.
Thanks for tackling this @rolznz!
Update: I believe it would be good to keep the alias constant ("LND" or "CLN" etc), but set the account name directly from the node name.
From https://github.com/getAlby/lightning-browser-extension/pull/2032 (closed due to not being the correct solution for this problem)