Skip to main content

flow_lib/
lib.rs

1//! Utilities to use within nodes and flows.
2//!
3//! Table of contents:
4//! - [`command`]: implementing a new command.
5//! - [`config`]: types definition
6//! - [`context`]: providing services and information for nodes to use.
7//! - [`solana`]: utilities for working with Solana.
8//! - [`utils`]: other utilities.
9
10pub mod command;
11pub mod config;
12pub mod context;
13pub mod errors;
14pub mod flow_run_events;
15pub mod solana;
16pub mod utils;
17
18pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
19
20pub type UserId = uuid::Uuid;
21
22pub use config::{
23    CmdInputDescription, CmdOutputDescription, CommandType, ContextConfig, FlowConfig, FlowId,
24    FlowRunId, Gate, HttpClientConfig, Name, NodeConfig, NodeId, SolanaClientConfig, SolanaNet,
25    ValueSet, ValueType,
26};
27pub use context::User;
28pub use inventory::submit;
29pub use value::{self, Error as ValueError, Value};
30
31/// Helper macro to read node definition file at compile-time.
32///
33/// `node_definition!("node.json")` will expand to read file at
34/// `$CARGO_MANIFEST_DIR/node-definitions/node.json`.
35///
36/// See: [CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates).
37#[macro_export]
38macro_rules! node_definition {
39    ($file:expr $(,)?) => {
40        include_str!(concat!(
41            env!("CARGO_MANIFEST_DIR"),
42            "/node-definitions/",
43            $file
44        ))
45    };
46}