MCPcopy Create free account
hub / github.com/dfinity/orbit / edit

Method edit

core/station/impl/src/services/asset.rs:82–110  ·  view source on GitHub ↗
(&self, input: EditAssetOperationInput)

Source from the content-addressed store, hash-verified

80 }
81
82 pub fn edit(&self, input: EditAssetOperationInput) -> ServiceResult<Asset> {
83 let mut asset = self.get(&input.asset_id)?;
84
85 if let Some(name) = input.name {
86 asset.name = name;
87 }
88
89 if let Some(symbol) = input.symbol {
90 asset.symbol = symbol;
91 }
92
93 if let Some(change_metadata) = input.change_metadata {
94 asset.metadata.change(change_metadata);
95 }
96
97 if let Some(blockchain) = input.blockchain {
98 asset.blockchain = blockchain;
99 }
100
101 if let Some(standards) = input.standards {
102 asset.standards = standards.into_iter().collect();
103 }
104
105 asset.validate()?;
106
107 self.asset_repository.insert(asset.id, asset.clone());
108
109 Ok(asset)
110 }
111
112 pub fn remove(&self, input: RemoveAssetOperationInput) -> ServiceResult<Asset> {
113 let asset = self.get(&input.asset_id)?;

Callers 7

executeMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
test_asset_editFunction · 0.45

Calls 4

changeMethod · 0.80
getMethod · 0.45
validateMethod · 0.45
insertMethod · 0.45