mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
inherit NFTFactory from SmartContract
This commit is contained in:
parent
4515f938e2
commit
c09a48fa72
@ -1,8 +1,7 @@
|
|||||||
import { Contract } from 'web3-eth-contract'
|
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import { TransactionReceipt } from 'web3-core'
|
import { TransactionReceipt } from 'web3-core'
|
||||||
import { AbiItem } from 'web3-utils'
|
import { AbiItem } from 'web3-utils'
|
||||||
import defaultFactory721Abi from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json'
|
import ERC721Factory from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json'
|
||||||
import {
|
import {
|
||||||
LoggerInstance,
|
LoggerInstance,
|
||||||
getFairGasPrice,
|
getFairGasPrice,
|
||||||
@ -10,11 +9,9 @@ import {
|
|||||||
getFreCreationParams,
|
getFreCreationParams,
|
||||||
getErcCreationParams,
|
getErcCreationParams,
|
||||||
getPoolCreationParams,
|
getPoolCreationParams,
|
||||||
setContractDefaults,
|
|
||||||
estimateGas,
|
estimateGas,
|
||||||
ZERO_ADDRESS
|
ZERO_ADDRESS
|
||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
import { Config, ConfigHelper } from '../../config'
|
|
||||||
import {
|
import {
|
||||||
FreCreationParams,
|
FreCreationParams,
|
||||||
Erc20CreateParams,
|
Erc20CreateParams,
|
||||||
@ -24,38 +21,14 @@ import {
|
|||||||
Template,
|
Template,
|
||||||
TokenOrder
|
TokenOrder
|
||||||
} from '../../@types'
|
} from '../../@types'
|
||||||
|
import { SmartContractWithAddress } from '..'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an interface for NFT Factory contract
|
* Provides an interface for NFT Factory contract
|
||||||
*/
|
*/
|
||||||
export class NftFactory {
|
export class NftFactory extends SmartContractWithAddress {
|
||||||
public factory721Address: string
|
getDefaultAbi(): AbiItem | AbiItem[] {
|
||||||
public factory721Abi: AbiItem | AbiItem[]
|
return ERC721Factory.abi as AbiItem[]
|
||||||
public web3: Web3
|
|
||||||
public config: Config
|
|
||||||
public factory721: Contract
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiate Datatokens.
|
|
||||||
* @param {String} factory721Address
|
|
||||||
* @param {AbiItem | AbiItem[]} factory721ABI
|
|
||||||
* @param {Web3} web3
|
|
||||||
*/
|
|
||||||
constructor(
|
|
||||||
factory721Address: string,
|
|
||||||
web3: Web3,
|
|
||||||
network?: string | number,
|
|
||||||
factory721Abi?: AbiItem | AbiItem[],
|
|
||||||
config?: Config
|
|
||||||
) {
|
|
||||||
this.factory721Address = factory721Address
|
|
||||||
this.factory721Abi = factory721Abi || (defaultFactory721Abi.abi as AbiItem[])
|
|
||||||
this.web3 = web3
|
|
||||||
this.config = config || new ConfigHelper().getConfig(network || 'unknown')
|
|
||||||
this.factory721 = setContractDefaults(
|
|
||||||
new this.web3.eth.Contract(this.factory721Abi, this.factory721Address),
|
|
||||||
this.config
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +40,7 @@ export class NftFactory {
|
|||||||
public async estGasCreateNFT(address: string, nftData: NftCreateData): Promise<string> {
|
public async estGasCreateNFT(address: string, nftData: NftCreateData): Promise<string> {
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.deployERC721Contract,
|
this.contract.methods.deployERC721Contract,
|
||||||
nftData.name,
|
nftData.name,
|
||||||
nftData.symbol,
|
nftData.symbol,
|
||||||
nftData.templateIndex,
|
nftData.templateIndex,
|
||||||
@ -105,7 +78,7 @@ export class NftFactory {
|
|||||||
}
|
}
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.deployERC721Contract,
|
this.contract.methods.deployERC721Contract,
|
||||||
nftData.name,
|
nftData.name,
|
||||||
nftData.symbol,
|
nftData.symbol,
|
||||||
nftData.templateIndex,
|
nftData.templateIndex,
|
||||||
@ -117,7 +90,7 @@ export class NftFactory {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.deployERC721Contract(
|
.deployERC721Contract(
|
||||||
nftData.name,
|
nftData.name,
|
||||||
nftData.symbol,
|
nftData.symbol,
|
||||||
@ -147,7 +120,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<number>} Number of NFT created from this factory
|
* @return {Promise<number>} Number of NFT created from this factory
|
||||||
*/
|
*/
|
||||||
public async getCurrentNFTCount(): Promise<number> {
|
public async getCurrentNFTCount(): Promise<number> {
|
||||||
const trxReceipt = await this.factory721.methods.getCurrentNFTCount().call()
|
const trxReceipt = await this.contract.methods.getCurrentNFTCount().call()
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +128,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<number>} Number of DTs created from this factory
|
* @return {Promise<number>} Number of DTs created from this factory
|
||||||
*/
|
*/
|
||||||
public async getCurrentTokenCount(): Promise<number> {
|
public async getCurrentTokenCount(): Promise<number> {
|
||||||
const trxReceipt = await this.factory721.methods.getCurrentTokenCount().call()
|
const trxReceipt = await this.contract.methods.getCurrentTokenCount().call()
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +136,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<string>} Factory Owner address
|
* @return {Promise<string>} Factory Owner address
|
||||||
*/
|
*/
|
||||||
public async getOwner(): Promise<string> {
|
public async getOwner(): Promise<string> {
|
||||||
const trxReceipt = await this.factory721.methods.owner().call()
|
const trxReceipt = await this.contract.methods.owner().call()
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +144,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<number>} Number of NFT Template added to this factory
|
* @return {Promise<number>} Number of NFT Template added to this factory
|
||||||
*/
|
*/
|
||||||
public async getCurrentNFTTemplateCount(): Promise<number> {
|
public async getCurrentNFTTemplateCount(): Promise<number> {
|
||||||
const count = await this.factory721.methods.getCurrentNFTTemplateCount().call()
|
const count = await this.contract.methods.getCurrentNFTTemplateCount().call()
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +152,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<number>} Number of ERC20 Template added to this factory
|
* @return {Promise<number>} Number of ERC20 Template added to this factory
|
||||||
*/
|
*/
|
||||||
public async getCurrentTokenTemplateCount(): Promise<number> {
|
public async getCurrentTokenTemplateCount(): Promise<number> {
|
||||||
const count = await this.factory721.methods.getCurrentTemplateCount().call()
|
const count = await this.contract.methods.getCurrentTemplateCount().call()
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +168,7 @@ export class NftFactory {
|
|||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
throw new Error(`Template index cannot be ZERO`)
|
throw new Error(`Template index cannot be ZERO`)
|
||||||
}
|
}
|
||||||
const template = await this.factory721.methods.getNFTTemplate(index).call()
|
const template = await this.contract.methods.getNFTTemplate(index).call()
|
||||||
return template
|
return template
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +177,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<Template>} DT Template info
|
* @return {Promise<Template>} DT Template info
|
||||||
*/
|
*/
|
||||||
public async getTokenTemplate(index: number): Promise<Template> {
|
public async getTokenTemplate(index: number): Promise<Template> {
|
||||||
const template = await this.factory721.methods.getTokenTemplate(index).call()
|
const template = await this.contract.methods.getTokenTemplate(index).call()
|
||||||
return template
|
return template
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +186,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<Boolean>} return true if deployed from this factory
|
* @return {Promise<Boolean>} return true if deployed from this factory
|
||||||
*/
|
*/
|
||||||
public async checkDatatoken(datatoken: string): Promise<Boolean> {
|
public async checkDatatoken(datatoken: string): Promise<Boolean> {
|
||||||
const isDeployed = await this.factory721.methods.erc20List(datatoken).call()
|
const isDeployed = await this.contract.methods.erc20List(datatoken).call()
|
||||||
return isDeployed
|
return isDeployed
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +195,7 @@ export class NftFactory {
|
|||||||
* @return {Promise<String>} return address(0) if it's not, or the nftAddress if true
|
* @return {Promise<String>} return address(0) if it's not, or the nftAddress if true
|
||||||
*/
|
*/
|
||||||
public async checkNFT(nftAddress: string): Promise<String> {
|
public async checkNFT(nftAddress: string): Promise<String> {
|
||||||
const confirmAddress = await this.factory721.methods.erc721List(nftAddress).call()
|
const confirmAddress = await this.contract.methods.erc721List(nftAddress).call()
|
||||||
return confirmAddress
|
return confirmAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +211,7 @@ export class NftFactory {
|
|||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.add721TokenTemplate,
|
this.contract.methods.add721TokenTemplate,
|
||||||
templateAddress
|
templateAddress
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -262,12 +235,12 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.add721TokenTemplate,
|
this.contract.methods.add721TokenTemplate,
|
||||||
templateAddress
|
templateAddress
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke add721TokenTemplate function of the contract
|
// Invoke add721TokenTemplate function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.add721TokenTemplate(templateAddress)
|
.add721TokenTemplate(templateAddress)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -290,7 +263,7 @@ export class NftFactory {
|
|||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.disable721TokenTemplate,
|
this.contract.methods.disable721TokenTemplate,
|
||||||
templateIndex
|
templateIndex
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -317,12 +290,12 @@ export class NftFactory {
|
|||||||
}
|
}
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.disable721TokenTemplate,
|
this.contract.methods.disable721TokenTemplate,
|
||||||
templateIndex
|
templateIndex
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.disable721TokenTemplate(templateIndex)
|
.disable721TokenTemplate(templateIndex)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -345,7 +318,7 @@ export class NftFactory {
|
|||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.reactivate721TokenTemplate,
|
this.contract.methods.reactivate721TokenTemplate,
|
||||||
templateIndex
|
templateIndex
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -373,12 +346,12 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.reactivate721TokenTemplate,
|
this.contract.methods.reactivate721TokenTemplate,
|
||||||
templateIndex
|
templateIndex
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.reactivate721TokenTemplate(templateIndex)
|
.reactivate721TokenTemplate(templateIndex)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -399,7 +372,7 @@ export class NftFactory {
|
|||||||
address: string,
|
address: string,
|
||||||
templateAddress: string
|
templateAddress: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return estimateGas(address, this.factory721.methods.addTokenTemplate, templateAddress)
|
return estimateGas(address, this.contract.methods.addTokenTemplate, templateAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -421,12 +394,12 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.addTokenTemplate,
|
this.contract.methods.addTokenTemplate,
|
||||||
templateAddress
|
templateAddress
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.addTokenTemplate(templateAddress)
|
.addTokenTemplate(templateAddress)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -447,11 +420,7 @@ export class NftFactory {
|
|||||||
address: string,
|
address: string,
|
||||||
templateIndex: number
|
templateIndex: number
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return estimateGas(
|
return estimateGas(address, this.contract.methods.disableTokenTemplate, templateIndex)
|
||||||
address,
|
|
||||||
this.factory721.methods.disableTokenTemplate,
|
|
||||||
templateIndex
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -479,12 +448,12 @@ export class NftFactory {
|
|||||||
}
|
}
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.disableTokenTemplate,
|
this.contract.methods.disableTokenTemplate,
|
||||||
templateIndex
|
templateIndex
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.disableTokenTemplate(templateIndex)
|
.disableTokenTemplate(templateIndex)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -507,7 +476,7 @@ export class NftFactory {
|
|||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.reactivateTokenTemplate,
|
this.contract.methods.reactivateTokenTemplate,
|
||||||
templateIndex
|
templateIndex
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -538,12 +507,12 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.reactivateTokenTemplate,
|
this.contract.methods.reactivateTokenTemplate,
|
||||||
templateIndex
|
templateIndex
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.reactivateTokenTemplate(templateIndex)
|
.reactivateTokenTemplate(templateIndex)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -563,7 +532,7 @@ export class NftFactory {
|
|||||||
address: string,
|
address: string,
|
||||||
orders: TokenOrder[]
|
orders: TokenOrder[]
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return estimateGas(address, this.factory721.methods.startMultipleTokenOrder, orders)
|
return estimateGas(address, this.contract.methods.startMultipleTokenOrder, orders)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -588,18 +557,16 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.startMultipleTokenOrder,
|
this.contract.methods.startMultipleTokenOrder,
|
||||||
orders
|
orders
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods.startMultipleTokenOrder(orders).send({
|
||||||
.startMultipleTokenOrder(orders)
|
from: address,
|
||||||
.send({
|
gas: estGas + 1,
|
||||||
from: address,
|
gasPrice: await getFairGasPrice(this.web3, this.config)
|
||||||
gas: estGas + 1,
|
})
|
||||||
gasPrice: await getFairGasPrice(this.web3, this.config)
|
|
||||||
})
|
|
||||||
|
|
||||||
return trxReceipt
|
return trxReceipt
|
||||||
}
|
}
|
||||||
@ -620,7 +587,7 @@ export class NftFactory {
|
|||||||
const ercCreateData = getErcCreationParams(ercParams)
|
const ercCreateData = getErcCreationParams(ercParams)
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20,
|
this.contract.methods.createNftWithErc20,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData
|
ercCreateData
|
||||||
)
|
)
|
||||||
@ -644,13 +611,13 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20,
|
this.contract.methods.createNftWithErc20,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData
|
ercCreateData
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.createNftWithErc20(nftCreateData, ercCreateData)
|
.createNftWithErc20(nftCreateData, ercCreateData)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -679,7 +646,7 @@ export class NftFactory {
|
|||||||
const poolData = await getPoolCreationParams(this.web3, poolParams)
|
const poolData = await getPoolCreationParams(this.web3, poolParams)
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20WithPool,
|
this.contract.methods.createNftWithErc20WithPool,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData,
|
ercCreateData,
|
||||||
poolData
|
poolData
|
||||||
@ -707,14 +674,14 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20WithPool,
|
this.contract.methods.createNftWithErc20WithPool,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData,
|
ercCreateData,
|
||||||
poolData
|
poolData
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.createNftWithErc20WithPool(nftCreateData, ercCreateData, poolData)
|
.createNftWithErc20WithPool(nftCreateData, ercCreateData, poolData)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -742,7 +709,7 @@ export class NftFactory {
|
|||||||
const fixedData = await getFreCreationParams(freParams)
|
const fixedData = await getFreCreationParams(freParams)
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20WithFixedRate,
|
this.contract.methods.createNftWithErc20WithFixedRate,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData,
|
ercCreateData,
|
||||||
fixedData
|
fixedData
|
||||||
@ -770,14 +737,14 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20WithFixedRate,
|
this.contract.methods.createNftWithErc20WithFixedRate,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData,
|
ercCreateData,
|
||||||
fixedData
|
fixedData
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.createNftWithErc20WithFixedRate(nftCreateData, ercCreateData, fixedData)
|
.createNftWithErc20WithFixedRate(nftCreateData, ercCreateData, fixedData)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
@ -804,7 +771,7 @@ export class NftFactory {
|
|||||||
const ercCreateData = getErcCreationParams(ercParams)
|
const ercCreateData = getErcCreationParams(ercParams)
|
||||||
return estimateGas(
|
return estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20WithDispenser,
|
this.contract.methods.createNftWithErc20WithDispenser,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData,
|
ercCreateData,
|
||||||
dispenserParams
|
dispenserParams
|
||||||
@ -834,14 +801,14 @@ export class NftFactory {
|
|||||||
|
|
||||||
const estGas = await estimateGas(
|
const estGas = await estimateGas(
|
||||||
address,
|
address,
|
||||||
this.factory721.methods.createNftWithErc20WithDispenser,
|
this.contract.methods.createNftWithErc20WithDispenser,
|
||||||
nftCreateData,
|
nftCreateData,
|
||||||
ercCreateData,
|
ercCreateData,
|
||||||
dispenserParams
|
dispenserParams
|
||||||
)
|
)
|
||||||
|
|
||||||
// Invoke createToken function of the contract
|
// Invoke createToken function of the contract
|
||||||
const trxReceipt = await this.factory721.methods
|
const trxReceipt = await this.contract.methods
|
||||||
.createNftWithErc20WithDispenser(nftCreateData, ercCreateData, dispenserParams)
|
.createNftWithErc20WithDispenser(nftCreateData, ercCreateData, dispenserParams)
|
||||||
.send({
|
.send({
|
||||||
from: address,
|
from: address,
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
import { Contract } from 'web3-eth-contract'
|
import { Contract } from 'web3-eth-contract'
|
||||||
import { MetadataProof, MetadataAndTokenURI, NftRoles } from '../../@types'
|
import { MetadataProof, MetadataAndTokenURI, NftRoles } from '../../@types'
|
||||||
import { SmartContract } from '../SmartContract'
|
import { SmartContract } from '..'
|
||||||
|
|
||||||
export class Nft extends SmartContract {
|
export class Nft extends SmartContract {
|
||||||
getDefaultAbi(): AbiItem | AbiItem[] {
|
getDefaultAbi(): AbiItem | AbiItem[] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user