77 ICreateCollection ,
88 ICreateSubstrateCollection ,
99 ICreateCollectionBase ,
10+ ICreateUniqueCollection ,
1011} from '../../types/nfts' ;
1112import { NftCollection } from './nft-collection' ;
1213
@@ -52,7 +53,7 @@ export class Nft extends ApillonModule {
5253 * @returns A NftCollection instance.
5354 */
5455 public async create ( data : ICreateCollection ) {
55- return await this . createNft ( data , true ) ;
56+ return await this . createNft ( data , 'evm' ) ;
5657 }
5758
5859 /**
@@ -61,17 +62,26 @@ export class Nft extends ApillonModule {
6162 * @returns A NftCollection instance.
6263 */
6364 public async createSubstrate ( data : ICreateSubstrateCollection ) {
64- return await this . createNft ( data , false ) ;
65+ return await this . createNft ( data , 'substrate' ) ;
6566 }
6667
67- private async createNft ( data : ICreateCollectionBase , isEvm : boolean ) {
68+ /**
69+ * Deploys a new Unique NftCollection smart contract.
70+ * @param data NFT collection data.
71+ * @returns A NftCollection instance.
72+ */
73+ public async createUnique ( data : ICreateUniqueCollection ) {
74+ return await this . createNft ( data , 'unique' ) ;
75+ }
76+
77+ private async createNft ( data : ICreateCollectionBase , type : string ) {
6878 // If not drop, set drop properties to default 0
6979 if ( ! data . drop ) {
7080 data . dropStart = data . dropPrice = data . dropReserve = 0 ;
7181 }
7282 const response = await ApillonApi . post <
7383 NftCollection & { collectionUuid : string }
74- > ( `${ this . API_PREFIX } /${ isEvm ? 'evm' : 'substrate' } ` , data ) ;
84+ > ( `${ this . API_PREFIX } /${ type } ` , data ) ;
7585 return new NftCollection ( response . collectionUuid , response ) ;
7686 }
7787}
0 commit comments