Skip to content

Commit

Permalink
Merge pull request #32 from helius-labs/fix/improve-search-assets-opt…
Browse files Browse the repository at this point in the history
…ions

fix(search_assets): Surface `show_native_balance` and Fix `SerdeJson` Error
  • Loading branch information
0xIchigo authored May 27, 2024
2 parents f0fa49e + 746e4a9 commit 832bf50
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/types/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ pub struct SearchAssetsOptions {
pub show_zero_balance: bool,
#[serde(default)]
pub show_closed_accounts: bool,
#[serde(default)]
pub show_native_balance: bool,
}
4 changes: 2 additions & 2 deletions src/types/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,8 @@ pub struct FileQuality {
pub struct Metadata {
pub attributes: Option<Vec<Attribute>>,
pub description: Option<String>,
pub name: String,
pub symbol: String,
pub name: Option<String>,
pub symbol: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions tests/rpc/test_get_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ async fn test_get_asset_success() {
description: Some(
"Apt323 the 36 page Collectors Edition.".to_string(),
),
name: "Apt323 Collectors Edition #72".to_string(),
symbol: "".to_string(),
name: Some("Apt323 Collectors Edition #72".to_string()),
symbol: Some("".to_string()),
},
links: Some(
Links {
Expand Down
8 changes: 4 additions & 4 deletions tests/rpc/test_get_asset_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ async fn test_get_asset_batch_success() {
}
]),
description: Some("A hotspot NFT on Helium".to_string()),
name: "gentle-mandarin-ferret".to_string(),
symbol: "HOTSPOT".to_string(),
name: Some("gentle-mandarin-ferret".to_string()),
symbol: Some("HOTSPOT".to_string()),
},
links: Some(Links {
external_url: None,
Expand Down Expand Up @@ -156,8 +156,8 @@ async fn test_get_asset_batch_success() {
}
]),
description: Some("Aerial photograph of a parking structure in LA depicting the photographer, Andrew Mason, \"sliding\" through the image.".to_string()),
name: "Slide".to_string(),
symbol: "".to_string(),
name: Some("Slide".to_string()),
symbol: Some("".to_string()),
},
links: Some(Links {
external_url: Some("".to_string()),
Expand Down
4 changes: 2 additions & 2 deletions tests/rpc/test_get_assets_by_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ async fn test_get_assets_by_authority_success() {
description: Some(
"Fock it.".to_string(),
),
name: "Mad Lads #6867".to_string(),
symbol: "MAD".to_string(),
name: Some("Mad Lads #6867".to_string()),
symbol: Some("MAD".to_string()),
},
links: Some(
Links {
Expand Down
4 changes: 2 additions & 2 deletions tests/rpc/test_get_assets_by_creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ async fn test_get_assets_by_creator_success() {
description: Some(
"Fock it.".to_string(),
),
name: "Mad Lads #6867".to_string(),
symbol: "MAD".to_string(),
name: Some("Mad Lads #6867".to_string()),
symbol: Some("MAD".to_string()),
},
links: Some(
Links {
Expand Down
9 changes: 6 additions & 3 deletions tests/rpc/test_get_assets_by_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ async fn test_get_assets_by_group_success() {
trait_type: "Affiliation".to_string(),
}]),
description: Some("Obi-Wan Kenobi was a legendary Force-sensitive human male Jedi Master who served on the Jedi High Council during the final years of the Republic Era".to_string()),
name: "Obi-Wan Kenobi".to_string(),
symbol:"Guiding Light".to_string(),
name: Some("Obi-Wan Kenobi".to_string()),
symbol: Some("Guiding Light".to_string()),
},
links: Some(Links {
external_url: Some("https://example.com".to_string()),
Expand Down Expand Up @@ -169,7 +169,10 @@ async fn test_get_assets_by_group_success() {

let asset: AssetList = response.unwrap();
assert_eq!(asset.total, 1);
assert_eq!(asset.items[0].content.as_ref().unwrap().metadata.name, "Obi-Wan Kenobi");
assert_eq!(
asset.items[0].content.as_ref().unwrap().metadata.name,
Some("Obi-Wan Kenobi".to_string())
);
}

#[tokio::test]
Expand Down
4 changes: 2 additions & 2 deletions tests/rpc/test_get_assets_by_owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ async fn test_get_assets_by_owner_success() {
"Visit the domain shown in the picture and claim your exclusive voucher 3000jup.com"
.to_string(),
),
name: "3000Jup For You 3000Jup.com".to_string(),
symbol: "JFY".to_string(),
name: Some("3000Jup For You 3000Jup.com".to_string()),
symbol: Some("JFY".to_string()),
},
links: Some(Links {
external_url: Some("https://3000jup.com".to_string()),
Expand Down
4 changes: 2 additions & 2 deletions tests/rpc/test_search_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ async fn test_search_assets_success() {
"Visit the domain shown in the picture and claim your exclusive voucher 3000jup.com"
.to_string(),
),
name: "3000Jup For You 3000Jup.com".to_string(),
symbol: "JFY".to_string(),
name: Some("3000Jup For You 3000Jup.com".to_string()),
symbol: Some("JFY".to_string()),
},
links: Some(Links {
external_url: Some("https://3000jup.com".to_string()),
Expand Down

0 comments on commit 832bf50

Please sign in to comment.