pub struct RequestBuilder<'a, C, S: 'a> { /* private fields */ }Expand description
RequestBuilder provides a builder interface to create and send
transactions to a cluster.
Implementations§
Source§impl<'a, C: Deref<Target = impl Signer> + Clone> RequestBuilder<'a, C, Arc<dyn ThreadSafeSigner>>
impl<'a, C: Deref<Target = impl Signer> + Clone> RequestBuilder<'a, C, Arc<dyn ThreadSafeSigner>>
pub fn from( program_id: Pubkey, cluster: &str, payer: C, options: Option<CommitmentConfig>, rpc_client: &'a AsyncRpcClient, ) -> Self
Available on crate feature
async only.pub fn signer<T: ThreadSafeSigner>(self, signer: T) -> Self
Available on crate feature
async only.pub async fn signed_transaction(&self) -> Result<Transaction, ClientError>
Available on crate feature
async only.pub async fn send(self) -> Result<Signature, ClientError>
Available on crate feature
async only.pub async fn send_with_spinner_and_config( self, config: RpcSendTransactionConfig, ) -> Result<Signature, ClientError>
Available on crate feature
async only.Source§impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, C, S>
impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, C, S>
pub fn payer(self, payer: C) -> Self
pub fn cluster(self, url: &str) -> Self
pub fn instruction(self, ix: Instruction) -> Self
pub fn program(self, program_id: Pubkey) -> Self
Sourcepub fn accounts(self, accounts: impl ToAccountMetas) -> Self
pub fn accounts(self, accounts: impl ToAccountMetas) -> Self
Set the accounts to pass to the instruction.
accounts argument can be:
- Any type that implements
ToAccountMetastrait - A vector of
AccountMetas (for remaining accounts)
Note that the given accounts are appended to the previous list of accounts instead of overriding the existing ones (if any).
§Example
ⓘ
program
.request()
// Regular accounts
.accounts(accounts::Initialize {
my_account: my_account_kp.pubkey(),
payer: program.payer(),
system_program: system_program::ID,
})
// Remaining accounts
.accounts(vec![AccountMeta {
pubkey: remaining,
is_signer: true,
is_writable: true,
}])
.args(instruction::Initialize { field: 42 })
.send()?;pub fn options(self, options: CommitmentConfig) -> Self
pub fn args(self, args: impl InstructionData) -> Self
pub fn instructions(&self) -> Vec<Instruction>
pub fn transaction(&self) -> Transaction
Auto Trait Implementations§
impl<'a, C, S> Freeze for RequestBuilder<'a, C, S>where
C: Freeze,
impl<'a, C, S> !RefUnwindSafe for RequestBuilder<'a, C, S>
impl<'a, C, S> Send for RequestBuilder<'a, C, S>
impl<'a, C, S> Sync for RequestBuilder<'a, C, S>
impl<'a, C, S> Unpin for RequestBuilder<'a, C, S>
impl<'a, C, S> UnsafeUnpin for RequestBuilder<'a, C, S>where
C: UnsafeUnpin,
impl<'a, C, S> !UnwindSafe for RequestBuilder<'a, C, S>
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