修改投放badge的方法, nftid由合约自动生成
This commit is contained in:
parent
09965d5eb6
commit
18d1293862
29842
src/abis/BEBadge.json
29842
src/abis/BEBadge.json
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -40,20 +40,21 @@ export class DistributorReactor {
|
||||
async mintNft({
|
||||
address,
|
||||
to,
|
||||
nftList,
|
||||
count,
|
||||
encodeABI = false,
|
||||
}: {
|
||||
address?: string
|
||||
to: string
|
||||
nftList: string[]
|
||||
count: number
|
||||
encodeABI?: boolean
|
||||
}) {
|
||||
const contract = address ? new this.web3.eth.Contract(abi, address, { from: this.account.address }) : this.contract
|
||||
const countStr = count + ''
|
||||
if (encodeABI) {
|
||||
return contract.methods.mintToUser(to, nftList).encodeABI()
|
||||
return contract.methods.mintToUser(to, countStr).encodeABI()
|
||||
}
|
||||
let gas = await contract.methods.mintToUser(to, nftList).estimateGas({ from: this.account.address })
|
||||
let res = await contract.methods.mintToUser(to, nftList).send({ gas: gas | 0 })
|
||||
let gas = await contract.methods.mintToUser(to, countStr).estimateGas({ from: this.account.address })
|
||||
let res = await contract.methods.mintToUser(to, countStr).send({ gas: gas | 0 })
|
||||
return res
|
||||
}
|
||||
/**
|
||||
|
@ -13,8 +13,10 @@ class ChainController extends BaseController {
|
||||
async addChainRequest(req, res) {
|
||||
// data是一个数组!!
|
||||
const { data, type, taskId, force, max } = req.params
|
||||
console.log(`income chain request:: taskId: ${taskId}, type: ${type}`)
|
||||
console.log(JSON.stringify(data))
|
||||
let maxTryCount = max !== undefined ? parseInt(max) : parseInt(process.env.CHAIN_MAX_TRY)
|
||||
let chainTask: DocumentType<ChainTaskClass> = await ChainTask.insertOrUpdate({ taskId }, { type, data })
|
||||
let chainTask: DocumentType<ChainTaskClass> = await ChainTask.insertOrUpdate({ taskId }, { type, taskData: data })
|
||||
|
||||
if ((!chainTask.newRecord && force) || chainTask.newRecord) {
|
||||
for (let sub of data) {
|
||||
@ -31,6 +33,7 @@ class ChainController extends BaseController {
|
||||
new ChainQueue().addTaskToQueue(subTask)
|
||||
}
|
||||
}
|
||||
chainTask.newRecord = false
|
||||
await chainTask.save()
|
||||
return chainTask.toJson()
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ export enum ReqTaskStatus {
|
||||
}
|
||||
|
||||
@dbconn()
|
||||
@index({ scheduleId: 1 }, { unique: true })
|
||||
@modelOptions({
|
||||
schemaOptions: { collection: 'chain_request_task', timestamps: true },
|
||||
options: { allowMixed: Severity.ALLOW },
|
||||
|
Loading…
x
Reference in New Issue
Block a user