create method

Deploys a new NftCollection smart contract. @param data NFT collection data. @returns A NftCollection instance.

Implementation

Future<NftCollection> create(ICreateCollection data) async {
  // If not drop, set drop properties to default 0
  if (!data.drop) {
    data.dropStart = data.dropPrice = data.dropReserve = 0;
  }
  final response = await ApillonApi.post<ICollection>(
      apiPrefix, data.toJson(),
      mapper: ICollection.fromJson);

  return NftCollection(response.collectionUuid, response.toJson());
}