Repository: tangle-network/gadget (language: rust)

Issue:
[BUG] Hello world blueprint does not compile.
Here is my blueprint:
```rust
use gadget_sdk as sdk;
use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api;
use std::convert::Infallible;

use api::services::events::JobCalled;
use sdk::event_listener::tangle::TangleEventListener;

#[derive(Clone)]
pub struct ServiceContext {
    pub config: sdk::config::StdGadgetConfiguration,
}

/// Returns "Hello World!" if `who` is `None`, otherwise returns "Hello, {who}!"
#[sdk::job(id = 0, params(who), result(_), event_listener(listener = TangleEventListener::<JobCalled, ServiceContext>))]
pub fn say_hello(who: Option<String>, context: ServiceContext) -> Result<String, Infallible> {
    match who {
        Some(who) => Ok(format!("Hello, {who}!")),
        None => Ok("Hello World!".to_string()),
    }
}

```

And When I try to compile it, I get this error:
```log
error[E0271]: expected `{async block@src/lib.rs:14:1: 14:121}` to be a future that resolves to `Result<TangleJobEvent<OnlineClient<PolkadotConfig>>, Error>`, but it resolves to `Result<TangleEvent<JobCalled, ServiceContext>, _>`
   --> src/lib.rs:14:1
    |
14  | #[sdk::job(id = 0, params(who), result(_), event_listener(listener = TangleEventListener::<JobCalled, ServiceContext>))]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result<TangleJobEvent<...>, ...>`, found `Result<TangleEvent<JobCalled, ...>, ...>`
    |
    = note: expected enum `Result<TangleJobEvent<OnlineClient<PolkadotConfig>>, gadget_sdk::Error>`
               found enum `Result<gadget_sdk::event_listener::tangle::TangleEvent<gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::services::events::JobCalled, ServiceContext>, _>`
note: required by a bound in `EventFlowWrapper::<Ctx, Event, PreProcessOut, JobOutput>::new`
   --> /home/shady/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gadget-sdk-0.2.1/src/event_listener/executor.rs:129:24
    |
