tx: receiver address
This commit is contained in:
parent
3e249c5314
commit
0ead11ec6c
2 changed files with 25 additions and 8 deletions
|
@ -12,18 +12,18 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use egui::{Align, Id, Layout, RichText, Rounding, ScrollArea};
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
use grin_util::ToHex;
|
||||
use grin_wallet_libwallet::{Error, Slate, SlateState, TxLogEntryType};
|
||||
use std::sync::Arc;
|
||||
use parking_lot::RwLock;
|
||||
use egui::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Align, Id, Layout, RichText, Rounding, ScrollArea};
|
||||
use grin_util::ToHex;
|
||||
use grin_core::core::amount_to_hr_string;
|
||||
use grin_wallet_libwallet::{Error, Slate, SlateState, TxLogEntryType};
|
||||
|
||||
use crate::gui::Colors;
|
||||
use crate::gui::icons::{BROOM, CHECK, CLIPBOARD_TEXT, COPY, CUBE, FILE_ARCHIVE, FILE_TEXT, HASH_STRAIGHT, PROHIBIT, QR_CODE, SCAN};
|
||||
use crate::gui::platform::PlatformCallbacks;
|
||||
|
||||
use crate::gui::views::{CameraContent, FilePickButton, Modal, QrCodeContent, View};
|
||||
use crate::gui::views::wallets::wallet::txs::WalletTransactions;
|
||||
use crate::gui::views::wallets::wallet::types::SLATEPACK_MESSAGE_HINT;
|
||||
|
@ -176,6 +176,11 @@ impl WalletTransactionModal {
|
|||
let label = format!("{} {}", FILE_ARCHIVE, t!("kernel"));
|
||||
Self::info_item_ui(ui, kernel.0.to_hex(), label, true, cb);
|
||||
}
|
||||
// Show receiver address.
|
||||
if let Some(rec) = tx.receiver() {
|
||||
let label = format!("{} {}", CUBE, t!("network_mining.address"));
|
||||
Self::info_item_ui(ui, rec.to_string(), label, true, cb);
|
||||
}
|
||||
// Show block height.
|
||||
if let Some(height) = tx.height {
|
||||
if height != 0 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue