Repository navigation
feat: add --mainnet flag to switch Bech32 address prefix - #1
Merged
Merged
Conversation
Introduces a persistent --mainnet CLI flag that selects the correct Bech32 address prefix before sdk.GetConfig().Seal() is called: - Default (testnet): addr_safro / addr_safrovaloper / addr_safrovalcons - --mainnet: safro / safrovaloper / safrovalcons os.Args is pre-scanned via getBech32Prefix() so the prefix is set before Cobra parses flags, which is required by the Cosmos SDK config seal contract. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
danbaruka
added a commit
that referenced
this pull request
Apr 26, 2026
feat: add --mainnet flag to switch Bech32 address prefix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
--mainnetflag to allow runtime switching between mainnet and testnet Bech32 address prefixes"safro") and testnet ("addr_safro") prefixesgetBech32Prefix()function to inspectos.Argsbefore Cobra parses flags, since SDK config must be sealed earlyNewRootCmd()to dynamically set all Bech32 prefix variables based on the flag--mainnetflag with Cobra to prevent unknown flag errorsDetails
This allows users to run the same binary with different address prefixes by passing
--mainnet, while maintaining backward compatibility with testnet as the default.