🟦
Mobile SDK Batch Requests

Design

Json-RPC allows packing several requests into one called a batch request.
Symbiosis Mobile SDK supports batch requests: there is a "builder" and an "executor" for each request.
For example,
  • moko-web3 has Web3Requests, and
  • The classes defined in the contracts package have fun something() in addition to fun somethingRequest() method.
For example: balanceOf() → balanceOfRequest(), reserves() → reservesRequest()
Important: there is an exception for write transactions. A write transaction should contain a correct, unique nonce. Therefore, you can send only one write transaction at a time.

Use

There is an example of how to use a batch request:
1
val (uniBalance, daiBalance, ethBalance) = client.executeBatch(
2
uniToken.balanceOfRequest(address),
3
daiToken.balanceOfRequest(address),
4
Web3Requests.getNativeBalance(address)
5
)
Copied!
It shows that calls can be repetitive within one batch request.
Limitations: within one batch request, you can work with one blockchain.
Copy link
Contents
Design
Use