120 |     pub fn new<T, Pre, PreFut, Job, JobFut, Post, PostFut>(
    |            --- required by a bound in this associated function
...
129 |         PreFut: Future<Output = Result<PreProcessOut, crate::Error>> + Send + 'static,
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EventFlowWrapper::<Ctx, Event, PreProcessOut, JobOutput>::new`
    = note: this error originates in the attribute macro `sdk::job` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0271`.
error: could not compile `hello-blueprint` (lib) due to 1 previous error
```

My Cargo.toml deps
```toml
[dependencies]
tracing = "0.1"
async-trait = "0.1"
color-eyre = "0.6"
structopt = "0.3.26"
tokio = { version = "1.39", default-features = false, features = ["full"] }
tracing-subscriber = { version = "0.3", features = ["parking_lot", "env-filter"] }

[dependencies.gadget-sdk]
version = "0.2.1"
default-features = false
features = ["std", "getrandom"]

[build-dependencies]
blueprint-metadata = "0.1.5"
```

This seems to be something related to the recent PRs #363 #359


Discussion / hints:

Fix patch:
diff --git a/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std b/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std
index 1de6eecf8..035de35f5 160000
--- a/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std
+++ b/blueprints/incredible-squaring-eigenlayer/contracts/lib/forge-std
@@ -1,1 +1,1 @@
-Subproject commit 1de6eecf821de7fe2c908cc48d3ab3dced20717f
+Subproject commit 035de35f5e366c8d6ed142aec4ccb57fe2dd87d4
diff --git a/blueprints/incredible-squaring/contracts/lib/forge-std b/blueprints/incredible-squaring/contracts/lib/forge-std
index 1de6eecf8..035de35f5 160000
--- a/blueprints/incredible-squaring/contracts/lib/forge-std
+++ b/blueprints/incredible-squaring/contracts/lib/forge-std
@@ -1,1 +1,1 @@
-Subproject commit 1de6eecf821de7fe2c908cc48d3ab3dced20717f
+Subproject commit 035de35f5e366c8d6ed142aec4ccb57fe2dd87d4
diff --git a/blueprints/incredible-squaring/contracts/lib/tnt-core b/blueprints/incredible-squaring/contracts/lib/tnt-core
index c1fa9c7c3..fad7030fe 160000
--- a/blueprints/incredible-squaring/contracts/lib/tnt-core
+++ b/blueprints/incredible-squaring/contracts/lib/tnt-core
@@ -1,1 +1,1 @@
-Subproject commit c1fa9c7c3c5891aab9bd25002a434d93c54942cd
+Subproject commit fad7030fe53ea5d4a7576316880f5416fe656ee9
diff --git a/blueprints/incredible-squaring/src/lib.rs b/blueprints/incredible-squaring/src/lib.rs
index 32f6f5e6c..c372608a3 100644
--- a/blueprints/incredible-squaring/src/lib.rs
+++ b/blueprints/incredible-squaring/src/lib.rs
@@ -1,20 +1,22 @@
-use gadget_sdk::clients::tangle::runtime::TangleClient;
 use gadget_sdk::event_listener::tangle::jobs::{services_post_processor, services_pre_processor};
 use gadget_sdk::event_listener::tangle::TangleEventListener;
 use gadget_sdk::job;
 use gadget_sdk::tangle_subxt::tangle_testnet_runtime::api::services::events::JobCalled;
 
+#[derive(Clone)]
+pub struct MyContext;
+
 /// Returns x^2 saturating to [`u64::MAX`] if overflow occurs.
 #[job(
     id = 0,
     params(x),
     result(_),
     event_listener(
-        listener = TangleEventListener<JobCalled, TangleClient>,
+        listener = TangleEventListener<JobCalled, MyContext>,
         pre_processor = services_pre_processor,
         post_processor = services_post_processor,
     ),
 )]
-pub fn xsquare(x: u64, context: TangleClient) -> Result<u64, gadget_sdk::Error> {
+pub fn xsquare(x: u64, context: MyContext) -> Result<u64, gadget_sdk::Error> {
     Ok(x.saturating_pow(2))
 }
diff --git a/blueprints/incredible-squaring/src/main.rs b/blueprints/incredible-squaring/src/main.rs
index d62eb05cb..a41f26fd1 100644
--- a/blueprints/incredible-squaring/src/main.rs
+++ b/blueprints/incredible-squaring/src/main.rs
@@ -13,8 +13,8 @@ async fn main() {
 
     let x_square = blueprint::XsquareEventHandler {
         service_id: env.service_id.unwrap(),
-        client: client.clone(),
-        context: client.clone(),
+        context: blueprint::MyContext,
+        client,
         signer,
     };
 
diff --git a/macros/blueprint-proc-macro/src/job.rs b/macros/blueprint-proc-macro/src/job.rs
index d876f8ce7..8714dfd9a 100644
--- a/macros/blueprint-proc-macro/src/job.rs
+++ b/macros/blueprint-proc-macro/src/job.rs
@@ -346,7 +346,7 @@ pub(crate) fn generate_event_workflow_tokenstream(
                         .expect("Failed to generate params");
                     let params_tokens = event_listeners.get_param_name_tokenstream(&params, true);
                     quote! {
-                        move |event: gadget_sdk::event_listener::tangle::jobs::TangleJobEvent<gadget_sdk::clients::tangle::runtime::TangleClient>| async move {
+                        move |event: gadget_sdk::event_listener::tangle::jobs::TangleJobEvent<#context_ty>| async move {
                             if let Some(call_id) = event.call_id {
                                 #call_id_static_name.store(call_id, std::sync::atomic::Ordering::Relaxed);
                             }


Test patch: