-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Display] RPC support for fetching and rendering Display object (#8663)
## Description This PR adds the RPC support for #7668 and added e2e TS tests Todos(in separate PRs) - [ ] merge the display endpoint into the[ new queryObjects API](https://www.notion.so/mystenlabs/RFC-GetObjects-API-Refactoring-27ff6b8d6ffc42c8b492c1efa368b70a?pvs=4) - [ ] Handle struct that has no Display defined `Overall display should be treated as Debug and Display traits in Rust. If we don’t have Display defined, we show default debug (on the FE/Apps), if there’s Display, we show things nicely.` I'll implement this when we implement the new queryObjects API - [ ] Add rust based tests ## Test Plan How did you test the new or updated feature? Added e2e TS tests to cover the following test cases - Escape syntax (e.g., `\{name\}` should return `{name}` instead of `Alice` even if there's a field called Alice) - Nested fields - multiple fields - option::some and option::none - no template value - sui address - UID - `sui::url::Url` type --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
- Loading branch information
Showing
16 changed files
with
582 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@mysten/sui.js": patch | ||
--- | ||
|
||
Add optional parameter for filtering object by type in getOwnedObjectsByAddress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::collection_types::VecMap; | ||
use crate::id::{ID, UID}; | ||
use crate::SUI_FRAMEWORK_ADDRESS; | ||
use move_core_types::ident_str; | ||
use move_core_types::identifier::IdentStr; | ||
use move_core_types::language_storage::StructTag; | ||
use serde::Deserialize; | ||
|
||
pub const DISPLAY_MODULE_NAME: &IdentStr = ident_str!("display"); | ||
pub const DISPLAY_CREATED_EVENT_NAME: &IdentStr = ident_str!("DisplayCreated"); | ||
|
||
// TODO: add tests to keep in sync | ||
/// Rust version of the Move sui::display::Display type | ||
#[derive(Debug, Deserialize, Clone, Eq, PartialEq)] | ||
pub struct DisplayObject { | ||
pub id: UID, | ||
pub fields: VecMap<String, String>, | ||
pub version: u16, | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
pub struct DisplayCreatedEvent { | ||
// The Object ID of Display Object | ||
pub id: ID, | ||
} | ||
|
||
impl DisplayCreatedEvent { | ||
pub fn type_(inner: &StructTag) -> StructTag { | ||
StructTag { | ||
address: SUI_FRAMEWORK_ADDRESS, | ||
name: DISPLAY_CREATED_EVENT_NAME.to_owned(), | ||
module: DISPLAY_MODULE_NAME.to_owned(), | ||
type_params: vec![inner.clone().into()], | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.