Skip to content

Commit

Permalink
Zcash Address
Browse files Browse the repository at this point in the history
  • Loading branch information
ec2 committed Sep 11, 2024
1 parent 0071d86 commit aa6882a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/bindgen/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use wasm_bindgen::prelude::*;

use tonic_web_wasm_client::Client;

use zcash_address::ZcashAddress;
use zcash_primitives::consensus::{self, BlockHeight};

use crate::error::Error;
Expand Down Expand Up @@ -122,6 +123,7 @@ impl Wallet {
to_address: String,
value: u64,
) -> Result<(), Error> {
let to_address = ZcashAddress::try_from_encoded(&to_address)?;
self.inner
.transfer(seed_phrase, from_account_index, to_address, value)
.await
Expand Down
10 changes: 5 additions & 5 deletions src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ where
}

/// Download and process all blocks in the given range
pub(crate) async fn fetch_and_scan_range(&mut self, start: u32, end: u32) -> Result<(), Error> {
async fn fetch_and_scan_range(&mut self, start: u32, end: u32) -> Result<(), Error> {
// get the chainstate prior to the range
let tree_state = self
.client
Expand Down Expand Up @@ -289,10 +289,10 @@ where
///
/// Create a transaction proposal to send funds from the wallet to a given address
///
pub(crate) fn propose_transfer(
fn propose_transfer(
&mut self,
account_index: usize,
to_address: String,
to_address: ZcashAddress,
value: u64,
) -> Result<Proposal, Error> {
let account_id = self.db.get_account_ids()?[account_index];
Expand All @@ -303,7 +303,7 @@ where
);

let request = TransactionRequest::new(vec![Payment::without_memo(
ZcashAddress::try_from_encoded(&to_address)?,
to_address,
NonNegativeAmount::from_u64(value)?,
)])
.unwrap();
Expand Down Expand Up @@ -378,7 +378,7 @@ where
&mut self,
seed_phrase: &str,
from_account_index: usize,
to_address: String,
to_address: ZcashAddress,
value: u64,
) -> Result<(), Error> {
let usk = usk_from_seed_str(seed_phrase, 0, &self.network)?;
Expand Down

0 comments on commit aa6882a

Please sign in to comment.