ignite / cli

Ignite is a CLI tool and hub designed for constructing Proof of Stake Blockchains rooted in Cosmos-SDK
https://ignite.com
Other
1.25k stars 549 forks source link

`cosmosclient`: improve account prefix management for txs #2744

Open lumtis opened 2 years ago

lumtis commented 2 years ago

We are currently updating the SDK global config for the address prefix everytime before sending a transaction: cli/ignite/pkg/cosmosclient/cosmosclient.go Or also when the client is created in https://github.com/ignite/cli/pull/2743

This method is a bit unclean as we must interact with global vars...

This method is kind of impose by the current structure of the SDK since it relies on the global config to parse the prefix when determining the address of an account.

The first step of this issue is to design and propose an issue in the SDK repo more flexibility to manage account prefix without relying on a global configuration. For example: Adding accountPrefix as attribute of transaction factory type: https://github.com/cosmos/cosmos-sdk/blob/1932ef175da024cf4abb5d91e03a590625320eee/client/tx/factory.go#L23

tbruyelle commented 2 years ago

Couldn't agree more, dealing with the sdkconfig for prefix changes is painful in cosmosclient.

julienrbrt commented 2 months ago

We'll be able to do this better in v0.52 as we can set an address codec in the client context. However, the global sdk config will still need to be used and set (until no other modules depend on it).

maxrobot commented 1 month ago

Couldn't agree more, dealing with the sdkconfig for prefix changes is painful in cosmosclient.

Do you have an example of how to change the prefix in the sdkconfig for use with cosmosclient?