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
//! command types contains all the type that are important
//! to implement the plugin library.
//!
//! author: https://github.com/vincenzopalazzo
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[derive(Clone, Eq, Hash, PartialEq, Serialize)]
pub struct RPCMethodInfo {
    pub name: String,
    pub usage: String,
    pub description: String,
    pub long_description: String,
    pub deprecated: bool,
}

#[derive(Clone, PartialEq, Eq, Hash, Serialize)]
pub struct RPCHookInfo {
    pub name: String,
    pub before: Option<Vec<String>>,
    pub after: Option<Vec<String>>,
}

#[derive(Deserialize)]
pub struct InitConf {
    pub options: serde_json::Value,
    pub configuration: ConfFiled,
}

#[derive(Deserialize)]
pub struct ConfFiled {
    #[serde(rename = "lightning-dir")]
    pub lightning_dir: String,
    #[serde(rename = "rpc-file")]
    pub rpc_file: String,
    pub startup: bool,
    pub network: String,
    pub feature_set: HashMap<String, String>,
    pub proxy: Option<ProxyInfo>,
    #[serde(rename = "torv3-enabled")]
    pub torv3_enabled: Option<bool>,
    pub always_use_proxy: Option<bool>,
}

#[derive(Deserialize)]
pub struct ProxyInfo {
    #[serde(alias = "type")]
    pub tup: String,
    pub address: String,
    pub port: i64,
}