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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
// Namespace: "stellar.1"
// Protocol: "common"
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Serialize, Deserialize};
use serde_repr::{Deserialize_repr, Serialize_repr};use super::*;

use crate::protocol::keybase1;
pub type AccountID = String;

pub type SecretKey = String;

pub type TransactionID = String;

pub type PaymentID = String;

pub type KeybaseTransactionID = String;

pub type TimeMs = i64;

pub type Hash = String;

pub type KeybaseRequestID = String;

pub type AssetCode = String;

#[derive(Serialize, Deserialize, Debug)]
pub struct Asset {
  #[serde(rename = "type")]
  #[serde(default)]
  pub ty: Option<String>,
  #[serde(default)]
  pub code: Option<String>,
  #[serde(default)]
  pub issuer: Option<String>,
  #[serde(default)]
  pub verifiedDomain: Option<String>,
  #[serde(default)]
  pub issuerName: Option<String>,
  #[serde(default)]
  pub desc: Option<String>,
  #[serde(default)]
  pub infoUrl: Option<String>,
  #[serde(default)]
  pub infoUrlText: Option<String>,
  #[serde(default)]
  pub showDepositButton: Option<bool>,
  #[serde(default)]
  pub depositButtonText: Option<String>,
  #[serde(default)]
  pub showWithdrawButton: Option<bool>,
  #[serde(default)]
  pub withdrawButtonText: Option<String>,
  #[serde(default)]
  pub withdrawType: Option<String>,
  #[serde(default)]
  pub transferServer: Option<String>,
  #[serde(default)]
  pub authEndpoint: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct AssetListResult {
  #[serde(default)]
  pub assets: Option<Vec<Asset>>,
  pub totalCount: Option<i32>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Balance {
  pub asset: Option<Asset>,
  #[serde(default)]
  pub amount: Option<String>,
  #[serde(default)]
  pub limit: Option<String>,
  #[serde(default)]
  pub isAuthorized: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct AccountReserve {
  #[serde(default)]
  pub amount: Option<String>,
  #[serde(default)]
  pub description: Option<String>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum TransactionStatus {
  None_0,
  Pending_1,
  Success_2,
  Error_transient_3,
  Error_permanent_4,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum RequestStatus {
  Ok_0,
  Canceled_1,
  Done_2,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum PaymentStrategy {
  None_0,
  Direct_1,
  Relay_2,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum RelayDirection {
  Claim_0,
  Yank_1,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct PaymentResult {
  pub senderAccountID: Option<AccountID>,
  pub keybaseID: Option<KeybaseTransactionID>,
  pub stellarID: Option<TransactionID>,
  #[serde(default)]
  pub pending: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RelayClaimResult {
  pub claimStellarID: Option<TransactionID>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct EncryptedNote {
  pub v: Option<i32>,
  #[serde(default)]
  pub e: Option<String>,
  pub n: Option<keybase1::BoxNonce>,
  pub sender: Option<NoteRecipient>,
  pub recipient: Option<NoteRecipient>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct NoteRecipient {
  pub user: Option<keybase1::UserVersion>,
  pub pukGen: Option<keybase1::PerUserKeyGeneration>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct NoteContents {
  #[serde(default)]
  pub note: Option<String>,
  pub stellarID: Option<TransactionID>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct EncryptedRelaySecret {
  pub v: Option<i32>,
  #[serde(default)]
  pub e: Option<String>,
  pub n: Option<keybase1::BoxNonce>,
  pub gen: Option<keybase1::PerTeamKeyGeneration>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RelayContents {
  pub stellarID: Option<TransactionID>,
  pub sk: Option<SecretKey>,
  #[serde(default)]
  pub note: Option<String>,
}

pub type OutsideCurrencyCode = String;

#[derive(Serialize, Deserialize, Debug)]
pub struct OutsideExchangeRate {
  pub currency: Option<OutsideCurrencyCode>,
  #[serde(default)]
  pub rate: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct CurrencySymbol {
  #[serde(rename = "str")]
  #[serde(default)]
  pub symbol: Option<String>,
  #[serde(default)]
  pub ambigious: Option<bool>,
  #[serde(default)]
  pub postfix: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct OutsideCurrencyDefinition {
  #[serde(default)]
  pub name: Option<String>,
  pub symbol: Option<CurrencySymbol>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct StellarServerDefinitions {
  pub revision: Option<i32>,
  pub currencies: Option<std::collections::HashMap<OutsideCurrencyCode, OutsideCurrencyDefinition>>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct PageCursor {
  #[serde(default)]
  pub horizonCursor: Option<String>,
  #[serde(default)]
  pub directCursor: Option<String>,
  #[serde(default)]
  pub relayCursor: Option<String>,
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum AccountMode {
  None_0,
  User_1, // Each of the user's devices has access to the keys
  Mobile_2, // Only the user's mobile devices have access to the keys
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Trustline {
  pub assetCode: Option<AssetCode>,
  pub issuer: Option<AccountID>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct PaymentPath {
  #[serde(default)]
  pub sourceAmount: Option<String>,
  #[serde(default)]
  pub sourceAmountMax: Option<String>,
  pub sourceAsset: Option<Asset>,
  #[serde(default)]
  pub path: Option<Vec<Asset>>,
  #[serde(default)]
  pub destinationAmount: Option<String>,
  pub destinationAsset: Option<Asset>,
  #[serde(default)]
  pub sourceInsufficientBalance: Option<String>,
}