From 72f9b290fe439cf24336da590212e62331f6bce6 Mon Sep 17 00:00:00 2001 From: Surinder Singh Matoo Date: Fri, 15 Mar 2024 07:17:30 +0530 Subject: [PATCH] cleanup/reverting core related changes --- core/src/core.rs | 23 ++++---------------- core/src/events.rs | 2 +- core/src/modules/account_manager/mod.rs | 6 ++--- core/src/modules/account_manager/overview.rs | 6 ----- extensions/chrome/api.js | 4 ++-- extensions/chrome/content-script.js | 4 ++-- extensions/chrome/src/lib.rs | 10 --------- 7 files changed, 11 insertions(+), 44 deletions(-) diff --git a/core/src/core.rs b/core/src/core.rs index 3d0d192..129537a 100644 --- a/core/src/core.rs +++ b/core/src/core.rs @@ -654,9 +654,9 @@ impl Core { ) -> Result<()> { // println!("event: {:?}", event); match event { - Events::WebMessage(msg)=>{ - log_info!("Events::WebMessage msg: {msg}"); - } + // Events::WebMessage(msg)=>{ + // log_info!("Events::WebMessage msg: {msg}"); + // } Events::NetworkChange(network) => { self.modules.clone().values().for_each(|module| { module.network_change(self, network); @@ -913,22 +913,7 @@ impl Core { self.purge_secure_stack(); } - CoreWallet::AccountSelection { id } => { - if let Some(id) = id{ - log_info!("AccountSelection id: {id}"); - self.account_collection - .as_ref() - .and_then(|account_collection| { - account_collection.get(&id).map(|account| { - let balance = account.balance(); - let address = account.receive_address(); - log_info!("AccountSelection address: {address}"); - let res = self.sender().try_send(Events::WebMessage(format!("address: {}, balance: {balance:?}", address))); - log_info!("AccountSelection res: {res:?}"); - }) - }); - } - } + CoreWallet::AccountSelection { id: _ } => { } CoreWallet::DaaScoreChange { current_daa_score } => { self.state.current_daa_score.replace(current_daa_score); } diff --git a/core/src/events.rs b/core/src/events.rs index 9c05730..37d9a7d 100644 --- a/core/src/events.rs +++ b/core/src/events.rs @@ -9,7 +9,7 @@ pub type ApplicationEventsChannel = crate::runtime::channel::Channel; #[derive(Clone, Debug)] pub enum Events { - WebMessage(String), + // WebMessage(String), NetworkChange(Network), UpdateStorage(StorageUpdateOptions), VisibilityChange(VisibilityState), diff --git a/core/src/modules/account_manager/mod.rs b/core/src/modules/account_manager/mod.rs index 2b1a8ed..b6297ca 100644 --- a/core/src/modules/account_manager/mod.rs +++ b/core/src/modules/account_manager/mod.rs @@ -335,8 +335,6 @@ impl AccountManager { } else if account_collection.len() == 1 { let account = account_collection.first().unwrap(); self.select(Some(account.clone()), core.device().clone()); - let id = account.id(); - let _ = core.sender().try_send(Events::Wallet { event: Box::new(kaspa_wallet_core::events::Events::AccountSelection{id: Some(id)}) }); } else { Panel::new(self) .with_caption(i18n("Select Account")) @@ -365,8 +363,8 @@ impl AccountManager { account_collection.iter().for_each(|account_select| { if ui.account_selector_button(account_select, &network_type, false, core.balance_padding()).clicked() { this.select(Some(account_select.clone()), core.device().clone()); - let id = account_select.id(); - let _ = core.sender().try_send(Events::Wallet { event: Box::new(kaspa_wallet_core::events::Events::AccountSelection{id: Some(id)}) }); + // let id = account_select.id(); + // let _ = core.sender().try_send(Events::Wallet { event: Box::new(kaspa_wallet_core::events::Events::AccountSelection{id: Some(id)}) }); if core.device().single_pane() { this.section = AccountManagerSection::Overview; } else { diff --git a/core/src/modules/account_manager/overview.rs b/core/src/modules/account_manager/overview.rs index 78a4cf0..e8ce832 100644 --- a/core/src/modules/account_manager/overview.rs +++ b/core/src/modules/account_manager/overview.rs @@ -62,12 +62,6 @@ impl<'manager> Overview<'manager> { Action::None => { Qr::render(ui, rc); - // let address = rc.account.receive_address(); - // let balance = rc.account.balance(); - // log_info!("#### address: {address:?}"); - // log_info!("#### balance: {balance:?}"); - - ui.vertical_centered(|ui|{ diff --git a/extensions/chrome/api.js b/extensions/chrome/api.js index ef26ef2..91b6072 100644 --- a/extensions/chrome/api.js +++ b/extensions/chrome/api.js @@ -44,12 +44,12 @@ async function apiBuilder(uuid, eventKey){ connect() { // Communicate a message back to the extension - return postMessage("connect"); + return postMessage("Connect"); } signTransaction(data) { // Communicate a message back to the extension - return postMessage("sign-transaction", data); + return postMessage("SignTransaction", data); } } diff --git a/extensions/chrome/content-script.js b/extensions/chrome/content-script.js index f4e102b..689590a 100644 --- a/extensions/chrome/content-script.js +++ b/extensions/chrome/content-script.js @@ -23,7 +23,7 @@ } log("event.detail", event.detail); - port.postMessage({type: "WEBAPI", data:event.detail}) + port.postMessage({type: "WebAPI", data:event.detail}) }, false); let port = chrome.runtime.connect({name:"CONTENT"}); @@ -32,5 +32,5 @@ replyToPage(msg) }) - port.postMessage({type: "WEBAPI", data:{action:"inject-page-script", data:[chrome.runtime.id, EVENT_KEY]}}); + port.postMessage({type: "WebAPI", data:{action:"InjectPageScript", data:[chrome.runtime.id, EVENT_KEY]}}); \ No newline at end of file diff --git a/extensions/chrome/src/lib.rs b/extensions/chrome/src/lib.rs index c86e283..a0cc760 100644 --- a/extensions/chrome/src/lib.rs +++ b/extensions/chrome/src/lib.rs @@ -42,16 +42,6 @@ pub async fn kaspa_ng_main() { let application_events = ApplicationEventsChannel::unbounded(); let client_transport = Arc::new(client::ClientTransport::new(application_events.clone())); - for event in application_events.iter(){ - match event{ - kaspa_ng_core::events::Events::WebMessage(msg)=>{ - log_info!("kaspa_ng_core::events::Events::WebMessage msg: {msg:?}"); - } - _=>{ - - } - } - } let borsh_transport = Codec::Borsh(client_transport.clone()); let wallet_client: Arc = Arc::new(WalletClient::new(borsh_transport));