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
mod find;

pub mod wasm;

pub mod types {
    pub use fuel_indexer_schema::{
        join::{JoinMetadata, RawQuery},
        FtColumn,
    };
    pub use fuel_indexer_types::fuel::{BlockData, TxId};
    pub use fuel_indexer_types::scalar::UID;

    // For use with `early_exit` function to terminate execution on error.
    pub use fuel_indexer_lib::WasmIndexerError;

    // Traits needed to access client type fields. Could also include this as a sub-module
    // of `fuel_indexer_types::fuel`.
    pub use fuel_indexer_types::fuel::field::*;
    pub use fuel_indexer_types::{fuel, prelude::*};

    // These imports are used in the indexer.rs module when iterating over
    // block transactions, in order to cache contract IDs.
    pub use std::collections::{HashMap, HashSet};
}

pub mod utils {
    pub use fuel_indexer_lib::utils::sha256_digest;
}

pub use anyhow;
pub use bincode;
pub use fuel_indexer_lib::{
    graphql::MAX_FOREIGN_KEY_LIST_FIELDS,
    utils::{deserialize, serialize},
};

// Specifically we import `serde` here for the `Serialize` and `Deserialize` traits
// else the user would have to explicity import these in their indexer modules.
pub use serde;

// We import `serde_json` for the `From<T> for Json` in the `fuel-indexer-macro/schema` module.
pub use serde_json;

pub mod prelude {
    pub use super::{
        bincode, deserialize, serde, serde_json, serialize, types::*, utils::*,
        MAX_FOREIGN_KEY_LIST_FIELDS,
    };
    pub use crate::{debug, error, info, trace, warn};
}

#[macro_export]
macro_rules! error {
    ($($arg:tt)*) => {{
        Logger::error(&format!($($arg)*))
    }};
}

#[macro_export]
macro_rules! warn {
    ($($arg:tt)*) => {{
        Logger::warn(&format!($($arg)*))
    }};
}

#[macro_export]
macro_rules! info {
    ($($arg:tt)*) => {{
        Logger::info(&format!($($arg)*))
    }};
}

#[macro_export]
macro_rules! debug {
    ($($arg:tt)*) => {{
        Logger::debug(&format!($($arg)*))
    }};
}

#[macro_export]
macro_rules! trace {
    ($($arg:tt)*) => {{
        Logger::trace(&format!($($arg)*))
    }};
}