pub struct BlokliTestState {Show 15 fields
pub accounts: IndexMap<u32, Account>,
pub native_balances: IndexMap<String, NativeBalance>,
pub token_balances: IndexMap<String, HoprBalance>,
pub safe_allowances: IndexMap<String, SafeHoprAllowance>,
pub deployed_safes: IndexMap<String, Safe>,
pub safe_redeem_stats: IndexMap<String, RedeemedStats>,
pub tx_counts: IndexMap<String, u64>,
pub channels: IndexMap<String, Channel>,
pub services: IndexMap<String, ServiceEntry>,
pub service_types: IndexMap<String, ServiceTypeInfo>,
pub service_registry_config: ServiceRegistryConfig,
pub chain_info: ChainInfo,
pub version: String,
pub health: String,
pub active_txs: IndexMap<TxId, Transaction>,
}Expand description
In-memory state served by BlokliTestClient.
Fields are public so tests can build fixtures directly. Maps are keyed by the same identifiers used by the public
client responses, typically hex-encoded addresses or ids. BlokliTestState::default provides a small coherent
baseline suitable for tests that only need to override a few fields.
Fields§
§accounts: IndexMap<u32, Account>Contains KeyID -> Account
native_balances: IndexMap<String, NativeBalance>Contains native balances for addresses.
token_balances: IndexMap<String, HoprBalance>Contains token balances for addresses.
safe_allowances: IndexMap<String, SafeHoprAllowance>Contains safe allowances for addresses.
deployed_safes: IndexMap<String, Safe>Contains deployed Safes for addresses.
safe_redeem_stats: IndexMap<String, RedeemedStats>Ticket redemption statistics per Safe address
tx_counts: IndexMap<String, u64>Contains transaction counts for addresses.
channels: IndexMap<String, Channel>Contains ChannelId -> Channel.
services: IndexMap<String, ServiceEntry>Contains service registry entries, keyed by BlokliTestState::service_entry_key.
service_types: IndexMap<String, ServiceTypeInfo>Contains service type configuration, keyed by ServiceTypeInfo::service_type.
service_registry_config: ServiceRegistryConfigContains the registry-wide type registration fee and node-safe registry pointer.
chain_info: ChainInfoContains chain info.
version: StringVersion of the Blokli server.
health: StringHealth of the Blokli server.
active_txs: IndexMap<TxId, Transaction>Active transactions.
This field is transient and not serialized.
Implementations§
Source§impl BlokliTestState
impl BlokliTestState
Sourcepub fn service_entry_key(service_type: &str, node: &ChainAddress) -> String
pub fn service_entry_key(service_type: &str, node: &ChainAddress) -> String
Builds the services key for a service type and node address.
The key is "<service type>/<node address>", where the service type is written the way Blokli renders it -
the ASCII name, or 0x-prefixed hex - and the node address is hex, with or without a 0x prefix.
Sourcepub fn get_service_entry(
&self,
service_type: &ServiceTypeId,
node: &ChainAddress,
) -> Option<&ServiceEntry>
pub fn get_service_entry( &self, service_type: &ServiceTypeId, node: &ChainAddress, ) -> Option<&ServiceEntry>
Convenience method to return a reference to the ServiceEntry of a node for a service type.
Sourcepub fn get_service_entry_mut(
&mut self,
service_type: &ServiceTypeId,
node: &ChainAddress,
) -> Option<&mut ServiceEntry>
pub fn get_service_entry_mut( &mut self, service_type: &ServiceTypeId, node: &ChainAddress, ) -> Option<&mut ServiceEntry>
Convenience method to return a mutable reference to the ServiceEntry of a node for a service type.
Sourcepub fn get_service_type(
&self,
service_type: &ServiceTypeId,
) -> Option<&ServiceTypeInfo>
pub fn get_service_type( &self, service_type: &ServiceTypeId, ) -> Option<&ServiceTypeInfo>
Convenience method to return a reference to the ServiceTypeInfo of a service type.
Sourcepub fn get_service_type_mut(
&mut self,
service_type: &ServiceTypeId,
) -> Option<&mut ServiceTypeInfo>
pub fn get_service_type_mut( &mut self, service_type: &ServiceTypeId, ) -> Option<&mut ServiceTypeInfo>
Convenience method to return a mutable reference to the ServiceTypeInfo of a service type.
Sourcepub fn get_account(&self, chain_key: &ChainAddress) -> Option<&Account>
pub fn get_account(&self, chain_key: &ChainAddress) -> Option<&Account>
Convenience method to return a reference to an Account with a given ChainAddress.
Sourcepub fn get_account_mut(
&mut self,
chain_key: &ChainAddress,
) -> Option<&mut Account>
pub fn get_account_mut( &mut self, chain_key: &ChainAddress, ) -> Option<&mut Account>
Convenience method to return a mutable reference to an Account with a given ChainAddress.
Sourcepub fn get_channel_by_id(&self, channel_id: &ChannelId) -> Option<&Channel>
pub fn get_channel_by_id(&self, channel_id: &ChannelId) -> Option<&Channel>
Sourcepub fn get_channel_by_id_mut(
&mut self,
channel_id: &ChannelId,
) -> Option<&mut Channel>
pub fn get_channel_by_id_mut( &mut self, channel_id: &ChannelId, ) -> Option<&mut Channel>
Sourcepub fn get_account_safe_token_balance(
&self,
chain_key: &ChainAddress,
) -> Option<&HoprBalance>
pub fn get_account_safe_token_balance( &self, chain_key: &ChainAddress, ) -> Option<&HoprBalance>
Convenience method to return a reference to Safe balance corresponding to the given ChainAddress of the
Account.
Sourcepub fn get_account_safe_token_balance_mut(
&mut self,
chain_key: &ChainAddress,
) -> Option<&mut HoprBalance>
pub fn get_account_safe_token_balance_mut( &mut self, chain_key: &ChainAddress, ) -> Option<&mut HoprBalance>
Convenience method to return a mutable reference to Safe balance corresponding to the given ChainAddress of
the Account.
Sourcepub fn get_account_safe_native_balance(
&self,
chain_key: &ChainAddress,
) -> Option<&NativeBalance>
pub fn get_account_safe_native_balance( &self, chain_key: &ChainAddress, ) -> Option<&NativeBalance>
Convenience method to return a reference to the Safe’s native balance corresponding to the given
ChainAddress of the Account.
Sourcepub fn get_account_safe_native_balance_mut(
&mut self,
chain_key: &ChainAddress,
) -> Option<&mut NativeBalance>
pub fn get_account_safe_native_balance_mut( &mut self, chain_key: &ChainAddress, ) -> Option<&mut NativeBalance>
Convenience method to return a mutable reference to the Safe’s native balance corresponding to the given
ChainAddress of the Account.
Sourcepub fn get_account_safe_allowance(
&self,
chain_key: &ChainAddress,
) -> Option<&SafeHoprAllowance>
pub fn get_account_safe_allowance( &self, chain_key: &ChainAddress, ) -> Option<&SafeHoprAllowance>
Convenience method to return a reference to Safe allowance corresponding to the given ChainAddress of the
Account.
Sourcepub fn get_account_safe_allowance_mut(
&mut self,
chain_key: &ChainAddress,
) -> Option<&mut SafeHoprAllowance>
pub fn get_account_safe_allowance_mut( &mut self, chain_key: &ChainAddress, ) -> Option<&mut SafeHoprAllowance>
Convenience method to return a mutable reference to Safe allowance corresponding to the given ChainAddress
of the Account.
Sourcepub fn get_safe_redeem_stats(
&self,
chain_address: &ChainAddress,
) -> Option<&RedeemedStats>
pub fn get_safe_redeem_stats( &self, chain_address: &ChainAddress, ) -> Option<&RedeemedStats>
Gets RedeemedStats for the given Safe address.
Sourcepub fn get_safe_redeem_stats_mut(
&mut self,
chain_address: &ChainAddress,
) -> Option<&mut RedeemedStats>
pub fn get_safe_redeem_stats_mut( &mut self, chain_address: &ChainAddress, ) -> Option<&mut RedeemedStats>
Gets RedeemedStats for the given Safe address by mutable reference.
Sourcepub fn get_safe_by_owner(&self, owner: &ChainAddress) -> Vec<&Safe>
pub fn get_safe_by_owner(&self, owner: &ChainAddress) -> Vec<&Safe>
Convenience method to return references to Safes with the given owner’s ChainAddress.
Sourcepub fn get_safe_by_owner_mut(&mut self, owner: &ChainAddress) -> Vec<&mut Safe>
pub fn get_safe_by_owner_mut(&mut self, owner: &ChainAddress) -> Vec<&mut Safe>
Convenience method to return mutable references to Safes with the given owner’s ChainAddress.
Trait Implementations§
Source§impl AsRef<BlokliTestState> for BlokliTestStateSnapshot
impl AsRef<BlokliTestState> for BlokliTestStateSnapshot
Source§fn as_ref(&self) -> &BlokliTestState
fn as_ref(&self) -> &BlokliTestState
Source§impl Clone for BlokliTestState
impl Clone for BlokliTestState
Source§fn clone(&self) -> BlokliTestState
fn clone(&self) -> BlokliTestState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BlokliTestState
impl Debug for BlokliTestState
Source§impl Default for BlokliTestState
impl Default for BlokliTestState
Source§impl<'de> Deserialize<'de> for BlokliTestState
impl<'de> Deserialize<'de> for BlokliTestState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for BlokliTestState
impl PartialEq for BlokliTestState
Auto Trait Implementations§
impl Freeze for BlokliTestState
impl RefUnwindSafe for BlokliTestState
impl Send for BlokliTestState
impl Sync for BlokliTestState
impl Unpin for BlokliTestState
impl UnsafeUnpin for BlokliTestState
impl UnwindSafe for BlokliTestState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
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> ⓘ
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