Skip to content

Commit

Permalink
Merge branch 'main' into fix/txpool-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
alidevjimmy authored Nov 6, 2024
2 parents 18f441f + 6cde2ef commit 5ae87cb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
6 changes: 1 addition & 5 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,7 @@ func MakeConfig(workingDir string) (*config.Config, *genesis.Genesis, error) {
}

if !gen.ChainType().IsMainnet() {
crypto.AddressHRP = "tpc"
crypto.PublicKeyHRP = "tpublic"
crypto.PrivateKeyHRP = "tsecret"
crypto.XPublicKeyHRP = "txpublic"
crypto.XPrivateKeyHRP = "txsecret"
crypto.ToTestnetHRP()
}

walletsDir := PactusWalletDir(workingDir)
Expand Down
2 changes: 2 additions & 0 deletions cmd/wallet/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func buildPrivateKeyCmd(parentCmd *cobra.Command) {
Short: "displays the private key for a specified address",
Args: cobra.ExactArgs(1),
}

parentCmd.AddCommand(privateKeyCmd)

passOpt := addPasswordOption(privateKeyCmd)
Expand All @@ -166,6 +167,7 @@ func buildPublicKeyCmd(parentCmd *cobra.Command) {
Short: "displays the public key for a specified address",
Args: cobra.ExactArgs(1),
}

parentCmd.AddCommand(publicKeyCmd)

publicKeyCmd.Run = func(_ *cobra.Command, args []string) {
Expand Down
9 changes: 9 additions & 0 deletions crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ var (
// XPrivateKeyHRP is the Human Readable Part (HRP) for extended private key.
XPrivateKeyHRP = "xsecret"
)

// ToTestnetHRP makes HRPs testnet specified.
func ToTestnetHRP() {
AddressHRP = "tpc"
PublicKeyHRP = "tpublic"
PrivateKeyHRP = "tsecret"
XPublicKeyHRP = "txpublic"
XPrivateKeyHRP = "txsecret"
}
6 changes: 1 addition & 5 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,7 @@ func Create(walletPath, mnemonic, password string, chain genesis.ChainType,

func newWallet(walletPath string, store *Store, offline bool, option *walletOpt) (*Wallet, error) {
if !store.Network.IsMainnet() {
crypto.AddressHRP = "tpc"
crypto.PublicKeyHRP = "tpublic"
crypto.PrivateKeyHRP = "tsecret"
crypto.XPublicKeyHRP = "txpublic"
crypto.XPrivateKeyHRP = "txsecret"
crypto.ToTestnetHRP()
}

client := newGrpcClient(option.timeout, option.servers)
Expand Down

0 comments on commit 5ae87cb

Please sign in to comment.