Struct clarity_repl::clarity::contexts::GlobalContext[][src]

pub struct GlobalContext<'a> {
    pub event_batches: Vec<EventBatch>,
    pub database: ClarityDatabase<'a>,
    pub cost_track: LimitedCostTracker,
    pub mainnet: bool,
    // some fields omitted
}

GlobalContext represents the outermost context for a single transaction’s execution. It tracks an asset changes that occurred during the processing of the transaction, whether or not the current context is read_only, and is responsible for committing/rolling-back transactions as they error or abort.

Fields

event_batches: Vec<EventBatch>database: ClarityDatabase<'a>cost_track: LimitedCostTrackermainnet: bool

Implementations

impl<'a> GlobalContext<'a>[src]

pub fn new(
    mainnet: bool,
    database: ClarityDatabase<'_>,
    cost_track: LimitedCostTracker
) -> GlobalContext<'_>
[src]

pub fn is_top_level(&self) -> bool[src]

pub fn log_asset_transfer(
    &mut self,
    sender: &PrincipalData,
    contract_identifier: &QualifiedContractIdentifier,
    asset_name: &ClarityName,
    transfered: Value
)
[src]

pub fn log_token_transfer(
    &mut self,
    sender: &PrincipalData,
    contract_identifier: &QualifiedContractIdentifier,
    asset_name: &ClarityName,
    transfered: u128
) -> Result<()>
[src]

pub fn log_stx_transfer(
    &mut self,
    sender: &PrincipalData,
    transfered: u128
) -> Result<()>
[src]

pub fn log_stx_burn(
    &mut self,
    sender: &PrincipalData,
    transfered: u128
) -> Result<()>
[src]

pub fn execute<F, T>(&mut self, f: F) -> Result<T> where
    F: FnOnce(&mut Self) -> Result<T>, 
[src]

pub fn is_read_only(&self) -> bool[src]

pub fn begin(&mut self)[src]

pub fn begin_read_only(&mut self)[src]

pub fn commit(&mut self) -> Result<(Option<AssetMap>, Option<EventBatch>)>[src]

pub fn roll_back(&mut self)[src]

pub fn handle_tx_result(&mut self, result: Result<Value>) -> Result<Value>[src]

pub fn destruct(self) -> Option<(ClarityDatabase<'a>, LimitedCostTracker)>[src]

Destroys this context, returning ownership of its database reference. If the context wasn’t top-level (i.e., it had uncommitted data), return None, because the database is not guaranteed to be in a sane state.

Trait Implementations

impl CostTracker for GlobalContext<'_>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for GlobalContext<'a>

impl<'a> !Send for GlobalContext<'a>

impl<'a> !Sync for GlobalContext<'a>

impl<'a> Unpin for GlobalContext<'a>

impl<'a> !UnwindSafe for GlobalContext<'a>

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, U> Into<U> for T where
    U: From<T>, 
[src]

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>,