pub struct Program<C> { /* private fields */ }Expand description
Program is the primary client handle to be used to build and send requests.
Implementations§
Source§impl<C: Deref<Target = impl Signer> + Clone> Program<C>
impl<C: Deref<Target = impl Signer> + Clone> Program<C>
pub fn new(program_id: Pubkey, cfg: Config<C>) -> Result<Self, ClientError>
Available on non-crate feature
async only.pub fn rpc(&self) -> RpcClient
Available on non-crate feature
async and non-crate feature mock only.Sourcepub fn request(&self) -> RequestBuilder<'_, C, Box<dyn Signer + '_>>
Available on non-crate feature async only.
pub fn request(&self) -> RequestBuilder<'_, C, Box<dyn Signer + '_>>
async only.Returns a request builder.
Sourcepub fn account<T: AccountDeserialize>(
&self,
address: Pubkey,
) -> Result<T, ClientError>
Available on non-crate feature async only.
pub fn account<T: AccountDeserialize>( &self, address: Pubkey, ) -> Result<T, ClientError>
async only.Returns the account at the given address.
Sourcepub fn accounts<T: AccountDeserialize + Discriminator>(
&self,
filters: Vec<RpcFilterType>,
) -> Result<Vec<(Pubkey, T)>, ClientError>
Available on non-crate feature async only.
pub fn accounts<T: AccountDeserialize + Discriminator>( &self, filters: Vec<RpcFilterType>, ) -> Result<Vec<(Pubkey, T)>, ClientError>
async only.Returns all program accounts of the given type matching the given filters
Sourcepub fn accounts_lazy<T: AccountDeserialize + Discriminator>(
&self,
filters: Vec<RpcFilterType>,
) -> Result<ProgramAccountsIterator<T>, ClientError>
Available on non-crate feature async only.
pub fn accounts_lazy<T: AccountDeserialize + Discriminator>( &self, filters: Vec<RpcFilterType>, ) -> Result<ProgramAccountsIterator<T>, ClientError>
async only.Returns all program accounts of the given type matching the given filters as an iterator Deserialization is executed lazily
pub fn on<T: Event + AnchorDeserialize>( &self, f: impl FnMut(&EventContext, T) + Send + 'static, ) -> Result<EventUnsubscriber<'_>, ClientError>
Available on non-crate feature
async only.Auto Trait Implementations§
impl<C> !Freeze for Program<C>
impl<C> !RefUnwindSafe for Program<C>
impl<C> !UnwindSafe for Program<C>
impl<C> Send for Program<C>where
C: Send,
impl<C> Sync for Program<C>where
C: Sync,
impl<C> Unpin for Program<C>where
C: Unpin,
impl<C> UnsafeUnpin for Program<C>where
C: UnsafeUnpin,
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
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