Delegatecall
delegatecall
is a powerful EVM opcode that allows the calling contract to execute code in another contract, while keeping the storage context. You can read more about delegatecall
here.
API
To send a UserOp that uses delegatecall
, simply specify the callType
of the UserOp:
const userOpHash = await kernelClient.sendUserOperation({
userOperation: {
callData: await kernelClient.account.encodeCallData({
to: targetAdress,
data: callData,
value: 0n,
callType: "delegatecall",
}),
},
})