This commit is contained in:
aozhiwei 2022-04-22 14:18:14 +08:00
parent 9fb7e16e14
commit f906010bee

View File

@ -26,7 +26,10 @@ class Present {
async mint() {
const logClass = 'present.mint';
await this.internalMint();
const exists = await this.nftExists();
if (!exists) {
await this.internalMint();
}
await this.updateDbMustBeSuccess(
logClass,
[
@ -290,6 +293,21 @@ class Present {
return utils.getMintInstance(this.presentDb['bc_mint_token_type']);
}
async nftExists() {
while (true) {
const {err, row} = await dbhelper.ormSelectOne(
't_nft',
[
['token_id', this.getTokenId()]
]);
if (!err) {
return row ? true : false;
}
await utils.sleep(5000 + utils.randRange(500, 1500));
}
return false;
}
};
exports.Present = Present;