Skip to main content

fiber_json_types/
info.rs

1//! Node info types for the Fiber Network JSON-RPC API.
2
3use crate::graph::UdtCfgInfos;
4use crate::schema_helpers::*;
5use crate::serde_utils::{Hash256, Pubkey, U128Hex, U32Hex, U64Hex};
6use ckb_jsonrpc_types::Script;
7use schemars::JsonSchema;
8use serde::{Deserialize, Serialize};
9use serde_with::serde_as;
10
11/// Node information result.
12#[serde_as]
13#[derive(Clone, Serialize, Deserialize, Debug, JsonSchema)]
14pub struct NodeInfoResult {
15    /// The version of the node software.
16    pub version: String,
17
18    /// The commit hash of the node software.
19    pub commit_hash: String,
20
21    /// The identity public key of this node (secp256k1 compressed, hex without 0x prefix).
22    pub pubkey: Pubkey,
23
24    /// The features supported by the node.
25    pub features: Vec<String>,
26
27    /// The optional name of the node.
28    pub node_name: Option<String>,
29
30    /// A list of multi-addresses associated with the node (as strings).
31    #[schemars(schema_with = "schema_as_string_array")]
32    pub addresses: Vec<String>,
33
34    /// The hash of the blockchain that the node is connected to.
35    pub chain_hash: Hash256,
36
37    /// The minimum CKB funding amount for automatically accepting open channel requests, serialized as a hexadecimal string.
38    #[serde_as(as = "U64Hex")]
39    #[schemars(schema_with = "schema_as_uint_hex")]
40    pub open_channel_auto_accept_min_ckb_funding_amount: u64,
41
42    /// The CKB funding amount for automatically accepting channel requests, serialized as a hexadecimal string.
43    #[serde_as(as = "U64Hex")]
44    #[schemars(schema_with = "schema_as_uint_hex")]
45    pub auto_accept_channel_ckb_funding_amount: u64,
46
47    /// The default funding lock script for the node.
48    pub default_funding_lock_script: Script,
49
50    /// The locktime expiry delta for Time-Locked Contracts (TLC), serialized as a hexadecimal string.
51    #[serde_as(as = "U64Hex")]
52    #[schemars(schema_with = "schema_as_uint_hex")]
53    pub tlc_expiry_delta: u64,
54
55    /// The minimum value for Time-Locked Contracts (TLC) we can send, serialized as a hexadecimal string.
56    #[serde_as(as = "U128Hex")]
57    #[schemars(schema_with = "schema_as_uint_hex")]
58    pub tlc_min_value: u128,
59
60    /// The fee (to forward payments) proportional to the value of Time-Locked Contracts (TLC),
61    /// expressed in millionths and serialized as a hexadecimal string.
62    #[serde_as(as = "U128Hex")]
63    #[schemars(schema_with = "schema_as_uint_hex")]
64    pub tlc_fee_proportional_millionths: u128,
65
66    /// The number of channels associated with the node, serialized as a hexadecimal string.
67    #[serde_as(as = "U32Hex")]
68    #[schemars(schema_with = "schema_as_uint_hex")]
69    pub channel_count: u32,
70
71    /// The number of pending channels associated with the node, serialized as a hexadecimal string.
72    #[serde_as(as = "U32Hex")]
73    #[schemars(schema_with = "schema_as_uint_hex")]
74    pub pending_channel_count: u32,
75
76    /// The number of peers connected to the node, serialized as a hexadecimal string.
77    #[serde_as(as = "U32Hex")]
78    #[schemars(schema_with = "schema_as_uint_hex")]
79    pub peers_count: u32,
80
81    /// Configuration information for User-Defined Tokens (UDT) associated with the node.
82    pub udt_cfg_infos: UdtCfgInfos,
83}