Skip to content

Commit

Permalink
Merge pull request #24 from ergoplatform/deleteunused
Browse files Browse the repository at this point in the history
Delete select_wallet_address
  • Loading branch information
SethDusek authored Feb 17, 2025
2 parents 8926e95 + b589790 commit cc618c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ println!("Current height: {}", node.current_block_height());
Furthermore a number of helper methods are implemented as well, such as:

```rust
/// A CLI interactive interface for prompting a user to select an address
pub fn select_wallet_address(&self) -> Result<P2PKAddressString>


/// Get the current state context of the blockchain
pub fn get_state_context(&self) -> Result<ErgoStateContext>
/// Returns a sorted list of unspent boxes which cover at least the
/// provided value `total` of nanoErgs.
/// Note: This box selection strategy simply uses the largest
Expand Down Expand Up @@ -99,4 +98,4 @@ cargo doc --open

Contributing
============
See [CONTRIBUTING](CONTRIBUTING.md)
See [CONTRIBUTING](CONTRIBUTING.md)
26 changes: 0 additions & 26 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,6 @@ impl NodeInterface {
Ok(addresses)
}

/// A CLI interactive interface for prompting a user to select an address
pub fn select_wallet_address(&self) -> Result<P2PKAddressString> {
let address_list = self.wallet_addresses()?;
if address_list.len() == 1 {
return Ok(address_list[0].clone());
}

let mut n = 0;
for address in &address_list {
n += 1;
println!("{n}. {address}");
}
println!("Which address would you like to select?");
let mut input = String::new();
if std::io::stdin().read_line(&mut input).is_ok() {
if let Ok(input_n) = input.trim().parse::<usize>() {
if input_n > address_list.len() || input_n < 1 {
println!("Please select an address within the range.");
return self.select_wallet_address();
}
return Ok(address_list[input_n - 1].clone());
}
}
self.select_wallet_address()
}

/// Acquires unspent boxes from the node wallet
pub fn unspent_boxes(&self) -> Result<Vec<ErgoBox>> {
let endpoint = "/wallet/boxes/unspent?minConfirmations=0&minInclusionHeight=0";
Expand Down

0 comments on commit cc618c6

Please sign in to comment.