Skip to content

Commit 8463d63

Browse files
authored
asset: add coingecko_id to Metadata struct (#5007)
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. ## Issue ticket number and link prax-wallet/registry#121 ## Checklist before requesting a review - [x] I have added guiding text to explain how a reviewer should test these changes. - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:
1 parent 5bf9549 commit 8463d63

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/core/asset/src/asset/denom_metadata.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub(super) struct Inner {
4949
display_index: usize,
5050
name: String,
5151
symbol: String,
52+
coingecko_id: String,
5253
}
5354

5455
impl DomainType for Metadata {
@@ -68,7 +69,7 @@ impl From<&Inner> for pb::Metadata {
6869
images: inner.images.clone(),
6970
badges: inner.badges.clone(),
7071
priority_score: inner.priority_score,
71-
coingecko_id: String::new(),
72+
coingecko_id: inner.coingecko_id.clone(),
7273
}
7374
}
7475
}
@@ -136,6 +137,7 @@ impl TryFrom<pb::Metadata> for Inner {
136137
images: value.images,
137138
badges: value.badges,
138139
priority_score: value.priority_score,
140+
coingecko_id: value.coingecko_id,
139141
})
140142
}
141143
}
@@ -259,6 +261,7 @@ impl Inner {
259261
images: Vec::new(),
260262
badges: Vec::new(),
261263
priority_score: 0,
264+
coingecko_id: String::new(),
262265
}
263266
}
264267
}
@@ -435,6 +438,7 @@ impl Debug for Metadata {
435438
symbol,
436439
priority_score,
437440
badges,
441+
coingecko_id,
438442
} = inner.as_ref();
439443

440444
f.debug_struct("Metadata")
@@ -448,6 +452,7 @@ impl Debug for Metadata {
448452
.field("display_index", display_index)
449453
.field("name", name)
450454
.field("symbol", symbol)
455+
.field("coingecko_id", coingecko_id)
451456
.finish()
452457
}
453458
}

0 commit comments

Comments
 (0)