Complex Cross Contract Call
This example presents 3 instances of complex cross-contract calls. Particularly, it shows:
- How to batch multiple method calls to a same contract.
- How to call multiple contracts in parallel, each returning a different type.
- Different ways of handling the responses in the callback.
Batch Actions
You can aggregate multiple actions directed towards one same contract into a batched transaction. Methods called this way are executed sequentially, with the added benefit that, if one fails then they all get reverted.
- 🦀 Rust
loading...
Getting the Last Response
In this case, the callback has access to the value returned by the last action from the chain.
- 🦀 Rust
loading...
Calling Multiple Contracts
A contract can call multiple other contracts. This creates multiple transactions that execute all in parallel. If one of them fails the rest ARE NOT REVERTED.
- 🦀 Rust
loading...
Getting All Responses
In this case, the callback has access to an array of responses, which have either the value returned by each call, or an error message.
- 🦀 Rust
loading...
Multiple Calls - Same Result Type
This example is a particular case of the previous one (2. Calling Multiple Contracts).
It simply showcases a different way to check the results by directly accessing the promise_result
array.
In this case, we call multiple contracts that will return the same type:
- 🦀 Rust
loading...
Getting All Responses
In this case, the callback again has access to an array of responses, which we can iterate checking the results.
- 🦀 Rust
loading...