33import com .hedera .hashgraph .sdk .AccountId ;
44import com .hedera .hashgraph .sdk .PrivateKey ;
55import com .hedera .hashgraph .sdk .TokenId ;
6+ import java .nio .charset .StandardCharsets ;
7+ import java .util .Arrays ;
68import java .util .List ;
79import java .util .Objects ;
810import java .util .Set ;
@@ -41,6 +43,22 @@ public interface NftClient {
4143 TokenId createNftType (@ NonNull String name , @ NonNull String symbol , @ NonNull PrivateKey supplierKey )
4244 throws HederaException ;
4345
46+ /**
47+ * Create a new NFT type. The operator account is used as treasury account for the NFT type.
48+ *
49+ * @param name the name of the NFT type
50+ * @param symbol the symbol of the NFT type
51+ * @param supplierKey the private key of the supplier account
52+ * @return the ID of the new NFT type
53+ * @throws HederaException if the NFT type could not be created
54+ */
55+ @ NonNull
56+ default TokenId createNftType (@ NonNull String name , @ NonNull String symbol , @ NonNull String supplierKey )
57+ throws HederaException {
58+ Objects .requireNonNull (supplierKey , "supplierKey must not be null" );
59+ return createNftType (name , symbol , PrivateKey .fromString (supplierKey ));
60+ }
61+
4462 /**
4563 * Create a new NFT type. The operator account is used as supplier account for the NFT type.
4664 *
@@ -55,6 +73,24 @@ TokenId createNftType(@NonNull String name, @NonNull String symbol, @NonNull Pri
5573 TokenId createNftType (@ NonNull String name , @ NonNull String symbol , @ NonNull AccountId treasuryAccountId ,
5674 @ NonNull PrivateKey treasuryKey ) throws HederaException ;
5775
76+ /**
77+ * Create a new NFT type. The operator account is used as supplier account for the NFT type.
78+ *
79+ * @param name the name of the NFT type
80+ * @param symbol the symbol of the NFT type
81+ * @param treasuryAccountId the ID of the treasury account
82+ * @param treasuryKey the private key of the treasury account
83+ * @return the ID of the new NFT type
84+ * @throws HederaException if the NFT type could not be created
85+ */
86+ @ NonNull
87+ default TokenId createNftType (@ NonNull String name , @ NonNull String symbol , @ NonNull String treasuryAccountId ,
88+ @ NonNull String treasuryKey ) throws HederaException {
89+ Objects .requireNonNull (treasuryAccountId , "treasuryAccountId must not be null" );
90+ Objects .requireNonNull (treasuryKey , "treasuryKey must not be null" );
91+ return createNftType (name , symbol , AccountId .fromString (treasuryAccountId ), PrivateKey .fromString (treasuryKey ));
92+ }
93+
5894 /**
5995 * Create a new NFT type. The operator account is used as supplier account for the NFT type.
6096 *
@@ -87,6 +123,27 @@ default TokenId createNftType(@NonNull String name, @NonNull String symbol, @Non
87123 TokenId createNftType (@ NonNull String name , @ NonNull String symbol , @ NonNull AccountId treasuryAccountId ,
88124 @ NonNull PrivateKey treasuryKey , @ NonNull PrivateKey supplierKey ) throws HederaException ;
89125
126+ /**
127+ * Create a new NFT type.
128+ *
129+ * @param name the name of the NFT type
130+ * @param symbol the symbol of the NFT type
131+ * @param treasuryAccountId the ID of the treasury account
132+ * @param treasuryKey the private key of the treasury account
133+ * @param supplierKey the private key of the supplier account
134+ * @return the ID of the new NFT type
135+ * @throws HederaException if the NFT type could not be created
136+ */
137+ @ NonNull
138+ default TokenId createNftType (@ NonNull String name , @ NonNull String symbol , @ NonNull String treasuryAccountId ,
139+ @ NonNull String treasuryKey , @ NonNull String supplierKey ) throws HederaException {
140+ Objects .requireNonNull (treasuryAccountId , "treasuryAccountId must not be null" );
141+ Objects .requireNonNull (treasuryKey , "treasuryKey must not be null" );
142+ Objects .requireNonNull (supplierKey , "supplierKey must not be null" );
143+ return createNftType (name , symbol , AccountId .fromString (treasuryAccountId ), PrivateKey .fromString (treasuryKey ),
144+ PrivateKey .fromString (supplierKey ));
145+ }
146+
90147 /**
91148 * Create a new NFT type.
92149 *
@@ -117,6 +174,23 @@ default TokenId createNftType(@NonNull String name, @NonNull String symbol, @Non
117174 void associateNft (@ NonNull TokenId tokenId , @ NonNull AccountId accountId , @ NonNull PrivateKey accountKey )
118175 throws HederaException ;
119176
177+ /**
178+ * Associate an account with an NFT type. If an account is associated with an NFT type, the account can hold NFTs of
179+ * that type. Otherwise, the account cannot hold NFTs of that type and tranfer NFTs of that type will fail.
180+ *
181+ * @param tokenId the ID of the NFT type
182+ * @param accountId the ID of the account
183+ * @param accountKey the private key of the account
184+ * @throws HederaException if the account could not be associated with the NFT type
185+ */
186+ default void associateNft (@ NonNull String tokenId , @ NonNull String accountId , @ NonNull String accountKey )
187+ throws HederaException {
188+ Objects .requireNonNull (tokenId , "tokenId must not be null" );
189+ Objects .requireNonNull (accountId , "accountId must not be null" );
190+ Objects .requireNonNull (accountKey , "accountKey must not be null" );
191+ associateNft (TokenId .fromString (tokenId ), AccountId .fromString (accountId ), PrivateKey .fromString (accountKey ));
192+ }
193+
120194 /**
121195 * Associate an account with an NFT type. If an account is associated with an NFT type, the account can hold NFTs of
122196 * that type. Otherwise, the account cannot hold NFTs of that type and tranfer NFTs of that type will fail.
@@ -139,7 +213,21 @@ default void associateNft(@NonNull TokenId tokenId, @NonNull Account account) th
139213 * @return the serial number of the new NFT
140214 * @throws HederaException if the NFT could not be minted
141215 */
142- long mintNft (@ NonNull TokenId tokenId , @ NonNull String metadata ) throws HederaException ;
216+ long mintNft (@ NonNull TokenId tokenId , @ NonNull byte [] metadata ) throws HederaException ;
217+
218+ /**
219+ * Mint a new NFT of the given type. The NFT is minted by the operator account. The operator account is used as
220+ * supply account for the NFT.
221+ *
222+ * @param tokenId the ID of the NFT type
223+ * @param metadata the metadata of the NFT
224+ * @return the serial number of the new NFT
225+ * @throws HederaException if the NFT could not be minted
226+ */
227+ default long mintNft (@ NonNull String tokenId , @ NonNull byte [] metadata ) throws HederaException {
228+ Objects .requireNonNull (tokenId , "tokenId must not be null" );
229+ return mintNft (TokenId .fromString (tokenId ), metadata );
230+ }
143231
144232 /**
145233 * Mint a new NFT of the given type.
@@ -150,9 +238,25 @@ default void associateNft(@NonNull TokenId tokenId, @NonNull Account account) th
150238 * @return the serial number of the new NFT
151239 * @throws HederaException if the NFT could not be minted
152240 */
153- long mintNft (@ NonNull TokenId tokenId , @ NonNull String metadata , @ NonNull PrivateKey supplyKey )
241+ long mintNft (@ NonNull TokenId tokenId , @ NonNull PrivateKey supplyKey , @ NonNull byte [] metadata )
154242 throws HederaException ;
155243
244+ /**
245+ * Mint a new NFT of the given type.
246+ *
247+ * @param tokenId the ID of the NFT type
248+ * @param metadata the metadata of the NFT
249+ * @param supplyKey the private key of the supply account
250+ * @return the serial number of the new NFT
251+ * @throws HederaException if the NFT could not be minted
252+ */
253+ default long mintNft (@ NonNull String tokenId , @ NonNull String supplyKey , @ NonNull byte [] metadata )
254+ throws HederaException {
255+ Objects .requireNonNull (tokenId , "tokenId must not be null" );
256+ Objects .requireNonNull (supplyKey , "supplyKey must not be null" );
257+ return mintNft (TokenId .fromString (tokenId ), PrivateKey .fromString (supplyKey ), metadata );
258+ }
259+
156260 /**
157261 * Mint new NFTs of the given type. The NFTs are minted by the operator account. The operator account is used as
158262 * supply account for the NFTs.
@@ -163,7 +267,22 @@ long mintNft(@NonNull TokenId tokenId, @NonNull String metadata, @NonNull Privat
163267 * @throws HederaException if the NFTs could not be minted
164268 */
165269 @ NonNull
166- List <Long > mintNfts (@ NonNull TokenId tokenId , @ NonNull List <String > metadata ) throws HederaException ;
270+ List <Long > mintNfts (@ NonNull TokenId tokenId , @ NonNull byte []... metadata ) throws HederaException ;
271+
272+ /**
273+ * Mint new NFTs of the given type. The NFTs are minted by the operator account. The operator account is used as
274+ * supply account for the NFTs.
275+ *
276+ * @param tokenId the ID of the NFT type
277+ * @param metadata the metadata of the NFTs
278+ * @return the serial numbers of the new NFTs
279+ * @throws HederaException if the NFTs could not be minted
280+ */
281+ @ NonNull
282+ default List <Long > mintNfts (@ NonNull String tokenId , @ NonNull byte []... metadata ) throws HederaException {
283+ Objects .requireNonNull (tokenId , "tokenId must not be null" );
284+ return mintNfts (TokenId .fromString (tokenId ), metadata );
285+ }
167286
168287 /**
169288 * Mint new NFTs of the given type.
@@ -175,9 +294,26 @@ long mintNft(@NonNull TokenId tokenId, @NonNull String metadata, @NonNull Privat
175294 * @throws HederaException if the NFTs could not be minted
176295 */
177296 @ NonNull
178- List <Long > mintNfts (@ NonNull TokenId tokenId , @ NonNull List < String > metadata , @ NonNull PrivateKey supplyKey )
297+ List <Long > mintNfts (@ NonNull TokenId tokenId , @ NonNull PrivateKey supplyKey , @ NonNull byte []... metadata )
179298 throws HederaException ;
180299
300+ /**
301+ * Mint new NFTs of the given type.
302+ *
303+ * @param tokenId the ID of the NFT type
304+ * @param metadata the metadata of the NFTs
305+ * @param supplyKey the private key of the supply account
306+ * @return the serial numbers of the new NFTs
307+ * @throws HederaException if the NFTs could not be minted
308+ */
309+ @ NonNull
310+ default List <Long > mintNfts (@ NonNull String tokenId , @ NonNull String supplyKey , @ NonNull byte []... metadata )
311+ throws HederaException {
312+ Objects .requireNonNull (tokenId , "tokenId must not be null" );
313+ Objects .requireNonNull (supplyKey , "supplyKey must not be null" );
314+ return mintNfts (TokenId .fromString (tokenId ), PrivateKey .fromString (supplyKey ), metadata );
315+ }
316+
181317 default void burnNft (@ NonNull TokenId tokenId , long serialNumber ) throws HederaException {
182318 burnNfts (tokenId , Set .of (serialNumber ));
183319 }
0 commit comments