Prepare user operation
Changed onPrepares a new user operation on a Smart Account for a specific network.
Request
- Base URLhttps://api.cdp.coinbase.com/platform
- AuthHTTP bearer
Path parameters
The address of the Smart Account to create the user operation on.
Request body
The network the user operation is for.
The list of calls to make from the Smart Account.
The URL of the paymaster to use for the user operation.
The ERC-7677 context object forwarded to the paymaster service as part of the paymasterService capability. The fields in this object are defined by the paymaster service provider; CDP forwards them to the paymaster unchanged. This field is only valid when a paymaster is configured for the request. Providing paymasterContext without a paymaster configured results in an invalid_request error.
The EIP-8021 data suffix (hex-encoded) that enables transaction attribution for the user operation.
Example request
{
"network": "base",
"calls": [
{
"to": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"value": "0",
"data": "0xa9059cbb000000000000000000000000fc807d1be4997e5c7b33e4d8d57e60c5b0f02b1a0000000000000000000000000000000000000000000000000000000000000064",
"overrideGasLimit": "100000"
}
],
"paymasterUrl": "https://api.developer.coinbase.com/rpc/v1/base/<token>",
"paymasterContext": {
"policyId": "962b252c-a726-4a37-8d86-333ce0a07299"
},
"dataSuffix": "0xdddddddd62617365617070070080218021802180218021802180218021"
}Response
The prepared user operation.
A smart account operation response.
The network the user operation is for.
The hash of the user operation. This is not the transaction hash, as a transaction consists of multiple user operations. The user operation hash is the hash of this particular user operation which gets signed by the owner of the Smart Account.
The list of calls in the user operation.
The status of the user operation.
The hash of the transaction that included this particular user operation. This gets set after the user operation is broadcasted and the transaction is included in a block.
The list of receipts associated with the user operation.
The timestamp at which the prepared user operation expires.
Example response
{
"network": "base",
"userOpHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"calls": [
{
"to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"value": "0",
"data": "0xa9059cbb000000000000000000000000fc807d1be4997e5c7b33e4d8d57e60c5b0f02b1a0000000000000000000000000000000000000000000000000000000000000064"
},
{
"to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"value": "1000000000000000",
"data": "0x"
}
],
"status": "pending",
"transactionHash": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"receipts": [
{
"revert": {
"data": "0x123",
"message": "reason for failure"
},
"blockHash": "0x386544b58930c0ec9e8f3ed09fb4cdb76b9ae0a1a37ddcacebe3925b57978e65",
"blockNumber": 29338819,
"gasUsed": "100000"
}
],
"expiresAt": "2025-03-25T12:00:00Z"
}Changes
- warning
added the new
policy_not_applicableenum value to theerrorTyperesponse property for the response status - warning
added the new
policy_not_applicableenum value to theerrorTyperesponse property for the response status - warning
added the new
policy_not_applicableenum value to theerrorTyperesponse property for the response status
3 more changes in this revision
- warning