Struct near_fetch::ops::Transaction

source ·
pub struct Transaction<'a, S> { /* 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, S> Transaction<'a, S>where S: Signer + ExposeAccountId + 'static,

source

pub async fn transact(self) -> Result<FinalExecutionOutcomeView>

Process the transaction, and return the result of the execution.

source

pub async fn transact_async(self) -> Result<CryptoHash>

Send the transaction to the network to be processed. This will be done asynchronously without waiting for the transaction to complete. This returns us a [TransactionStatus] for which we can call into status and/or .await to retrieve info about whether the transaction has been completed or not. Note that .await will wait till completion of the transaction.

source§

impl<S> Transaction<'_, S>

source

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.

source

pub fn call(self, function: Function) -> Self

Call into the receiver_id’s contract with the specific function arguments.

source

pub fn create_account(self) -> Self

Create a new account with the account id being receiver_id.

source

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.

source

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.

source

pub fn deploy(self, code: &[u8]) -> Self

Deploy contract code or WASM bytes to the receiver_id’s account.

source

pub fn stake(self, stake: NearToken, pk: PublicKey) -> Self

An action which stakes the signer’s tokens and setups a validator public key.

source

pub fn transfer(self, deposit: NearToken) -> Self

Transfer deposit amount from signer’s account into receiver_id’s account.

Auto Trait Implementations§

§

impl<'a, S> !RefUnwindSafe for Transaction<'a, S>

§

impl<'a, S> Send for Transaction<'a, S>where S: Send,

§

impl<'a, S> Sync for Transaction<'a, S>where S: Sync,

§

impl<'a, S> Unpin for Transaction<'a, S>where S: Unpin,

§

impl<'a, S> !UnwindSafe for Transaction<'a, S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more