Multicall
For any write function, the SDK includes a corresponding call data version that returns the call data information instead of submitting a transaction. These objects can then be aggregated and passed into the multicall
function in order to batch multiple operations into one transaction.
multicall
Batch multiple write operations in one transaction.
Arguments:
account
- Viem account (Address for JSON-RPC accounts or Account for other types).calls
- An array of call data objects, each one includes the function name and the call data to pass to the function.
Response:
status
- "success" if transaction was successful, "reverted" if transaction reverted.transactionHash
- transaction's hash.gasUsed
- Amount of gas used in the transaction.hatsCreated
- Hats IDs of any newly created hats.hatsMinted
- For every hat minted, contains an object with the hat ID and the new wearer address.hatsBurned
- For every hat burned, contains an object with the hat ID and the wearer address.hatStatusChanges
- For every hat status change, contains on object with the hat ID and the new status.wearerStandingChanges
- For every wearer standing status change, contains an object with the hat ID, the wearer address and the new standing.
Example:
Create a new top-hat, then create one child hat and mint the child hat to a new wearer.
multicallPreFlightCheck
Simulates the multicall function with the provided calls. The function has no return value, will revert on failure, with a custom error.
Arguments:
account
- Viem account (Address for JSON-RPC accounts or Account for other types).calls
- An array of call data objects, each one includes the function name and the call data to pass to the function.
Last updated