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
use serde::Serialize;

/// A convenient struct in NovaX used to accumulate information necessary for creating a transaction simulation request.
/// This struct is internally converted into `SimulationGatewayRequestBody` when sending the request to the gateway.
pub struct SimulationGatewayRequest {
    /// The value being transferred in the transaction, represented as a stringified number.
    pub value: String,

    /// The blockchain address of the transaction's receiver.
    pub receiver: String,

    /// The blockchain address of the transaction's sender.
    pub sender: String,

    /// The maximum amount of gas that the transaction is allowed to consume.
    pub gas_limit: u64,

    /// The data payload of the transaction, typically encoded for the transaction's context.
    pub data: String,
}

/// Struct representing the body of a request for transaction simulation, sent to the MultiversX gateway.
/// This structure is used to simulate transactions via the `/transaction/cost` endpoint.
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SimulationGatewayRequestBody {
    /// The nonce of the transaction, ensuring transactions are processed in order and exactly once.
    pub nonce: u64,

    /// The value being transferred in the transaction, represented as a stringified number.
    pub value: String,

    /// The blockchain address of the transaction's receiver.
    pub receiver: String,

    /// The blockchain address of the transaction's sender.
    pub sender: String,

    /// The gas price for the transaction, influencing the priority and speed of processing.
    pub gas_price: u64,

    /// The maximum gas amount that can be consumed by the transaction, limiting computational work.
    pub gas_limit: u64,

    /// The data payload of the transaction, often encoded for the transaction's context.
    pub data: String,

    /// The identifier of the blockchain network for transaction processing.
    pub chain_id: String,

    /// The version of the transaction structure/format for network compatibility.
    pub version: u8
}