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

initial draft for MEV refund read endpoints #577

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
161 changes: 161 additions & 0 deletions docs/flashbots-auction/advanced/rpc-endpoint.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,167 @@ If the first address matches the authentication signature, then a response with

If the signature is invalid or does not match the first address, an appropriate error will be returned instead.

### MEV Refund JSON-RPC API Documentation
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would delete this section (lines 872-874) and instead repeat the context on line 874 (APIs are for MEV-Share, not authenticated) in each individual API entry below. The reason is:

  • It's not standard to have sub-headings in our API docs today (we can revisit this, but it doesn't match the rest of the docs so would prefer to keep things consistent for now)
  • We want all of the context to be mentioned in each entry because a user might navigate directly to one of the API methods and miss this overall heading (in which case it won't be clear that the API they're looking at is for MEV-Share or does not require authentication)


Below we will document set of endpoints to track MEV Refunds generated by MEV-Share. All of these endpoints do not require signature

### flashbots_getMevRefundsByRecipient

Retrieves all refunds sent to a specific recipient address.
Copy link
Collaborator

Choose a reason for hiding this comment

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

In each of these individual API entries we should:

  • Specify that this API is for MEV-Share refunds. Eg. change the text to say "Retrieves all MEV-Share refunds..." where "MEV-Share" could also be a link to https://docs.flashbots.net/flashbots-protect/mev-share
  • Specify that the API does not require authentication (I would say "authentication" and not "signature")

(This same comment applies to each new API section below).


#### Request

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "flashbots_getMevRefundsByRecipient",
"params": ["0x7642259CD28C04F75EB4C00785F95461434101C0"]
}
```

#### Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"refunds": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this list should be paginated?

{
"txHash": "0x0eee857653a726179a8dd0a9f2f58351ba1e25acae6844e45faee2250275fa8d",
"amount": "0x9f458e97b818c",
"recipient": "0x7642259cd28c04f75eb4c00785f95461434101c0"
}
]
}
}
```

### flashbots_getMevRefundsByHash

Retrieves refunds associated with a specific transaction or `sbundle` hash.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we add a quick explanation of what an "sbundle" is?


#### Request

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "flashbots_getMevRefundsByHash",
"params": ["0x8A29C254B498E0757FF93B3E8424225DC441C24AC5C6A2F8CC9925D36E0CDB86"]
}
```

#### Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"refunds": [
{
"txHash": "0xeb81e87b450f83a5e1a08033ea51bbb6a4b5b706eb629fbb1ed8e81d173207fe",
"amount": "0x95dc82ca0cb6b",
"recipient": "0xa34c84ed07fdf0c92858e364cfcdfa1e47fe5369"
}
]
}
}
```

### flashbots_getMevRefundsBySender

Retrieves all refunds sent by a specific sender address (for transactions) or signer address (for `sbundles`)

#### Request

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "flashbots_getMevRefundsBySender",
"params": ["0x7642259CD28C04F75EB4C00785F95461434101C0"]
}
```

#### Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"refunds": [
{
"txHash": "0x0eee857653a726179a8dd0a9f2f58351ba1e25acae6844e45faee2250275fa8d",
"amount": "0x9f458e97b818c",
"recipient": "0x7642259cd28c04f75eb4c00785f95461434101c0"
}
]
}
}
```

### flashbots_getMevRefundTotalByRecipient

Retrieves the total amount of MEV refunds received by a specific recipient address.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"MEV refunds" -> "MEV-Share refunds"


#### Request

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "flashbots_getMevRefundTotalByRecipient",
"params": ["0xDCDDAE87EDF1D9F62AE2F3A66EB2018ACD0B2508"]
}
```

#### Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"total": "0xeff5f44e097dcfac"
}
}
```

Note: The total is returned as a hexadecimal string representing the amount in wei.

### flashbots_GetMevRefundTotalBySender

Retrieves the total amount of MEV refunds sent by a specific sender address.

#### Request

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "flashbots_getMevRefundTotalBySender",
"params": ["0xDCDDAE87EDF1D9F62AE2F3A66EB2018ACD0B2508"]
}
```

#### Response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"total": "0x4a817c800"
}
}
```

Note: The total is returned as a hexadecimal string representing the amount in wei.

### API Response

- All method supports JSON-RPC standards for success response and not supported for error response(V2 methods are exceptions).
Expand Down
Loading