|
| 1 | +//! RPC types that are supported by Beaverbuild |
| 2 | +use alloy_primitives::{Address, BlockNumber, TxHash}; |
| 3 | +use reth_primitives::TransactionSigned; |
| 4 | +use serde::{Deserialize, Serialize}; |
| 5 | +use serde_with::{serde_as, skip_serializing_none}; |
| 6 | + |
| 7 | +/// Bundle as recognised by Beaverbuild |
| 8 | +/// |
| 9 | +/// Consult <https://beaverbuild.org/docs.html>. Note that the deprecated `replacementUuid` field |
| 10 | +/// has been omitted. |
| 11 | +#[skip_serializing_none] |
| 12 | +#[derive(Clone, Debug, Default, Deserialize, Serialize)] |
| 13 | +#[serde(rename_all = "camelCase")] |
| 14 | +#[serde_as] |
| 15 | +pub struct BeaverBundle { |
| 16 | + /// List of hex-encoded, raw transactions. Can be empty for cancelling a bundle |
| 17 | + #[serde(rename = "txs")] |
| 18 | + pub transactions: Vec<TransactionSigned>, |
| 19 | + /// The block that this bundle will be valid for. 0 means it's valid for the next block (and only this one) |
| 20 | + #[serde(with = "alloy_serde::quantity")] |
| 21 | + pub block_number: BlockNumber, |
| 22 | + /// If specified and >0, the bundle will only be valid if the block timestamp is greater or equal to `minTimestamp` |
| 23 | + pub min_timestamp: Option<u64>, |
| 24 | + /// If specified and >0, the bundle will only be valid if the block timestamp is smaller or equal to `maxTimestamp` |
| 25 | + pub max_timestamp: Option<u64>, |
| 26 | + /// A list of transaction hashes contained in the bundle, that can be allowed to revert, or be removed from your bundle if it's deemed useful |
| 27 | + #[serde(skip_serializing_if = "Vec::is_empty")] |
| 28 | + pub reverting_transaction_hashes: Vec<TxHash>, |
| 29 | + /// A list of transaction hashes contained in the bundle, that can be allowed to be removed from your bundle if it's deemed useful (but not revert) |
| 30 | + #[serde(skip_serializing_if = "Vec::is_empty")] |
| 31 | + pub dropping_transaction_hashes: Vec<TxHash>, |
| 32 | + /// An UUID string, which allows you to update/cancel your bundles: if you specify an uuid and we already have a bundle with an identical one, we'll forget about the old bundle. So we can only have a single bundle with a certain `uuid` at all times (and we keep the most recent) |
| 33 | + pub uuid: Option<String>, |
| 34 | + /// An integer between 1-99. How much of the total priority fee + coinbase payment you want to be refunded for. This will negatively impact your prioritization because this refund is gonna eat into your bundle payment. Example: if a bundle pays 0.2 ETH of priority fee plus 1 ETH to coinbase, a refundPercent set to 50 will result in a transaction being appended after the bundle, paying 0.59 ETH back to the EOA. This is assuming the payout tx will cost beaver 0.01 ETH in fees, which are deduced from the 0.6 ETH payout. |
| 35 | + pub refund_percent: Option<u64>, |
| 36 | + /// You can specify an address that the funds from `refundPercent` will be sent to. If not specified, they will be sent to the `from` address of the first transaction |
| 37 | + pub refund_recipient: Option<Address>, |
| 38 | + /// The hashes of transactions in the bundle that the refund will be based on. If it's empty, we'll use the last transaction |
| 39 | + #[serde(skip_serializing_if = "Vec::is_empty")] |
| 40 | + pub refund_transaction_hashes: Vec<TxHash>, |
| 41 | +} |
0 commit comments