Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/iota-indexer/src/indexer_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use iota_types::{
dynamic_field::{DynamicFieldInfo, DynamicFieldName},
effects::TransactionEvents,
event::EventID,
governance::{StakedIota, staked_iota_display_version_update_event},
iota_system_state::{
IotaSystemStateTrait,
iota_system_state_summary::{IotaSystemStateSummary, IotaValidatorSummary},
Expand Down Expand Up @@ -1393,9 +1394,13 @@ impl<U: R2D2Connection> IndexerReader<U> {
&self,
object_type: &move_core_types::language_storage::StructTag,
) -> Result<Option<iota_types::display::DisplayVersionUpdatedEvent>, IndexerError> {
let object_type = object_type.to_canonical_string(/* with_prefix */ true);
self.spawn_blocking(move |this| this.get_display_update_event(object_type))
.await
if StakedIota::is_staked_iota(&object_type) {
Ok(Some(staked_iota_display_version_update_event()))
} else {
let object_type = object_type.to_canonical_string(/* with_prefix */ true);
self.spawn_blocking(move |this| this.get_display_update_event(object_type))
.await
}
}

fn get_display_update_event(
Expand Down
11 changes: 8 additions & 3 deletions crates/iota-json-rpc/src/read_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use iota_types::{
display::DisplayVersionUpdatedEvent,
effects::{TransactionEffects, TransactionEffectsAPI, TransactionEvents},
error::{IotaError, IotaObjectResponseError},
governance::{StakedIota, staked_iota_display_version_update_event},
iota_serde::BigInt,
messages_checkpoint::{
CheckpointContents, CheckpointContentsDigest, CheckpointSequenceNumber, CheckpointSummary,
Expand Down Expand Up @@ -1142,9 +1143,13 @@ async fn get_display_fields(
error: None,
});
};
if let Some(display_object) =
get_display_object_by_type(kv_store, fullnode_api, &object_type).await?
{
if let Some(display_object) = {
if StakedIota::is_staked_iota(&object_type) {
Some(staked_iota_display_version_update_event())
} else {
get_display_object_by_type(kv_store, fullnode_api, &object_type).await?
}
} {
return get_rendered_fields(display_object.fields, &layout);
}
Ok(DisplayFieldsResponse {
Expand Down
24 changes: 24 additions & 0 deletions crates/iota-types/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use crate::{
IOTA_SYSTEM_ADDRESS,
balance::Balance,
base_types::ObjectID,
collection_types::{Entry, VecMap},
committee::EpochId,
display::DisplayVersionUpdatedEvent,
error::IotaError,
gas_coin::NANOS_PER_IOTA,
id::{ID, UID},
Expand Down Expand Up @@ -116,3 +118,25 @@ impl TryFrom<&Object> for StakedIota {
})
}
}

pub fn staked_iota_display_version_update_event() -> DisplayVersionUpdatedEvent {
let id = ID::new(ObjectID::ZERO);
let version = 0_u16;
let contents = vec![
Entry {
key: "name".to_string(),
value: "staked_iota".to_string(),
},
Entry {
key: "image_url".to_string(),
value: "https://d315pvdvxi2gex.cloudfront.net/d96a337f84c5c900f31e08803.svg"
.to_string(),
},
];
let fields = VecMap { contents };
DisplayVersionUpdatedEvent {
id,
version,
fields,
}
}
Loading