Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(blockchainAPI): bundler interaction API #246

Merged
merged 6 commits into from
Aug 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions docs/specs/servers/blockchain/blockchain-bundler-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Blockchain API Bundlers interaction

This API provides a bundlers JSON-RPC interaction.
The supported `userOperation` interaction schema is according to v0.7 ERC-4337 specification.

## Make a bundler JSON-RPC request

Used to make a JSON-RPC call to the designated bundler.

`POST /v1/bundler?projectId={projectId}&chainId={chainId}&bundler={bundlerName}`

* `projectId` - Required. The project identifier.
* `chainId` - CAIP-2 chain identifier.
geekbrother marked this conversation as resolved.
Show resolved Hide resolved
* `bundlerName` - (Optional) Bundler name to use.
geekbrother marked this conversation as resolved.
Show resolved Hide resolved

The list of currently supported bundler names:
* `pimlico` - [Pimlico bundler](https://docs.pimlico.io/permissionless/reference/bundler-actions/sendUserOperation).

#### Success response body:
geekbrother marked this conversation as resolved.
Show resolved Hide resolved

```typescript
{
id: number, // Unique identifier. Default is 1.
jsonrpc: string, // JSON-RPC version. Default 2.0
method: string, // ERC-4337 bundler operation methods. Please check supported methods below.
params: string[], // Array of string variables input for the method.
}
```

List of supported `method` values:
* `sendUserOperation` - Sends a user operation to the given EVM network.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since method names differ in different bundlers (not all, but some) we can unify them as I did here (and convert to the bundler-specific at the server-side) or pass the method through without any changes to the designated bundler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need support for wallet_getCallsStatus and wallet_showCallsStatus, Im not aware if we need the others.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@geekbrother please add wallet_getCallsStatus to the supported list

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we also need to add: wallet_sendCalls, or how the client sends the batch to the designated bundler? I believe this should be also done by our endpoint?
cc @llbartekll @jakubuid

Copy link
Contributor

@jakubuid jakubuid Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ganchoradkov what's the implementation here? I thought that wallet is responsible for executing an atomic batch on it's own and this endpoint is for dapp to call for a status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the API: we will allow just wallet_getCallsStatus and wallet_showCallsStatus operations for now.

* `estimateUserOperationGas` - Estimate the gas limits for a User Operation.
* `getUserOperationByHash` - Return a User Operation based on a User Operation hash.
* `getUserOperationReceipt` - Return a User Operation receipt based on a User Operation hash.
* `supportedEntryPoints` - Return the Entry Points supported by the bundler.

#### Success response body:

Successfull response body will contain the following JSON-RPC structure:

```typescript
{
id: number, // Unique identifier passed to the operation. Default is 1.
jsonrpc: string, // JSON-RPC version. Default 2.0
result: object // Result object from the operation.
geekbrother marked this conversation as resolved.
Show resolved Hide resolved
}
```

#### Response error codes:

* `400 Bad request` - Wrong input variables format.