openzeppelin_monitor::services::filter

Struct StellarBlockFilter

Source
pub struct StellarBlockFilter<T> {
    pub _client: PhantomData<T>,
}
Expand description

Implementation of the block filter for Stellar blockchain

Fields§

§_client: PhantomData<T>

Implementations§

Source§

impl<T> StellarBlockFilter<T>

Source

pub fn find_matching_transaction( &self, transaction: &StellarTransaction, monitor: &Monitor, matched_transactions: &mut Vec<TransactionCondition>, )

Finds matching transactions based on monitor conditions

§Arguments
  • transaction - The Stellar transaction to check
  • monitor - The monitor containing match conditions
  • matched_transactions - Vector to store matching transactions
Source

pub fn convert_arguments_to_match_param_entry( &self, arguments: &[Value], function_spec: Option<&StellarContractFunction>, ) -> Vec<StellarMatchParamEntry>

Converts Stellar function arguments into match parameter entries

§Arguments
  • arguments - Vector of argument values to convert
  • function_spec - Optional function specification for named parameters
§Returns

Vector of converted parameter entries

Source

pub fn find_matching_functions_for_transaction( &self, monitored_addresses: &[String], contract_specs: &[(String, StellarFormattedContractSpec)], transaction: &StellarTransaction, monitor: &Monitor, matched_functions: &mut Vec<FunctionCondition>, matched_on_args: &mut StellarMatchArguments, )

Finds matching functions within a transaction

§Arguments
  • monitored_addresses - List of addresses being monitored
  • contract_specs - List of contract specifications (SEP-48 ABIs) for monitored addresses
  • transaction - The transaction to check
  • monitor - The monitor containing match conditions
  • matched_functions - Vector to store matching functions
  • matched_on_args - Arguments that matched the conditions
Source

pub fn find_matching_events_for_transaction( &self, events: &[EventMap], transaction: &StellarTransaction, monitor: &Monitor, matched_events: &mut Vec<EventCondition>, matched_on_args: &mut StellarMatchArguments, )

Finds matching events for a transaction

§Arguments
  • events - List of decoded events
  • transaction - The transaction to check
  • monitor - The monitor containing match conditions
  • matched_events - Vector to store matching events
  • matched_on_args - Arguments that matched the conditions
Source

pub async fn decode_events( &self, events: &Vec<StellarEvent>, monitored_addresses: &[String], _contract_specs: &[(String, StellarFormattedContractSpec)], ) -> Vec<EventMap>

Decodes Stellar events into a more processable format

§Arguments
  • events - Raw Stellar events to decode
  • monitored_addresses - List of addresses being monitored
§Returns

Vector of decoded events mapped to their transaction hashes

Source

pub fn compare_map( &self, param_value: &str, operator: &str, compare_value: &str, ) -> bool

Compares two values that might be JSON or plain strings using the specified operator.

§Arguments
  • param_value - The first value to compare, which could be a JSON string or plain string
  • operator - The comparison operator (“==”, “!=”, “>”, “>=”, “<”, “<=”)
  • compare_value - The second value to compare against, which could be a JSON string or plain string
§Supported Comparison Cases
  1. JSON vs JSON: Both values are valid JSON

    • Supports equality (==, !=)
    • Supports numeric comparisons (>, >=, <, <=) when both values are numbers
  2. JSON vs String: First value is JSON, second is plain string

    • Supports dot notation to access nested JSON values (e.g., “user.address.city”)
    • Can check if the string matches a key in a JSON object
    • Falls back to direct string comparison if above checks fail
  3. String vs JSON: First value is string, second is JSON

    • Currently returns false as this is an invalid comparison
  4. String vs String: Neither value is valid JSON

    • Performs direct string comparison
§Returns
  • bool - True if the comparison succeeds, false otherwise
Source

pub fn evaluate_expression( &self, expression: &str, args: &Option<Vec<StellarMatchParamEntry>>, ) -> bool

Evaluates a complex matching expression against provided arguments

§Arguments
  • expression - The expression to evaluate (supports AND/OR operations)
  • args - The arguments to evaluate against
§Returns

Boolean indicating if the expression evaluates to true

Trait Implementations§

Source§

impl<T: BlockChainClient + StellarClientTrait> BlockFilter for StellarBlockFilter<T>

Source§

fn filter_block<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, client: &'life1 Self::Client, network: &'life2 Network, block: &'life3 BlockType, monitors: &'life4 [Monitor], contract_specs: Option<&'life5 [(String, ContractSpec)]>, ) -> Pin<Box<dyn Future<Output = Result<Vec<MonitorMatch>, FilterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Filters a Stellar block against provided monitors

§Arguments
  • client - The blockchain client to use
  • _network - The network being monitored
  • block - The block to filter
  • monitors - List of monitors to check against
  • contract_specs - List of contract specs to use for decoding events
§Returns

Result containing vector of matching monitors or a filter error

Source§

type Client = T

Auto Trait Implementations§

§

impl<T> Freeze for StellarBlockFilter<T>

§

impl<T> RefUnwindSafe for StellarBlockFilter<T>
where T: RefUnwindSafe,

§

impl<T> Send for StellarBlockFilter<T>
where T: Send,

§

impl<T> Sync for StellarBlockFilter<T>
where T: Sync,

§

impl<T> Unpin for StellarBlockFilter<T>
where T: Unpin,

§

impl<T> UnwindSafe for StellarBlockFilter<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Chain<T> for T

§

fn len(&self) -> usize

The number of items that this chain link consists of.
§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,