Skip to content

Conversation

kien6034
Copy link
Contributor

@kien6034 kien6034 commented Oct 26, 2024

Close #9166

Motivation

Solution

  • add option -default-keystore to allow user to generate wallet if no path is given

@kien6034 kien6034 changed the title feat: add deafult path when cast new wallet feat(cast): add default path when cast new wallet Oct 26, 2024
@kien6034 kien6034 changed the title feat(cast): add default path when cast new wallet feat(cast): wallet new - enable default keystore Oct 26, 2024
@kien6034
Copy link
Contributor Author

output locally:
image

@zerosnacks
Copy link
Member

Hi @kien6034 thanks for your PR, a few notes

@kien6034 kien6034 force-pushed the feat/cast-wallet-default-keystore-path branch from 31537dc to f28f6af Compare October 29, 2024 08:05
@kien6034 kien6034 requested a review from zerosnacks October 29, 2024 08:59
@kien6034
Copy link
Contributor Author

Hi @zerosnacks , i updated code and writing tests following your comments.

Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Some small notes, tests look good 👍

@zerosnacks zerosnacks self-requested a review October 31, 2024 08:59
zerosnacks
zerosnacks previously approved these changes Oct 31, 2024
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

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

Thanks @kien6034, looks great

Pending another review cc @grandizzy / @yash-atreya

@kien6034
Copy link
Contributor Author

kien6034 commented Nov 4, 2024

@grandizzy @yash-atreya can you help me review this PR?

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

left a comment re newly introduced default_keystore, @zerosnacks pls chime in. thanks!

json: bool,

/// Use default keystore location (~/.foundry/keystores).
#[arg(long, short, conflicts_with = "path", default_value = "false")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I get it right, the default keystore is used if no path provided but only with unsafe_password option (any reason why this is not available for password too?).
If so, do we want to make this explicit by adding the new default_keystore arg or can we just use default keystore if path is None?
That is the

} else if default_keystore {

below to be

} else if unsafe_password {

@zerosnacks wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

the removal of requires = "path should allow it to use the default path, not place a conditional on it

I would prefer making the default path implicit as well over having a new flag be introduced

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zerosnacks @grandizzy tks for reviewing

so as my understanding, we should use default_key_store when path is none + unsafe password or password is provided.

if password fields not provided, we just printout the keys for user?

Copy link
Member

Choose a reason for hiding this comment

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

Correct, a keystore implies having a password whereas a keypair does not

@zerosnacks zerosnacks self-requested a review November 5, 2024 08:29
@zerosnacks zerosnacks dismissed their stale review November 5, 2024 08:29

new updates

@kien6034 kien6034 requested a review from grandizzy November 6, 2024 09:40
@kien6034
Copy link
Contributor Author

kien6034 commented Nov 6, 2024

@zerosnacks updated sir

@kien6034
Copy link
Contributor Author

@zerosnacks @grandizzy hello sirs, can you help me finalize this pr?

@zerosnacks zerosnacks moved this to In Progress in Foundry Aug 25, 2025
@zerosnacks zerosnacks self-assigned this Aug 25, 2025
@zerosnacks zerosnacks added the C-cast Command: cast label Aug 25, 2025
@zerosnacks
Copy link
Member

Hi @kien6034

My apology for missing your pings and losing track of your PR; this is definitely still something we want to merge!

I've updated the PR to reflect the changes that happened since your proposal

@zerosnacks zerosnacks moved this from In Progress to Ready For Review in Foundry Aug 26, 2025
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

makes sense, left one nit

…ien6034/foundry into feat/cast-wallet-default-keystore-path
@zerosnacks zerosnacks enabled auto-merge (squash) August 26, 2025 09:32
@zerosnacks zerosnacks requested a review from grandizzy August 26, 2025 09:32
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

lgtm

@zerosnacks zerosnacks merged commit 3e674ae into foundry-rs:master Aug 26, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry Aug 26, 2025
@zerosnacks
Copy link
Member

Thanks @kien6034 for your PR!

@grandizzy grandizzy moved this from Done to Completed in Foundry Sep 1, 2025
MerkleBoy pushed a commit to MerkleBoy/foundry that referenced this pull request Sep 17, 2025
* feat: use default keystore flag

* bet

* refactor: wallet new function

* feat: implicitly defer default keystore

* fix nit

---------

Co-authored-by: zerosnacks <zerosnacks@protonmail.com>
Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cast Command: cast

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

feat(cast) cast wallet new - enable default keystore

3 participants