pub struct Transaction<'a> { /* private fields */ }Expand description
A builder-like object that will allow specifying various actions to be performed in a single transaction. For details on each of the actions, find them in NEAR transactions.
All actions are performed on the account specified by receiver_id.
Implementations§
source§impl<'a> Transaction<'a>
impl<'a> Transaction<'a>
sourcepub async fn transact(self) -> Result<FinalExecutionOutcomeView>
pub async fn transact(self) -> Result<FinalExecutionOutcomeView>
Process the transaction, and return the result of the execution.
sourcepub async fn transact_async(self) -> Result<AsyncTransactionStatus>
pub async fn transact_async(self) -> Result<AsyncTransactionStatus>
Send the transaction to the network to be processed. This will be done asynchronously without waiting for the transaction to complete.
source§impl Transaction<'_>
impl Transaction<'_>
sourcepub fn add_key(self, pk: PublicKey, ak: AccessKey) -> Self
pub fn add_key(self, pk: PublicKey, ak: AccessKey) -> Self
Adds a key to the receiver_id’s account, where the public key can be used
later to delete the same key.
sourcepub fn call(self, function: Function) -> Self
pub fn call(self, function: Function) -> Self
Call into the receiver_id’s contract with the specific function arguments.
sourcepub fn create_account(self) -> Self
pub fn create_account(self) -> Self
Create a new account with the account id being receiver_id.
sourcepub fn delete_account(self, beneficiary_id: &AccountId) -> Self
pub fn delete_account(self, beneficiary_id: &AccountId) -> Self
Deletes the receiver_id’s account. The beneficiary specified by
beneficiary_id will receive the funds of the account deleted.
sourcepub fn delete_key(self, pk: PublicKey) -> Self
pub fn delete_key(self, pk: PublicKey) -> Self
Deletes a key from the receiver_id’s account, where the public key is
associated with the access key to be deleted.
sourcepub fn deploy(self, code: &[u8]) -> Self
pub fn deploy(self, code: &[u8]) -> Self
Deploy contract code or WASM bytes to the receiver_id’s account.
sourcepub fn stake(self, stake: NearToken, pk: PublicKey) -> Self
pub fn stake(self, stake: NearToken, pk: PublicKey) -> Self
An action which stakes the signer’s tokens and setups a validator public key.
sourcepub fn transfer(self, deposit: NearToken) -> Self
pub fn transfer(self, deposit: NearToken) -> Self
Transfer deposit amount from signer’s account into receiver_id’s account.
sourcepub fn retry_exponential(self, base_millis: u64, max_retries: usize) -> Self
pub fn retry_exponential(self, base_millis: u64, max_retries: usize) -> Self
Retry this transactions if it fails. This will retry the transaction with exponential backoff.
sourcepub fn retry(
self,
strategy: impl Iterator<Item = Duration> + Send + Sync + 'static,
) -> Self
pub fn retry( self, strategy: impl Iterator<Item = Duration> + Send + Sync + 'static, ) -> Self
Retry this transactions if it fails. This will retry the transaction with the provided retry strategy.
sourcepub fn wait_until(self, wait_until: TxExecutionStatus) -> Self
pub fn wait_until(self, wait_until: TxExecutionStatus) -> Self
Specifies the status to wait until the transaction reaches in the network. The default
value is TxExecutionStatus::ExecutedOptimistic if not specified by this function.
Auto Trait Implementations§
impl<'a> Freeze for Transaction<'a>
impl<'a> !RefUnwindSafe for Transaction<'a>
impl<'a> Send for Transaction<'a>
impl<'a> Sync for Transaction<'a>
impl<'a> Unpin for Transaction<'a>
impl<'a> !UnwindSafe for Transaction<'a>
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
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