pub struct ClientContext<Env: Environment> {
pub client: Arc<Client<Env>>,
pub genesis_config: GenesisConfig,
pub send_timeout: Duration,
pub recv_timeout: Duration,
pub retry_delay: Duration,
pub max_retries: u32,
pub chain_listeners: JoinSet,
pub default_chain: Option<ChainId>,
pub client_metrics: Option<ClientMetrics>,
}Fields§
§client: Arc<Client<Env>>§genesis_config: GenesisConfig§send_timeout: Duration§recv_timeout: Duration§retry_delay: Duration§max_retries: u32§chain_listeners: JoinSet§default_chain: Option<ChainId>§client_metrics: Option<ClientMetrics>Implementations§
Source§impl<S, Si, W> ClientContext<Impl<S, NodeProvider, Si, W>>
impl<S, Si, W> ClientContext<Impl<S, NodeProvider, Si, W>>
Source§impl<Env: Environment> ClientContext<Env>
impl<Env: Environment> ClientContext<Env>
Sourcepub fn admin_chain(&self) -> ChainId
pub fn admin_chain(&self) -> ChainId
Returns the ID of the admin chain.
Sourcepub fn default_account(&self) -> Account
pub fn default_account(&self) -> Account
Retrieve the default account. Current this is the common account of the default chain.
Sourcepub fn default_chain(&self) -> ChainId
pub fn default_chain(&self) -> ChainId
Retrieve the default chain.
pub async fn first_non_admin_chain(&self) -> Result<ChainId, Error>
pub fn make_node_provider(&self) -> NodeProvider
pub fn client_metrics(&self) -> Option<&ClientMetrics>
pub async fn update_wallet_from_client<Env_: Environment>( &self, client: &ChainClient<Env_>, ) -> Result<(), Error>
Sourcepub async fn update_wallet_for_new_chain(
&mut self,
chain_id: ChainId,
owner: Option<AccountOwner>,
timestamp: Timestamp,
epoch: Epoch,
) -> Result<(), Error>
pub async fn update_wallet_for_new_chain( &mut self, chain_id: ChainId, owner: Option<AccountOwner>, timestamp: Timestamp, epoch: Epoch, ) -> Result<(), Error>
Remembers the new chain and its owner (if any) in the wallet.
pub async fn process_inbox( &mut self, chain_client: &ChainClient<Env>, ) -> Result<Vec<ConfirmedBlockCertificate>, Error>
pub async fn assign_new_chain_to_key( &mut self, chain_id: ChainId, owner: AccountOwner, ) -> Result<(), Error>
Sourcepub async fn apply_client_command<E, F, Fut, T>(
&mut self,
client: &ChainClient<Env>,
f: F,
) -> Result<T, Error>where
F: FnMut(&ChainClient<Env>) -> Fut,
Fut: Future<Output = Result<ClientOutcome<T>, E>>,
Error: From<E>,
pub async fn apply_client_command<E, F, Fut, T>(
&mut self,
client: &ChainClient<Env>,
f: F,
) -> Result<T, Error>where
F: FnMut(&ChainClient<Env>) -> Fut,
Fut: Future<Output = Result<ClientOutcome<T>, E>>,
Error: From<E>,
Applies the given function to the chain client.
Updates the wallet regardless of the outcome. As long as the function returns a round timeout, it will wait and retry.
pub async fn ownership( &mut self, chain_id: Option<ChainId>, ) -> Result<ChainOwnership, Error>
pub async fn change_ownership( &mut self, chain_id: Option<ChainId>, ownership_config: ChainOwnershipConfig, ) -> Result<(), Error>
pub async fn set_preferred_owner( &mut self, chain_id: Option<ChainId>, preferred_owner: AccountOwner, ) -> Result<(), Error>
pub async fn check_compatible_version_info( &self, address: &str, node: &impl ValidatorNode, ) -> Result<VersionInfo, Error>
pub async fn check_matching_network_description( &self, address: &str, node: &impl ValidatorNode, ) -> Result<CryptoHash, Error>
pub async fn check_validator_chain_info_response( &self, public_key: Option<&ValidatorPublicKey>, address: &str, node: &impl ValidatorNode, chain_id: ChainId, ) -> Result<ChainInfo, Error>
Sourcepub async fn query_validator(
&self,
address: &str,
node: &impl ValidatorNode,
chain_id: ChainId,
public_key: Option<&ValidatorPublicKey>,
) -> ValidatorQueryResults
pub async fn query_validator( &self, address: &str, node: &impl ValidatorNode, chain_id: ChainId, public_key: Option<&ValidatorPublicKey>, ) -> ValidatorQueryResults
Query a validator for version info, network description, and chain info.
Returns a ValidatorQueryResults struct with the results of all three queries.
Sourcepub async fn query_local_node(
&self,
chain_id: ChainId,
) -> Result<ValidatorQueryResults, Error>
pub async fn query_local_node( &self, chain_id: ChainId, ) -> Result<ValidatorQueryResults, Error>
Query the local node for version info, network description, and chain info.
Returns a ValidatorQueryResults struct with the local node’s information.
Source§impl<Env: Environment> ClientContext<Env>
impl<Env: Environment> ClientContext<Env>
pub async fn prepare_for_benchmark( &mut self, num_chains: usize, transactions_per_block: usize, tokens_per_chain: Amount, fungible_application_id: Option<ApplicationId>, pub_keys: Vec<AccountPublicKey>, chains_config_path: Option<&Path>, ) -> Result<(Vec<ChainClient<Env>>, Vec<Vec<Operation>>), Error>
pub async fn wrap_up_benchmark( &mut self, chain_clients: Vec<ChainClient<Env>>, close_chains: bool, wrap_up_max_in_flight: usize, ) -> Result<(), Error>
Trait Implementations§
Source§impl<Env: Environment> ClientContext for ClientContext<Env>
impl<Env: Environment> ClientContext for ClientContext<Env>
type Environment = Env
fn wallet(&self) -> &Env::Wallet
fn storage(&self) -> &Env::Storage
fn client(&self) -> &Arc<Client<Env>>
Source§fn timing_sender(&self) -> Option<UnboundedSender<(u64, TimingType)>>
fn timing_sender(&self) -> Option<UnboundedSender<(u64, TimingType)>>
async fn update_wallet_for_new_chain( &mut self, chain_id: ChainId, owner: Option<AccountOwner>, timestamp: Timestamp, epoch: Epoch, ) -> Result<(), Error>
async fn update_wallet( &mut self, client: &ChainClient<Env>, ) -> Result<(), Error>
fn admin_chain(&self) -> ChainId
fn make_chain_client( &self, chain_id: ChainId, ) -> impl Future<Output = Result<ChainClient<Self::Environment>, Error>> + Send + Sync
Auto Trait Implementations§
impl<Env> Freeze for ClientContext<Env>
impl<Env> !RefUnwindSafe for ClientContext<Env>
impl<Env> Send for ClientContext<Env>
impl<Env> Sync for ClientContext<Env>
impl<Env> Unpin for ClientContext<Env>
impl<Env> !UnwindSafe for ClientContext<Env>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> ClientContextExt for Twhere
T: ClientContext,
impl<T> ClientContextExt for Twhere
T: ClientContext,
async fn clients( &self, ) -> Result<Vec<ChainClient<<Self as ClientContext>::Environment>>, Error>
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.