Skip to content

Commit

Permalink
update deps and remove nightly features
Browse files Browse the repository at this point in the history
  • Loading branch information
gilescope committed Jun 26, 2024
1 parent 1ea7897 commit 91eef22
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 70 deletions.
59 changes: 40 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions src/datasource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,7 @@ pub fn associate_events(
events: Vec<DataEvent>,
) -> Vec<(Option<DataEntity>, Vec<(usize, DataEvent)>)> {
let mut events: Vec<_> = events.into_iter().enumerate().collect();

let mut ext: Vec<(Option<DataEntity>, Vec<(usize, DataEvent)>)> = ext
.into_iter()
.map(|extrinsic| {
Expand All @@ -1661,15 +1662,20 @@ pub fn associate_events(
panic!("bad stuff happened");
};
// println!("{} count ", events.len());
(
let selected_events: Vec<_> = events.iter()
.filter(|(_index, ev)| match ev.details.parent {
Some(extrinsic_id) => extrinsic_id == eid,
_ => false,
}).cloned()
.collect();
for (index, event) in selected_events.iter().rev() {
events.remove(*index);
}
let res: (Option<DataEntity>, Vec<(usize, DataEvent)>) = (
Some(extrinsic),
events
.drain_filter(|ev| match ev.1.details.parent {
Some(extrinsic_id) => extrinsic_id == eid,
_ => false,
})
.collect(),
)
selected_events,
);
res
})
.collect();

Expand All @@ -1678,7 +1684,6 @@ pub fn associate_events(
}

ext
//leftovers in events should be utils..
}

#[cfg(test)]
Expand Down
18 changes: 3 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
#![feature(drain_filter)]
#![feature(hash_drain_filter)]
#![feature(slice_pattern)]
#![feature(slice_group_by)]
#![feature(option_get_or_insert_default)]
#![feature(async_closure)]
#![feature(stmt_expr_attributes)]
#![feature(let_chains)]
#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]
#![allow(clippy::identity_op)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::wildcard_in_or_patterns)]
Expand Down Expand Up @@ -576,7 +566,7 @@ async fn async_main() -> std::result::Result<(), ()> {
//.expect("Failed to enable logging");

// App assumes the target dir exists for caching data
#[cfg(not(feature = "wasm32"))]
#[cfg(not(target_arch = "wasm32"))]
let _ = std::fs::create_dir_all("target");

let _low_power_mode = false;
Expand Down Expand Up @@ -2965,7 +2955,7 @@ fn source_data(
do_datasources(sovereigns, as_of);

#[cfg(target_family = "wasm")]
let t = async move || {
wasm_bindgen_futures::spawn_local(async move {
log("send to bridge");

let bridge: WorkerBridge<IOWorker> = crate::webworker::IOWorker::spawner()
Expand Down Expand Up @@ -2999,10 +2989,8 @@ fn source_data(
async_std::task::sleep(Duration::from_millis(300)).await;
// log!("asking bridge msg...");
}
};
});

#[cfg(target_family = "wasm")]
wasm_bindgen_futures::spawn_local(t());
#[cfg(target_family = "wasm")]
log!("sent to bridge");
}
Expand Down
62 changes: 35 additions & 27 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,21 @@ pub fn ui_bars_system(
// }
// });

if ui.button("📋").clicked() {
let url = "ws://127.0.0.1:9944"; //selected.doturl.url;
log!("button clicked {}", url);
async_std::task::block_on(async {
let pipe = polkapipe::PolkaPipe{
rpc: polkapipe::ws_web::Backend::new(&[url]).await.unwrap(),
};
log!("pipe created");
// Hello world 0 lifetime, 0 nonce, signed by alice
let v = hex::decode("d5018400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d019264ccc4a8654543325ee6b3414f11c9563f04cc3aa3afb726fce3f25ff5db7bef7f229133d35b683cfbf66f94e2278512aa0eb6d8b9e3737e708262c34b0a8d0008000000072c48656c6c6f20776f726c64").unwrap();
log!("payload created");
let r = pipe.submit(v.as_slice()).await;
log!("result {:?}", r);
});
};
// if ui.button("📋").clicked() {
// let url = "ws://127.0.0.1:9944"; //selected.doturl.url;
// log!("button clicked {}", url);
// async_std::task::block_on(async {
// let pipe = polkapipe::PolkaPipe{
// rpc: polkapipe::ws_web::Backend::new(&[url]).await.unwrap(),
// };
// log!("pipe created");
// // Hello world 0 lifetime, 0 nonce, signed by alice
// let v = hex::decode("d5018400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d019264ccc4a8654543325ee6b3414f11c9563f04cc3aa3afb726fce3f25ff5db7bef7f229133d35b683cfbf66f94e2278512aa0eb6d8b9e3737e708262c34b0a8d0008000000072c48656c6c6f20776f726c64").unwrap();
// log!("payload created");
// let r = pipe.submit(v.as_slice()).await;
// log!("result {:?}", r);
// });
// };
} else {
occupied_screen_space.left = 0.;
}
Expand Down Expand Up @@ -412,12 +412,17 @@ fn funk<'r>(ui: &'r mut Ui, val: &scale_borrow::Value) {
let (mut k, v) = &pairs[0];
let mut v: &scale_borrow::Value = v;

while let scale_borrow::Value::Object(nested_pairs) = &v && nested_pairs.len() == 1 {
header.push_str(k);
header.push('.');
let (nk, nv) = &nested_pairs[0];
k = nk;
v = nv;
while matches!(&v, scale_borrow::Value::Object(_)) {
if let scale_borrow::Value::Object(nested_pairs) = &v {
if nested_pairs.len() != 1 {
break;
}
header.push_str(k);
header.push('.');
let (nk, nv) = &nested_pairs[0];
k = nk;
v = nv;
}
}
header.push_str(k);
// use egui::CollapsingHeader;
Expand All @@ -430,12 +435,15 @@ fn funk<'r>(ui: &'r mut Ui, val: &scale_borrow::Value) {
let mut header = String::new();
let mut v: &scale_borrow::Value = v;

while let scale_borrow::Value::Object(nested_pairs) = &v && nested_pairs.len() == 1 {
header.push_str(k);
header.push('.');
let (nk, nv) = &nested_pairs[0];
k = nk;
v = nv;
while matches!(&v, scale_borrow::Value::Object(_)) {
if let scale_borrow::Value::Object(nested_pairs) = &v {
if nested_pairs.len() != 1 { break; }
header.push_str(k);
header.push('.');
let (nk, nv) = &nested_pairs[0];
k = nk;
v = nv;
}
}
header.push_str(k);
// use egui::CollapsingHeader;
Expand Down

0 comments on commit 91eef22

Please sign in to comment.