Skip to content

Commit

Permalink
feat(wallet info): add both HEX and CB58 private key to the template.
Browse files Browse the repository at this point in the history
  • Loading branch information
servalD committed Feb 8, 2024
1 parent e655254 commit 76b6961
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crates/ash_cli/src/utils/templating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,13 @@ pub(crate) fn template_wallet_info(wallet_info: &AvalancheWalletInfo, indent: us
info_str.push_str(&formatdoc!(
"
Wallet information:
X-Chain address: {}
P-Chain address: {}
EVM address: {}",
HEX private key: {}
CB58 private key: {}
X-Chain address: {}
P-Chain address: {}
EVM address: {}",
type_colorize(&wallet_info.hex_private_key),
type_colorize(&wallet_info.cb58_private_key),
type_colorize(&wallet_info.xchain_address),
type_colorize(&wallet_info.pchain_address),
type_colorize(&wallet_info.evm_address),
Expand Down
6 changes: 6 additions & 0 deletions crates/ash_sdk/src/avalanche/wallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ pub struct AvalancheWalletInfo {
pub pchain_address: String,
/// EVM address
pub evm_address: String,
/// EVM formated Private key
pub hex_private_key : String,
/// AVAX formated Private key
pub cb58_private_key: String,
}

impl From<AvalancheWallet> for AvalancheWalletInfo {
Expand All @@ -133,6 +137,8 @@ impl From<AvalancheWallet> for AvalancheWalletInfo {
xchain_address: wallet.xchain_wallet.x_address,
pchain_address: wallet.pchain_wallet.p_address,
evm_address: wallet.xchain_wallet.eth_address,
hex_private_key: wallet.private_key.to_hex(),
cb58_private_key: wallet.private_key.to_cb58(),
}
}
}
Expand Down

0 comments on commit 76b6961

Please sign in to comment.