Skip to content

Commit

Permalink
asset: add coingecko_id to Metadata struct
Browse files Browse the repository at this point in the history
Extends the `Inner` struct in `denom_metadata.rs` to include a `coingecko_id` field. Updates related methods to handle the new field, including `From`, `TryFrom`, `Debug`, and default initialization.
  • Loading branch information
vacekj committed Jan 27, 2025
1 parent 5bf9549 commit 0e625d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/core/asset/src/asset/denom_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub(super) struct Inner {
display_index: usize,
name: String,
symbol: String,
coingecko_id: String,
}

impl DomainType for Metadata {
Expand All @@ -68,7 +69,7 @@ impl From<&Inner> for pb::Metadata {
images: inner.images.clone(),
badges: inner.badges.clone(),
priority_score: inner.priority_score,
coingecko_id: String::new(),
coingecko_id: inner.coingecko_id.clone(),
}
}
}
Expand Down Expand Up @@ -136,6 +137,7 @@ impl TryFrom<pb::Metadata> for Inner {
images: value.images,
badges: value.badges,
priority_score: value.priority_score,
coingecko_id: value.coingecko_id,
})
}
}
Expand Down Expand Up @@ -259,6 +261,7 @@ impl Inner {
images: Vec::new(),
badges: Vec::new(),
priority_score: 0,
coingecko_id: String::new(),
}
}
}
Expand Down Expand Up @@ -435,6 +438,7 @@ impl Debug for Metadata {
symbol,
priority_score,
badges,
coingecko_id,
} = inner.as_ref();

f.debug_struct("Metadata")
Expand All @@ -448,6 +452,7 @@ impl Debug for Metadata {
.field("display_index", display_index)
.field("name", name)
.field("symbol", symbol)
.field("coingecko_id", coingecko_id)
.finish()
}
}
Expand Down

0 comments on commit 0e625d3

Please sign in to comment.