Struct workspaces::operations::Transaction
source · 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
. This object
is most commonly constructed from Account::batch
or Contract::batch
,
where receiver_id
is specified in the Account::batch
while Contract::id()
is used by default for Contract::batch
.
Implementations§
source§impl<'a> Transaction<'a>
impl<'a> Transaction<'a>
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: Balance, pk: PublicKey) -> Self
pub fn stake(self, stake: Balance, pk: PublicKey) -> Self
An action which stakes the signer’s tokens and setups a validator public key.
sourcepub fn transfer(self, deposit: Balance) -> Self
pub fn transfer(self, deposit: Balance) -> Self
Transfer deposit
amount from signer
’s account into receiver_id
’s account.
sourcepub async fn transact(self) -> Result<ExecutionFinalResult>
pub async fn transact(self) -> Result<ExecutionFinalResult>
Process the transaction, and return the result of the execution.
sourcepub async fn transact_async(self) -> Result<TransactionStatus<'a>>
pub async fn transact_async(self) -> Result<TransactionStatus<'a>>
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.