pub struct Environment<C> { /* private fields */ }
Implementations§
Source§impl<C> Environment<C>
impl<C> Environment<C>
Source§impl<C: ClientSync> Environment<C>
impl<C: ClientSync> Environment<C>
Sourcepub fn run_instructions(
&mut self,
instructions: &[Instruction],
signers: &[&Keypair],
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn run_instructions( &mut self, instructions: &[Instruction], signers: &[&Keypair], ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Executes provided instructions as a transaction and returns the result.
Sourcepub fn run_instruction(
&mut self,
instruction: Instruction,
signers: &[&Keypair],
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn run_instruction( &mut self, instruction: Instruction, signers: &[&Keypair], ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Runs a single instruction as a transaction and returns the result.
Sourcepub fn run_instructions_with_payer(
&mut self,
instructions: &[Instruction],
payer: &Keypair,
signers: &[&Keypair],
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn run_instructions_with_payer( &mut self, instructions: &[Instruction], payer: &Keypair, signers: &[&Keypair], ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Executes provided instructions as a transaction and returns the result with the provided payer keypair.
Sourcepub fn run_instruction_with_payer(
&mut self,
instruction: Instruction,
payer: &Keypair,
signers: &[&Keypair],
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn run_instruction_with_payer( &mut self, instruction: Instruction, payer: &Keypair, signers: &[&Keypair], ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Runs a single instruction as a transaction and returns the result with the provided payer keypair.
Sourcepub fn wait_for_tick(
&mut self,
) -> Result<Hash, ClientError<<C as ClientSync>::ChannelError>>
pub fn wait_for_tick( &mut self, ) -> Result<Hash, ClientError<<C as ClientSync>::ChannelError>>
Wait for the next tick
Sourcepub fn get_account(
&mut self,
address: Pubkey,
) -> Result<Account, ClientError<<C as ClientSync>::ChannelError>>
pub fn get_account( &mut self, address: Pubkey, ) -> Result<Account, ClientError<<C as ClientSync>::ChannelError>>
Gets account information at the given address.
Sourcepub fn token_balance(
&mut self,
token_account: Pubkey,
) -> Result<u64, ClientError<<C as ClientSync>::ChannelError>>
pub fn token_balance( &mut self, token_account: Pubkey, ) -> Result<u64, ClientError<<C as ClientSync>::ChannelError>>
Gets how much token does this token account hold.
Sourcepub fn create_token_mint(
&mut self,
mint: &Keypair,
authority: Pubkey,
freeze_authority: Option<Pubkey>,
decimals: u8,
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn create_token_mint( &mut self, mint: &Keypair, authority: Pubkey, freeze_authority: Option<Pubkey>, decimals: u8, ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Creates a new token mint using the provided keypair.
Sourcepub fn mint_tokens(
&mut self,
mint: Pubkey,
authority: &Keypair,
recipient: Pubkey,
amount: u64,
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn mint_tokens( &mut self, mint: Pubkey, authority: &Keypair, recipient: Pubkey, amount: u64, ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Mints tokens to recipient
token account with the token authority keypair.
Sourcepub fn create_associated_token_account(
&mut self,
owner: Pubkey,
mint: Pubkey,
) -> Result<Pubkey, ClientError<<C as ClientSync>::ChannelError>>
pub fn create_associated_token_account( &mut self, owner: Pubkey, mint: Pubkey, ) -> Result<Pubkey, ClientError<<C as ClientSync>::ChannelError>>
Creates a token account using the associated token account scheme.
Sourcepub fn create_account_with_data(
&mut self,
account: &Keypair,
data: &[u8],
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn create_account_with_data( &mut self, account: &Keypair, data: &[u8], ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Creates an account with a data field. The account is required to be empty and will be owned by bpf_loader afterwards.
Sourcepub fn deploy_program(
&mut self,
program_account: &Keypair,
data: &[u8],
) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
pub fn deploy_program( &mut self, program_account: &Keypair, data: &[u8], ) -> Result<(), ClientError<<C as ClientSync>::ChannelError>>
Create an executable account using a given keypair.
Sourcepub fn deploy_upgradeable_program(
&mut self,
program_account: &Keypair,
buffer_account: &Keypair,
authority_account: &Keypair,
data: &[u8],
compact: bool,
) -> Result<Pubkey, ClientError<<C as ClientSync>::ChannelError>>
pub fn deploy_upgradeable_program( &mut self, program_account: &Keypair, buffer_account: &Keypair, authority_account: &Keypair, data: &[u8], compact: bool, ) -> Result<Pubkey, ClientError<<C as ClientSync>::ChannelError>>
Deploys an upgradeable program and returns its ProgramData address
Auto Trait Implementations§
impl<C> Freeze for Environment<C>where
C: Freeze,
impl<C> RefUnwindSafe for Environment<C>where
C: RefUnwindSafe,
impl<C> Send for Environment<C>where
C: Send,
impl<C> Sync for Environment<C>where
C: Sync,
impl<C> Unpin for Environment<C>where
C: Unpin,
impl<C> UnwindSafe for Environment<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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