From 76b6961d11952ee68254aa99e9cd4dd408c88dee Mon Sep 17 00:00:00 2001 From: gaetan cabaret Date: Thu, 8 Feb 2024 11:12:54 +0100 Subject: [PATCH] feat(wallet info): add both HEX and CB58 private key to the template. --- crates/ash_cli/src/utils/templating.rs | 10 +++++++--- crates/ash_sdk/src/avalanche/wallets.rs | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/ash_cli/src/utils/templating.rs b/crates/ash_cli/src/utils/templating.rs index a3af62a..2c0da30 100644 --- a/crates/ash_cli/src/utils/templating.rs +++ b/crates/ash_cli/src/utils/templating.rs @@ -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), diff --git a/crates/ash_sdk/src/avalanche/wallets.rs b/crates/ash_sdk/src/avalanche/wallets.rs index 2ae6a70..5e86fad 100644 --- a/crates/ash_sdk/src/avalanche/wallets.rs +++ b/crates/ash_sdk/src/avalanche/wallets.rs @@ -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 for AvalancheWalletInfo { @@ -133,6 +137,8 @@ impl From 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(), } } }