Skip to content

Commit e581260

Browse files
committed
warnings
1 parent 2b43519 commit e581260

File tree

9 files changed

+50
-56
lines changed

9 files changed

+50
-56
lines changed

src/accounts/accounts_response.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ use crate::models::Response;
55

66
/// Struct defining the self link in the list all accounts response.
77
#[derive(Debug, Deserialize, Serialize, Clone, Getters)]
8-
pub struct SelfLink {
8+
pub struct AccountsResponseSelfLink {
99
href: String,
1010
}
1111

1212
/// Struct defining the links in the list all accounts response.
1313
#[derive(Debug, Deserialize, Serialize, Clone, Getters)]
14-
pub struct Links {
14+
pub struct AccountsResponseLinks {
1515
#[serde(rename = "self")]
16-
self_link: SelfLink,
17-
next: Option<SelfLink>,
18-
prev: Option<SelfLink>,
16+
self_link: AccountsResponseSelfLink,
17+
next: Option<AccountsResponseSelfLink>,
18+
prev: Option<AccountsResponseSelfLink>,
1919
}
2020

2121
/// Struct defining a single balance in the list all accounts response.
@@ -29,15 +29,15 @@ pub struct Balances {
2929

3030
/// Struct defining the thresholds in the list all accounts response.
3131
#[derive(Debug, Deserialize, Serialize, Clone, Getters)]
32-
pub struct Thresholds {
32+
pub struct AccountsResponseThresholds {
3333
low_threshold: i32,
3434
med_threshold: i32,
3535
high_threshold: i32,
3636
}
3737

3838
/// Struct defining the flags in the list all accounts response.
3939
#[derive(Debug, Deserialize, Serialize, Clone, Getters)]
40-
pub struct Flags {
40+
pub struct AccountsResponseFlags {
4141
auth_required: bool,
4242
auth_revocable: bool,
4343
auth_immutable: bool,
@@ -57,15 +57,15 @@ pub struct Signers {
5757
#[derive(Debug, Deserialize, Serialize, Clone, Getters)]
5858
pub struct Record {
5959
#[serde(rename = "_links")]
60-
links: Links,
60+
links: AccountsResponseLinks,
6161
id: String,
6262
account_id: String,
6363
sequence: String,
6464
subentry_count: i32,
6565
last_modified_ledger: i64,
6666
last_modified_time: String,
67-
thresholds: Thresholds,
68-
flags: Flags,
67+
thresholds: AccountsResponseThresholds,
68+
flags: AccountsResponseFlags,
6969
balances: Vec<Balances>,
7070
signers: Vec<Signers>,
7171
data: serde_json::Value,
@@ -83,7 +83,7 @@ pub struct Embedded {
8383
/// Struct defining the list all accounts response.
8484
#[derive(Debug, Deserialize, Serialize, Clone, Getters)]
8585
pub struct AccountsResponse {
86-
_links: Links,
86+
_links: AccountsResponseLinks,
8787
_embedded: Embedded,
8888
}
8989

src/claimable_balances/all_claimable_balances_response.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ use crate::models::Response;
1010
#[serde(rename_all = "camelCase")]
1111
pub struct AllClaimableBalancesResponse {
1212
#[serde(rename = "_links")]
13-
links: Links,
13+
links: AllClaimableBalancesLinks,
1414
#[serde(rename = "_embedded")]
1515
embedded: Embedded,
1616
}
1717

1818
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
1919
#[serde(rename_all = "camelCase")]
20-
pub struct Links {
20+
pub struct AllClaimableBalancesLinks {
2121
#[serde(rename = "self")]
22-
self_field: Self_field,
22+
self_field: AllClaimableAssetsReponseSelfField,
2323
next: Next,
2424
prev: Prev,
2525
}
2626

2727
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
2828
#[serde(rename_all = "camelCase")]
29-
pub struct Self_field {
29+
pub struct AllClaimableAssetsReponseSelfField {
3030
href: String,
3131
}
3232

@@ -61,8 +61,8 @@ pub struct Record {
6161
last_modified_ledger: i64,
6262
#[serde(rename = "last_modified_time")]
6363
last_modified_time: String,
64-
claimants: Vec<Claimant>,
65-
flags: Flags,
64+
claimants: Vec<AllClaimableAssetsResponseClaimant>,
65+
flags: AllClaimableResponseFlags,
6666
#[serde(rename = "paging_token")]
6767
paging_token: String,
6868
}
@@ -71,49 +71,49 @@ pub struct Record {
7171
#[serde(rename_all = "camelCase")]
7272
pub struct RecordsLinks {
7373
#[serde(rename = "self")]
74-
self_field: Records_Self_field,
75-
transactions: Transactions,
76-
operations: Operations,
74+
self_field: RecordsSelfField,
75+
transactions: AllClaimableAssetsResponseTransactions,
76+
operations: AllClaimableAssetsResponseOperations,
7777
}
7878

7979
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
8080
#[serde(rename_all = "camelCase")]
81-
pub struct Records_Self_field {
81+
pub struct RecordsSelfField {
8282
href: String,
8383
}
8484

8585
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
8686
#[serde(rename_all = "camelCase")]
87-
pub struct Transactions {
87+
pub struct AllClaimableAssetsResponseTransactions {
8888
href: String,
8989
templated: bool,
9090
}
9191

9292
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
9393
#[serde(rename_all = "camelCase")]
94-
pub struct Operations {
94+
pub struct AllClaimableAssetsResponseOperations {
9595
href: String,
9696
templated: bool,
9797
}
9898

9999
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
100100
#[serde(rename_all = "camelCase")]
101-
pub struct Claimant {
101+
pub struct AllClaimableAssetsResponseClaimant {
102102
destination: String,
103-
predicate: Predicate,
103+
predicate: AllClaimableAssetsResponsePredicate,
104104
}
105105

106106
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
107107
#[serde(rename_all = "camelCase")]
108-
pub struct Predicate {
108+
pub struct AllClaimableAssetsResponsePredicate {
109109
unconditional: Option<bool>,
110-
or: Option<Vec<Or>>,
110+
or: Option<Vec<AllClaimableAssetsOr>>,
111111
}
112112

113113
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
114114
#[serde(rename_all = "camelCase")]
115-
pub struct Or {
116-
and: Option<Vec<And>>,
115+
pub struct AllClaimableAssetsOr {
116+
and: Option<Vec<AllClaimableAssetsResponseAnd>>,
117117
#[serde(rename = "abs_before")]
118118
abs_before: Option<String>,
119119
#[serde(rename = "abs_before_epoch")]
@@ -122,8 +122,8 @@ pub struct Or {
122122

123123
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
124124
#[serde(rename_all = "camelCase")]
125-
pub struct And {
126-
not: Option<Not>,
125+
pub struct AllClaimableAssetsResponseAnd {
126+
not: Option<AllClaimableBalancesResponseNot>,
127127
#[serde(rename = "abs_before")]
128128
abs_before: Option<String>,
129129
#[serde(rename = "abs_before_epoch")]
@@ -132,7 +132,7 @@ pub struct And {
132132

133133
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
134134
#[serde(rename_all = "camelCase")]
135-
pub struct Not {
135+
pub struct AllClaimableBalancesResponseNot {
136136
#[serde(rename = "abs_before")]
137137
abs_before: String,
138138
#[serde(rename = "abs_before_epoch")]
@@ -141,7 +141,7 @@ pub struct Not {
141141

142142
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
143143
#[serde(rename_all = "camelCase")]
144-
pub struct Flags {
144+
pub struct AllClaimableResponseFlags {
145145
#[serde(rename = "clawback_enabled")]
146146
clawback_enabled: bool,
147147
}
@@ -155,7 +155,7 @@ impl Response for AllClaimableBalancesResponse {
155155
}
156156

157157
/// This method checks if a claim is valid at a specific datetime.
158-
impl Predicate {
158+
impl AllClaimableAssetsResponsePredicate {
159159
// This method checks if a claim is valid at a specific datetime.
160160
pub fn is_valid_claim(&self, datetime: DateTime<Utc>) -> bool {
161161
// If the predicate is marked as unconditional, the claim is always valid.
@@ -174,7 +174,7 @@ impl Predicate {
174174
}
175175

176176

177-
impl Or {
177+
impl AllClaimableAssetsOr {
178178
// This method checks if any condition under 'or' validates the claim.
179179
fn is_valid(&self, datetime: DateTime<Utc>) -> bool {
180180
// If there are 'and' conditions, check if any combination of these conditions is valid.
@@ -196,7 +196,7 @@ impl Or {
196196
}
197197
}
198198

199-
impl And {
199+
impl AllClaimableAssetsResponseAnd {
200200
// This method checks if all conditions under 'and' are met.
201201
fn is_valid(&self, datetime: DateTime<Utc>) -> bool {
202202
let mut is_valid = true;
@@ -217,7 +217,7 @@ impl And {
217217
}
218218
}
219219

220-
impl Not {
220+
impl AllClaimableBalancesResponseNot {
221221
// This method checks if the datetime does not fall before the specified date, negating the condition.
222222
fn is_valid(&self, datetime: DateTime<Utc>) -> bool {
223223
if let Ok(not_before_date) = DateTime::parse_from_rfc3339(&self.abs_before) {

src/claimable_balances/single_claimable_balance_response.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ pub struct SingleClaimableBalanceResponse {
2929
#[serde(rename_all = "camelCase")]
3030
pub struct Links {
3131
#[serde(rename = "self")]
32-
pub self_field: Self_field,
32+
pub self_field: SelfField,
3333
pub transactions: Transactions,
3434
pub operations: Operations,
3535
}
3636

3737
#[derive(Default, Debug, Clone, Serialize, Deserialize, Getters)]
3838
#[serde(rename_all = "camelCase")]
39-
pub struct Self_field {
39+
pub struct SelfField {
4040
pub href: String,
4141
}
4242

src/horizon_client/horizon_client.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ use crate::{
1515
use reqwest;
1616
use url::Url;
1717

18-
use crate::accounts::prelude::*;
19-
2018
pub struct HorizonClient {
2119
/// The base URL for the Horizon server
2220
base_url: String,
@@ -165,7 +163,7 @@ impl HorizonClient {
165163

166164
let url = request.build_url(&self.base_url);
167165
let response = reqwest::get(&url).await.map_err(|e| e.to_string())?;
168-
println!("\n\nREQWEST RESPONSE: {:?}", response);
166+
// println!("\n\nREQWEST RESPONSE: {:?}", response);
169167
let result: TResponse = handle_response(response).await?;
170168

171169
// print!("\n\nResult: {:?}", result);
@@ -197,7 +195,7 @@ async fn handle_response<TResponse: Response>(
197195
}
198196
/// url_validate validates a URL
199197
fn url_validate(url: &str) -> Result<(), String> {
200-
println!("URL: {}", url);
198+
// println!("URL: {}", url);
201199
// check if start with http:// or https://
202200
if !url.starts_with("http://") && !url.starts_with("https://") {
203201
return Err(format!("URL must start with http:// or https://: {}", url));
@@ -209,8 +207,8 @@ fn url_validate(url: &str) -> Result<(), String> {
209207

210208
#[cfg(test)]
211209
mod tests {
212-
use base64::encode;
213-
use chrono::{DateTime, TimeZone, Utc};
210+
use base64::{Engine, engine::general_purpose};
211+
use chrono::{ TimeZone, Utc};
214212

215213
use crate::{
216214
assets::prelude::AllAssetsRequest,
@@ -883,8 +881,8 @@ mod tests {
883881
assert_eq!(decoded_xdr_header.max_tx_set_size, 100);
884882

885883
let tx_set_hash = decoded_xdr_header.scp_value.tx_set_hash.to_string();
886-
let tx_set_hash_bytes = hex::decode(tx_set_hash).expect("Failed to decode hex");
887-
let tx_set_hash_base64 = encode(&tx_set_hash_bytes);
884+
let tx_set_hash_bytes = hex::decode(tx_set_hash.clone()).expect("Failed to decode hex");
885+
let tx_set_hash_base64 = general_purpose::STANDARD.encode(tx_set_hash_bytes.clone());
888886

889887
assert_eq!(
890888
tx_set_hash_base64,

src/ledgers/ledgers_request.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::models::*;
22

3-
use super::super::AssetType;
43
use super::super::Order;
54

65
pub struct LedgersRequest {

src/ledgers/ledgers_response.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::models::Response;
55

66
/// Struct defining the self link in the list all ledgers response.
77
#[derive(Debug, Deserialize, Clone, Getters)]
8-
pub struct Link {
8+
pub struct LedgersResponseLink {
99
#[serde(rename = "self")]
1010
self_link: SelfLink,
1111
next: Option<SelfLink>,
@@ -21,7 +21,7 @@ pub struct SelfLink {
2121
/// Struct defining a record of a single ledger in the list all ledgers response.
2222
#[derive(Debug, Deserialize, Clone, Getters)]
2323
pub struct Records {
24-
_links: Link,
24+
_links: LedgersResponseLink,
2525
id: String,
2626
paging_token: String,
2727
hash: String,
@@ -50,7 +50,7 @@ pub struct Embedded {
5050
/// Struct defining the list all ledgers response.
5151
#[derive(Debug, Deserialize, Clone, Getters)]
5252
pub struct LedgersResponse {
53-
_links: Link,
53+
_links: LedgersResponseLink,
5454
_embedded: Embedded,
5555
}
5656

src/ledgers/single_ledger_request.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use crate::models::*;
22

3-
use super::super::AssetType;
4-
use super::super::Order;
5-
63
pub struct SingleLedgerRequest {
74
/// The sequence of the ledger
85
sequence: u32,

src/ledgers/single_ledger_response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use derive_getters::Getters;
2-
use serde::{de, Deserialize};
2+
use serde::Deserialize;
33
use stellar_xdr::{LedgerHeader, ReadXdr};
44

55
use crate::models::Response;

src/xdr/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(test)]
22
mod tests {
33

4-
use ::stellar_xdr::{LedgerHeader, ReadXdr};
4+
use ::stellar_xdr::ReadXdr;
55
use stellar_xdr::curr as stellar_xdr;
66

77
// TODO, add vice versa.

0 commit comments

Comments
 (0)