Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wallet info): add both HEX and CB58 private key to the template. #89

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
/// Hex-encoded private key
pub hex_private_key : String,
/// CB58-encoded 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
Loading