From 3111ed4204feac15e421b6decf8cbf35e048ef69 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Fri, 30 Jun 2023 12:19:49 +0300 Subject: [PATCH 1/3] add nft tag to name --- nft-minter/src/nft_minting.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nft-minter/src/nft_minting.rs b/nft-minter/src/nft_minting.rs index f774b39..790b54f 100644 --- a/nft-minter/src/nft_minting.rs +++ b/nft-minter/src/nft_minting.rs @@ -165,10 +165,13 @@ pub trait NftMintingModule: let attributes = self.build_nft_attributes(&brand_info.collection_hash, brand_id, nft_id); let nft_amount = BigUint::from(NFT_AMOUNT); + let mut nft_name = brand_info.token_display_name.clone(); + nft_name.append_bytes(b"#"); + nft_name.append_bytes(&nft_id.to_be_bytes()); let nft_nonce = self.send().esdt_nft_create( &nft_token_id, &nft_amount, - &brand_info.token_display_name, + &nft_name, &brand_info.royalties, &ManagedBuffer::new(), &attributes, From e375db8383d7b921aa76a49961696b199456d678 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Fri, 30 Jun 2023 13:11:55 +0300 Subject: [PATCH 2/3] fix tag --- nft-minter/src/nft_minting.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nft-minter/src/nft_minting.rs b/nft-minter/src/nft_minting.rs index 790b54f..cfec7bb 100644 --- a/nft-minter/src/nft_minting.rs +++ b/nft-minter/src/nft_minting.rs @@ -167,7 +167,7 @@ pub trait NftMintingModule: let nft_amount = BigUint::from(NFT_AMOUNT); let mut nft_name = brand_info.token_display_name.clone(); nft_name.append_bytes(b"#"); - nft_name.append_bytes(&nft_id.to_be_bytes()); + nft_name.append_bytes(stringify!(nft_id).as_bytes()); let nft_nonce = self.send().esdt_nft_create( &nft_token_id, &nft_amount, From 1331324c46bbadcc762dc62da4811c227a689e7b Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Fri, 30 Jun 2023 16:32:17 +0300 Subject: [PATCH 3/3] fix tag append by sc_format --- nft-minter/src/nft_minting.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nft-minter/src/nft_minting.rs b/nft-minter/src/nft_minting.rs index cfec7bb..03258d4 100644 --- a/nft-minter/src/nft_minting.rs +++ b/nft-minter/src/nft_minting.rs @@ -165,9 +165,8 @@ pub trait NftMintingModule: let attributes = self.build_nft_attributes(&brand_info.collection_hash, brand_id, nft_id); let nft_amount = BigUint::from(NFT_AMOUNT); - let mut nft_name = brand_info.token_display_name.clone(); - nft_name.append_bytes(b"#"); - nft_name.append_bytes(stringify!(nft_id).as_bytes()); + let nft_name = + self.get_nft_name_with_tag(brand_info.token_display_name.clone(), nft_id); let nft_nonce = self.send().esdt_nft_create( &nft_token_id, &nft_amount, @@ -189,4 +188,10 @@ pub trait NftMintingModule: nft_output_payments } + + fn get_nft_name_with_tag(&self, name: ManagedBuffer, tag: usize) -> ManagedBuffer { + let mut nft_name = name; + nft_name.append(&sc_format!("#{}", tag)); + nft_name + } }