Skip to content

Commit

Permalink
Merge pull request #101 from logical-mechanism/100-add-function-to-ge…
Browse files Browse the repository at this point in the history
…t-logic-stake-key

returns the stake key used in the constants file for logic
  • Loading branch information
logicalmechanism authored Feb 4, 2025
2 parents 95aa825 + a8d91d4 commit 9185cb6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
20 changes: 20 additions & 0 deletions seedelf-cli/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ use pallas_addresses::{
ShelleyPaymentPart, StakeKeyHash,
};

/// Returns the [LOGIC] stake used during address generation
///
/// /// # Arguments
///
/// * `network_flag` - A boolean flag indicating the expected network:
/// - `true` checks for Testnet.
/// - `false` checks for Mainnet.
///
/// /// # Returns
///
/// * `str` - The stake key in hex.
pub fn stake_key(network_flag: bool) -> &'static str {
if network_flag {
PREPROD_STAKE_HASH
} else {
MAINNET_STAKE_HASH
}
}


/// Determines whether the given address belongs to the correct Cardano network.
///
/// Checks if the provided address matches the expected network based on the `network_flag`.
Expand Down
10 changes: 6 additions & 4 deletions seedelf-cli/src/commands/dapp/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ pub async fn run(network_flag: bool) -> Result<(), Error> {
display::preprod_text(network_flag);
display::block_number_and_time(network_flag).await;

println!("{}", "\ndApp Wallet:".bright_white());
println!(
"{}",
"\nThis wallet should only receive funds from smart contracts. This address should not be public.".bright_yellow()
"{}: {} {}",
"\nThe dApp Wallet".bright_white(),
"This wallet should only receive funds from smart contracts.".bright_yellow(),
"This address should not be public.".bright_red()
);

let scalar: Scalar = setup::load_wallet();

let vkey = convert::secret_key_to_public_key(scalar);
println!("Public Key Hash: {}", vkey.bright_blue());
println!("Stake Key Hash: {}", address::stake_key(network_flag).bright_blue());
let addr = address::dapp_address(vkey, network_flag);
let addr_bech32 = addr.to_bech32().unwrap();
println!("Address: {}", addr_bech32.bright_blue());
println!("\nAddress: {}", addr_bech32.bright_blue());

let all_utxos: Vec<UtxoResponse> =
utxos::collect_all_address_utxos(&addr_bech32, network_flag).await;
Expand Down

0 comments on commit 9185cb6

Please sign in to comment.