UserOperation.getSignPayload
Obtains the signing payload for a UserOperation.UserOperation
.
Imports
Named
import { UserOperation } from 'ox/erc4337'
Examples
import { Secp256k1, Value } from 'ox'
import { UserOperation } from 'ox/erc4337'
const userOperation = UserOperation.from({
callData: '0xdeadbeef',
callGasLimit: 300_000n,
maxFeePerGas: Value.fromGwei('20'),
maxPriorityFeePerGas: Value.fromGwei('2'),
nonce: 69n,
preVerificationGas: 100_000n,
sender: '0x9f1fdab6458c5fc642fa0f4c5af7473c46837357',
verificationGasLimit: 100_000n,
})
const payload = UserOperation.getSignPayload(userOperation, {
chainId: 1,
entryPointAddress: '0x1234567890123456789012345678901234567890',
entryPointVersion: '0.6',
})
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
Definition
function getSignPayload<entrypointVersion>(
userOperation: UserOperation<entrypointVersion>,
options: getSignPayload.Options<entrypointVersion>,
): Hex.Hex
Source: src/erc4337/UserOperation.ts
Parameters
userOperation
- Type:
UserOperation<entrypointVersion>
The user operation to get the sign payload for.
userOperation.callData
- Type:
0x${string}
The data to pass to the sender
during the main execution call.
userOperation.callGasLimit
- Type:
bigintType
The amount of gas to allocate the main execution call
userOperation.initCode
- Type:
0x${string}
- Optional
Account init code. Only for new accounts.
userOperation.maxFeePerGas
- Type:
bigintType
Maximum fee per gas.
userOperation.maxPriorityFeePerGas
- Type:
bigintType
Maximum priority fee per gas.
userOperation.nonce
- Type:
bigintType
Anti-replay parameter.
userOperation.paymasterAndData
- Type:
0x${string}
- Optional
Paymaster address with calldata.
userOperation.preVerificationGas
- Type:
bigintType
Extra gas to pay the Bundler.
userOperation.sender
- Type:
abitype_Address
The account making the operation.
userOperation.signature
- Type:
0x${string}
userOperation.verificationGasLimit
- Type:
bigintType
The amount of gas to allocate for the verification step.
options
- Type:
getSignPayload.Options<entrypointVersion>
Return Type
The signing payload for the user operation.
Hex.Hex