Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/backend_task/identity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ impl AppContext {
.await
}
IdentityTask::RegisterIdentity(registration_info) => {
self.register_identity(registration_info, sender).await
self.register_identity(registration_info).await
}
IdentityTask::RegisterDpnsName(input) => self.register_dpns_name(sdk, input).await,
IdentityTask::RefreshIdentity(qualified_identity) => self
Expand All @@ -467,9 +467,7 @@ impl AppContext {
self.load_user_identity_from_wallet(sdk, wallet, identity_index)
.await
}
IdentityTask::TopUpIdentity(top_up_info) => {
self.top_up_identity(top_up_info, sender).await
}
IdentityTask::TopUpIdentity(top_up_info) => self.top_up_identity(top_up_info).await,
IdentityTask::RefreshLoadedIdentitiesOwnedDPNSNames => {
self.refresh_loaded_identities_dpns_names(sender).await
}
Expand Down
104 changes: 0 additions & 104 deletions src/backend_task/identity/register_identity.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::app::TaskResult;
use crate::backend_task::BackendTaskSuccessResult;
use crate::backend_task::identity::{IdentityRegistrationInfo, RegisterIdentityFundingMethod};
use crate::context::AppContext;
Expand All @@ -20,93 +19,9 @@ use std::collections::BTreeMap;
use std::time::Duration;

