From 9d7e91d1de94cd1f114a26eec3ca08ceca6c9d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thoralf=20M=C3=BCller?= Date: Thu, 11 Jan 2024 10:00:04 +0100 Subject: [PATCH] Simply Metadata::new usage in more places --- cli/src/wallet_cli/mod.rs | 5 +---- .../client/output/build_account_output.rs | 5 +---- .../high_level/minting/create_native_token.rs | 2 +- sdk/tests/wallet/output_preparation.rs | 20 ++++--------------- 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/cli/src/wallet_cli/mod.rs b/cli/src/wallet_cli/mod.rs index 344750e127..0122efb4cf 100644 --- a/cli/src/wallet_cli/mod.rs +++ b/cli/src/wallet_cli/mod.rs @@ -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( diff --git a/sdk/examples/client/output/build_account_output.rs b/sdk/examples/client/output/build_account_output.rs index 5a340d9b8e..a86d95785d 100644 --- a/sdk/examples/client/output/build_account_output.rs +++ b/sdk/examples/client/output/build_account_output.rs @@ -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()?; diff --git a/sdk/src/wallet/operations/transaction/high_level/minting/create_native_token.rs b/sdk/src/wallet/operations/transaction/high_level/minting/create_native_token.rs index 35d26339b3..0206c59bad 100644 --- a/sdk/src/wallet/operations/transaction/high_level/minting/create_native_token.rs +++ b/sdk/src/wallet/operations/transaction/high_level/minting/create_native_token.rs @@ -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)], )?); } diff --git a/sdk/tests/wallet/output_preparation.rs b/sdk/tests/wallet/output_preparation.rs index cad4de1870..949ef3b057 100644 --- a/sdk/tests/wallet/output_preparation.rs +++ b/sdk/tests/wallet/output_preparation.rs @@ -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 @@ -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