-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Multi-call #399
Multi-call #399
Conversation
} | ||
|
||
/// Call contract methods on the node, in a state-modifying manner. | ||
pub async fn call<D: Tokenizable + Debug>(&self) -> Result<MultiCallResponse<D>, Error> { |
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.
It may look simple, but this line took us days of debugging and redesign to get right 😂
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.
Also the trick with bundling the output tokens of all the separate calls into a Token::Tupple
so that the generic D
effectively covers multiple types to avoid the need for dynamic dispatch
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.
nit
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.
Whenever I see somebody do something smart I wonder 'would I have thought of that?'
Let's just say I've been doing a lot of wondering :D
Great work.
Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
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.
LGTM -- great work!
Closes #211
This PR introduces the
MultiContractCallHandler
for bundling contract calls into a single transaction. It provides a similar interface toContractCallHandler
.Alternatively, the response can be fetched like this if we want to have access to receipts and logs in the
MultiCallResponse
:The harness is extended with a test for the regular work flow and one for the script workflow (exposes script). Another test is added to
script.rs
for verifying that script data i built correctly.