multiversx_sc_meta_lib/
ei_check_json.rs

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
use serde::{Deserialize, Serialize};

use crate::ei::EIVersion;

#[derive(Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EiCheckJson {
    #[serde(default)]
    pub ei_version: String,

    #[serde(default)]
    pub ok: bool,
}

impl EiCheckJson {
    pub fn new(check_ei: &Option<EIVersion>, status: bool) -> Option<Self> {
        if let Some(ei) = check_ei {
            return Some(EiCheckJson {
                ei_version: ei.name().to_string(),
                ok: status,
            });
        }

        None
    }
}