lightning-browser-extension icon indicating copy to clipboard operation
lightning-browser-extension copied to clipboard

Enhancement: Include id and balance for each account in Accounts page

Open thebrandonlucas opened this issue 2 years ago • 5 comments

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.

Screen Shot 2022-05-30 at 12 25 03 AM

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: Screen Shot 2022-05-30 at 12 18 24 AM

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 avatar May 30 '22 04:05 thebrandonlucas

@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

wr

theewiz avatar Jun 12 '22 17:06 theewiz

@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.

thebrandonlucas avatar Jun 16 '22 10:06 thebrandonlucas

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 avatar Jun 16 '22 10:06 bumi

@bumi you think it would be helpful to display the node id?

escapedcat avatar Jun 17 '22 03:06 escapedcat

@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

thebrandonlucas avatar Jun 17 '22 14:06 thebrandonlucas

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}

qqqzhch avatar Dec 02 '22 12:12 qqqzhch

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?

escapedcat avatar Dec 02 '22 14:12 escapedcat

sss 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" } });

qqqzhch avatar Dec 03 '22 03:12 qqqzhch

sss

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

qqqzhch avatar Dec 03 '22 05:12 qqqzhch

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 avatar Dec 03 '22 23:12 bumi

@bumi @escapedcat
This adds the number, do you need to implement it to see the effect?

qqqzhch avatar Dec 24 '22 07:12 qqqzhch

This adds the number

What's "this"?

escapedcat avatar Dec 27 '22 15:12 escapedcat

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 WX20230114-113257 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. WX20230114-113556

qqqzhch avatar Jan 14 '23 03:01 qqqzhch

cc @reneaaron what do you think about identicons?

bumi avatar Jan 14 '23 18:01 bumi

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

rolznz avatar Jan 15 '23 13:01 rolznz

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.

bumi avatar Jan 15 '23 14:01 bumi

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)

reneaaron avatar Jan 15 '23 19:01 reneaaron

@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)

rolznz avatar Jan 16 '23 13:01 rolznz

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).

reneaaron avatar Jan 16 '23 14:01 reneaaron

if we want the alias in there we can add the alias when adding the account. (- I did not mean to do this manually)

bumi avatar Jan 16 '23 19:01 bumi

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 avatar Jan 29 '23 03:01 qqqzhch

@qqqzhch not sure if we still need this. Avatars have just been merged with #1992

escapedcat avatar Jan 29 '23 14:01 escapedcat

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

qqqzhch avatar Jan 30 '23 01:01 qqqzhch

Should we close this @reneaaron @rolznz ?

escapedcat avatar Jan 30 '23 09:01 escapedcat

@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.

rolznz avatar Jan 30 '23 12:01 rolznz

WX20230131-104958 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 WX20230131-105325 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

qqqzhch avatar Jan 31 '23 02:01 qqqzhch

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!

reneaaron avatar Jan 31 '23 09:01 reneaaron

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)

rolznz avatar Jul 04 '23 05:07 rolznz