Skip to content

Commit

Permalink
Simply Metadata::new usage in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Jan 11, 2024
1 parent e314ebe commit 9d7e91d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 25 deletions.
5 changes: 1 addition & 4 deletions cli/src/wallet_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,10 +778,7 @@ pub async fn mint_nft_command(
.with_sender(sender)
.with_issuer(issuer);
if let Some(metadata) = metadata {
nft_options = nft_options.with_metadata(MetadataFeature::new(std::collections::BTreeMap::from_iter(vec![(
metadata.clone(),
metadata,
)]))?);
nft_options = nft_options.with_metadata(MetadataFeature::new([(metadata.clone(), metadata)])?);
}
if let Some(immutable_metadata) = immutable_metadata {
nft_options = nft_options.with_immutable_metadata(MetadataFeature::new(
Expand Down
5 changes: 1 addition & 4 deletions sdk/examples/client/output/build_account_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ async fn main() -> Result<()> {
.add_feature(SenderFeature::new(address.clone()))
.add_feature(MetadataFeature::new([(metadata.to_vec(), metadata.to_vec())])?)
.add_immutable_feature(IssuerFeature::new(address.clone()))
.add_immutable_feature(MetadataFeature::new(std::collections::BTreeMap::from_iter(vec![(
metadata.to_vec(),
metadata.to_vec(),
)]))?)
.add_immutable_feature(MetadataFeature::new([(metadata.to_vec(), metadata.to_vec())])?)
.add_unlock_condition(AddressUnlockCondition::new(address))
.finish_output()?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ where
if let Some(foundry_metadata) = params.foundry_metadata {
foundry_builder = foundry_builder.add_immutable_feature(MetadataFeature::new(
// TODO: what hardcoded key or let user provide the full metadata?
BTreeMap::from_iter(vec![(b"foundry".to_vec(), foundry_metadata)]),
[(b"foundry".to_vec(), foundry_metadata)],
)?);
}

Expand Down
20 changes: 4 additions & 16 deletions sdk/tests/wallet/output_preparation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,16 +553,10 @@ async fn prepare_nft_output_features_update() -> Result<()> {
let nft_options = [MintNftParams::new()
.with_address(wallet_address.clone())
.with_sender(wallet_address.clone())
.with_metadata(MetadataFeature::new(std::collections::BTreeMap::from_iter(vec![(
vec![42],
vec![42],
)]))?)
.with_metadata(MetadataFeature::new([(vec![42], vec![42])])?)
.with_tag(b"some nft tag".to_vec())
.with_issuer(wallet_address.clone())
.with_immutable_metadata(MetadataFeature::new(std::collections::BTreeMap::from_iter(vec![(
vec![42],
vec![42],
)]))?)];
.with_immutable_metadata(MetadataFeature::new([(vec![42], vec![42])])?)];

let transaction = wallet.mint_nfts(nft_options, None).await.unwrap();
wallet
Expand Down Expand Up @@ -852,16 +846,10 @@ async fn prepare_existing_nft_output_gift() -> Result<()> {
let nft_options = [MintNftParams::new()
.with_address(address.clone())
.with_sender(address.clone())
.with_metadata(MetadataFeature::new(std::collections::BTreeMap::from_iter(vec![(
vec![42],
vec![42],
)]))?)
.with_metadata(MetadataFeature::new([(vec![42], vec![42])])?)
.with_tag(b"some nft tag".to_vec())
.with_issuer(address.clone())
.with_immutable_metadata(MetadataFeature::new(std::collections::BTreeMap::from_iter(vec![(
vec![43],
vec![43],
)]))?)];
.with_immutable_metadata(MetadataFeature::new([(vec![43], vec![43])])?)];

let transaction = wallet.mint_nfts(nft_options, None).await.unwrap();
wallet
Expand Down

0 comments on commit 9d7e91d

Please sign in to comment.