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
use alloc::{string::String, vec::Vec};

#[derive(Debug, PartialEq)]
pub struct Abi {
    pub version: String,
    pub types: Vec<AbiType>,
    pub structs: Vec<AbiStruct>,
    pub actions: Vec<AbiAction>,
    pub tables: Vec<AbiTable>,
    pub ricardian_clauses: Vec<AbiRicardianClause>,
    pub error_messages: Vec<AbiErrorMessage>,
    pub abi_extensions: Vec<AbiExtension>,
    // TODO variants: Vec<Variant>,
}

#[derive(Debug, PartialEq)]
pub struct AbiType {
    pub new_type_name: String,
    pub type_: String,
}

#[derive(Debug, PartialEq)]
pub struct AbiStruct {
    pub name: String,
    pub base: String,
    pub fields: Vec<AbiField>,
}

#[derive(Debug, PartialEq)]
pub struct AbiField {
    pub name: String,
    pub type_: String,
}

#[derive(Debug, PartialEq)]
pub struct AbiAction {
    pub name: String,
    pub type_: String,
    pub ricardian_contract: String,
}

#[derive(Debug, PartialEq)]
pub struct AbiTable {
    pub name: String,
    pub index_type: String,
    pub key_names: Vec<String>,
    pub key_types: Vec<String>,
    pub type_: String,
}

#[derive(Debug, PartialEq)]
pub struct AbiRicardianClause {
    pub id: String,
    pub body: String,
}

#[derive(Debug, PartialEq)]
pub struct AbiErrorMessage {
    pub error_code: u64,
    pub error_msg: String,
}

#[derive(Debug, PartialEq)]
pub struct AbiExtension {
    pub type_: u16,
    pub data: String,
}