multiversx_sdk/data/
vm.rsuse super::sdk_address::SdkAddress;
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::collections::HashMap;
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone)]
#[repr(u8)]
pub enum CallType {
DirectCall = 0,
AsynchronousCall = 1,
AsynchronousCallBack = 2,
ESDTTransferAndExecute = 3,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VMQueryInput {
pub sc_address: SdkAddress,
pub func_name: String,
pub args: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LogEntryApi {
pub identifier: String,
pub address: SdkAddress,
pub topics: Vec<String>,
pub data: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OutputTransferApi {
pub value: String,
pub gas_limit: u64,
pub data: String,
pub call_type: CallType,
pub sender_address: SdkAddress,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OutputAccountApi {
address: SdkAddress,
nonce: u64,
balance_delta: u64,
storage_updates: Option<HashMap<String, StorageUpdateApi>>,
code: Option<String>,
code_metadata: Option<String>,
#[serde(default)]
output_transfers: Vec<OutputTransferApi>,
call_type: CallType,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StorageUpdateApi {
offset: String,
data: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VMOutputApi {
#[serde(default)]
pub return_data: Vec<String>,
pub return_code: String,
pub return_message: String,
pub gas_remaining: u64,
pub gas_refund: u64,
pub output_accounts: HashMap<String, OutputAccountApi>,
pub deleted_accounts: Option<Vec<String>>,
pub touched_accounts: Option<Vec<String>>,
pub logs: Option<Vec<LogEntryApi>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VmValuesResponseData {
pub data: VMOutputApi,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ResponseVmValue {
pub data: Option<VmValuesResponseData>,
pub error: String,
pub code: String,
}