Refund API
Refund APIs should be queried at https://relay.flashbots.net.
BuilderNet provides these APIs to check refunds data:
buildernet_getFeeRefundTotalsByRecipientbuildernet_getFeeRefundsByRecipientbuildernet_getFeeRefundsByBlockbuildernet_getFeeRefundsByBundlebuildernet_setFeeRefundRecipientbuildernet_getDelayedRefundsbuildernet_getDelayedRefundTotalsByRecipient
buildernet_getFeeRefundTotalsByRecipient
The buildernet_getFeeRefundTotalsByRecipient JSON-RPC method returns the total amount of fee refunds that have been earned by a specific address.
{
"jsonrpc": "2.0",
"id": 1,
"method": "buildernet_getFeeRefundTotalsByRecipient",
"params": [
recipient, // String, the address to query for fee refunds
]
}
The response contains three fields:
{
"pending":"0x17812ea4fbbe314",
"received":"0x108d1b27b63a213",
"maxBlockNumber":"0x13ddb08"
}
pending: the total amount of fee refunds that have been earned but not yet received by the recipientreceived: the total amount of fee refunds that have been received by the recipientmaxBlockNumber: the highest block number for which fee refunds have been processed
buildernet_getFeeRefundsByRecipient
The buildernet_getFeeRefundsByRecipient JSON-RPC method returns detailed information about fee refunds that have been earned by a specific address. Our refund process usually calculates these values about 2.5 hours after the block.
{
"jsonrpc": "2.0",
"id": 1,
"method": "buildernet_getFeeRefundsByRecipient",
"params": [
recipient, // String, the address to query for fee refunds
cursor, // [optional] String, the cursor to continue from
]
}
Responses are paginated and contain the following fields:
{
"refunds": [
{
"hash": "0x...",
"amount": "0x...",
"blockNumber": "0x13ddaa4",
"status": "sent",
"recipient": "0x...",
"refundTxHash": "0x...",
"refundTxBlockNumber": "0x...",
"refundTxStatus": "confirmed"
},
...
],
"cursor": "0x..."
}
The "refunds" field contains an array of per-order fee refunds, each with the following fields:
hash: the bundle hash or transaction hash associated with the fee refundamount: the amount of the fee refund, in weiblockNumber: the block number the order was contained instatus: the status of the fee refund, either "pending" or "sent"recipient: the address the fee refund is credited to, either the bundle signer or transaction senderrefundTxHash,refundTxBlockNumber,refundTxStatus: the payout transaction, once the fee refund has been sent
The "cursor" field is only included if there are more fee refunds to fetch. To continue fetching fee refunds, include the cursor as the second argument in the next request.
NOTE: This API currently only returns details for bundles included in block 20759441 (15 September 2024) and later. To see total fee refunds processed for a specific address since inception, use the buildernet_getFeeRefundTotalsByRecipient method.
buildernet_getFeeRefundsByBundle
The buildernet_getFeeRefundsByBundle is similar to buildernet_getFeeRefundsByRecipient but returns result for the given bundle.
{
"jsonrpc": "2.0",
"id": 1,
"method": "buildernet_getFeeRefundsByBundle",
"params": [
bundle_hash, // String, the hash of the bundle
]
}
buildernet_getFeeRefundsByBlock
The buildernet_getFeeRefundsByBlock is similar to buildernet_getFeeRefundsByRecipient but returns result for the given block. The result is not paginated and has no cursor.
{
"jsonrpc": "2.0",
"id": 1,
"method": "buildernet_getFeeRefundsByBlock",
"params": [
block_number, // String, hex-encoded block number (e.g. 0x15d0280)
recipient, // (Optional) String, only return refunds for this address
]
}
buildernet_setFeeRefundRecipient
The buildernet_setFeeRefundRecipient JSON-RPC method allows a user to "delegate" their fee refunds to a specific wallet address. Two addresses must be provided, the first is the address associated with the signing key used to authenticate your request, while the second is the address to send refunds to.
{
"jsonrpc": "2.0",
"id": 1,
"method": "buildernet_setFeeRefundRecipient",
"params": [
"0xD2824D2D7D6399a4b9A47F258B870D2AFb213948",
"0xa273A268CE96E54cF6a7D879B7d016F57E396F48"
]
}
If the first address matches the authentication signature, then a response with from and to fields in the result will be returned:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"from":"0xd2824d2d7d6399a4b9a47f258b870d2afb213948",
"to":"0xa273a268ce96e54cf6a7d879b7d016f57e396f48"
}
}
If the signature is invalid or does not match the first address, an appropriate error will be returned instead.
buildernet_getDelayedRefunds
The buildernet_getDelayedRefunds JSON-RPC method returns detailed information about delayed refunds.
{
"jsonrpc": "2.0",
"id": 1,
"method": "buildernet_getDelayedRefunds",
"params": [
{
recipient, // (Optional) String, the address that receives delayed refunds
blockRangeFrom, // [optional] String, hex-encoded block number for the start of the range (inclusive)
blockRangeTo, // [optional] String, hex-encoded block number for the end of the range (inclusive)
cursor, // [optional] String, the cursor to continue from
hash, // [optional] String, bundle hash; if provided, you must also set both blockRangeFrom and blockRangeTo
}
]
}
Responses are paginated and contain the following fields:
{
"refunds": [
{
"amount": "0x...",
"blockNumber": "0x13ddaa4",
"hash": "0x...",
"recipient": "0x...",
"status": "pending"
},
...
],
"nextCursor": "0x...",
"indexedUpTo": "0x..."
}
The "refunds" field contains an array of per-order fee refunds, each with the following fields:
amount: the amount of the delayed refund, in weiblockNumber: the block number the order was contained inhash: the bundle hash that generated delayed refundstatus: the status of the delayed refund, either "pending" or "sent"recipient: the address the delayed refund is credited to
The "nextCursor" field is only included if there are more delayed refunds to fetch, or if more data might become available in the future. To continue fetching, pass its value as the cursor field in the next request. If the response is empty but contains nextCursor, retry later.
"indexedUpTo" contains maximum block number for which delayed refunds are indexed
buildernet_getDelayedRefundTotalsByRecipient
The buildernet_getDelayedRefundTotalsByRecipient JSON-RPC method returns the total amount of delayed refunds that have been earned by a specific address.
{
"jsonrpc": "2.0",
"id": 1,
"method": "buildernet_getDelayedRefundTotalsByRecipient",
"params": [
{
recipient, // String, the address to query for delayed refunds
blockRangeFrom, // [optional] String, hex-encoded block number for the start of the range (inclusive)
blockRangeTo, // [optional] String, hex-encoded block number for the end of the range (inclusive)
}
]
}
The response contains three fields:
{
"indexedUpTo":"0x13ddb08",
"pending":"0x17812ea4fbbe314",
"received":"0x108d1b27b63a213"
}
indexedUpTo: the highest block number for which delayed refunds have been processedpending: the total amount of fee refunds that have been earned but not yet received by the recipientreceived: the total amount of fee refunds that have been received by the recipient