Repository navigation
fix: top up with qr code wasnt working #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,11 +10,9 @@ use std::sync::Arc; | |||||
|
|
||||||
| impl TopUpIdentityScreen { | ||||||
| fn render_qr_code(&mut self, ui: &mut egui::Ui, amount: f64) -> Result<(), String> { | ||||||
| let (address, _should_check_balance) = { | ||||||
| // Scope the write lock to ensure it's dropped before calling `start_balance_check`. | ||||||
|
|
||||||
| let address = { | ||||||
| if let Some(wallet_guard) = self.wallet.as_ref() { | ||||||
| // Get the receive address | ||||||
| // Get the receive address from the selected wallet | ||||||
| if self.funding_address.is_none() { | ||||||
| let mut wallet = wallet_guard.write().unwrap(); | ||||||
| let receive_address = wallet.receive_address( | ||||||
|
|
@@ -23,49 +21,33 @@ impl TopUpIdentityScreen { | |||||
| Some(&self.app_context), | ||||||
| )?; | ||||||
|
|
||||||
| if let Some(has_address) = self.core_has_funding_address { | ||||||
| if !has_address { | ||||||
| self.app_context | ||||||
| .core_client | ||||||
| .read() | ||||||
| .expect("Core client lock was poisoned") | ||||||
| .import_address( | ||||||
| &receive_address, | ||||||
| Some("Managed by Dash Evo Tool"), | ||||||
| Some(false), | ||||||
| ) | ||||||
| .map_err(|e| e.to_string())?; | ||||||
| } | ||||||
| self.funding_address = Some(receive_address); | ||||||
| } else { | ||||||
| let info = self | ||||||
| .app_context | ||||||
| .core_client | ||||||
| .read() | ||||||
| .expect("Core client lock was poisoned") | ||||||
| .get_address_info(&receive_address) | ||||||
| // Import address to Core if needed for monitoring | ||||||
| let core_client = self | ||||||
| .app_context | ||||||
| .core_client | ||||||
| .read() | ||||||
| .expect("Core client lock was poisoned"); | ||||||
|
||||||
| .expect("Core client lock was poisoned"); | |
| .map_err(|_| "Core client lock was poisoned".to_string())?; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,7 +34,6 @@ pub struct TopUpIdentityScreen { | |||||||||||||||
| step: Arc<RwLock<WalletFundedScreenStep>>, | ||||||||||||||||
| funding_asset_lock: Option<(Transaction, AssetLockProof, Address)>, | ||||||||||||||||
| wallet: Option<Arc<RwLock<Wallet>>>, | ||||||||||||||||
| core_has_funding_address: Option<bool>, | ||||||||||||||||
| funding_address: Option<Address>, | ||||||||||||||||
| funding_method: Arc<RwLock<FundingMethod>>, | ||||||||||||||||
| funding_amount: String, | ||||||||||||||||
|
|
@@ -55,7 +54,6 @@ impl TopUpIdentityScreen { | |||||||||||||||
| step: Arc::new(RwLock::new(WalletFundedScreenStep::ChooseFundingMethod)), | ||||||||||||||||
| funding_asset_lock: None, | ||||||||||||||||
| wallet: None, | ||||||||||||||||
| core_has_funding_address: None, | ||||||||||||||||
| funding_address: None, | ||||||||||||||||
| funding_method: Arc::new(RwLock::new(FundingMethod::NoSelection)), | ||||||||||||||||
| funding_amount: "".to_string(), | ||||||||||||||||
|
|
@@ -490,11 +488,26 @@ impl ScreenLike for TopUpIdentityScreen { | |||||||||||||||
|
|
||||||||||||||||
| if funding_method == FundingMethod::UseWalletBalance | ||||||||||||||||
| || funding_method == FundingMethod::UseUnusedAssetLock | ||||||||||||||||
| || funding_method == FundingMethod::AddressWithQRCode | ||||||||||||||||
| { | ||||||||||||||||
| ui.heading(format!( | ||||||||||||||||
| "{}. Choose the wallet to use to top up this identity.", | ||||||||||||||||
| step_number | ||||||||||||||||
| )); | ||||||||||||||||
| ui.horizontal(|ui| { | ||||||||||||||||
| ui.heading(format!( | ||||||||||||||||
| "{}. Choose the wallet to use to top up this identity.", | ||||||||||||||||
| step_number | ||||||||||||||||
| )); | ||||||||||||||||
| ui.add_space(10.0); | ||||||||||||||||
|
|
||||||||||||||||
| // Add info icon with hover tooltip | ||||||||||||||||
| crate::ui::helpers::info_icon_button( | ||||||||||||||||
| ui, | ||||||||||||||||
| "The selected wallet will be used to:\n\n\ | ||||||||||||||||
| • Generate a receive address for the QR code\n\ | ||||||||||||||||
| • Hold the private keys needed to create the asset lock transaction\n\ | ||||||||||||||||
| • Sign and broadcast the transaction to top up your identity\n\n\ | ||||||||||||||||
| The wallet must have control over the funds to create the asset lock \ | ||||||||||||||||
| that credits your identity on the Dash Platform.", | ||||||||||||||||
|
||||||||||||||||
| "The selected wallet will be used to:\n\n\ | |
| • Generate a receive address for the QR code\n\ | |
| • Hold the private keys needed to create the asset lock transaction\n\ | |
| • Sign and broadcast the transaction to top up your identity\n\n\ | |
| The wallet must have control over the funds to create the asset lock \ | |
| that credits your identity on the Dash Platform.", | |
| TOOLTIP_TEXT, |
Uh oh!
There was an error while loading. Please reload this page.