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>, rpc_client: AsyncRpcClient, ) -> Result<Self, ClientError>
Available on crate feature
async
only.Sourcepub fn request(&self) -> RequestBuilder<'_, C, Arc<dyn ThreadSafeSigner>>
Available on crate feature async
only.
pub fn request(&self) -> RequestBuilder<'_, C, Arc<dyn ThreadSafeSigner>>
async
only.Returns a threadsafe request builder
Sourcepub async fn account<T: AccountDeserialize>(
&self,
address: Pubkey,
) -> Result<T, ClientError>
Available on crate feature async
only.
pub async fn account<T: AccountDeserialize>( &self, address: Pubkey, ) -> Result<T, ClientError>
async
only.Returns the account at the given address.
Sourcepub async fn accounts<T: AccountDeserialize + Discriminator>(
&self,
filters: Vec<RpcFilterType>,
) -> Result<Vec<(Pubkey, T)>, ClientError>
Available on crate feature async
only.
pub async 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 async fn accounts_lazy<T: AccountDeserialize + Discriminator>(
&self,
filters: Vec<RpcFilterType>,
) -> Result<ProgramAccountsIterator<T>, ClientError>
Available on crate feature async
only.
pub async 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
Sourcepub async fn on<T: Event + AnchorDeserialize>(
&self,
f: impl Fn(&EventContext, T) + Send + 'static,
) -> Result<EventUnsubscriber<'_>, ClientError>
Available on crate feature async
only.
pub async fn on<T: Event + AnchorDeserialize>( &self, f: impl Fn(&EventContext, T) + Send + 'static, ) -> Result<EventUnsubscriber<'_>, ClientError>
async
only.Subscribe to program logs.
Returns an EventUnsubscriber
to unsubscribe and close connection gracefully.
Auto Trait Implementations§
impl<C> Freeze for Program<C>where
C: Freeze,
impl<C> !RefUnwindSafe 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> !UnwindSafe for Program<C>
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
Mutably borrows from an owned value. Read more