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
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
// Rust JSON-RPC Library
// Written by
//     Andrew Poelstra <apoelstra@wpsoftware.net>
//     Wladimir J. van der Laan <laanwj@gmail.com>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication
// along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//
//! Structures representing requests to API calls
#![allow(missing_docs)]

use common;

/// 'getinfo' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct GetInfo {}

/// 'feerates' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct FeeRates {
    pub style: String,
}

/// 'listnodes' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ListNodes {
    pub id: Option<String>,
}

/// 'listchannels' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ListChannels {
    pub short_channel_id: Option<String>,
}

/// 'help' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Help {
    pub command: Option<String>,
}

/// 'getlog' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct GetLog {
    pub level: Option<String>,
}

/// 'listconfigs' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ListConfigs {
    pub config: Option<String>,
}

/// 'listpeers' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ListPeers {
    pub id: Option<String>,
    pub level: Option<String>,
}

/// 'listinvoices' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ListInvoices {
    pub label: Option<String>,
}

/// 'invoice' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Invoice {
    pub msatoshi: i64,
    pub label: String,
    pub description: String,
    pub expiry: Option<i64>,
}

/// 'delinvoice' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DelInvoice {
    pub label: String,
    pub status: String,
}

/// 'delexpiredinvoice' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DelExpiredInvoice {
    pub maxexpirytime: Option<i64>,
}

/// 'autocleaninvoice' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct AutoCleanInvoice {
    pub cycle_seconds: Option<i64>,
    pub expired_by: Option<i64>,
}

/// 'waitanyinvoice' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct WaitAnyInvoice {
    pub lastpay_index: Option<i64>,
}

/// 'waitinvoice' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct WaitInvoice {
    pub label: String,
}

/// 'pay' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Pay {
    pub bolt11: String,
    pub msatoshi: Option<i64>,
    pub description: Option<String>,
    pub riskfactor: Option<f64>,
    pub maxfeepercent: Option<f64>,
    pub exemptfee: Option<i64>,
    pub retry_for: Option<i64>,
    pub maxdelay: Option<i64>,
}

/// 'sendpay' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct SendPay {
    pub route: Vec<common::RouteItem>,
    pub payment_hash: String,
    pub description: Option<String>,
    pub msatoshi: Option<i64>,
}

/// 'waitsendpay' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct WaitSendPay {
    pub payment_hash: String,
    pub timeout: i64,
}

/// 'listpayments' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ListPayments {
    pub bolt11: Option<String>,
    pub payment_hash: Option<String>,
}

/// 'decodepay' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct DecodePay {
    pub bolt11: String,
    pub description: Option<String>,
}

/// 'getroute' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct GetRoute {
    pub id: String,
    pub msatoshi: i64,
    pub riskfactor: f64,
    pub cltv: Option<i64>,
    pub fromid: Option<String>,
    pub fuzzpercent: Option<f64>,
    pub seed: Option<String>,
}

/// 'connect' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Connect {
    pub id: String,
    pub host: Option<String>,
}

/// 'disconnect' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Disconnect {
    pub id: String,
}

/// 'fundchannel' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct FundChannel {
    pub id: String,
    pub satoshi: i64,
    pub feerate: Option<i64>,
}

/// 'close' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Close {
    pub id: String,
    pub force: Option<bool>,
    pub timeout: Option<i64>,
}

/// 'ping' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Ping {
    pub peerid: String,
    pub len: Option<i64>,
    pub pongbytes: Option<i64>,
}

/// 'listfunds' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ListFunds {}

/// 'withdraw' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Withdraw {
    pub destination: String,
    pub satoshi: i64,
    pub feerate: Option<i64>,
}

/// 'newaddr' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct NewAddr {
    pub addresstype: Option<String>,
}

/// 'stop' command
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Stop {}