-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wasm target #7
Comments
Hi @852Kerfunkle, Currently, this is not on the roadmap. The error above comes from the RPC crate. The remaining crates should compile fine for target We may have a look at it next year if we find some time. |
Thank you @RomarQ. It is the rpc crate, indeed. It would be the one that is most interesting to me - I probably only need bigmap queries for now :) I can probably get by otherwise and should I really need it, maybe I can try to make a PR. Thanks! |
Hey @852Kerfunkle ! Hope that will help. |
Amazing @m-kus, thank you! I didn't even get to figuring out what was causing the issue. I will give it a try soon 🙇 |
Right, so, I got it to compile (with tezos-contracts) removing the Send trait from a few things (ContractFetcher, Http, FeeEstimator). @m-kus as far as I can tell, your changes made no difference for me (rustc 1.66). No idea if it works, didn't try to use it yet. |
Sure seems to work. Not sure this is useful to anyone else, but basically: diff --git a/tezos-contract/src/contract.rs b/tezos-contract/src/contract.rs
index 6d35ed1..8e7498f 100644
--- a/tezos-contract/src/contract.rs
+++ b/tezos-contract/src/contract.rs
@@ -469,7 +469,7 @@ impl CompatibleWith<Type> for DataSome {
}
}
-#[async_trait]
+#[async_trait(?Send)]
pub trait ContractFetcher<'a, HttpClient: Http + Sync> {
async fn contract_at(
&'a self,
@@ -478,7 +478,7 @@ pub trait ContractFetcher<'a, HttpClient: Http + Sync> {
) -> Result<Contract<'a, HttpClient>>;
}
-#[async_trait]
+#[async_trait(?Send)]
impl<'a, HttpClient: Http + Sync> ContractFetcher<'a, HttpClient> for TezosRpc<HttpClient> {
async fn contract_at(
&'a self,
diff --git a/tezos-rpc/src/http.rs b/tezos-rpc/src/http.rs
index 8bfb59e..c2f08ae 100644
--- a/tezos-rpc/src/http.rs
+++ b/tezos-rpc/src/http.rs
@@ -4,7 +4,7 @@ use {
serde::{de::DeserializeOwned, Serialize},
};
-#[async_trait]
+#[async_trait(?Send)]
pub trait Http {
fn new(rpc_endpoint: String) -> Self;
@@ -76,7 +76,7 @@ pub mod default {
}
#[cfg(feature = "http")]
- #[async_trait]
+ #[async_trait(?Send)]
impl Http for HttpClient {
/// Creates an Http client that will be used to send requests to the specified node.
fn new(rpc_endpoint: String) -> Self {
diff --git a/tezos-rpc/src/internal/estimator.rs b/tezos-rpc/src/internal/estimator.rs
index b214457..6cd844b 100644
--- a/tezos-rpc/src/internal/estimator.rs
+++ b/tezos-rpc/src/internal/estimator.rs
@@ -27,7 +27,7 @@ use crate::{
Error, Result,
};
-#[async_trait]
+#[async_trait(?Send)]
pub trait FeeEstimator {
async fn min_fee<'a>(
&self,
@@ -48,7 +48,7 @@ impl<'a, HttpClient: Http> OperationFeeEstimator<'a, HttpClient> {
const PLACEHOLDER_SIGNATURE: &'static str = "edsigtXomBKi5CTRf5cjATJWSyaRvhfYNHqSUGrn4SdbYRcGwQrUGjzEfQDTuqHhuA8b2d8NarZjz8TRf65WkpQmo423BtomS8Q";
-#[async_trait]
+#[async_trait(?Send)]
impl<'a, HttpClient: Http + Send + Sync> FeeEstimator for OperationFeeEstimator<'a, HttpClient> {
async fn min_fee<'b>(
&self,
|
@852Kerfunkle feel free to submit a PR with your changes. We will have a look when possible. |
@RomarQ Will do, once I figured out if there's maybe a better way to achieve it. Cheers. |
First of all, this is great, thank you!
Compiling with
--target wasm32-unknown-unknown
yields a bunch offuture cannot be sent between threads safely
errors.Is this on the roadmap?
The text was updated successfully, but these errors were encountered: