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

feat: add balance logic in implicit account creation wizard #8075

Merged

Conversation

evavirseda
Copy link
Collaborator

Summary

Closes #8053
...

Changelog

- Please write a list of changes

Testing

Platforms

Please select any platforms where your changes have been tested.

  • Desktop
    • MacOS
    • Linux
    • Windows

Instructions

Please describe the specific instructions, configurations, and/or test cases necessary to test and verify that your changes work as intended.

...

Checklist

Please tick the following boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or modified tests that prove my changes work as intended
  • I have verified that new and existing unit tests pass locally with my changes
  • I have verified that my latest changes pass CI workflows for testing and linting
  • I have made corresponding changes to the documentation

packages/desktop/views/dashboard/account-management/AccountManagement.svelte
…nt-info

packages/desktop/views/dashboard/account-management/AccountManagement.svelte
…nt-info

packages/desktop/views/dashboard/account-management/AccountManagement.svelte
packages/desktop/views/dashboard/account-management/AccountManagement.svelte
cpl121 and others added 5 commits February 16, 2024 12:59
…w' and 'feat/add-account-info-logic' of github.com:iotaledger/firefly into feat/update-logic-for-activate-account-in-details-view
…w' and 'develop-iota2.0' of github.com:iotaledger/firefly into feat/update-logic-for-activate-account-in-details-view
@evavirseda evavirseda linked an issue Feb 20, 2024 that may be closed by this pull request
evavirseda and others added 4 commits February 20, 2024 11:26
…w' and 'develop-iota2.0' of github.com:iotaledger/firefly into feat/update-logic-for-activate-account-in-details-view
… into feat/add-balance-logic-to-implicit-wizard-and-management
Copy link
Member

@cpl121 cpl121 left a comment

Choose a reason for hiding this comment

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

Nice 👌🏼

@cpl121 cpl121 requested a review from marc2332 February 21, 2024 12:53
@@ -54,10 +54,21 @@
$: accountId = isAccountOutput(selectedOutput) ? (selectedOutput?.output as AccountOutput)?.accountId : null
$: address = accountId ? getBech32AddressFromAddressTypes(new AccountAddress(accountId)) : null
$: isMainAccount = accountId && accountId === $selectedWalletMainAccountId
$: balance = getAccountBalance(selectedOutput)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should probably pass isImplicitAccount to getAccountBalance, so if isImplicitAccount changes for any reason, the balance will be updated, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i'm a bit confused about why it might be necessary to pass it. If an implicitAccount is created through handleActivateAccount, it's not like it would spontaneously change, right?
sorry, but I don't see the situation in which this would happen... 🙈
could you help me understand this better? 🙏 maybe i'm wrong..

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I agree with Eva, the moment the implicitOutput stops being implicit the selectedOutput will also change

Copy link
Collaborator

@marc2332 marc2332 Feb 23, 2024

Choose a reason for hiding this comment

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

I prefer explicit reactive dependencies over assumptions, if L53 changes in the future, isImplicitAccount might start changing its value because of another factor than selectedOutput, and balance might get out of sync if you forget to update the logic of getAccountBalance. I don't see how passing isImplicitAccount would be a problem

Copy link
Member

Choose a reason for hiding this comment

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

Okeey, makes sense 👌🏼

Comment on lines 15 to 17
$: formattedWalletBalance = walletBalance
? formatTokenAmountBestMatch(Number(walletBalance.baseCoin?.available), baseCoin?.metadata)
: '-'
Copy link
Collaborator

Choose a reason for hiding this comment

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

this makes more sense, right?

Suggested change
$: formattedWalletBalance = walletBalance
? formatTokenAmountBestMatch(Number(walletBalance.baseCoin?.available), baseCoin?.metadata)
: '-'
$: formattedWalletBalance = walletBalance?.baseCoin?.available
? formatTokenAmountBestMatch(Number(walletBalance.baseCoin.available), baseCoin?.metadata)
: '-'

Base automatically changed from feat/update-logic-for-activate-account-in-details-view to develop-iota2.0 February 22, 2024 16:20
…t-wizard-and-management

packages/desktop/views/dashboard/wallet/views/implicit-account-creation-multistep/FundConfirmationView.svelte
@@ -54,10 +54,21 @@
$: accountId = isAccountOutput(selectedOutput) ? (selectedOutput?.output as AccountOutput)?.accountId : null
$: address = accountId ? getBech32AddressFromAddressTypes(new AccountAddress(accountId)) : null
$: isMainAccount = accountId && accountId === $selectedWalletMainAccountId
$: balance = getAccountBalance(selectedOutput)
Copy link
Collaborator

@marc2332 marc2332 Feb 23, 2024

Choose a reason for hiding this comment

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

I prefer explicit reactive dependencies over assumptions, if L53 changes in the future, isImplicitAccount might start changing its value because of another factor than selectedOutput, and balance might get out of sync if you forget to update the logic of getAccountBalance. I don't see how passing isImplicitAccount would be a problem

Copy link
Collaborator

@marc2332 marc2332 left a comment

Choose a reason for hiding this comment

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

Unrelated to this PR but I don't see why

listBlockKeysFeature(selectedOutput)
is being called on an onMount, what if the output changes?

Copy link
Collaborator

@marc2332 marc2332 left a comment

Choose a reason for hiding this comment

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

🆒

@cpl121 cpl121 merged commit f3a42fa into develop-iota2.0 Feb 23, 2024
3 of 4 checks passed
@cpl121 cpl121 deleted the feat/add-balance-logic-to-implicit-wizard-and-management branch February 23, 2024 08:54
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.

[Task]: Add balance logic in implicit account creation wizard
3 participants