Struct near_sdk_sim::UserAccount[][src]

pub struct UserAccount {
    pub account_id: AccountId,
    pub signer: InMemorySigner,
    // some fields omitted
}

A user that can sign transactions. It includes a signer and an account id.

Fields

account_id: AccountIdsigner: InMemorySigner

Implementations

impl UserAccount[src]

pub fn account_id(&self) -> AccountId[src]

Returns a copy of the account_id

pub fn valid_account_id(&self) -> ValidAccountId[src]

pub fn account(&self) -> Option<Account>[src]

Look up the account information on chain.

pub fn transfer(&self, to: AccountId, deposit: Balance) -> ExecutionResult[src]

Transfer yoctoNear to another account

pub fn function_call(
    &self,
    pending_tx: PendingContractTx,
    gas: Gas,
    deposit: Balance
) -> ExecutionResult
[src]

Make a contract call. pending_tx includes the receiver, the method to call as well as its arguments. Note: You will most likely not be using this method directly but rather the call! macro.

pub fn call(
    &self,
    receiver_id: AccountId,
    method: &str,
    args: &[u8],
    gas: Gas,
    deposit: Balance
) -> ExecutionResult
[src]

pub fn deploy(
    &self,
    wasm_bytes: &[u8],
    account_id: AccountId,
    deposit: Balance
) -> UserAccount
[src]

Deploy a contract and create its account for account_id. Note: You will most likely not be using this method directly but rather the deploy! macro.

pub fn deploy_and_initialize(
    &self,
    wasm_bytes: &[u8],
    pending_tx: PendingContractTx,
    deposit: Balance,
    gas: Gas
) -> UserAccount
[src]

Deploy a contract and in the same transaction call its initialization method. Note: You will most likely not be using this method directly but rather the deploy! macro.

pub fn deploy_and_init(
    &self,
    wasm_bytes: &[u8],
    account_id: AccountId,
    method: &str,
    args: &[u8],
    deposit: Balance,
    gas: Gas
) -> UserAccount
[src]

pub fn create_transaction(&self, receiver_id: AccountId) -> UserTransaction[src]

Create a user transaction to receiver_id to be signed the current user

pub fn view_method_call(&self, pending_tx: PendingContractTx) -> ViewResult[src]

Call a view method on a contract. Note: You will most likely not be using this method directly but rather the view! macro.

pub fn view(
    &self,
    receiver_id: AccountId,
    method: &str,
    args: &[u8]
) -> ViewResult
[src]

pub fn create_user_from(
    &self,
    signer_user: &UserAccount,
    account_id: AccountId,
    amount: Balance
) -> UserAccount
[src]

Creates a user and is signed by the signer_user

pub fn create_user(&self, account_id: AccountId, amount: Balance) -> UserAccount[src]

Create a new user where the signer is this user account

pub fn borrow_runtime(&self) -> Ref<'_, RuntimeStandalone>[src]

Returns a reference to a memory location of the standalone runtime.

Examples

let master_account = near_sdk_sim::init_simulator(None);
let runtime = master_account.borrow_runtime();

// with use
let _block = runtime.current_block();

pub fn borrow_runtime_mut(&self) -> RefMut<'_, RuntimeStandalone>[src]

Returns a mutable memory location to the standalone runtime.

Examples

let master_account = near_sdk_sim::init_simulator(None);
let mut runtime = master_account.borrow_runtime_mut();

// with use
runtime.produce_block().unwrap();

Trait Implementations

impl Debug for UserAccount[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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