Struct near_sdk_sim::runtime::RuntimeStandalone[][src]

pub struct RuntimeStandalone {
    pub genesis: GenesisConfig,
    pub cur_block: Block,
    pub last_outcomes: Vec<CryptoHash>,
    // some fields omitted
}

Fields

genesis: GenesisConfigcur_block: Blocklast_outcomes: Vec<CryptoHash>

Implementations

impl RuntimeStandalone[src]

pub fn new(genesis: GenesisConfig, store: Arc<Store>) -> Self[src]

pub fn new_with_store(genesis: GenesisConfig) -> Self[src]

pub fn resolve_tx(
    &mut self,
    tx: SignedTransaction
) -> Result<(CryptoHash, ExecutionOutcome), RuntimeError>
[src]

Processes blocks until the final value is produced

pub fn send_tx(&mut self, tx: SignedTransaction) -> CryptoHash[src]

Just puts tx into the transaction pool

pub fn outcome(&self, hash: &CryptoHash) -> Option<ExecutionOutcome>[src]

pub fn profile_of_outcome(&self, hash: &CryptoHash) -> Option<ProfileData>[src]

pub fn process_all(&mut self) -> Result<(), RuntimeError>[src]

Processes all transactions and pending receipts until there is no pending_receipts left

pub fn produce_block(&mut self) -> Result<(), RuntimeError>[src]

Processes one block. Populates outcomes and producining new pending_receipts.

pub fn produce_blocks(&mut self, num_of_blocks: u64) -> Result<(), RuntimeError>[src]

Produce num_of_blocks blocks.

Examples

use near_sdk_sim::runtime::init_runtime;
let (mut runtime, _, _) = init_runtime(None);
runtime.produce_blocks(5);
assert_eq!(runtime.current_block().block_height, 5);
assert_eq!(runtime.current_block().epoch_height, 1);

pub fn force_account_update(&mut self, account_id: AccountId, account: &Account)[src]

Force alter account and change state_root.

pub fn view_account(&self, account_id: &str) -> Option<Account>[src]

pub fn view_access_key(
    &self,
    account_id: &str,
    public_key: &PublicKey
) -> Option<AccessKey>
[src]

pub fn view_method_call(
    &self,
    account_id: &str,
    method_name: &str,
    args: &[u8]
) -> ViewResult
[src]

Returns a ViewResult containing the value or error and any logs

pub fn current_block(&self) -> &Block[src]

Returns a reference to the current block.

Examples

use near_sdk_sim::runtime::init_runtime;
let (mut runtime, _, _) = init_runtime(None);
runtime.produce_block().unwrap();
runtime.current_block();
assert_eq!(runtime.current_block().block_height, 1);
runtime.produce_blocks(4).unwrap();
assert_eq!(runtime.current_block().block_height, 5);

pub fn pending_receipts(&self) -> &[Receipt][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>,