diff --git a/src/factories/NFTFactory.ts b/src/factories/NFTFactory.ts index e69f7477..7fd43f54 100644 --- a/src/factories/NFTFactory.ts +++ b/src/factories/NFTFactory.ts @@ -1,9 +1,14 @@ import { Contract } from 'web3-eth-contract' import Web3 from 'web3' +import { TransactionReceipt } from 'web3-core' import { AbiItem } from 'web3-utils' import defaultFactory721ABI from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json' import { Logger, getFairGasPrice, generateDtName } from '../utils' +interface Template { + templateAddress: string + isActive: boolean +} /** * Provides an interface for NFT DataTokens */ @@ -88,4 +93,278 @@ export class NFTFactory { } return tokenAddress } + + /** Get Current NFT Count (NFT created) + * @return {Promise} Number of NFT created from this factory + */ + public async getCurrentNFTCount(): Promise { + const trxReceipt = await this.factory721.methods.getCurrentNFTCount().call() + return trxReceipt + } + + /** Get Current Datatoken Count + * @return {Promise} Number of DTs created from this factory + */ + public async getCurrentTokenCount(): Promise { + const trxReceipt = await this.factory721.methods.getCurrentTokenCount().call() + return trxReceipt + } + + /** Get Factory Owner + * @return {Promise} Factory Owner address + */ + public async getOwner(): Promise { + const trxReceipt = await this.factory721.methods.owner().call() + return trxReceipt + } + + /** Get Current NFT Template Count + * @return {Promise} Number of NFT Template added to this factory + */ + public async getCurrentNFTTemplateCount(): Promise { + const count = await this.factory721.methods.getCurrentNFTTemplateCount().call() + return count + } + + /** Get Current Template Datatoken (ERC20) Count + * @return {Promise} Number of ERC20 Template added to this factory + */ + public async getCurrentTokenTemplateCount(): Promise { + const count = await this.factory721.methods.getCurrentTokenTemplateCount().call() + return count + } + + /** Get NFT Template + * @param {Number} index Template index + * @return {Promise