impl AppContext {
// pub(crate) async fn broadcast_and_retrieve_asset_lock(
// &self,
// asset_lock_transaction: &Transaction,
// address: &Address,
// ) -> Result<AssetLockProof, dash_sdk::Error> {
// // Use the span only for synchronous logging before the first await.
// // tracing::debug_span!(
// // "broadcast_and_retrieve_asset_lock",
// // transaction_id = asset_lock_transaction.txid().to_string(),
// // )
// // .in_scope(|| {
// // tracing::debug!("Starting asset lock broadcast.");
// // });
//
// let sdk = &self.sdk;
//
// let block_hash = sdk
// .execute(GetBlockchainStatusRequest {}, RequestSettings::default())
// .await?
// .chain
// .map(|chain| chain.best_block_hash)
// .ok_or_else(|| dash_sdk::Error::DapiClientError("Missing `chain` field".to_owned()))?;
//
// // tracing::debug!(
// // "Starting the stream from the tip block hash {}",
// // hex::encode(&block_hash)
// // );
//
// let mut asset_lock_stream = sdk
// .start_instant_send_lock_stream(block_hash, address)
// .await?;
//
// // tracing::debug!("Stream is started.");
//
// let request = BroadcastTransactionRequest {
// transaction: asset_lock_transaction.serialize(),
// allow_high_fees: false,
// bypass_limits: false,
// };
//
// // tracing::debug!("Broadcasting the transaction.");
//
// match sdk.execute(request, RequestSettings::default()).await {
// Ok(_) => {}
// Err(error) if error.to_string().contains("AlreadyExists") => {
// // tracing::warn!("Transaction already broadcasted.");
//
// let GetTransactionResponse { block_hash, .. } = sdk
// .execute(
// GetTransactionRequest {
// id: asset_lock_transaction.txid().to_string(),
// },
// RequestSettings::default(),
// )
// .await?;
//
// // tracing::debug!(
// // "Restarting the stream from the transaction mined block hash {}",
// // hex::encode(&block_hash)
// // );
//
// asset_lock_stream = sdk
// .start_instant_send_lock_stream(block_hash, address)
// .await?;
//
// // tracing::debug!("Stream restarted.");
// }
// Err(error) => {
// // tracing::error!("Transaction broadcast failed: {error}");
// return Err(error.into());
// }
// }
//
// // tracing::debug!("Waiting for asset lock proof.");
//
// sdk.wait_for_asset_lock_proof_for_transaction(
// asset_lock_stream,
// asset_lock_transaction,
// Some(Duration::from_secs(4 * 60)),
// )
// .await
// }

pub(super) async fn register_identity(
&self,
input: IdentityRegistrationInfo,
sender: crate::utils::egui_mpsc::SenderAsync<TaskResult>,
) -> Result<BackendTaskSuccessResult, String> {
let IdentityRegistrationInfo {
alias_input,
Expand Down Expand Up @@ -203,12 +118,6 @@ impl AppContext {
};

let tx_id = asset_lock_transaction.txid();
// todo: maybe one day we will want to use platform again, but for right now we use
// the local core as it is more stable
// let asset_lock_proof = self
// .broadcast_and_retrieve_asset_lock(&asset_lock_transaction, &change_address)
// .await
// .map_err(|e| e.to_string())?;

{
let mut proofs = self.transactions_waiting_for_finality.lock().unwrap();
Expand Down Expand Up @@ -270,12 +179,6 @@ impl AppContext {
};

let tx_id = asset_lock_transaction.txid();
// todo: maybe one day we will want to use platform again, but for right now we use
// the local core as it is more stable
// let asset_lock_proof = self
// .broadcast_and_retrieve_asset_lock(&asset_lock_transaction, &change_address)
// .await
// .map_err(|e| e.to_string())?;

{
let mut proofs = self.transactions_waiting_for_finality.lock().unwrap();
Expand Down Expand Up @@ -414,13 +317,6 @@ impl AppContext {
.set_asset_lock_identity_id(tx_id.as_byte_array(), identity_id.as_bytes())
.map_err(|e| e.to_string())?;

sender
.send(TaskResult::Success(Box::new(
BackendTaskSuccessResult::None,
)))
.await
.map_err(|e| e.to_string())?;

Ok(BackendTaskSuccessResult::RegisteredIdentity(
qualified_identity,
))
Expand Down
9 changes: 0 additions & 9 deletions src/backend_task/identity/top_up_identity.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::app::TaskResult;
use crate::backend_task::BackendTaskSuccessResult;
use crate::backend_task::identity::{IdentityTopUpInfo, TopUpIdentityFundingMethod};
use crate::context::AppContext;
Expand All @@ -21,7 +20,6 @@ impl AppContext {
pub(super) async fn top_up_identity(
&self,
input: IdentityTopUpInfo,
sender: crate::utils::egui_mpsc::SenderAsync<TaskResult>,
) -> Result<BackendTaskSuccessResult, String> {
let IdentityTopUpInfo {
mut qualified_identity,
Expand Down Expand Up @@ -331,13 +329,6 @@ impl AppContext {
.map_err(|e| e.to_string())?;
}

sender
.send(TaskResult::Success(Box::new(
BackendTaskSuccessResult::None,
)))
.await
.map_err(|e| e.to_string())?;

Ok(BackendTaskSuccessResult::ToppedUpIdentity(
qualified_identity,
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,14 @@ impl AddNewIdentityScreen {
ui.add_space(20.0);
}

ui.vertical_centered(|ui| {
match step {
WalletFundedScreenStep::WaitingForPlatformAcceptance => {
ui.heading("=> Waiting for Platform acknowledgement <=");
ui.add_space(20.0);
ui.label("NOTE: If this gets stuck, the funds were likely either transferred to the wallet or asset locked,\nand you can use the funding method selector in step 1 to change the method and use those funds to complete the process.");
}
WalletFundedScreenStep::Success => {
ui.heading("...Success...");
}
_ => {}
ui.vertical_centered(|ui| match step {
WalletFundedScreenStep::WaitingForPlatformAcceptance => {
ui.heading("=> Waiting for Platform acknowledgement <=");
}
WalletFundedScreenStep::Success => {
ui.heading("...Success...");
}
_ => {}
});

ui.add_space(40.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,17 @@ impl AddNewIdentityScreen {
ui.add_space(20.0);
}

ui.vertical_centered(|ui| {
match step {
WalletFundedScreenStep::WaitingForAssetLock => {
ui.heading("=> Waiting for Core Chain to produce proof of transfer of funds. <=");
ui.add_space(20.0);
ui.label("NOTE: If this gets stuck, the funds were likely either transferred to the wallet or asset locked,\nand you can use the funding method selector in step 1 to change the method and use those funds to complete the process.");
}
WalletFundedScreenStep::WaitingForPlatformAcceptance => {
ui.heading("=> Waiting for Platform acknowledgement <=");
ui.add_space(20.0);
ui.label("NOTE: If this gets stuck, the funds were likely either transferred to the wallet or asset locked,\nand you can use the funding method selector in step 1 to change the method and use those funds to complete the process.");
}
WalletFundedScreenStep::Success => {
ui.heading("...Success...");
}
_ => {}
ui.vertical_centered(|ui| match step {
WalletFundedScreenStep::WaitingForAssetLock => {
ui.heading("=> Waiting for Core Chain to produce proof of transfer of funds. <=");
}
WalletFundedScreenStep::WaitingForPlatformAcceptance => {
ui.heading("=> Waiting for Platform acknowledgement <=");
}
WalletFundedScreenStep::Success => {
ui.heading("...Success...");
}
_ => {}
});

ui.add_space(40.0);
Expand Down
Loading
Loading