Skip to content

Commit

Permalink
#39 Remove 'cosmosaccaddr' prefix from cyberd address
Browse files Browse the repository at this point in the history
  • Loading branch information
arturalbov committed Nov 16, 2018
1 parent 0e7f7f5 commit 1026309
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
13 changes: 13 additions & 0 deletions cosmos/poc/app/prefix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package app

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

func SetPrefix() {
config := sdk.GetConfig()
config.SetBech32PrefixForAccount("cbd", "cbd")
config.SetBech32PrefixForValidator("cbd", "cbd")
config.SetBech32PrefixForConsensusNode("cbd", "cbd")
config.Seal()
}
1 change: 1 addition & 0 deletions cosmos/poc/claim/context/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func NewClaimContext() (ClaimContext, error) {
chainId := viper.GetString(common.FlagChainId)

cdc := app.MakeCodec()
app.SetPrefix()

cliCtx := newCLIContext(name, chainId, viper.GetString(common.FlagNode)).
WithCodec(cdc).
Expand Down
3 changes: 2 additions & 1 deletion cosmos/poc/cyberd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ import (

const (
flagClientHome = "home-client"
flagAccsCount = "accs-count"
flagAccsCount = "accs-count"
)

func main() {

cdc := app.MakeCodec()
app.SetPrefix()
ctx := server.NewDefaultContext()

rootCmd := &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion cosmos/poc/cyberdcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func main() {

// get the codec
cdc := app.MakeCodec()
app.SetPrefix()

// TODO: Setup keybase, viper object, etc. to be passed into
// the below functions and eliminate global vars, like we do
Expand All @@ -57,7 +58,7 @@ func main() {
cyberdcli.AddCommand(
client.LineBreak,
lcd.ServeCommand(cdc), // Commands to start local rpc proxy to node
keys.Commands(), // Commands to generate and handle keys
keys.Commands(), // Commands to generate and handle keys
client.LineBreak,
version.VersionCmd,
)
Expand Down
2 changes: 1 addition & 1 deletion cosmos/poc/proxy/core/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type ProxyContext struct {
}

func NewProxyContext(endpoint string) ProxyContext {
app.SetPrefix()
return ProxyContext{
Codec: app.MakeCodec(),
Node: client.NewHTTP(endpoint, "/websocket"),
Expand Down Expand Up @@ -72,4 +73,3 @@ func (ctx ProxyContext) BroadcastTxSync(txBytes []byte) ([]byte, error) {

return respBytes, nil
}

0 comments on commit 1026309

Please sign in to comment.