Learn how to batch multiple operations into a single transaction for efficiency
multicall
function.multicall
Functionmulticall
function that allows you to combine multiple read or write operations into a single transaction.
multicall
function accepts an array of encoded call data and returns an array of encoded results corresponding to each function call:
multicall
function to batch the calls to the mintAndRegisterIpAndMakeDerivative
function.
Here’s how you might do it:
mintAndRegisterIpAndMakeDerivative
using the multicall
function:
viem
library provides native support for Multicall3.
aggregate3
: Batches calls using the Call3
struct.aggregate3Value
: Similar to aggregate3
, but also allows attaching a value to each call.aggregate3
.aggregate3Value
.aggregate3
and aggregate3Value
.