Skip to content

Commit

Permalink
Revert "fix: set address prefix with sdk v0.52 (#4486)"
Browse files Browse the repository at this point in the history
This reverts commit 8a382f9.
  • Loading branch information
julienrbrt committed Feb 10, 2025
1 parent b3ab467 commit 0418bad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
- [#4361](https://github.com/ignite/cli/pull/4361) Remove unused `KeyPrefix` method
- [#4384](https://github.com/ignite/cli/pull/4384) Compare genesis params into chain genesis tests
- [#4463](https://github.com/ignite/cli/pull/4463) Run `chain simulation` with any simulation test case
- [#4486](https://github.com/ignite/cli/pull/4486) Fix issue when set account prefix with sdk v0.52

### Fixes

Expand Down
15 changes: 13 additions & 2 deletions ignite/pkg/cosmosclient/cosmosclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ func New(ctx context.Context, options ...Option) (Client, error) {
if c.signer == nil {
c.signer = signer{}
}
// set address prefix in SDK global config
c.SetConfigAddressPrefix()

return c, nil
}
Expand Down Expand Up @@ -466,6 +468,16 @@ func (c Client) Context() client.Context {
return c.context
}

// SetConfigAddressPrefix sets the account prefix in the SDK global config.
func (c Client) SetConfigAddressPrefix() {
// TODO find a better way if possible.
// https://github.com/ignite/cli/issues/2744
mconf.Lock()
defer mconf.Unlock()
config := sdktypes.GetConfig()
config.SetBech32PrefixForAccount(c.addressPrefix, c.addressPrefix+"pub")
}

// Response of your broadcasted transaction.
type Response struct {
Codec codec.Codec
Expand Down Expand Up @@ -837,8 +849,7 @@ func (c Client) newContext() client.Context {
WithGenerateOnly(c.generateOnly).
WithAddressCodec(addressCodec).
WithValidatorAddressCodec(validatorAddressCodec).
WithConsensusAddressCodec(consensusAddressCodec).
WithAddressPrefix(c.addressPrefix)
WithConsensusAddressCodec(consensusAddressCodec)
}

func newFactory(clientCtx client.Context) tx.Factory {
Expand Down

0 comments on commit 0418bad

Please sign in to comment.