Skip to content
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
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
Loading