mirror of
https://github.com/jwinterm/grim.git
synced 2026-11-05 21:33:54 +01:00
tx: receiver address
This commit is contained in:
+13
-1
@@ -17,7 +17,8 @@ use std::sync::Arc;
|
||||
use grin_keychain::ExtKeychain;
|
||||
use grin_util::Mutex;
|
||||
use grin_wallet_impls::{DefaultLCProvider, HTTPNodeClient};
|
||||
use grin_wallet_libwallet::{TxLogEntry, TxLogEntryType, WalletInfo, WalletInst};
|
||||
use grin_wallet_libwallet::{SlatepackAddress, TxLogEntry, TxLogEntryType, WalletInfo, WalletInst};
|
||||
use grin_wallet_util::OnionV3Address;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
/// Mnemonic phrase word.
|
||||
@@ -176,4 +177,15 @@ impl WalletTransaction {
|
||||
self.data.tx_type != TxLogEntryType::TxReceivedCancelled
|
||||
&& self.data.tx_type != TxLogEntryType::TxSentCancelled
|
||||
}
|
||||
|
||||
/// Get receiver address if payment proof was created.
|
||||
pub fn receiver(&self) -> Option<SlatepackAddress> {
|
||||
if let Some(proof) = &self.data.payment_proof {
|
||||
let onion_addr = OnionV3Address::from_bytes(proof.receiver_address.to_bytes());
|
||||
if let Ok(addr) = SlatepackAddress::try_from(onion_addr) {
|
||||
return Some(addr);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user