-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add account manager #37
base: main
Are you sure you want to change the base?
Conversation
import 'package:fuelet_secure_layer/src/features/wallet_import/entity/wallet_import_typedef.dart'; | ||
|
||
class AccountsManagerImpl extends AccountsManager { | ||
final int _loadingDerevativeAccountCount = 20; |
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.
typo: derivative
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.
fix
(Account account, String seedPhrase) accountSeedPhraseItem = | ||
accountSeedPhrases[i]; | ||
|
||
(String phrase, List<Account> accout) derivativeAccounts = |
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.
typo. Can we defined it like (String, List<Account>)
or just final
or var
?
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.
it's for you, more readable
await _defineAccountSeedPhrases(currentAccounts); | ||
|
||
for (int i = 0; i < accountSeedPhrases.length; i++) { | ||
(Account account, String seedPhrase) accountSeedPhraseItem = |
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.
same: do we need variable names here in defintion? Why not just (Account, String) accountSeedPhraseItem =
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.
it's not problem, but, if Account is obvious, then String, what is it
element.fuelAddress.bech32Address == | ||
currentAccountItem.fuelAddress.bech32Address)) { |
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.
Can we compare not bech32Address
, but just addresses? element.fuelAddress == currentAccountItem.fuelAddress
?
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, comparing by primitive type is better, because Account object is not finished yet
return resultMap; | ||
} | ||
|
||
Future<List<(Account, String)>> _defineAccountSeedPhrases( |
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.
It's possible that several accounts will have the same seed phrase, we should filter them out here at return just distinct phrases. Also, I don't think that we need to return an account from this function, just List<String>
should be enough
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.
further we use this result, and need Account
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.
you can just use the first account from the list of derivative accounts, that'd be more accurate
No description provided.