Struct near_sdk_sim::UserTransaction [−][src]
pub struct UserTransaction { /* fields omitted */ }
A transaction to be signed by the user which created it. Multiple actions can be chained together and then signed and sumited to be executed.
Example:
use near_sdk_sim::{to_yocto, account::AccessKey}; use near_crypto::{InMemorySigner, KeyType, Signer}; let master_account = near_sdk_sim::init_simulator(None); let account_id = "alice".to_string(); let transaction = master_account.create_transaction(account_id.clone()); // Creates a signer which contains a public key. let signer = InMemorySigner::from_seed(&account_id, KeyType::ED25519, &account_id); let res = transaction.create_account() .add_key(signer.public_key(), AccessKey::full_access()) .transfer(to_yocto("10")) .submit();
This creates an account for alice
, and a new key pair for the account, adding the
public key to the account, and finally transfering 10
NEAR to the account from the
master_account
.
Implementations
impl UserTransaction
[src]
impl UserTransaction
[src]pub fn submit(self) -> ExecutionResult
[src]
Sign and execute the transaction
pub fn create_account(self) -> Self
[src]
Create account for the receiver of the transaction.
pub fn deploy_contract(self, code: Vec<u8>) -> Self
[src]
Deploy Wasm binary
pub fn function_call(
self,
method_name: String,
args: Vec<u8>,
gas: Gas,
deposit: Balance
) -> Self
[src]
self,
method_name: String,
args: Vec<u8>,
gas: Gas,
deposit: Balance
) -> Self
Execute contract call to receiver
pub fn transfer(self, deposit: Balance) -> Self
[src]
Transfer deposit to receiver
pub fn stake(self, stake: Balance, public_key: PublicKey) -> Self
[src]
Express interest in becoming a validator
pub fn add_key(self, public_key: PublicKey, access_key: AccessKey) -> Self
[src]
Add access key, either FunctionCall or FullAccess
pub fn delete_key(self, public_key: PublicKey) -> Self
[src]
Delete an access key
pub fn delete_account(self, beneficiary_id: AccountId) -> Self
[src]
Delete an account and send remaining balance to beneficiary_id
Auto Trait Implementations
impl !RefUnwindSafe for UserTransaction
impl !RefUnwindSafe for UserTransaction
impl !Send for UserTransaction
impl !Send for UserTransaction
impl !Sync for UserTransaction
impl !Sync for UserTransaction
impl Unpin for UserTransaction
impl Unpin for UserTransaction
impl !UnwindSafe for UserTransaction
impl !UnwindSafe for UserTransaction
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,