Multicalls
Multicall is a key advantage of Account abstraction that enables you to aggregate multiple transactions into one.
Think about the Approve + Swap feature present on most DEXes. What if you could aggregate both calls into one? That would create a huge impact on dApps UX right? Welcome to Multicalls.
To understand how to aggregate calls, we need to first take a look at the execute
method on the account
object.
The execute
method
execute
methodThe execute
method executes one or multiple calls using the account contract. If there is only one call, transactions will be an object that contains the parameters below. If there are multiple calls, transactions will be an array of transactions objects:
The transactions object structure:
contractPayload.contractAddress - the address of the contract
contractPayload.entrypoint - the entrypoint of the contract
contractPayload.calldata - (defaults to []) the calldata
contractPayload.signature - (defaults to []) the signature
abi - (optional) the abi of the contract for better displaying
The transactionsDetail object may include any of:
transactionsDetail.maxFee - Max Fee that will be used to execute the call(s)
transactionsDetail.nonce - Nonce for the transaction
transactionsDetail.version - Version for the transaction (default is 1)
Single vs Multicalls
In this section, we are going to take a look at how you perform single vs multiple calls using the execute
method.
Single call:
multicalls:
Last updated