diff --git a/docs/specs/servers/blockchain/blockchain-permissions-api.md b/docs/specs/servers/blockchain/blockchain-permissions-api.md index db3f46a1..861d6060 100644 --- a/docs/specs/servers/blockchain/blockchain-permissions-api.md +++ b/docs/specs/servers/blockchain/blockchain-permissions-api.md @@ -174,3 +174,84 @@ The POST request body should be in JSON format and following schema: * `400 Bad request` - Wrong format in request. * `401 Unauthorized` - Wrong signature. + +## Co-signing + +Co-signing request + +`POST /v1/sessions/{address}/sign?projectId={projectId}` + +* `address` - CAIP-10 address format. +* `projectId` - Required. The project identifier. + +### Request body: + +The POST request body should be in JSON format and following schema: + +```typescript +{ + pci: string, // Permission controller identifier. + userOp: // ERC-4337 pseudo transaction object for v0.7: + { + sender: string, // The address of the smart contract account. + nonce: number, // Anti-replay protection; also used as the salt for first-time account creation. + callData: string, // Data that's passed to the sender for execution. + callGasLimit: number, // Gas limit for execution phase. + verificationGasLimit: number, // Gas limit for verification phase. + preVerificationGas: number, // Gas to compensate the bundler. + maxPriorityFeePerGas: number, // Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas). + maxFeePerGas: number, // Maximum fee per gas (similar to EIP-1559(opens in a new tab) max_fee_per_gas). + signature: string, // Signature of all `userOp` fields hashed by keccak256 and signed by the key provided during the permission creation. + factory?: string, // Factory address if deploying a new sender contract. + factoryData?: string, // Data call for the factory. + paymaster?: string, // Paymaster address + paymasterVerificationGasLimit?: number, // Paymaster gas limits for the verification + paymasterPostOpGasLimit?: number, // Paymaster operation gas limit + paymasterData?: string // Bytes calldata for paymaster + } +} +``` + +#### Success response body: + +Response will contain user operation transaction hash. + +```typescript +{ + userOperationTxHash: string // User operation transaction hash +} +``` + +#### Response error codes: + +* `400 Bad request` - Invalid format in request. +* `401 Unauthorized` - Invalid signature. + +## Get the transaction receipt + +Get the user operation transaction receipt based on the transaction hash from `Co-signing` +request. + +`GET /v1/sessions/{address}/receipt?projectId={projectId}&userOpTxHash={hash}` + +* `projectId` - Required. The project identifier. +* `userOpTxHash` - User operation transaction hash to look for the receipt. + +#### Success response body: + +Response will contain user operation transaction hash receipt object. + +```typescript +{ + receipt: object +} +``` + +If the transaction is not done yet, the server will respond with the `HTTP 202` code: + +* `202 Accepted` - Transaction receipt is not yet available (tx is processing), please try again later. + +#### Response error codes: + +* `400 Bad request` - Wrong format in request. +* `401 Unauthorized` - Wrong signature. \ No newline at end of file