Function Signature
Description
Signs an ERC-4337 UserOperation using the client’s MPC key without broadcasting it to the network. This method is invoked viaportal.request() with the method set to eth_signUserOperation. The signed UserOperation can then be submitted through a separate backend (e.g., Pimlico or a custom bundler endpoint).
Parameters
Theparams array takes a single object with the following fields:
| Parameter | Type | Required | Description |
|---|---|---|---|
to | String | Yes | The recipient or contract address |
value | String | No | Value in wei (hex-encoded) |
data | String | No | Calldata (hex-encoded) |
gas | String | No | Gas limit (hex-encoded) |
maxFeePerGas | String | No | Max fee per gas for EIP-1559 (hex-encoded) |
maxPriorityFeePerGas | String | No | Max priority fee for EIP-1559 (hex-encoded) |
nonce | String | No | Transaction nonce (hex-encoded) |
Returns
PortalProviderResponse - An object containing:
| Property | Type | Description |
|---|---|---|
result | dynamic | A hex-encoded JSON string containing the signed UserOperation |
error | dynamic | Error information if the call failed |
Example
With EIP-1559 Gas Parameters
Errors
| Code | Description |
|---|---|
METHOD_UNSUPPORTED | The client does not have Account Abstraction enabled |
NOT_INITIALIZED | Portal was not initialized |
RPC_ERROR | The RPC call returned an error |