This commit is contained in:
aozhiwei 2023-07-04 16:39:48 +08:00
parent 7a5e7980c7
commit 690ba3722a
2 changed files with 6 additions and 1 deletions

View File

@ -59,6 +59,10 @@ class BlockChain extends BaseService {
return contract ? bcutils.toNormalAddress(contract['address']) : '';
}
async getPastEvents(contractName, eventName, ...args) {
return this.#bc[contractName + 'Instance'](eventName, ...args);
}
}
module.exports = BlockChain;

View File

@ -33,7 +33,8 @@ class PullBcEvent extends BaseService {
const fromBlock = await this.getFromBlock();
const toBlock = await this.calcToBlock(fromBlock);
if (toBlock > fromBlock) {
const events = await this.bc[this.getInstanceName()].getPastEvents(
const events = await this.bc.getPastEvents(
this.getContractName(),
this.getEventName(),
{
fromBlock: fromBlock,