[][src]Struct clarity_repl::clarity::clarity::ClarityTransactionConnection

pub struct ClarityTransactionConnection<'a> { /* fields omitted */ }

Interface for Clarity VM interactions within a given transaction.

commit the transaction to the block with .commit() rollback the transaction by dropping this struct.

Implementations

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

pub fn with_clarity_db<F, R>(&mut self, to_do: F) -> Result<R, Error> where
    F: FnOnce(&mut ClarityDatabase<'_>) -> Result<R, Error>, 
[src]

Do something to the underlying DB that involves writing.

pub fn cost_so_far(&self) -> ExecutionCost[src]

What's our total (block-wide) resource use so far?

pub fn analyze_smart_contract(
    &mut self,
    identifier: &QualifiedContractIdentifier,
    contract_content: &str
) -> Result<(ContractAST, ContractAnalysis), Error>
[src]

Analyze a provided smart contract, but do not write the analysis to the AnalysisDatabase

pub fn save_analysis(
    &mut self,
    identifier: &QualifiedContractIdentifier,
    contract_analysis: &ContractAnalysis
) -> Result<(), CheckError>
[src]

Save a contract analysis output to the AnalysisDatabase An error here would indicate that something has gone terribly wrong in the processing of a contract insert. the caller should likely abort the whole block or panic

pub fn run_contract_call<F>(
    &mut self,
    sender: &PrincipalData,
    contract: &QualifiedContractIdentifier,
    public_function: &str,
    args: &[Value],
    abort_call_back: F
) -> Result<(Value, AssetMap, Vec<StacksTransactionEvent>), Error> where
    F: FnOnce(&AssetMap, &mut ClarityDatabase<'_>) -> bool
[src]

Execute a contract call in the current block. If an error occurs while processing the transaction, it's modifications will be rolled back. abort_call_back is called with an AssetMap and a ClarityDatabase reference, if abort_call_back returns false, all modifications from this transaction will be rolled back. otherwise, they will be committed (though they may later be rolled back if the block itself is rolled back).

pub fn initialize_smart_contract<F>(
    &mut self,
    identifier: &QualifiedContractIdentifier,
    contract_ast: &ContractAST,
    contract_str: &str,
    abort_call_back: F
) -> Result<(AssetMap, Vec<StacksTransactionEvent>), Error> where
    F: FnOnce(&AssetMap, &mut ClarityDatabase<'_>) -> bool
[src]

Initialize a contract in the current block. If an error occurs while processing the initialization, it's modifications will be rolled back. abort_call_back is called with an AssetMap and a ClarityDatabase reference, if abort_call_back returns false, all modifications from this transaction will be rolled back. otherwise, they will be committed (though they may later be rolled back if the block itself is rolled back).

pub fn commit(self)[src]

Commit the changes from the edit log. panics if there is more than one open savepoint

Trait Implementations

impl<'_> ClarityConnection for ClarityTransactionConnection<'_>[src]

fn with_clarity_db_readonly_owned<F, R>(&mut self, to_do: F) -> R where
    F: FnOnce(ClarityDatabase<'_>) -> (R, ClarityDatabase<'_>)
[src]

Do something with ownership of the underlying DB that involves only reading.

impl<'a> Drop for ClarityTransactionConnection<'a>[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, 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.