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>
impl<T> StellarBlockFilter<T>
Sourcepub fn find_matching_transaction(
&self,
transaction: &StellarTransaction,
monitor: &Monitor,
matched_transactions: &mut Vec<TransactionCondition>,
)
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 checkmonitor
- The monitor containing match conditionsmatched_transactions
- Vector to store matching transactions
Sourcepub fn convert_arguments_to_match_param_entry(
&self,
arguments: &[Value],
function_spec: Option<&StellarContractFunction>,
) -> Vec<StellarMatchParamEntry>
pub fn convert_arguments_to_match_param_entry( &self, arguments: &[Value], function_spec: Option<&StellarContractFunction>, ) -> Vec<StellarMatchParamEntry>
Sourcepub 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,
)
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 monitoredcontract_specs
- List of contract specifications (SEP-48 ABIs) for monitored addressestransaction
- The transaction to checkmonitor
- The monitor containing match conditionsmatched_functions
- Vector to store matching functionsmatched_on_args
- Arguments that matched the conditions
Sourcepub fn find_matching_events_for_transaction(
&self,
events: &[EventMap],
transaction: &StellarTransaction,
monitor: &Monitor,
matched_events: &mut Vec<EventCondition>,
matched_on_args: &mut StellarMatchArguments,
)
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 eventstransaction
- The transaction to checkmonitor
- The monitor containing match conditionsmatched_events
- Vector to store matching eventsmatched_on_args
- Arguments that matched the conditions
Sourcepub async fn decode_events(
&self,
events: &Vec<StellarEvent>,
monitored_addresses: &[String],
_contract_specs: &[(String, StellarFormattedContractSpec)],
) -> Vec<EventMap>
pub async fn decode_events( &self, events: &Vec<StellarEvent>, monitored_addresses: &[String], _contract_specs: &[(String, StellarFormattedContractSpec)], ) -> Vec<EventMap>
Sourcepub fn compare_map(
&self,
param_value: &str,
operator: &str,
compare_value: &str,
) -> bool
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 stringoperator
- The comparison operator (“==”, “!=”, “>”, “>=”, “<”, “<=”)compare_value
- The second value to compare against, which could be a JSON string or plain string
§Supported Comparison Cases
-
JSON vs JSON: Both values are valid JSON
- Supports equality (==, !=)
- Supports numeric comparisons (>, >=, <, <=) when both values are numbers
-
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
-
String vs JSON: First value is string, second is JSON
- Currently returns false as this is an invalid comparison
-
String vs String: Neither value is valid JSON
- Performs direct string comparison
§Returns
bool
- True if the comparison succeeds, false otherwise
Sourcepub fn evaluate_expression(
&self,
expression: &str,
args: &Option<Vec<StellarMatchParamEntry>>,
) -> bool
pub fn evaluate_expression( &self, expression: &str, args: &Option<Vec<StellarMatchParamEntry>>, ) -> bool
Trait Implementations§
Source§impl<T: BlockChainClient + StellarClientTrait> BlockFilter for StellarBlockFilter<T>
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,
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 monitoredblock
- The block to filtermonitors
- List of monitors to check againstcontract_specs
- List of contract specs to use for decoding events
§Returns
Result containing vector of matching monitors or a filter error
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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