diff --git a/framework/snippets-dapp/src/interactor_scenario/interactor_vm_query.rs b/framework/snippets-dapp/src/interactor_scenario/interactor_vm_query.rs index 24839d5c0a..ad2f294306 100644 --- a/framework/snippets-dapp/src/interactor_scenario/interactor_vm_query.rs +++ b/framework/snippets-dapp/src/interactor_scenario/interactor_vm_query.rs @@ -8,7 +8,7 @@ use multiversx_sc_scenario::{ multiversx_sc::{abi::TypeAbiFrom, codec::TopDecodeMulti, types::ContractCall}, scenario_model::{ScQueryStep, TxResponse}, }; -use multiversx_sdk_wbg::{data::vm::VmValueRequest, utils::base64_decode}; +use multiversx_sdk_wbg::{data::vm::VMQueryInput, utils::base64_decode}; impl Interactor { pub async fn sc_query(&mut self, mut step: S) -> &mut Self @@ -21,7 +21,7 @@ impl Interactor { pub async fn perform_sc_query(&mut self, step: &mut ScQueryStep) { let sc_address = address_h256_to_erdrs(&step.tx.to.to_address()); - let req = VmValueRequest { + let req = VMQueryInput { sc_address: sc_address.clone(), func_name: step.tx.function.clone(), args: step @@ -30,8 +30,6 @@ impl Interactor { .iter() .map(|arg| hex::encode(&arg.value)) .collect(), - caller: sc_address, - value: "0".to_string(), }; let result = self .proxy diff --git a/framework/snippets/src/interactor_scenario/interactor_vm_query.rs b/framework/snippets/src/interactor_scenario/interactor_vm_query.rs index 7783dd9a2f..81298894b1 100644 --- a/framework/snippets/src/interactor_scenario/interactor_vm_query.rs +++ b/framework/snippets/src/interactor_scenario/interactor_vm_query.rs @@ -8,7 +8,7 @@ use multiversx_sc_scenario::{ multiversx_sc::{abi::TypeAbiFrom, codec::TopDecodeMulti, types::ContractCall}, scenario_model::{ScQueryStep, TxResponse}, }; -use multiversx_sdk_reqwest::core::{data::vm::VmValueRequest, utils::base64_decode}; +use multiversx_sdk_reqwest::core::{data::vm::VMQueryInput, utils::base64_decode}; impl Interactor { pub async fn sc_query(&mut self, mut step: S) -> &mut Self @@ -21,7 +21,7 @@ impl Interactor { pub async fn perform_sc_query(&mut self, step: &mut ScQueryStep) { let sc_address = step.tx.to.to_address(); - let req = VmValueRequest { + let req = VMQueryInput { sc_address: sc_address.clone().into(), func_name: step.tx.function.clone(), args: step @@ -30,8 +30,6 @@ impl Interactor { .iter() .map(|arg| hex::encode(&arg.value)) .collect(), - caller: sc_address.into(), - value: "0".to_string(), }; let result = self .proxy diff --git a/sdk/core/src/data/vm.rs b/sdk/core/src/data/vm.rs index 4b6e15539d..ebf1a50d84 100644 --- a/sdk/core/src/data/vm.rs +++ b/sdk/core/src/data/vm.rs @@ -25,11 +25,9 @@ pub enum CallType { // VmValueRequest defines the request struct for values available in a VM #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VmValueRequest { +pub struct VMQueryInput { pub sc_address: Address, pub func_name: String, - pub caller: Address, - pub value: String, pub args: Vec, } diff --git a/sdk/core/src/gateway/gateway_tx_vmquery.rs b/sdk/core/src/gateway/gateway_tx_vmquery.rs index 7ab448a529..e1523571da 100644 --- a/sdk/core/src/gateway/gateway_tx_vmquery.rs +++ b/sdk/core/src/gateway/gateway_tx_vmquery.rs @@ -1,13 +1,13 @@ -use crate::data::vm::{ResponseVmValue, VmValueRequest, VmValuesResponseData}; +use crate::data::vm::{ResponseVmValue, VMQueryInput, VmValuesResponseData}; use anyhow::anyhow; use super::{GatewayRequest, GatewayRequestType, VM_VALUES_ENDPOINT}; /// Executes a VM query. -pub struct VMQueryRequest<'a>(pub &'a VmValueRequest); +pub struct VMQueryRequest<'a>(pub &'a VMQueryInput); impl<'a> GatewayRequest for VMQueryRequest<'a> { - type Payload = VmValueRequest; + type Payload = VMQueryInput; type DecodedJson = ResponseVmValue; type Result = VmValuesResponseData; diff --git a/sdk/reqwest/examples/vm_query.rs b/sdk/reqwest/examples/vm_query.rs index b5747aba05..b1c78c537e 100644 --- a/sdk/reqwest/examples/vm_query.rs +++ b/sdk/reqwest/examples/vm_query.rs @@ -1,4 +1,4 @@ -use multiversx_sdk::data::{address::Address, vm::VmValueRequest}; +use multiversx_sdk::data::{address::Address, vm::VMQueryInput}; use multiversx_sdk_reqwest::gateway::{GatewayProxy, DEFAULT_USE_CHAIN_SIMULATOR, DEVNET_GATEWAY}; #[tokio::main] @@ -8,12 +8,10 @@ async fn main() { "erd1qqqqqqqqqqqqqpgq5dvvkmka7sujfsx7cfmygnx0n7luv8k0d8sskpqcec", ) .unwrap(); - let req = VmValueRequest { + let req = VMQueryInput { sc_address: sc_address.clone(), func_name: "empty".to_string(), args: vec![], - caller: sc_address, - value: "0".to_string(), }; let result = blockchain.execute_vmquery(&req).await; println!("{result:#?}"); diff --git a/sdk/reqwest/src/gateway/gateway_tx.rs b/sdk/reqwest/src/gateway/gateway_tx.rs index 7e3f7e9084..100cfc6567 100644 --- a/sdk/reqwest/src/gateway/gateway_tx.rs +++ b/sdk/reqwest/src/gateway/gateway_tx.rs @@ -6,7 +6,7 @@ use multiversx_sdk::{ transaction::{ ArgCreateTransaction, Transaction, TransactionOnNetwork, TxCostResponseData, }, - vm::{VmValueRequest, VmValuesResponseData}, + vm::{VMQueryInput, VmValuesResponseData}, }, gateway::{ GetTxCost, GetTxInfo, GetTxProcessStatus, GetTxStatus, SendMultiTxRequest, SendTxRequest, @@ -79,10 +79,7 @@ impl GatewayProxy { } // execute_vmquery retrieves data from existing SC trie through the use of a VM - pub async fn execute_vmquery( - &self, - vm_request: &VmValueRequest, - ) -> Result { + pub async fn execute_vmquery(&self, vm_request: &VMQueryInput) -> Result { self.request(VMQueryRequest(vm_request)).await } } diff --git a/sdk/wbg/src/gateway/gateway_tx.rs b/sdk/wbg/src/gateway/gateway_tx.rs index 56dfcdc580..9087822d25 100644 --- a/sdk/wbg/src/gateway/gateway_tx.rs +++ b/sdk/wbg/src/gateway/gateway_tx.rs @@ -9,7 +9,7 @@ use multiversx_sdk::data::{ Transaction, TransactionInfo, TransactionOnNetwork, TransactionProcessStatus, TransactionStatus, TxCostResponseData, }, - vm::{ResponseVmValue, VmValueRequest, VmValuesResponseData}, + vm::{ResponseVmValue, VMQueryInput, VmValuesResponseData}, }; use super::GatewayProxy; @@ -171,10 +171,7 @@ impl GatewayProxy { } // execute_vmquery retrieves data from existing SC trie through the use of a VM - pub async fn execute_vmquery( - &self, - vm_request: &VmValueRequest, - ) -> Result { + pub async fn execute_vmquery(&self, vm_request: &VMQueryInput) -> Result { let endpoint = self.get_endpoint(VM_VALUES_ENDPOINT); let resp = Request::post(&endpoint) .json(vm_request)?