Skip to content

Commit

Permalink
feat: add map_pool fn (paradigmxyz#11890)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Oct 19, 2024
1 parent ddc5ac3 commit 1a1aa2f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,21 @@ impl<Pool, Client, Attributes, Payload> BuildArguments<Pool, Client, Attributes,
best_payload: self.best_payload,
}
}

/// Maps the transaction pool to a new type using a closure with the current pool type as input.
pub fn map_pool<F, P>(self, f: F) -> BuildArguments<P, Client, Attributes, Payload>
where
F: FnOnce(Pool) -> P,
{
BuildArguments {
client: self.client,
pool: f(self.pool),
cached_reads: self.cached_reads,
config: self.config,
cancel: self.cancel,
best_payload: self.best_payload,
}
}
}

/// A trait for building payloads that encapsulate Ethereum transactions.
Expand Down

0 comments on commit 1a1aa2f

Please sign in to comment.