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

Improve commands - order networks selection based on the selected account id #225

Merged
merged 4 commits into from
Aug 28, 2023
Merged

Improve commands - order networks selection based on the selected account id #225

merged 4 commits into from
Aug 28, 2023

Conversation

thaodt
Copy link
Contributor

@thaodt thaodt commented Jul 5, 2023

This PR is served for #222.

@thaodt thaodt changed the title [WIP] improve commands - order networks selection based on the selected account id Improve commands - order networks selection based on the selected account id Jul 12, 2023
@thaodt thaodt marked this pull request as ready for review July 12, 2023 10:40
@thaodt
Copy link
Contributor Author

thaodt commented Jul 12, 2023

hi @frol , could you please help me review this PR?

Copy link
Collaborator

@frol frol left a 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>,
Copy link
Collaborator

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:

Suggested change
account_id: Option<crate::types::account_id::AccountId>,
account_id: Option<&crate::types::account_id::AccountId>,

src/common.rs Outdated
Comment on lines 1613 to 1615
let mut variants = config.network_connection.keys().collect::<Vec<_>>();
variants.sort();
variants
Copy link
Collaborator

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.

src/common.rs Outdated Show resolved Hide resolved
@thaodt thaodt requested a review from frol July 17, 2023 11:06
@thaodt
Copy link
Contributor Author

thaodt commented Jul 17, 2023

Finished per your review, please recheck.

Copy link
Collaborator

@frol frol left a 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)

@frol frol enabled auto-merge (squash) August 28, 2023 20:26
@frol frol merged commit 23bb067 into near:master Aug 28, 2023
8 checks passed
@frol frol mentioned this pull request Aug 28, 2023
FroVolod pushed a commit that referenced this pull request Aug 29, 2023
FroVolod pushed a commit that referenced this pull request Aug 29, 2023
FroVolod pushed a commit that referenced this pull request Sep 3, 2023
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.

2 participants