-
Notifications
You must be signed in to change notification settings - Fork 796
Conversation
Can update the changelog, if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also stumbled across this a couple of times.
this is useful if you need to move the future around.
An alternative could be to implement this if the type is Clone
but I think contract.clone().call_owned` is better.
needs cargo + nightly fmt
Will do in a couple of minutes |
Done |
@gakonst maybe merge? :) |
can't you just wrap in an |
Yeah, that should work. You think that |
tbh, I think that making |
Not necessarily?.. In case you want to estimate gas and do a transaction, after which transaction may fail and you want to retry?.. |
well, the user intent for |
In case it fails because of the provider and user wants to retry. |
|
I think much better dev ergonomics for joins is probably worth slightly worse dev ergo for retries? 🤔 |
Joins can be solved with |
slept on it. this would be a good place to implement IntoFuture, and keep |
Same page as Prestwich, let's replace with |
I'm not sure how Or are you suggesting to create new type (say, |
I'd default to call() and ignore the other 2 |
Motivation
I was trying to call multiple contracts concurrently by aggregating calls into a vec, so that I can
join_all(calls).await
them later.Since
ContractCall::call(&self)
takes an immutable reference, compiler prevents future from being created because future referencesContractCall
, which may not live long enough.I’ve tried
Box
-ingContractCall
, but it didn’t quite work.Solution
Add another method that takes ownership:
call_owned(self)
.That completely solved my problem.
PR Checklist