Skip to content

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({
    callData: await kernelClient.account.encodeCalls([{
      to: targetAdress,
      data: callData,
      value: 0n,
    }], "delegatecall"),
})