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
ToAccountMetas
trait - A vector of
AccountMeta
s (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) -> Result<Vec<Instruction>, ClientError>
pub fn transaction(&self) -> Result<Transaction, ClientError>
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> !UnwindSafe for RequestBuilder<'a, C, S>
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