-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iota-framework): added and integrated
SystemDisplayCap
- Loading branch information
Showing
5 changed files
with
119 additions
and
30 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
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
37 changes: 37 additions & 0 deletions
37
crates/iota-framework/packages/iota-system/sources/iota_system_display.move
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,37 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module iota_system::iota_system_display { | ||
|
||
use std::string::String; | ||
|
||
use iota::display::{Self, Display}; | ||
|
||
use iota_system::iota_system::IotaSystemState; | ||
|
||
/// Create an empty `Display` object with `SystemDisplayCap`. | ||
public fun system_new<T: key>( | ||
iota_system: &mut IotaSystemState, | ||
ctx: &mut TxContext | ||
): Display<T> { | ||
// Load the `SystemDisplayCap` instance. | ||
let sys_display_cap = iota_system.load_system_display_cap(); | ||
|
||
// Create a `Display` object. | ||
display::system_new<T>(sys_display_cap, ctx) | ||
} | ||
|
||
/// Create a new Display<T> object with a set of fields using `SystemDisplayCap`. | ||
public fun system_new_with_fields<T: key>( | ||
iota_system: &mut IotaSystemState, | ||
fields: vector<String>, | ||
values: vector<String>, | ||
ctx: &mut TxContext | ||
): Display<T> { | ||
// Load the `SystemDisplayCap` instance. | ||
let sys_display_cap = iota_system.load_system_display_cap(); | ||
|
||
// Create a `Display` object with fields. | ||
display::system_new_with_fields<T>(sys_display_cap, fields, values, ctx) | ||
} | ||
} |
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