multiversx_chain_vm/host/execution/
exec_query.rs1use crate::{
2 blockchain::state::BlockchainStateRef,
3 host::{
4 context::{TxCache, TxContext, TxInput, TxResult},
5 runtime::{RuntimeInstanceCallLambda, RuntimeRef},
6 },
7};
8
9pub fn execute_query<F>(
11 tx_input: TxInput,
12 state: &mut BlockchainStateRef,
13 runtime: &RuntimeRef,
14 f: F,
15) -> TxResult
16where
17 F: RuntimeInstanceCallLambda,
18{
19 let tx_cache = TxCache::new(state.get_arc());
20 let tx_context = TxContext::new(runtime.clone(), tx_input, tx_cache);
21 let tx_context = runtime.execute(tx_context, f);
22 let (tx_result, _) = tx_context.into_results();
23 tx_result
24}