-
Notifications
You must be signed in to change notification settings - Fork 56
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
Improve commands - order networks selection based on the selected account id #225
Improve commands - order networks selection based on the selected account id #225
Conversation
hi @frol , could you please help me review this PR? |
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 PR does not meet the task requirements.
src/common.rs
Outdated
pub fn input_network_name( | ||
config: &crate::config::Config, | ||
account_id: Option<crate::types::account_id::AccountId>, |
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 don't see a reason to pass account_id
by value, so I suggest passing it by reference to avoid unnecessary clones on the caller side:
account_id: Option<crate::types::account_id::AccountId>, | |
account_id: Option<&crate::types::account_id::AccountId>, |
src/common.rs
Outdated
let mut variants = config.network_connection.keys().collect::<Vec<_>>(); | ||
variants.sort(); | ||
variants |
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.
Preserve the configuration order, do not sort.
Finished per your review, please recheck. |
…s, and refactored to support a list of accounts
…k-on-selected-accid
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 leaving the review comments would take longer than finishing it myself, so I refactored the code to always use near_primitives::types::AccountId
instead of crate::types::account_id::AccountId
in Context structs, and added support for multiple account ids (e.g. sender/receiver/nft_contract_account_id)
This PR is served for #222.