Skip to content

Commit

Permalink
rebase develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Oct 16, 2023
2 parents 5b0911a + fb82095 commit 32560c1
Show file tree
Hide file tree
Showing 60 changed files with 2,134 additions and 444 deletions.
30 changes: 28 additions & 2 deletions cmd/zetacored/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package main

import (
"fmt"
"os"
"strings"

"github.com/cosmos/cosmos-sdk/server"
cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config"

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/zeta-chain/zetacore/app"
cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config"
)

func main() {
Expand All @@ -16,12 +17,37 @@ func main() {
rootCmd, _ := NewRootCmd()

if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {

switch e := err.(type) {
case server.ErrorCode:
os.Exit(e.Code)

default:
processError(e)
os.Exit(1)
}
}
}

func processError(err error) {
// --ledger flag can't be used with Ethereum HD path
if strings.Contains(err.Error(), "cannot set custom bip32 path with ledger") {
printNotice([]string{
"note: --ledger flag can't be used with Ethereum HD path (used by default)",
"use --hd-path=\"\" in the command to use Cosmos HD path",
})
os.Exit(1)
}
}

func printNotice(messages []string) {
if len(messages) == 0 {
return
}
border := strings.Repeat("*", len(messages[0])+4) // 4 to account for padding
fmt.Println(border)
for _, message := range messages {
fmt.Printf("* %s \n", message)
}
fmt.Println(border)
}
3 changes: 1 addition & 2 deletions cmd/zetacored/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,12 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig
ethermintclient.KeyCommands(app.DefaultNodeHome),
)

// replace the default hd-path for the key add command
// replace the default hd-path for the key add command with Ethereum HD Path
if err := SetEthereumHDPath(rootCmd); err != nil {
fmt.Printf("warning: unable to set default HD path: %v\n", err)
}

rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec))

}

func addModuleInitFlags(startCmd *cobra.Command) {
Expand Down
Loading

0 comments on commit 32560c1

Please sign in to comment.