Skip to content

Commit

Permalink
allow hasAddress to accept string(via AddressT)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaffinPX committed Sep 28, 2024
1 parent 49ec7f5 commit b3eb1d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wallet/core/src/storage/transaction/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use super::*;
use crate::imports::*;
use crate::storage::{Binding, BindingT};
use crate::tx::PendingTransactionInner;
use kaspa_addresses::AddressT;
use workflow_core::time::{unixtime_as_millis_u64, unixtime_to_locale_string};
use workflow_wasm::utils::try_get_js_value_prop;

Expand Down Expand Up @@ -814,8 +815,9 @@ impl TransactionRecord {

/// Check if the transaction record has the given address within the associated UTXO set.
#[wasm_bindgen(js_name = hasAddress)]
pub fn has_address(&self, address: &Address) -> bool {
self.transaction_data.has_address(address)
pub fn has_address(&self, address: &AddressT) -> Result<bool> {
let address = Address::try_cast_from(address)?;
Ok(self.transaction_data.has_address(address.as_ref()))
}

/// Check if the transaction record is coinbase sourced.
Expand Down

0 comments on commit b3eb1d5

Please sign in to comment.