From 526fdaa9d1aaf7fc080bcc15e882efed78012e07 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Fri, 29 Aug 2025 15:12:16 -0700 Subject: [PATCH 1/5] use hyperware_process_lib::hyperapp::spawn --- Cargo.toml | 2 +- src/lib.rs | 48 +++++++++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 87e39ac..ac5f05b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ proc-macro2 = "1.0" quote = "1.0" syn = { version = "2.0", features = ["full", "extra-traits"] } -hyperware_process_lib = { git = "https://github.com/hyperware-ai/process_lib", features = ["hyperapp", "logging"], rev = "c27a881" } +hyperware_process_lib = { git = "https://github.com/hyperware-ai/process_lib", features = ["hyperapp"], rev = "fbefdbd" } diff --git a/src/lib.rs b/src/lib.rs index 427face..4d873f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -633,11 +633,11 @@ fn validate_request_response_function(method: &syn::ImplItemFn) -> syn::Result<( fn analyze_methods( impl_block: &ItemImpl, ) -> syn::Result<( - Option, // init method - Option, // ws method - Option, // ws_client method - Vec, // metadata for request/response methods - bool, // whether init method contains logging init + Option, // init method + Option, // ws method + Option, // ws_client method + Vec, // metadata for request/response methods + bool, // whether init method contains logging init )> { let mut init_method = None; let mut ws_method = None; @@ -1076,11 +1076,11 @@ fn generate_async_handler_arm( HPMRequest::#variant_name{} => { // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::run_async! { + hyperware_process_lib::hyperapp::spawn( // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name().await }; #response_handling - } + ) } } } else if func.params.len() == 1 { @@ -1090,11 +1090,11 @@ fn generate_async_handler_arm( let param_captured = param; // Capture param before moving into async block // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::run_async! { + hyperware_process_lib::hyperapp::spawn( // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name(param_captured).await }; #response_handling - } + ) } } } else { @@ -1114,11 +1114,11 @@ fn generate_async_handler_arm( #(#capture_statements)* // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::run_async! { + hyperware_process_lib::hyperapp::spawn( // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name(#(#captured_names),*).await }; #response_handling - } + ) } } } @@ -1182,10 +1182,10 @@ fn init_method_opt_to_call( quote! { // Create a pointer to state for use in the async block let state_ptr: *mut #self_ty = &mut state; - hyperware_process_lib::hyperapp::run_async! { + hyperware_process_lib::hyperapp::spawn( // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name().await }; - } + ) } } else { quote! {} @@ -1203,17 +1203,20 @@ fn ws_method_opt_to_token(ws_method: &Option) -> proc_macro2::Toke } /// Convert optional WebSocket method to token stream for method call -fn ws_method_opt_to_call(ws_method: &Option, self_ty: &Box) -> proc_macro2::TokenStream { +fn ws_method_opt_to_call( + ws_method: &Option, + self_ty: &Box, +) -> proc_macro2::TokenStream { if let Some(method_info) = ws_method { let method_name = &method_info.name; if method_info.is_async { quote! { // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::run_async! { + hyperware_process_lib::hyperapp::spawn( // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name(channel_id, message_type, blob).await }; - } + ) } } else { quote! { unsafe { (*state).#method_name(channel_id, message_type, blob) }; } @@ -1236,17 +1239,20 @@ fn ws_client_method_opt_to_token( } /// Convert optional WebSocket client method to token stream for method call -fn ws_client_method_opt_to_call(ws_client_method: &Option, self_ty: &Box) -> proc_macro2::TokenStream { +fn ws_client_method_opt_to_call( + ws_client_method: &Option, + self_ty: &Box, +) -> proc_macro2::TokenStream { if let Some(method_info) = ws_client_method { let method_name = &method_info.name; if method_info.is_async { quote! { // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::run_async! { + hyperware_process_lib::hyperapp::spawn( // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name(channel_id, message_type, blob).await }; - } + ) } } else { quote! { unsafe { (*state).#method_name(channel_id, message_type, blob) }; } @@ -1470,10 +1476,10 @@ fn generate_parameterless_handler_dispatch( let handler_body = if handler.is_async { quote! { let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::run_async! { + hyperware_process_lib::hyperapp::spawn( let result = unsafe { (*state_ptr).#fn_name().await }; #response_handling - } + ) unsafe { hyperware_process_lib::hyperapp::maybe_save_state(&mut *state); } } } else { From f854f34fe03f4f5e59746eb77f79a3a73f5d421c Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Fri, 29 Aug 2025 15:38:20 -0700 Subject: [PATCH 2/5] bump process_lib dep --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ac5f05b..87ffa36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ proc-macro2 = "1.0" quote = "1.0" syn = { version = "2.0", features = ["full", "extra-traits"] } -hyperware_process_lib = { git = "https://github.com/hyperware-ai/process_lib", features = ["hyperapp"], rev = "fbefdbd" } +hyperware_process_lib = { git = "https://github.com/hyperware-ai/process_lib", features = ["hyperapp"], rev = "a16d47a" } From 4438266eaa46f9c0773632a4708c11a325879544 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Fri, 29 Aug 2025 15:43:44 -0700 Subject: [PATCH 3/5] fix spawn calls --- src/lib.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4d873f9..0be19bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1076,11 +1076,11 @@ fn generate_async_handler_arm( HPMRequest::#variant_name{} => { // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::spawn( + hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name().await }; #response_handling - ) + }) } } } else if func.params.len() == 1 { @@ -1090,11 +1090,11 @@ fn generate_async_handler_arm( let param_captured = param; // Capture param before moving into async block // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::spawn( + hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name(param_captured).await }; #response_handling - ) + }) } } } else { @@ -1114,11 +1114,11 @@ fn generate_async_handler_arm( #(#capture_statements)* // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::spawn( + hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name(#(#captured_names),*).await }; #response_handling - ) + }) } } } @@ -1182,10 +1182,10 @@ fn init_method_opt_to_call( quote! { // Create a pointer to state for use in the async block let state_ptr: *mut #self_ty = &mut state; - hyperware_process_lib::hyperapp::spawn( + hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name().await }; - ) + }) } } else { quote! {} @@ -1213,10 +1213,10 @@ fn ws_method_opt_to_call( quote! { // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::spawn( + hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name(channel_id, message_type, blob).await }; - ) + }) } } else { quote! { unsafe { (*state).#method_name(channel_id, message_type, blob) }; } @@ -1249,10 +1249,10 @@ fn ws_client_method_opt_to_call( quote! { // Create a raw pointer to state for use in the async block let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::spawn( + hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name(channel_id, message_type, blob).await }; - ) + }) } } else { quote! { unsafe { (*state).#method_name(channel_id, message_type, blob) }; } @@ -1476,10 +1476,10 @@ fn generate_parameterless_handler_dispatch( let handler_body = if handler.is_async { quote! { let state_ptr: *mut #self_ty = state; - hyperware_process_lib::hyperapp::spawn( + hyperware_process_lib::hyperapp::spawn(async move { let result = unsafe { (*state_ptr).#fn_name().await }; #response_handling - ) + }) unsafe { hyperware_process_lib::hyperapp::maybe_save_state(&mut *state); } } } else { From f9443121b8627de5651ccff00173066a4f06db3f Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Fri, 29 Aug 2025 15:47:22 -0700 Subject: [PATCH 4/5] fix semicolons --- Cargo.lock | 23 +++++++++++++++++++++-- src/lib.rs | 14 +++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 638b39d..fe0f162 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,10 +56,13 @@ dependencies = [ "alloy-eips", "alloy-genesis", "alloy-json-rpc", + "alloy-network", "alloy-provider", "alloy-rpc-client", "alloy-rpc-types", "alloy-serde", + "alloy-signer", + "alloy-signer-local", "alloy-transport", "alloy-transport-http", ] @@ -430,6 +433,22 @@ dependencies = [ "thiserror 2.0.12", ] +[[package]] +name = "alloy-signer-local" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47fababf5a745133490cde927d48e50267f97d3d1209b9fc9f1d1d666964d172" +dependencies = [ + "alloy-consensus", + "alloy-network", + "alloy-primitives", + "alloy-signer", + "async-trait", + "k256", + "rand 0.8.5", + "thiserror 2.0.12", +] + [[package]] name = "alloy-sol-macro" version = "0.8.25" @@ -1608,8 +1627,8 @@ dependencies = [ [[package]] name = "hyperware_process_lib" -version = "2.0.1" -source = "git+https://github.com/hyperware-ai/process_lib?rev=c27a881#c27a881e764920636ac025112533a714d622793c" +version = "2.2.0" +source = "git+https://github.com/hyperware-ai/process_lib?rev=a16d47a#a16d47a2bfae7864e97d70a3914829b4e54a4033" dependencies = [ "alloy", "alloy-primitives", diff --git a/src/lib.rs b/src/lib.rs index 0be19bd..f7eb28a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1080,7 +1080,7 @@ fn generate_async_handler_arm( // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name().await }; #response_handling - }) + }); } } } else if func.params.len() == 1 { @@ -1094,7 +1094,7 @@ fn generate_async_handler_arm( // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name(param_captured).await }; #response_handling - }) + }); } } } else { @@ -1118,7 +1118,7 @@ fn generate_async_handler_arm( // Inside the async block, use the pointer to access state let result = unsafe { (*state_ptr).#fn_name(#(#captured_names),*).await }; #response_handling - }) + }); } } } @@ -1185,7 +1185,7 @@ fn init_method_opt_to_call( hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name().await }; - }) + }); } } else { quote! {} @@ -1216,7 +1216,7 @@ fn ws_method_opt_to_call( hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name(channel_id, message_type, blob).await }; - }) + }); } } else { quote! { unsafe { (*state).#method_name(channel_id, message_type, blob) }; } @@ -1252,7 +1252,7 @@ fn ws_client_method_opt_to_call( hyperware_process_lib::hyperapp::spawn(async move { // Inside the async block, use the pointer to access state unsafe { (*state_ptr).#method_name(channel_id, message_type, blob).await }; - }) + }); } } else { quote! { unsafe { (*state).#method_name(channel_id, message_type, blob) }; } @@ -1479,7 +1479,7 @@ fn generate_parameterless_handler_dispatch( hyperware_process_lib::hyperapp::spawn(async move { let result = unsafe { (*state_ptr).#fn_name().await }; #response_handling - }) + }); unsafe { hyperware_process_lib::hyperapp::maybe_save_state(&mut *state); } } } else { From ac437440d2eb2de6e5196a79eb02e3e6c78b5f62 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Fri, 29 Aug 2025 20:38:18 -0700 Subject: [PATCH 5/5] use process_lib with working polling --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 87ffa36..f8ea4d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ proc-macro2 = "1.0" quote = "1.0" syn = { version = "2.0", features = ["full", "extra-traits"] } -hyperware_process_lib = { git = "https://github.com/hyperware-ai/process_lib", features = ["hyperapp"], rev = "a16d47a" } +hyperware_process_lib = { git = "https://github.com/hyperware-ai/process_lib", features = ["hyperapp"], rev = "b9f1ead" }