diff --git a/crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs b/crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs index 383649ad97..09181ca63e 100644 Binary files a/crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs and b/crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs differ diff --git a/crates/core/asset/src/asset/denom_metadata.rs b/crates/core/asset/src/asset/denom_metadata.rs index 9ec45b1b1d..8d67bcb756 100644 --- a/crates/core/asset/src/asset/denom_metadata.rs +++ b/crates/core/asset/src/asset/denom_metadata.rs @@ -39,6 +39,7 @@ pub(super) struct Inner { // For now, don't bother with a domain type here, // since we don't render images from Rust code. images: Vec, + badges: Vec, priority_score: u64, /// Sorted by priority order. @@ -65,6 +66,7 @@ impl From<&Inner> for pb::Metadata { penumbra_asset_id: Some(inner.id.into()), denom_units: inner.units.clone().into_iter().map(|x| x.into()).collect(), images: inner.images.clone(), + badges: inner.badges.clone(), priority_score: inner.priority_score, } } @@ -131,6 +133,7 @@ impl TryFrom for Inner { name: value.name, symbol: value.symbol, images: value.images, + badges: value.badges, priority_score: value.priority_score, }) } @@ -253,6 +256,7 @@ impl Inner { name: String::new(), symbol: String::new(), images: Vec::new(), + badges: Vec::new(), priority_score: 0, } } @@ -429,6 +433,7 @@ impl Debug for Metadata { name, symbol, priority_score, + badges, } = inner.as_ref(); f.debug_struct("Metadata") @@ -436,6 +441,7 @@ impl Debug for Metadata { .field("base_denom", base_denom) .field("description", description) .field("images", images) + .field("badges", badges) .field("priority_score", priority_score) .field("units", units) .field("display_index", display_index) diff --git a/crates/proto/src/gen/penumbra.core.asset.v1.rs b/crates/proto/src/gen/penumbra.core.asset.v1.rs index 13edd5ca93..9ec732783c 100644 --- a/crates/proto/src/gen/penumbra.core.asset.v1.rs +++ b/crates/proto/src/gen/penumbra.core.asset.v1.rs @@ -89,6 +89,10 @@ pub struct Metadata { /// This is solely for use in client-side registries. #[prost(uint64, tag = "1986")] pub priority_score: u64, + /// Associated icons for asset. + /// For ibc assets, usually an image of the source chain. + #[prost(message, repeated, tag = "1987")] + pub badges: ::prost::alloc::vec::Vec, } impl ::prost::Name for Metadata { const NAME: &'static str = "Metadata"; diff --git a/crates/proto/src/gen/penumbra.core.asset.v1.serde.rs b/crates/proto/src/gen/penumbra.core.asset.v1.serde.rs index 0eff480e20..bf0faaf4d8 100644 --- a/crates/proto/src/gen/penumbra.core.asset.v1.serde.rs +++ b/crates/proto/src/gen/penumbra.core.asset.v1.serde.rs @@ -1039,6 +1039,9 @@ impl serde::Serialize for Metadata { if self.priority_score != 0 { len += 1; } + if !self.badges.is_empty() { + len += 1; + } let mut struct_ser = serializer.serialize_struct("penumbra.core.asset.v1.Metadata", len)?; if !self.description.is_empty() { struct_ser.serialize_field("description", &self.description)?; @@ -1068,6 +1071,9 @@ impl serde::Serialize for Metadata { #[allow(clippy::needless_borrow)] struct_ser.serialize_field("priorityScore", ToString::to_string(&self.priority_score).as_str())?; } + if !self.badges.is_empty() { + struct_ser.serialize_field("badges", &self.badges)?; + } struct_ser.end() } } @@ -1090,6 +1096,7 @@ impl<'de> serde::Deserialize<'de> for Metadata { "images", "priority_score", "priorityScore", + "badges", ]; #[allow(clippy::enum_variant_names)] @@ -1103,6 +1110,7 @@ impl<'de> serde::Deserialize<'de> for Metadata { PenumbraAssetId, Images, PriorityScore, + Badges, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -1134,6 +1142,7 @@ impl<'de> serde::Deserialize<'de> for Metadata { "penumbraAssetId" | "penumbra_asset_id" => Ok(GeneratedField::PenumbraAssetId), "images" => Ok(GeneratedField::Images), "priorityScore" | "priority_score" => Ok(GeneratedField::PriorityScore), + "badges" => Ok(GeneratedField::Badges), _ => Ok(GeneratedField::__SkipField__), } } @@ -1162,6 +1171,7 @@ impl<'de> serde::Deserialize<'de> for Metadata { let mut penumbra_asset_id__ = None; let mut images__ = None; let mut priority_score__ = None; + let mut badges__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::Description => { @@ -1220,6 +1230,12 @@ impl<'de> serde::Deserialize<'de> for Metadata { Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } + GeneratedField::Badges => { + if badges__.is_some() { + return Err(serde::de::Error::duplicate_field("badges")); + } + badges__ = Some(map_.next_value()?); + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } @@ -1235,6 +1251,7 @@ impl<'de> serde::Deserialize<'de> for Metadata { penumbra_asset_id: penumbra_asset_id__, images: images__.unwrap_or_default(), priority_score: priority_score__.unwrap_or_default(), + badges: badges__.unwrap_or_default(), }) } } diff --git a/crates/proto/src/gen/proto_descriptor.bin.no_lfs b/crates/proto/src/gen/proto_descriptor.bin.no_lfs index 1b37ab32d8..f2452b1c4b 100644 Binary files a/crates/proto/src/gen/proto_descriptor.bin.no_lfs and b/crates/proto/src/gen/proto_descriptor.bin.no_lfs differ diff --git a/proto/penumbra/penumbra/core/asset/v1/asset.proto b/proto/penumbra/penumbra/core/asset/v1/asset.proto index 433e1c1a33..2b9bdbd9a6 100644 --- a/proto/penumbra/penumbra/core/asset/v1/asset.proto +++ b/proto/penumbra/penumbra/core/asset/v1/asset.proto @@ -67,6 +67,10 @@ message Metadata { // // This is solely for use in client-side registries. uint64 priority_score = 1986; + + // Associated icons for asset. + // For ibc assets, usually an image of the source chain. + repeated AssetImage badges = 1987; } // DenomUnit represents a struct that describes a given denomination unit of the basic token.