Multicall
Batch transactions together into a single multicall transaction. This multicall function can be accessed through any of the sdk clients (Splits, Waterfall, Liquid Splits, Vesting).
multicall
Any write function from the SDK has a corresponding call data version that generates call data instead of submitting a transaction. That call data can be passed into a multicall transaction. Here is an example where a liquid split is a recipient of a split. First we distribute a token on the split, then we withdraw that token for the liquid split from SplitMain, then we distribute the liquid split.
const splitDistributionArgs = {
splitAddress: "0xd9137B84f56D61Bb961082DD9Eb21bE3D7B14cB9",
token: "0x64d91f12ece7362f91a6f8e7940cd55f05060b92",
distributorAddress: "0x2fa128274cfcf47afd4dc03cd3f2a59af09b6a72",
}
const splitDistributionCallData = await splitsClient.callData.distributeToken(splitDistributionArgs)
const withdrawArgs = {
address: "0xb5Ce41320F3d486671918733BB3226E3981Db62b",
tokens: ["0x64d91f12ece7362f91a6f8e7940cd55f05060b92"],
}
const withdrawCallData = await splitsClient.callData.withdrawFunds(withdrawArgs)
const liquidSplitDistributionArgs = {
liquidSplitAddress: "0xb5Ce41320F3d486671918733BB3226E3981Db62b",
token: "0x64d91f12ece7362f91a6f8e7940cd55f05060b92",
distributorAddress: "0x2fa128274cfcf47afd4dc03cd3f2a59af09b6a72",
}
const liquidSplitDistributionCallData = await splitsClient.liquidSplits.callData.distributeToken(liquidSplitDistributionArgs)
const response = await splitsClient.multicall({
calls: [splitDistributionCallData, withdrawCallData, liquidSplitDistributionCallData],
})
Arguments
{
calls: CallData[] # call data objects can be generated by calling splitsClient.callData.functionName
}
Response
{
events: Log[]
}