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

fix(template): remove client.ReadPersistentCommandFlags #4132

Closed
wants to merge 6 commits into from

Conversation

islishude
Copy link
Contributor

The client.SetCmdClientContextHandler has the client.ReadPersistentCommandFlags

https://github.com/cosmos/cosmos-sdk/blob/0c91044220403e7b899ad0e51ccd2d4e5d66a901/client/cmd.go#L30-L37

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

I believe you still need to read the flags before. Blocking this until I test this thoroughly. But from my memory this is in purpose.

@julienrbrt
Copy link
Member

Now that your changes (cosmos/cosmos-sdk#20356) have been merged and backported to v0.50 in the SDK, let me check if this works now.

@islishude
Copy link
Contributor Author

the steps to initialize the client instance:

  1. use the depinject
  2. add cobra cmd
  3. read the flags (I removed this)
  4. read the config file
  5. add tx config (it doesn't depend on step 3)
  6. read the flags again in the SetCmdClientContextHandler

I don't think the step 3 is necessary.

and by the way, refer to the viper documentation, the flag has higher priority

https://github.com/spf13/viper?tab=readme-ov-file#why-viper

changelog.md Outdated Show resolved Hide resolved
@Pantani Pantani self-requested a review May 17, 2024 00:14
@julienrbrt
Copy link
Member

This is required, otherwise ReadFromClientConfig will have a client context with possibly wrong values (such as the home) or the output.

@julienrbrt julienrbrt closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants