1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
use super::address::Address;
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 VmValueRequest {
pub sc_address: Address,
pub func_name: String,
pub caller: Address,
pub value: String,
pub args: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LogEntryApi {
pub identifier: String,
pub address: Address,
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: Address,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct OutputAccountApi {
address: Address,
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 {
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,
}