ant_protocol/devnet_manifest.rs
1//! Devnet manifest — on-disk handoff between a running devnet and
2//! clients that want to connect to it.
3//!
4//! The manifest is a JSON document that the devnet writes when it
5//! starts (bootstrap peers, data dir, optional EVM info) and that a
6//! client (`ant-cli`, `LocalDevnet`, an SDK wrapper) reads to discover
7//! the network. Both sides need the same type, and neither side needs
8//! to pull in the node runtime to read or write it — so it lives here.
9
10use saorsa_core::MultiAddr;
11use serde::{Deserialize, Serialize};
12use std::path::PathBuf;
13
14/// Devnet manifest for client discovery.
15///
16/// Written by the devnet launcher (see `ant_node::devnet::Devnet`) and
17/// read by clients via the `--devnet-manifest <path>` CLI flag or the
18/// `LocalDevnet::write_manifest` helper.
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct DevnetManifest {
21 /// Base port for nodes.
22 pub base_port: u16,
23 /// Node count.
24 pub node_count: usize,
25 /// Bootstrap addresses.
26 pub bootstrap: Vec<MultiAddr>,
27 /// Data directory.
28 pub data_dir: PathBuf,
29 /// Creation time (RFC 3339 or Unix seconds; the launcher picks the
30 /// format — clients treat this as opaque text).
31 pub created_at: String,
32 /// EVM configuration (present when EVM payment enforcement is enabled).
33 #[serde(default, skip_serializing_if = "Option::is_none")]
34 pub evm: Option<DevnetEvmInfo>,
35}
36
37/// EVM configuration info included in the devnet manifest.
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct DevnetEvmInfo {
40 /// Anvil RPC URL.
41 pub rpc_url: String,
42 /// Funded wallet private key (hex-encoded with 0x prefix).
43 pub wallet_private_key: String,
44 /// Payment token contract address.
45 pub payment_token_address: String,
46 /// Unified payment vault contract address (handles both single-node and merkle payments).
47 pub payment_vault_address: String,
48}