From 816744b600358f23ce5f040137e22a61c9bbce27 Mon Sep 17 00:00:00 2001 From: Max Kalashnikoff Date: Tue, 9 Jul 2024 12:55:33 +0200 Subject: [PATCH 1/3] feat(sessions): permission co-signer API --- .../blockchain/blockchain-permissions-api.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/docs/specs/servers/blockchain/blockchain-permissions-api.md b/docs/specs/servers/blockchain/blockchain-permissions-api.md index db3f46a1..bd83f3d4 100644 --- a/docs/specs/servers/blockchain/blockchain-permissions-api.md +++ b/docs/specs/servers/blockchain/blockchain-permissions-api.md @@ -174,3 +174,51 @@ 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: + { + sender: string, // The address of the smart contract account. + nonce: number, // Anti-replay protection; also used as the salt for first-time account creation. + initCode: string, // Code used to deploy the account if not yet on-chain. + 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. + maxFeePerGas: number, // Maximum fee per gas (similar to EIP-1559(opens in a new tab) max_fee_per_gas). + maxPriorityFeePerGas: number, // Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas). + paymasterAndData: string, // Paymaster Contract address and any extra data required for verification and execution (empty for self-sponsored transaction). + signature: string // Signature of all `userOp` fields hashed by keccak256 and signed by the key provided during the permission creation. + } +} +``` + +#### Success response body: + +Response will contain user operation receipt. + +```typescript +{ + userOpReceipt: string // User operation receipt data. +} +``` + +#### Response error codes: + +* `400 Bad request` - Wrong format in request. +* `401 Unauthorized` - Wrong signature. From 8c28790b525f44407e922c02efbd3e26258b6b6f Mon Sep 17 00:00:00 2001 From: Max Kalashnikoff Date: Mon, 22 Jul 2024 16:58:06 +0200 Subject: [PATCH 2/3] fix: update schema to v07 --- .../blockchain/blockchain-permissions-api.md | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/specs/servers/blockchain/blockchain-permissions-api.md b/docs/specs/servers/blockchain/blockchain-permissions-api.md index bd83f3d4..98bbe3b0 100644 --- a/docs/specs/servers/blockchain/blockchain-permissions-api.md +++ b/docs/specs/servers/blockchain/blockchain-permissions-api.md @@ -190,20 +190,24 @@ The POST request body should be in JSON format and following schema: ```typescript { - pci: String, // Permission controller identifier. - userOp: // ERC-4337 pseudo transaction object: + 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. - initCode: string, // Code used to deploy the account if not yet on-chain. 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. - maxFeePerGas: number, // Maximum fee per gas (similar to EIP-1559(opens in a new tab) max_fee_per_gas). maxPriorityFeePerGas: number, // Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas). - paymasterAndData: string, // Paymaster Contract address and any extra data required for verification and execution (empty for self-sponsored transaction). - signature: string // Signature of all `userOp` fields hashed by keccak256 and signed by the key provided during the permission creation. + 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 } } ``` @@ -220,5 +224,5 @@ Response will contain user operation receipt. #### Response error codes: -* `400 Bad request` - Wrong format in request. -* `401 Unauthorized` - Wrong signature. +* `400 Bad request` - Invalid format in request. +* `401 Unauthorized` - Invalid signature. From b73f6c0f8d88f6a17f8776a80aedad695e486d3e Mon Sep 17 00:00:00 2001 From: Max Kalashnikoff Date: Fri, 26 Jul 2024 16:30:35 +0200 Subject: [PATCH 3/3] feat: adding get receipt endpoint --- .../blockchain/blockchain-permissions-api.md | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/specs/servers/blockchain/blockchain-permissions-api.md b/docs/specs/servers/blockchain/blockchain-permissions-api.md index 98bbe3b0..861d6060 100644 --- a/docs/specs/servers/blockchain/blockchain-permissions-api.md +++ b/docs/specs/servers/blockchain/blockchain-permissions-api.md @@ -214,11 +214,11 @@ The POST request body should be in JSON format and following schema: #### Success response body: -Response will contain user operation receipt. +Response will contain user operation transaction hash. ```typescript { - userOpReceipt: string // User operation receipt data. + userOperationTxHash: string // User operation transaction hash } ``` @@ -226,3 +226,32 @@ Response will contain user operation receipt. * `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