|
|
|
@ -272,19 +272,19 @@ func processNewCommnad() { |
|
|
|
|
if err != nil { |
|
|
|
|
fmt.Printf("new account error: %v\n", err) |
|
|
|
|
} |
|
|
|
|
fmt.Printf("account: %s\n", account.Address.Hex()) |
|
|
|
|
fmt.Printf("account: %s\n", common2.MustAddressToBech32(account.Address)) |
|
|
|
|
fmt.Printf("URL: %s\n", account.URL) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func _exportAccount(account accounts.Account) { |
|
|
|
|
fmt.Printf("account: %s\n", account.Address.Hex()) |
|
|
|
|
fmt.Printf("account: %s\n", common2.MustAddressToBech32(account.Address)) |
|
|
|
|
fmt.Printf("URL: %s\n", account.URL) |
|
|
|
|
pass := utils.AskForPassphrase("Original Passphrase: ") |
|
|
|
|
newpass := utils.AskForPassphrase("Export Passphrase: ") |
|
|
|
|
|
|
|
|
|
data, err := ks.Export(account, pass, newpass) |
|
|
|
|
if err == nil { |
|
|
|
|
filename := fmt.Sprintf(".hmy/%s.key", account.Address.Hex()) |
|
|
|
|
filename := fmt.Sprintf(".hmy/%s.key", common2.MustAddressToBech32(account.Address)) |
|
|
|
|
f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0644) |
|
|
|
|
if err != nil { |
|
|
|
|
panic("Failed to open keystore") |
|
|
|
@ -316,7 +316,7 @@ func processListCommand() { |
|
|
|
|
|
|
|
|
|
allAccounts := ks.Accounts() |
|
|
|
|
for _, account := range allAccounts { |
|
|
|
|
fmt.Printf("account: %s\n", account.Address.Hex()) |
|
|
|
|
fmt.Printf("account: %s\n", common2.MustAddressToBech32(account.Address)) |
|
|
|
|
fmt.Printf("URL: %s\n", account.URL) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -330,7 +330,7 @@ func processExportCommand() { |
|
|
|
|
|
|
|
|
|
allAccounts := ks.Accounts() |
|
|
|
|
for _, account := range allAccounts { |
|
|
|
|
if acc == "" || acc == account.Address.Hex() { |
|
|
|
|
if acc == "" || acc == common2.MustAddressToBech32(account.Address) { |
|
|
|
|
_exportAccount(account) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -360,7 +360,7 @@ func processImportCommnad() { |
|
|
|
|
if err != nil { |
|
|
|
|
panic("Failed to import the private key") |
|
|
|
|
} |
|
|
|
|
fmt.Printf("Private key imported for account: %s\n", account.Address.Hex()) |
|
|
|
|
fmt.Printf("Private key imported for account: %s\n", common2.MustAddressToBech32(account.Address)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func processBalancesCommand() { |
|
|
|
@ -373,14 +373,14 @@ func processBalancesCommand() { |
|
|
|
|
allAccounts := ks.Accounts() |
|
|
|
|
for i, account := range allAccounts { |
|
|
|
|
fmt.Printf("Account %d:\n", i) |
|
|
|
|
fmt.Printf(" Address: %s\n", account.Address.Hex()) |
|
|
|
|
fmt.Printf(" Address: %s\n", common2.MustAddressToBech32(account.Address)) |
|
|
|
|
for shardID, balanceNonce := range FetchBalance(account.Address) { |
|
|
|
|
fmt.Printf(" Balance in Shard %d: %s, nonce: %v \n", shardID, convertBalanceIntoReadableFormat(balanceNonce.balance), balanceNonce.nonce) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
address := common2.ParseAddr(*balanceAddressPtr) |
|
|
|
|
fmt.Printf("Account: %s:\n", address.Hex()) |
|
|
|
|
fmt.Printf("Account: %s:\n", common2.MustAddressToBech32(address)) |
|
|
|
|
for shardID, balanceNonce := range FetchBalance(address) { |
|
|
|
|
fmt.Printf(" Balance in Shard %d: %s, nonce: %v \n", shardID, convertBalanceIntoReadableFormat(balanceNonce.balance), balanceNonce.nonce) |
|
|
|
|
} |
|
|
|
|