-
Notifications
You must be signed in to change notification settings - Fork 82
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
frontend: update 'My portfolio' with lightning account #2703
base: staging-ln
Are you sure you want to change the base?
Conversation
4a1bd10
to
3db7734
Compare
1dd6252
to
571341f
Compare
571341f
to
7e6de8d
Compare
const hasLightningFromOtherKeystore = ( | ||
lightningConfig.accounts.length !== 0 | ||
&& ( | ||
accountsByKeystore.length === 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that you can avoid checking the length, it should be handled by the some condition anyway, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this check is redundant here, removed.
) | ||
); | ||
|
||
const showTotalCoins = accountsByKeystore.length > 1 || (hasLightningFromOtherKeystore && accountsByKeystore.length === 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: what about doing smth like
let keystores = accountsByKeystore.length; if (hasLightningFromOtherKeystore) { keystores += 1; }
and check for keystores > 1 below?
I feel like it would be more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this to use keystores
547408d
to
2e0ac00
Compare
@Beerosagos
Also, this should be resolved now. PTAL |
There was some refactoring on master, maybe consider merge master->staging-ln before this? |
Yes, I agree 👍 |
merge master > staging-ln PR: #2782 |
6396687
to
e11b223
Compare
This commit adds functionality to display Lightning account in 'My portfolio' in cases where it is active but not associated with a connected or remembered wallet, or when all mainnet accounts in the connected wallet are disabled. The total coins table is updated to include the Lightning account, and the Lightning configuration now also contains the keystore name.
e11b223
to
3aed2f7
Compare
@Beerosagos rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple comments.
Also, I noticed that if the only active account is the lightning one, then the chart in the account summary is empty. Not sure what we want to do with this, the easier is probably to hide it, at least for now. wdyt @thisconnect ?
return nil, err | ||
} | ||
totalCoinsBalances[coin.CodeBTC] = lightningBalance.Available().BigInt() | ||
sortedCoins = append(sortedCoins, coin.CodeBTC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This potentially breaks the coin sorting, which should be derived by the accounts sorting. The LN balance handling should be done together with the BTC accounts balance
@@ -26,6 +26,8 @@ type LightningAccountConfig struct { | |||
Mnemonic string `json:"mnemonic"` | |||
// RootFingerprint is fingerprint of the keystore that generated the entropy. | |||
RootFingerprint jsonp.HexBytes `json:"rootFingerprint"` | |||
// KeyStoreName is name of the keystore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that storing the keystore name could lead to issues when the device name is changed by the user.
I didn't look deeply into this, but I think that the proper way of doing it could be to get the persisted keystore info and retrieve the name there (see backend.Config().AccountsConfig()
), but we may need to actively persist the current keystore when enabling the LN account).
cc @benma wdyt?
This commit adds functionality to display lightning account in 'My portfolio' in cases where it is active but not associated with a connected or remembered wallet, or when all mainnet accounts in the connected wallet are disabled.
The total coins table is updated to include the Lightning account, and the Lightning configuration now also contains the keystore name.