Skip to content

Commit

Permalink
cleanup/reverting core related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder83singh committed Mar 15, 2024
1 parent b4da55f commit 72f9b29
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 44 deletions.
23 changes: 4 additions & 19 deletions core/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub type ApplicationEventsChannel = crate::runtime::channel::Channel<Events>;

#[derive(Clone, Debug)]
pub enum Events {
WebMessage(String),
// WebMessage(String),
NetworkChange(Network),
UpdateStorage(StorageUpdateOptions),
VisibilityChange(VisibilityState),
Expand Down
6 changes: 2 additions & 4 deletions core/src/modules/account_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions core/src/modules/account_manager/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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|{

Expand Down
4 changes: 2 additions & 2 deletions extensions/chrome/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/chrome/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"});
Expand All @@ -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]}});

10 changes: 0 additions & 10 deletions extensions/chrome/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn WalletApi> = Arc::new(WalletClient::new(borsh_transport));

Expand Down

0 comments on commit 72f9b29

Please sign in to comment.