修改mint nft类型的task
This commit is contained in:
parent
4e2cefbba4
commit
63051447c8
@ -80,7 +80,11 @@ export class BlockChain {
|
|||||||
break
|
break
|
||||||
case TaskType.MINT_NFT:
|
case TaskType.MINT_NFT:
|
||||||
reqData.tokenId = reqData.tokenId || reqData.tokenid
|
reqData.tokenId = reqData.tokenId || reqData.tokenid
|
||||||
abi = await this.erc721Reactor.mint(reqData)
|
if (reqData.tokenId && !reqData.amount) {
|
||||||
|
abi = await this.erc721Reactor.mint(reqData)
|
||||||
|
} else {
|
||||||
|
abi = await this.erc721Reactor.batchMint(reqData)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case TaskType.TRANSFER_FT:
|
case TaskType.TRANSFER_FT:
|
||||||
abi = await this.erc20Reactor.transfer(reqData)
|
abi = await this.erc20Reactor.transfer(reqData)
|
||||||
|
@ -340,30 +340,31 @@ export class ERC721Reactor {
|
|||||||
return contract.methods.mint(to, tokenId).encodeABI()
|
return contract.methods.mint(to, tokenId).encodeABI()
|
||||||
}
|
}
|
||||||
let gas = await contract.methods.mint(to, tokenId).estimateGas({ gas: 1000000 })
|
let gas = await contract.methods.mint(to, tokenId).estimateGas({ gas: 1000000 })
|
||||||
return contract.methods.mint(to, tokenId).send({ gas: (gas * 1.1) | 0 })
|
return contract.methods.mint(to, tokenId).send({ gas: gas | 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
async batchMint({
|
async batchMint({
|
||||||
account,
|
account,
|
||||||
address,
|
address,
|
||||||
to,
|
to,
|
||||||
tokenIds,
|
count,
|
||||||
encodeABI = false,
|
encodeABI = false,
|
||||||
}: {
|
}: {
|
||||||
account?: string
|
account?: string
|
||||||
address?: string
|
address?: string
|
||||||
to: string
|
to: string
|
||||||
tokenIds: string[]
|
count: number
|
||||||
encodeABI?: boolean
|
encodeABI?: boolean
|
||||||
}) {
|
}) {
|
||||||
const contract = address
|
const contract = address
|
||||||
? new this.web3.eth.Contract(abiNft, address, { from: account || this.account.address })
|
? new this.web3.eth.Contract(abiNft, address, { from: account || this.account.address })
|
||||||
: this.contract
|
: this.contract
|
||||||
// let gas = await contract.methods.batchMint(to, tokenIds, configIds).estimateGas({ gas: 1000000 })
|
const countStr = count + ''
|
||||||
if (encodeABI) {
|
if (encodeABI) {
|
||||||
return contract.methods.batchMint(to, tokenIds).encodeABI()
|
return contract.methods.batchMint(to, countStr).encodeABI()
|
||||||
}
|
}
|
||||||
return contract.methods.batchMint(to, tokenIds).send({ gas: 1000000 })
|
let gas = await contract.methods.batchMint(to, countStr).estimateGas({ from: account || this.account.address })
|
||||||
|
return contract.methods.batchMint(to, countStr).send({ gas: gas | 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPastEvents({ address, fromBlock }: { address?: string; fromBlock: number }) {
|
async getPastEvents({ address, fromBlock }: { address?: string; fromBlock: number }) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user