Struct near_sdk_sim::user::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: AccountId
signer: InMemorySigner
Implementations
impl UserAccount
[src]
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]
&self,
pending_tx: PendingContractTx,
gas: Gas,
deposit: Balance
) -> ExecutionResult
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]
&self,
receiver_id: AccountId,
method: &str,
args: &[u8],
gas: Gas,
deposit: Balance
) -> ExecutionResult
pub fn deploy(
&self,
wasm_bytes: &[u8],
account_id: AccountId,
deposit: Balance
) -> UserAccount
[src]
&self,
wasm_bytes: &[u8],
account_id: AccountId,
deposit: Balance
) -> UserAccount
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]
&self,
wasm_bytes: &[u8],
pending_tx: PendingContractTx,
deposit: Balance,
gas: Gas
) -> UserAccount
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]
&self,
wasm_bytes: &[u8],
account_id: AccountId,
method: &str,
args: &[u8],
deposit: Balance,
gas: Gas
) -> UserAccount
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]
&self,
receiver_id: AccountId,
method: &str,
args: &[u8]
) -> ViewResult
pub fn create_user_from(
&self,
signer_user: &UserAccount,
account_id: AccountId,
amount: Balance
) -> UserAccount
[src]
&self,
signer_user: &UserAccount,
account_id: AccountId,
amount: Balance
) -> UserAccount
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
Auto Trait Implementations
impl !RefUnwindSafe for UserAccount
impl !RefUnwindSafe for UserAccount
impl !Send for UserAccount
impl !Send for UserAccount
impl !Sync for UserAccount
impl !Sync for UserAccount
impl Unpin for UserAccount
impl Unpin for UserAccount
impl !UnwindSafe for UserAccount
impl !UnwindSafe for UserAccount
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>,