1
This commit is contained in:
parent
1cc504a2d1
commit
a658ecafd8
@ -14,10 +14,11 @@ class Transfer extends BaseEventProcess {
|
||||
const tokenId = returnValues['tokenId'];
|
||||
|
||||
if (bcutils.isSysAddress(from)) {
|
||||
const airDropMeta = metaFactory.getAirDrop(tokenId,
|
||||
this.getNetId(),
|
||||
bcconst.BC_NFT_HERO,
|
||||
this.getContractAddress());
|
||||
const airDropMeta = metaFactory.getAirDrop(
|
||||
tokenId,
|
||||
this.getNetId(),
|
||||
bcconst.BC_NFT_HERO,
|
||||
this.getContractAddress());
|
||||
if (airDropMeta) {
|
||||
const exists = await this.exists721Nft(tokenId, this.getContractAddress());
|
||||
if (!exists) {
|
||||
@ -30,7 +31,7 @@ class Transfer extends BaseEventProcess {
|
||||
this.getBlockNumber()
|
||||
);
|
||||
}
|
||||
await this.apiMint(airDropMeta);
|
||||
await this.apiMint(to, tokenId, airDropMeta);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,8 +46,28 @@ class Transfer extends BaseEventProcess {
|
||||
await this.markOk();
|
||||
}
|
||||
|
||||
async apiMint(airDropMeta) {
|
||||
|
||||
async apiMint(address, tokenId, airDropMeta) {
|
||||
const params = {
|
||||
'c': 'Callback',
|
||||
'a': 'dispatch',
|
||||
'action': 'mintNftHero',
|
||||
'address': address,
|
||||
'tokenId': tokenId,
|
||||
'itemId': airDropMeta['item_id'],
|
||||
'quality': airDropMeta['quality'],
|
||||
};
|
||||
await this.callGameApi
|
||||
(params,
|
||||
async (data) => {
|
||||
if (!data) {
|
||||
this.throwError('callGameApi error:' + data);
|
||||
}
|
||||
if (data['errcode'] == 0 ||
|
||||
data['errcode'] == 1) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user